Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Functions
sim_tutorial2.cpp File Reference

A minimal example for simulating a balanced network model. More...

#include "auryn.h"
Include dependency graph for sim_tutorial2.cpp:

Functions

int main (int ac, char *av[])
 

Detailed Description

A minimal example for simulating a balanced network model.

This is the code for the Tutorial 2. The tutorials can be found at http://www.fzenke.net/auryn/doku.php?id=tutorials:start

Function Documentation

◆ main()

int main ( int  ac,
char *  av[] 
)
35 {
36  // Initialize Auryn kernel
37  auryn_init( ac, av );
38 
39  // Set master random seed
40  sys->set_master_seed(42);
41 
42  // Initialize excitatory and inhibitory network neurons
43  int nb_exc_neurons = 20000;
44  int nb_inh_neurons = nb_exc_neurons/4;
45  IFGroup * neurons_exc = new IFGroup(nb_exc_neurons);
46  neurons_exc->set_name("exc neurons");
47  neurons_exc->get_state_vector("g_nmda")->set_random();
48  IFGroup * neurons_inh = new IFGroup(nb_inh_neurons);
49  neurons_inh->set_tau_mem(5e-3);
50  neurons_inh->set_name("inh neurons");
51 
52  // Initialize Poisson input population (PoissonGroup)
53  int nb_input_neurons = 5000;
54  float poisson_rate = 2.0;
55  PoissonGroup * poisson = new PoissonGroup(nb_input_neurons,poisson_rate);
56 
57  // Connect Poisson input to exc population
58  float weight = 0.2; // conductance amplitude in units of leak conductance
59  float sparseness = 0.05; // probability of connection
60  SparseConnection * con_ext_exc = new SparseConnection(poisson,neurons_exc,weight,sparseness,GLUT);
61 
62  // Set up recurrent connections
63  float gamma = 4.0;
64  SparseConnection * con_ee = new SparseConnection(neurons_exc,neurons_exc,weight,sparseness,GLUT);
65  SparseConnection * con_ei = new SparseConnection(neurons_exc,neurons_inh,weight,sparseness,GLUT);
66  SparseConnection * con_ie = new SparseConnection(neurons_inh,neurons_exc,gamma*weight,sparseness,GABA);
67  SparseConnection * con_ii = new SparseConnection(neurons_inh,neurons_inh,gamma*weight,sparseness,GABA);
68 
69  // Initialize monitors which record information to file
70 
71  // Set up to display the population firing rate in the progress bar
72  sys->set_online_rate_monitor_id(neurons_exc->get_uid());
73 
74  // Record input and output spikes
75  SpikeMonitor * exc_spike_mon = new SpikeMonitor( neurons_exc, sys->fn("exc","ras") );
76 
77  // Record membrane voltage of one of the neurons
78  VoltageMonitor * voltage_mon = new VoltageMonitor( neurons_exc, 0, sys->fn("neuron","mem") );
79  voltage_mon->record_for(2); // only record for 2 seconds
80 
81  // Run the simulation for 10 seconds
82  sys->run(10);
83 
84  // let's add a cell assembly
85  con_ee->set_block(0,500,0,500,5*weight);
86 
87  // Run the simulation for another 2 seconds
88  sys->run(2);
89 
90  // Shut down Auryn kernel
91  auryn_free();
92 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
void set_block(NeuronID lo_row, NeuronID hi_row, NeuronID lo_col, NeuronID hi_col, AurynWeight weight)
Sets all weights of existing connections in a block spanned by the first 4 parameters to the value gi...
Definition: SparseConnection.cpp:307
void set_random(unsigned int seed=0)
Initializes vector elements with Gaussian of unit varince and a seed derived from system time if no s...
Definition: AurynVector.h:738
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
NeuronID get_uid()
Get the unique ID of the class.
Definition: SpikingGroup.cpp:265
AurynStateVector * get_state_vector(std::string key)
Creates a new or returns an existing state vector by name.
Definition: SpikingGroup.cpp:781
The base class to create sparse random connections.
Definition: SparseConnection.h:66
The standard Monitor object to record spikes from a SpikingGroup and write them to a text file...
Definition: SpikeMonitor.h:52
void set_tau_mem(AurynFloat taum)
Sets the membrane time constant.
Definition: IFGroup.cpp:154
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
A SpikingGroup that creates poissonian spikes with a given rate.
Definition: PoissonGroup.h:52
void set_master_seed(unsigned int seed=123)
Set master seed.
Definition: System.cpp:1014
Records the membrane potential from one unit from the source neuron group to a file.
Definition: VoltageMonitor.h:48
void set_online_rate_monitor_id(unsigned int id=0)
Sets the SpikingGroup used to display the rate estimate in the progressbar.
Definition: System.cpp:939
void auryn_init(int ac, char *av[], string dir, string simulation_name, string logfile_prefix, LogMessageType filelog_level, LogMessageType consolelog_level)
Initalizes MPI and the Auryn simulation environment.
Definition: auryn_global.cpp:84
void record_for(AurynDouble time=10.0)
Sets relative time at which to stop recording.
Definition: StateMonitor.cpp:153
Standard Gabaergic (inhibitory) transmission.
Definition: auryn_definitions.h:140
string fn(std::string extension)
Format output file name.
Definition: System.cpp:689
void set_name(std::string s)
Set connection name.
Definition: SpikingGroup.cpp:507
Implements the standard integrate and file model used in Auryn.
Definition: IFGroup.h:47
Here is the call graph for this function: