multimeter – Sampling continuous quantities from neurons

Description

Most sampling use cases are covered by the multimeter, which allows to record analog values from neurons. Models which have such values expose a recordables property that lists all recordable quantities. This property can be inspected using GetDefaults on the model class or GetStatus on a model instance. It cannot be changed by the user.

>>> nest.GetDefaults('iaf_cond_alpha')['recordables']
['g_ex', 'g_in', 't_ref_remaining', 'V_m']

The record_from property of a multimeter (a list, empty by default) can be set to contain the name(s) of one or more of these recordables to have them sampled during simulation.

mm = nest.Create('multimeter', 1, {'record_from': ['V_m', 'g_ex'],
'record_to': memory})

The sampling interval for recordings (given in ms) can be controlled using the multimeter parameter interval. The default value of 1.0 ms can be changed by supplying a new value either in the call to Create or by using SetStatus on the model instance.

nest.SetStatus(mm, 'interval': 0.1})

The recording interval must be greater than or equal to the simulation resolution, which defaults to 0.1 ms.

Warning

The set of variables to record from and the recording interval must be set before the multimeter is connected to any neuron. These properties cannot be changed afterwards.

After configuration, a multimeter can be connected to the neurons it should record from by using the standard Connect routine.

neurons = nest.Create('iaf_psc_alpha', 100)
nest.Connect(mm, neurons)

To learn more about possible connection patterns and additional options when using Connect, see the guide on connectivity concepts.

The above call to Connect would fail if the neurons would not support the sampling of the values V_m and g_ex. It would also fail if carried out in the wrong direction, that is , trying to connect the neurons to mm.

Note

A pre-configured multimeter is available under the name voltmeter. Its record_from property is already set to record the variable V_m from the neurons it is connected to.

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.

record_from

A list (default: []) of parameters and state variables to sample from the nodes, the multimeter is connected to. Potential recordables are given in the corresponding model documentation.

interval

A float (default: 1.0) specifying the interval in ms, at which data is collected from the nodes, the multimeter is connected to.

See also

Examples using this model