The Simulation Clock

The components here provide implementations of different kinds of simulation clocks for use in vivarium.

For more information about time in the simulation, see the associated concept note.

class vivarium.framework.time.SimulationClock[source]

Defines a base implementation for a simulation clock.

property name
property time: Timestamp | datetime | Number

The current simulation time.

property stop_time: Timestamp | datetime | Number

The time at which the simulation will stop.

property step_size: Timedelta | timedelta | Number

The size of the next time step.

step_forward()[source]

Advances the clock by the current step size.

Return type:

None

step_backward()[source]

Rewinds the clock by the current step size.

class vivarium.framework.time.SimpleClock[source]

A unitless step-count based simulation clock.

configuration_defaults = {'time': {'end': 100, 'start': 0, 'step_size': 1}}
property name
setup(builder)[source]
vivarium.framework.time.get_time_stamp(time)[source]
class vivarium.framework.time.DateTimeClock[source]

A date-time based simulation clock.

configuration_defaults = {'time': {'end': {'day': 2, 'month': 7, 'year': 2010}, 'start': {'day': 2, 'month': 7, 'year': 2005}, 'step_size': 1}}
property name
setup(builder)[source]
class vivarium.framework.time.TimeInterface(manager)[source]
Parameters:

manager (SimulationClock) –

clock()[source]

Gets a callable that returns the current simulation time.

Return type:

Callable[[], Timestamp | datetime | Number]

step_size()[source]

Gets a callable that returns the current simulation step size.

Return type:

Callable[[], Timedelta | timedelta | Number]