send_steps_from_pre#
- class brainpy.state.network.send_steps_from_pre(pre_spikes, pre_of_edge=None, *, lag=0)[source]#
Step indices where each edge’s presynaptic neuron fired (the send mask).
- Parameters:
pre_spikes (
array_like) –(T,)single-pre spike train, or(T, n_pre)population matrix (1/0or boolean). A send is a step where the edge’s presynaptic neuron fired.pre_of_edge (
array_likeofint, optional) –(E,)population-local presynaptic index per edge in CSR (sorted-by-pre) order, i.e.proj.pre_local_idx[proj._pre_idx].Noneuses a(T,)train (or the lone column of a(T, 1)matrix) for every edge.lag (
int, optional) – Offset added to each fire step to align with the weight trajectory. The fullSimulatorreads the per-population spike holder one step late, so a presynaptic spike at stepsshows up inweight_trace[s + lag](lag=1); the direct-feed parity drives feed the projection in-step (lag=0, the default). Shifted steps outside[0, T)are clipped.
- Returns:
(n_send,)integer array for a single presynaptic train (pre_of_edgeisNone), otherwise a length-Elist of per-edge integer arrays (CSR order).- Return type:
numpy.ndarrayorlistofnumpy.ndarray- Raises:
ValueError – If
pre_spikesis a multi-column(T, n_pre)matrix andpre_of_edgeis not supplied.
See also
weight_recorder_eventsSample a weight trajectory at the send steps.
Examples
>>> import numpy as np >>> from brainpy_state._nest_network import send_steps_from_pre >>> pre = np.zeros(8); pre[[2, 5]] = 1 >>> send_steps_from_pre(pre).tolist() [2, 5]