tutorials:tutorial_1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:tutorial_1 [2016/09/01 19:26] – Subheadings zenke | tutorials:tutorial_1 [2017/04/24 19:16] (current) – Changes links to fzenke.net zenke | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tutorial 1 ====== | + | ====== Tutorial 1: Single neuron with Poisson input ====== |
Here you will learn to simulate a single AdEx neuron and record spikes and membrane potentials. | Here you will learn to simulate a single AdEx neuron and record spikes and membrane potentials. | ||
Line 8: | Line 8: | ||
<code c++> | <code c++> | ||
int main(int ac, char* av[]) | int main(int ac, char* av[]) | ||
+ | { | ||
| | ||
} | } | ||
Line 17: | Line 18: | ||
using namespace auryn; | using namespace auryn; | ||
int main(int ac, char* av[]) | int main(int ac, char* av[]) | ||
+ | { | ||
auryn_init( ac, av ); | auryn_init( ac, av ); | ||
| | ||
- | | + | |
| | ||
auryn_free(); | auryn_free(); | ||
} | } | ||
</ | </ | ||
- | For convenience we also set our current namespace to Auryn' | + | For convenience we also set our current namespace to Auryn' |
Line 31: | Line 33: | ||
===== Building the network model ===== | ===== Building the network model ===== | ||
- | To actually have you simulation do something we will now define | + | To actually have your simulation do something, we want to build the following network model: |
{{ : | {{ : | ||
in which a single AdEx neuron receives input from 100 Poisson neurons. | in which a single AdEx neuron receives input from 100 Poisson neurons. | ||
+ | We will do this in three steps. First, we define all the populations of neurons which generate or receive spikes. Second, we will connect these classes with synaptic connections. Finally, we will define some special classes which will allow us to readout information from the simulation and store it to disk. | ||
+ | ==== Adding the neural populations ==== | ||
+ | Populations in Auryn are abstracted as [[manual:: | ||
Let's first set up our input. We want 100 Poisson neurons which should fire at 5Hz. | Let's first set up our input. We want 100 Poisson neurons which should fire at 5Hz. | ||
- | After '' | + | After '' |
- | ryn_init'' | + | |
<code c++> | <code c++> | ||
int nb_input_neurons = 100; | int nb_input_neurons = 100; | ||
Line 48: | Line 52: | ||
AdExGroup * neuron = new AdExGroup(1); | AdExGroup * neuron = new AdExGroup(1); | ||
</ | </ | ||
- | Here the one sais that we want only one neuron in the group. For network simulations you will typically have more than one. You would write 2000 or whatever number of neurons you want. | + | Here the " |
+ | |||
+ | ==== Connecting neural populations ==== | ||
Now we need to connect the input with our AdEx neuron. For this simple example we choose all-to-all connectivity: | Now we need to connect the input with our AdEx neuron. For this simple example we choose all-to-all connectivity: | ||
Line 66: | Line 72: | ||
- | Now we are almost done setting up our model, but the simulation would run without any output. | + | Now we are almost done setting up our model, but the simulation would still run without |
- | However, | + | Let's say we want to record the input and output spikes and the postsynaptic voltage. |
This is how we rig our [[manual: | This is how we rig our [[manual: | ||
Line 76: | Line 82: | ||
</ | </ | ||
The last arguments for each of those is the filename where we want to write the output. The '' | The last arguments for each of those is the filename where we want to write the output. The '' | ||
+ | |||
+ | One comment is in order: Writing output to disk is computationally expensive. It's often possible to speed up a simulation substantially by reducing the amount of data that's saved. Choose the variables you want to record carefully and you will be rewarded with code that runs much faster. | ||
+ | |||
===== Simulating the model ===== | ===== Simulating the model ===== | ||
Line 83: | Line 92: | ||
sys-> | sys-> | ||
</ | </ | ||
+ | where sys is the global pointer variable pointing to the Auryn kernel (which was initialized by '' | ||
+ | ===== Running the simulation ===== | ||
That's it! Now we can [[manual: | That's it! Now we can [[manual: | ||
Line 97: | Line 108: | ||
</ | </ | ||
- | ===== Visualizing the output ===== | + | |
+ | |||
+ | ====== Visualizing the output | ||
Each monitor has written its own output file. Let's take a look at the membrane potential, which is the file with the [[manual: | Each monitor has written its own output file. Let's take a look at the membrane potential, which is the file with the [[manual: | ||
- | I like plotting things in [[gnuplot]], | + | I like plotting things in [[http:// |
Here is my voltage trace as plotted by Gnuplot: | Here is my voltage trace as plotted by Gnuplot: | ||
- | {{ : | + | {{ : |
And here are the input Poisson spikes | And here are the input Poisson spikes | ||
- | {{ : | + | {{ : |
Line 113: | Line 126: | ||
https:// | https:// | ||
- | ===== Excercise ===== | ||
- | As an exercise try simulating | + | |
+ | In the [[Tutorial 2|next section]] you will learn how to simulate a recurrent network model instead of single neuron. | ||
+ | |||
+ | |||
+ | ====== Exercises ====== | ||
+ | * Play with different rate values for the Poisson processes | ||
+ | * Replace the AdEx by an Izhikevich neuron | ||
+ | * Add a second Poisson input population which provides inhibitory input to the output neuron | ||
+ | * Simulate |
tutorials/tutorial_1.txt · Last modified: 2017/04/24 19:16 by zenke