Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


examples:sim_epsp

This is an old revision of the document!


sim_epsp

This simulation sets up an excitatory and an inhibitory Poisson neuron and connects them to a single postsynaptic cell (IFGroup). It records and outputs the membrane potential in the file out_epsp.mem.

Running the program

The simulation can be invoked without any parameters. It creates the following command line output

zenke@merlin ~/auryn/build/home $ ./sim_epsp 
( 0) Running ...
[=========================] 100%      t=10.0 s
( 0) Freeing ...

and a set of files

   0 -rw-r--r-- 1 zenke zenke    0 Jan 10 19:54 out_epsp.ras
1.8M -rw-r--r-- 1 zenke zenke 1.8M Jan 10 19:54 out_epsp.nmda
1.9M -rw-r--r-- 1 zenke zenke 1.9M Jan 10 19:54 out_epsp.mem
1.8M -rw-r--r-- 1 zenke zenke 1.8M Jan 10 19:54 out_epsp.gaba
1.8M -rw-r--r-- 1 zenke zenke 1.8M Jan 10 19:54 out_epsp.ampa
4.0K -rw-r--r-- 1 zenke zenke 1.2K Jan 10 19:54 out_epsp.0.log

In the default configuration of the simulation the ras file stays empty since the neuron does not emit any spikes. The mem file contains the trace of the membrane potential over time. The other files (with extensions ampa,gaba and nmda) contain traces of the neuron's conductance variables.

Output example

This plot shows the membrane potential of the single neuron in the simulation.

This plot can be generated by running gnuplot and issueing the follwing commands in the same directory

set xlabel 'Time [s]'
set ylabel 'Membrane voltage [V]'
plot 'out_epsp.mem' with lines

The importand bits

PoissonGroup * poisson = new PoissonGroup(N,1.);
PoissonGroup * poisson2 = new PoissonGroup(N,1.);
IFGroup * neuron = new IFGroup(1);

Sets up the two Poisson neurons (two groups containing a single Poisson cell each) and a single integrate-and-fire cell from the IFGroup type.

IdentityConnection * con = new IdentityConnection(poisson,neuron,w,GLUT);
IdentityConnection * con2 = new IdentityConnection(poisson2,neuron,w,GABA);

Creates two one-to-one connetions between the Poisson neurons and the integrate-and-fire cell.

SpikeMonitor * smon = new SpikeMonitor( neuron, tmpstr.c_str() );

Sets up a SpikeMonitor and tells it to record from our neuron. The output is written to a file that is specified by tmpstr.

VoltageMonitor * vmon = new VoltageMonitor( neuron, 0, tmpstr.c_str() );

Creates a VoltageMonitor that records the voltage to a different file which is again specified in tmpstr. Note that an equivalent alternative syntax would be to recorde voltages would be directly using a StateMonitor. The conductance monitors are set up in a similar way.

logger->msg("Running ...",PROGRESS);
sys->run(10);

This finally outputs a message Running… on the console and triggers the run for 10s. Note the call of the global variable sys of type System.

The full program

/* 
* Copyright 2014 Friedemann Zenke
*
* This file is part of Auryn, a simulation package for plastic
* spiking neural networks.
* 
* Auryn is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* Auryn is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with Auryn.  If not, see <http://www.gnu.org/licenses/>.
*/
 
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string>
 
#include <boost/program_options.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi.hpp>
 
#include "auryn_global.h"
#include "auryn_definitions.h"
#include "System.h"
#include "Logger.h"
#include "NeuronGroup.h"
#include "IFGroup.h"
#include "AIFGroup.h"
#include "PoissonGroup.h"
#include "SparseConnection.h"
#include "IdentityConnection.h"
#include "TripletConnection.h"
#include "TripletDecayConnection.h"
#include "WeightMonitor.h"
#include "WeightMatrixMonitor.h"
#include "PopulationRateMonitor.h"
#include "SpikeMonitor.h"
#include "VoltageMonitor.h"
#include "AmpaMonitor.h"
#include "GabaMonitor.h"
#include "NmdaMonitor.h"
#include "DelayedSpikeMonitor.h"
#include "RateChecker.h"
#include "FileInputGroup.h"
 
#define N 1
 
using namespace std;
 
namespace po = boost::program_options;
namespace mpi = boost::mpi;
 
int main(int ac, char* av[]) 
{
 
	int errcode = 0;
	char strbuf [255];
	string outputfile = "out_epsp";
	string tmpstr;
	AurynWeight w = 1.0;
 
	// BEGIN Global definitions
	mpi::environment env(ac, av);
	mpi::communicator world;
	communicator = &world;
 
	sprintf(strbuf, "out_epsp.%d.log", world.rank());
	string logfile = strbuf;
	logger = new Logger(logfile,world.rank(),PROGRESS,EVERYTHING);
 
	sys = new System(&world);
	// END Global definitions
 
	PoissonGroup * poisson = new PoissonGroup(N,1.);
	PoissonGroup * poisson2 = new PoissonGroup(N,1.);
	IFGroup * neuron = new IFGroup(1);
 
	IdentityConnection * con = new IdentityConnection(poisson,neuron,w,GLUT);
	IdentityConnection * con2 = new IdentityConnection(poisson2,neuron,w,GABA);
 
	tmpstr = outputfile;
	tmpstr += ".ras";
	SpikeMonitor * smon = new SpikeMonitor( neuron, tmpstr.c_str() );
 
	tmpstr = outputfile;
	tmpstr += ".mem";
	VoltageMonitor * vmon = new VoltageMonitor( neuron, 0, tmpstr.c_str() );
 
	tmpstr = outputfile;
	tmpstr += ".ampa";
	AmpaMonitor * amon = new AmpaMonitor( neuron, 0, tmpstr.c_str() );
 
	tmpstr = outputfile;
	tmpstr += ".gaba";
	GabaMonitor * gmon = new GabaMonitor( neuron, 0, tmpstr.c_str() );
 
	tmpstr = outputfile;
	tmpstr += ".nmda";
	NmdaMonitor * nmon = new NmdaMonitor( neuron, 0, tmpstr.c_str() );
 
	logger->msg("Running ...",PROGRESS);
	sys->run(10);
 
	logger->msg("Freeing ...",PROGRESS,true);
	delete sys;
 
	if (errcode)
		env.abort(errcode);
	return errcode;
}
examples/sim_epsp.1389383206.txt.gz · Last modified: 2014/01/10 19:46 by zenke