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

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

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

Functions

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

Detailed Description

A minimal example for simulating a plastic balanced network model.

This is the code for the Tutorial 3. 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 
65  // plasticity parameters
66  float tau_hom = 10.0; // timescale of homeostatic sliding threshold
67  float eta_rel = 0.1; // relative learning rate
68  float kappa = 1.0; // target rate
69  TripletConnection * con_ee = new TripletConnection(neurons_exc,neurons_exc,weight,sparseness,tau_hom,eta_rel,kappa);
70  con_ee->set_transmitter(GLUT);
71  con_ee->stdp_active = false;
72  SparseConnection * con_ei = new SparseConnection(neurons_exc,neurons_inh,weight,sparseness,GLUT);
73  SparseConnection * con_ie = new SparseConnection(neurons_inh,neurons_exc,gamma*weight,sparseness,GABA);
74  SparseConnection * con_ii = new SparseConnection(neurons_inh,neurons_inh,gamma*weight,sparseness,GABA);
75 
76 
77  // Initialize monitors which record information to file
78 
79  // Set up to display the population firing rate in the progress bar
80  sys->set_online_rate_monitor_id(neurons_exc->get_uid());
81 
82  // Record input and output spikes
83  SpikeMonitor * exc_spike_mon = new SpikeMonitor( neurons_exc, sys->fn("exc","ras") );
84 
85  // Record membrane voltage of one of the neurons
86  VoltageMonitor * voltage_mon = new VoltageMonitor( neurons_exc, 0, sys->fn("neuron","mem") );
87  voltage_mon->record_for(2); // only record for 2 seconds
88 
89  // Add a population rate monitor
90  PopulationRateMonitor * prate_mon_exc = new PopulationRateMonitor(neurons_exc, sys->fn("exc","prate"));
91  PopulationRateMonitor * prate_mon_inh = new PopulationRateMonitor(neurons_inh, sys->fn("inh","prate"));
92 
93  // Run the simulation for 10 seconds
94  sys->run(10);
95 
96  // Run the simulation for 100 seconds
97  con_ee->stdp_active = true;
98  sys->run(100);
99 
100  // Shut down Auryn kernel
101  auryn_free();
102 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
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
bool stdp_active
Toggles stdp active/inactive. When inactive traces are still updated, but weights are not...
Definition: TripletConnection.h:153
Implements triplet STDP with metaplasticity as described by Pfister and Gerstner 2006.
Definition: TripletConnection.h:48
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
Monitor class to record population firing rates.
Definition: PopulationRateMonitor.h:46
void set_transmitter(AurynStateVector *ptr)
Same as set_target.
Implements the standard integrate and file model used in Auryn.
Definition: IFGroup.h:47
Here is the call graph for this function: