Devices#
Stimulation and recording devices, faithful to NEST’s device vocabulary. A
Simulator device is created like any model and connected into the
network; recorded data is read back after the run from the
SimulationResult.
import brainunit as u
from brainpy import state as bp
sim = bp.Simulator(dt=0.1 * u.ms)
neuron = sim.create(bp.iaf_psc_exp, 1)
pg = sim.create(bp.poisson_generator, 1, rate=8000. * u.Hz, rng_seed=0)
sr = sim.create(bp.spike_recorder)
mm = sim.create(bp.multimeter, record_from=["V_m"], interval=0.1 * u.ms)
sim.connect(pg, neuron, weight=10. * u.pA, delay=1. * u.ms)
sim.connect(neuron, sr)
sim.connect(mm, neuron) # reversed: the multimeter observes the neuron
res = sim.simulate(100. * u.ms)
Two connection directions#
The direction of a device connect follows NEST:
Stimulation devices are sources:
connect(generator, neuron)— the generator drives the neuron.Recording devices observe:
connect(voltmeter, neuron)/connect(multimeter, neuron)is the reversed direction, because the recorder samples the neuron rather than receiving events from it. Aspike_recordertaps a node’s spikes withconnect(neuron, recorder).
Current vs spike sources#
A load-bearing distinction:
Current generators inject a current (
pA) through the neuron’s current ring buffer — a NEST-faithful one-step delay. These aredc_generator,ac_generator,noise_generator,step_current_generator,step_rate_generator.Spike sources deliver delayed delta events:
poisson_generator(and_ps/inhomogeneous/sinusoidalvariants),spike_generator(explicit spike times),spike_train_injector,spike_dilutor, and thegamma_sup/mip/ppd_sup/pulsepacketgenerators.
A generator fans out to one independent train per target neuron, matching
NEST. A multi-channel generator (create(poisson_generator, k, rate=[...]))
gives a k-segment view; connect then takes a per-channel weight vector.
Generators#
Device |
Use |
|---|---|
|
Constant current ( |
|
Sinusoidal current. |
|
White-noise current, |
|
Piecewise-constant current / rate. |
|
Poisson spike trains at a given |
|
Emit spikes at explicit |
|
Specialized / correlated spike sources. |
Recorders#
Device |
Records |
Read back with |
|---|---|---|
|
Per-step spikes of the tapped node. |
|
|
Named analog recordables ( |
|
|
Membrane potential (a |
|
|
Per-edge synaptic weights of a plastic projection. |
|
Detectors#
correlation_detector, correlomatrix_detector,
correlospinmatrix_detector, and spin_detector compute correlation
statistics from recorded trains. Several detectors are imperative host devices
(NumPy-RNG / Python-loop) and run eagerly — obtain the spike data first, then
drive the detector — rather than inside a compiled simulation loop.
volume_transmitter broadcasts a (dopamine) signal to a modulated plasticity
rule; see STDP parity: where state lives and how spikes pair for where its parameters live.
In-memory recording
Recording is in memory only — there is no file/ascii backend yet — so
NEST’s record_to backend axis collapses to the in-memory equivalent. The
time_in_steps format axis is reproduced post-hoc by reading recorded
spikes either as integer step indices or as times in ms. See
Record and analyze.
See also#
One neuron, Record and analyze — devices in runnable tutorials.
Connectivity — how devices connect into the network.
NEST-Compatible Devices — the full device API with signatures.
NEST simulator documentation — the authoritative reference for upstream device semantics.