Time Interface

This module provides an interface to the various types of simulation clocks for use in vivarium.

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

class vivarium.framework.time.interface.TimeInterface(manager)[source]

Public interface for the simulation time management system.

Parameters:

manager (SimulationClock)

clock()[source]

Gets a callable that returns the current simulation time.

Return type:

Callable[[], Timestamp | datetime | int]

step_size()[source]

Gets a callable that returns the current simulation step size.

Return type:

Callable[[], Timedelta | timedelta | int]

simulant_next_event_times()[source]

Gets a callable that returns the next event times for simulants.

Return type:

Callable[[pd.Index[int]], pd.Series[ClockTime]]

simulant_step_sizes()[source]

Gets a callable that returns the simulant step sizes.

Return type:

Callable[[pd.Index[int]], pd.Series[ClockStepSize]]

move_simulants_to_end()[source]

Gets a callable that moves simulants to the end of the simulation

Return type:

Callable[[pd.Index[int]], None]

register_step_size_modifier(modifier, required_resources=())[source]

Registers a step size modifier.

Parameters:
  • modifier (Callable[[pd.Index[int]], pd.Series[ClockStepSize]]) – Modifier of the step size pipeline. Modifiers can take an index and should return a series of step sizes.

  • required_resources (Sequence[str | Resource]) – A list of resources that the producer requires. A string represents a population attribute.

Return type:

None