timestep function¶
(Shortest import: from brian2.core.functions import timestep)
- brian2.core.functions.timestep(t, dt)[source]¶
Converts a given time to an integer time step. This function slightly shifts the time before dividing it by
dtto make sure that multiples ofdtdo not end up in the preceding time step due to floating point issues. This function is used in the refractoriness calculation.New in version 2.1.3.
- Parameters
t : np.ndarray, float, Quantity
The time to convert.
dt : float or Quantity
The length of a simulation time step.
- Returns
ts : np.ndarray, np.int64
The time step corresponding to the given time.
Notes
This function cannot handle infinity values, use big values instead (e.g. a
NeuronGroupwill use-1e4*secondas the value of thelastspikevariable for neurons that never spiked).