Clock class¶
(Shortest import: from brian2 import Clock)
- class brian2.core.clocks.Clock(*args, **kw)[source]¶
Bases:
BaseClockAn object that holds the simulation time and the time step.
- Parameters:
dt : float
The time step of the simulation as a float
name : str, optional
An explicit name, if not specified gives an automatically generated name
Notes
Clocks are run in the same
Network.runiteration iftis the same. The condition for two clocks to be considered as having the same time isabs(t1-t2)<epsilon*abs(t1), a standard test for equality of floating point values. The value ofepsilonis1e-14.Attributes
The time step of the simulation in seconds.
The time step of the simulation as a float (in seconds)
The relative difference for times (in terms of dt) so that they are considered identical.
Methods
advance()Advance to the next time step.
same_time(other)Check if two clocks are at the same time (within epsilon_dt * dt).
set_interval(start, end)Set the start and end time of the simulation.
Details
- dt¶
The time step of the simulation in seconds.
- dt_¶
The time step of the simulation as a float (in seconds)
- epsilon_dt¶
The relative difference for times (in terms of dt) so that they are considered identical.
- same_time(other)[source]¶
Check if two clocks are at the same time (within epsilon_dt * dt).
- Parameters:
other : BaseClock
The other clock to compare with
- Returns:
bool :
True if both clocks are at the same time
- set_interval(start, end)[source]¶
Set the start and end time of the simulation.
Sets the start and end value of the clock precisely if possible (using epsilon_dt) or rounding up if not. This assures that multiple calls to
Network.runwill not re-run the same time step.- Parameters:
start : second
The start time of the simulation
end : second
The end time of the simulation