Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


tutorials:tutorial_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorials:tutorial_2 [2016/09/01 21:19] – [Visualizing the spikes] zenketutorials:tutorial_2 [2017/04/24 19:15] – Changes links to fzenke.net zenke
Line 3: Line 3:
 Here you will learn to wire up a simple balanced network. Here you will learn to wire up a simple balanced network.
 This assumes that you already know the basics explained in [[Tutorial 1]]. This assumes that you already know the basics explained in [[Tutorial 1]].
 +
 +The code of this example can be found here
 +https://github.com/fzenke/auryn/blob/master/examples/sim_tutorial2.cpp
 +
  
 ===== Setting up neural populations ===== ===== Setting up neural populations =====
Line 14: Line 18:
 IFGroup * neurons_exc = new IFGroup(nb_exc_neurons); IFGroup * neurons_exc = new IFGroup(nb_exc_neurons);
 neurons_exc->set_name("exc neurons"); neurons_exc->set_name("exc neurons");
 +neurons_exc->get_state_vector("g_nmda")->set_random();
 IFGroup * neurons_inh = new IFGroup(nb_inh_neurons); IFGroup * neurons_inh = new IFGroup(nb_inh_neurons);
 neurons_inh->set_tau_mem(5e-3); neurons_inh->set_tau_mem(5e-3);
Line 19: Line 24:
 </code> </code>
  
-The above code snipped initializes an excitatory population (''neurons_exc'') with 20000 neurons and an inhibitory population which is one quarter in size. Here were are using [[manual:IFGroup]] one of Auryn's standard neuron models. These neurons have conductance based synapses with a fast and slow excitatory conductance. Moreover, the model has a relative refractory mechanism. Also note that we give the inhibitory neurons a membrane time constant of 5ms.+The above code snipped initializes an excitatory population (''neurons_exc'') with 20000 neurons and an inhibitory population which is one quarter in size. Here were are using [[manual:IFGroup]] one of Auryn's standard neuron models. These neurons have conductance based synapses with a fast and slow excitatory conductance. Moreover, the model has a relative refractory mechanism. Here, we initialize the NMDA conductances of the excitatory population randomly to avoid that all neurons spike synchronously initially. That's what ''set_random()'' does. Also note that we give the inhibitory neurons a membrane time constant of 5ms.
  
 As before in [[Tutorial 1]] we define Poisson input as a separate population: As before in [[Tutorial 1]] we define Poisson input as a separate population:
Line 28: Line 33:
 </code> </code>
  
-==== Connecting the network ====+===== Connecting the network =====
  
 Now let's connect these three populations. First the input: Now let's connect these three populations. First the input:
Line 48: Line 53:
 Note that we made inhibitory connections stronger by a factor of ''gamma = 4.0''. Note that we made inhibitory connections stronger by a factor of ''gamma = 4.0''.
  
-==== Set up monitors ====+===== Set up monitors =====
  
 Let's record spikes from all neurons and the membrane potential from neuron 0 in the excitatory population. Let's record spikes from all neurons and the membrane potential from neuron 0 in the excitatory population.
Line 60: Line 65:
  
  
-==== Running the simulation ====+===== Running the simulation =====
  
 To run the simulation for 10 seconds we simply add the run command: To run the simulation for 10 seconds we simply add the run command:
Line 75: Line 80:
  
  
-===== Visualizing the spikes =====+====== Visualizing the spikes ======
  
 Running above code will generate the following files: Running above code will generate the following files:
Line 90: Line 95:
 That's a lot of spikes, but the image suggests that there is some synchrony going on at times, but there are also phases of asynchronous firing. Let's zoom in a bit more: That's a lot of spikes, but the image suggests that there is some synchrony going on at times, but there are also phases of asynchronous firing. Let's zoom in a bit more:
 {{ :tutorials:tutorial2_exc_spikes_zoom.png?300 |}} {{ :tutorials:tutorial2_exc_spikes_zoom.png?300 |}}
 +
 +We can also analyze this a little more and plot for instance the distribution of firing rates:
 +{{ :tutorials:tutorial2_exc_rates.png?300 |}}
  
 Now let's have a look the membrane trace we recorded from one of our cells: Now let's have a look the membrane trace we recorded from one of our cells:
Line 108: Line 116:
 {{ :tutorials:tutorial2_exc_spikes_assembly.png?300 |}} {{ :tutorials:tutorial2_exc_spikes_assembly.png?300 |}}
  
-For more sophisticated ways of writing patterns into a connectivity matrix, check out the documentation of [[manual:SparseConnection]] and specifically the functions called ''load_patterns'' (see also http://www.fzenke.net/auryn/doxygen/current/classauryn_1_1SparseConnection.html).+For more sophisticated ways of writing patterns or synfire chain structures into a connectivity matrix, check out the documentation of [[manual:SparseConnection]] and specifically the functions called ''load_patterns'' (see also http://fzenke.net/auryn/doxygen/current/classauryn_1_1SparseConnection.html).  
 +You can also always load a weight matrix from an external file which have generated using MATLAB or Python. Auryn supports a coordinate based [[http://math.nist.gov/MatrixMarket/|matrix market]] format which allows for the seamless exchange of weight matrices with external tools (see [[manual:wmat|matrix format]]). 
 + 
 + 
 +In the next [[Tutorial 3|tutorial]] we will make this model plastic.
  
 ====== Exercises ====== ====== Exercises ======
tutorials/tutorial_2.txt · Last modified: 2018/02/28 17:58 by zenke