spike_detector – Collecting spikes from neurons
Description
The spike_detector
collects and records all spikes it receives
from neurons that are connected to it.
Any neuron from which spikes have to be recorded must be connected to
the spike recorder using the standard Connect
command.
Warning
Differently from NEST, the connection weights
and delays
are
taken into account by the spike recorder. This device will be modified
in the future in order to have a device more similar to the one of NEST.
To record and retrieve the spikes emitted by a neuron, a new recorder has
to be created using the command CreateRecord
. For more details about
the continuous recording of variables see the multimeter
documentation.
Here follows an example:
neuron = nestgpu.Create("aeif_cond_beta", 3)
spike_det = nestgpu.Create("spike_detector")
nestgpu.Connect([neuron[0]], spike_det, {"rule": "one_to_one"}, {"weight": 1.0, "delay": 1.0, "receptor":0})
recorder = nestgpu.CreateRecord("", ["spike_height"], [spike_det[0]], [0])
nestgpu.Simulate()
recorded_data = nestgpu.GetRecordData(record)
time = [row[0] for row in recorded_data]
spike_height = [row[1] for row in recorded_data]
The output is thus a continuous variable, which is 0 when no spikes are emitted
by the neuron, and is weights
when a spike is emitted.
Note
A faster implementation for spike recording, which is also similar to the one of NEST in terms of output, is described in the guide of how to record spikes.