spike_recorder – Collecting spikes from neurons¶
Description¶
The most universal collector device is the spike_recorder
, which
collects and records all spikes it receives from neurons that are
connected to it. Each spike received by the spike recorder is
immediately handed over to the selected recording backend for further
processing.
Any node from which spikes are to be recorded, must be connected to
the spike recorder using the standard Connect
command. The
connection weights
and delays
are ignored by the spike
recorder, which means that the spike recorder records the time of
spike creation rather than that of their arrival.
>>> neurons = nest.Create("iaf_psc_alpha", 5)
>>> sr = nest.Create("spike_recorder", params={"record_to":"memory", "time_in_steps": False})
>>> nest.Connect(neurons, sr)
Note the call to Connect
will fail if the connection direction is
reversed (i.e., connecting sr to neurons).
Recording time window¶
The time span during which the recorder actively records can be
specified using the properties start
and stop
. These define
the recording period of the device in ms. An additional property
origin
allows to shift the recording window by a certain time,
which can be useful in experimental protocols with repeated
simulations. Please note that events with
timestamp t = start are not recorded.
Data handling¶
All recorded data is handed over to the recording backend, selected
via the record_to
property:
>>> sr = nest.Create("spike_recorder", params={"record_to":"ascii", "time_in_steps": False})
>>> mm = nest.Create("multimeter", 1, {"record_from": ["V_m", "g_ex"], "record_to": "memory"})
By default, data recorded from recorders is stored in the memory backend.
You can access the data recorded by the recorders with the events
property.
mm_events = mm.get("events")
Note
The type of recording backend you choose may affect the efficiency of your simulation. The memory backend is ideal for interactive work, but can only be used for limited amount of data. Additionally, transferring data to disk later on may be slower than directly writing from the NEST kernel via ascii or sionlib backends.
Large simulations with many threads may benefit from the sionlib backend, as the ascii backend opens many files which can be very time consuming on parallel file systems.
The complete list of parameters and other recording backend options can be found in the guide to recording from simulations.
Recorder properties¶
- label
A string (default: “”) specifying an arbitrary textual label for the device. Recording backends might use the label to generate device specific identifiers like filenames and such.
- n_events
The number of events that were collected by the recorder can be read out of the n_events entry. The number of events can be reset to 0. Other values cannot be set.
- origin
A positive floating point number (default : 0.0) used as the reference time in ms for start and stop.
- record_to
A string (default: “memory”) containing the name of the recording backend where to write data to. An empty string turns all recording of individual events off.
- start
A positive floating point number (default: 0.0) specifying the activation time in ms, relative to origin.
- stop
A floating point number (default: infinity) specifying the deactivation time in ms, relative to origin. The value of stop must be greater than or equal to start.
See also¶
Examples using this model¶
Conductance-based generalized leaky integrate and fire (GLIF) neuron example
Current-based generalized leaky integrate and fire (GLIF) neuron example
Population rate model of generalized integrate-and-fire neurons
Random balanced network (alpha synapses) connected with NEST
Random balanced network (exp synapses, multiple time constants)
Random balanced network with astrocytes with Bernoulli connectivity
Random balanced network with astrocytes with fixed-indegree connectivity
Script controlling the simulation of a single game of Sudoku
Tutorial on learning to accumulate evidence with e-prop after Bellec et al. (2020)
Tutorial on learning to generate a lemniscate with e-prop after Bellec et al. (2020)
Tutorial on learning to generate handwritten text with e-prop after Bellec et al. (2020)
Tutorial on learning to generate sine waves with e-prop after Bellec et al. (2020)
Use evolution strategies to find parameters for a random balanced network (alpha synapses)
Weight adaptation according to the Urbanczik-Senn plasticity