weight_recorder_events#
- class brainpy.state.network.weight_recorder_events(weight_trace, send_steps)[source]#
Per-send weight events over a weight trajectory (the thin send-view).
NEST’s
weight_recorderlogs one event per plasticsend, value = the weight at send-time (our post-sendweight_tracevalue). This masks the dense per-step trajectory to the send steps.- Parameters:
weight_trace (
array_like) –(T,)or(T, E)per-step weight (or delivered amplitude) trajectory, sampled post-update (the order NEST logs: after this send’s pairing update).send_steps (
numpy.ndarrayorlistofnumpy.ndarray) –(n_send,)integer send-step indices (e.g. fromsend_steps_from_pre()), or a length-Elist of per-edge step arrays masking each column of a(T, E)trace independently (multapses recording in CSR order).
- Returns:
(steps, weights)withsteps == send_stepsandweights == weight_trace[steps]((n_send,)for a 1-D trace, or(n_send, E)for shared steps over a 2-D trace); a list of(steps_e, weights_e)per edge whensend_stepsis a per-edge list.- Return type:
- Raises:
ValueError – If
send_stepsis a per-edge list butweight_traceis not 2-D, or the list length does not match the number of trace columns.
See also
send_steps_from_preBuild the send mask from a presynaptic spike train.
Notes
A weight change strictly between the last send and the run end is absent from the events (NEST’s recorder logs only at sends, so it misses it too); read it from
weight_trace[-1]/ the final connection weight instead.Examples
>>> import numpy as np >>> from brainpy_state._nest_network import weight_recorder_events >>> trace = np.array([5.0, 4.0, 4.0, 3.0]) >>> steps, w = weight_recorder_events(trace, np.array([1, 3])) >>> steps.tolist(), w.tolist() ([1, 3], [4.0, 3.0])