epymorph.log.movement
For capturing extremely detailed movement data from a simulation.
MovementData
Bases: Protocol
A data collection of simulation movement data.
Run the simulation inside a movement_data
context and
an instance of this class will be returned. After the simulation
has completed, you can use this object to retrieve movement data
either by clause or in aggregate across all clauses.
A note about axis ordering: both requested
and actual
data
includes a pair of axes that are the length of the number of geo nodes
in the simulation (N). Because these data represent movement flows we
use the convention that the first N represents where the movement is "from" and
the second N represents where the movement is "to". This is true regardless
of which clause is responsible. Returning movement from the return clause is treated
no differently than outgoing movement from a user-defined clause.
requested_by
abstractmethod
The time series of requested movement by clause. Array shape: (T,N,N)
actual_by
abstractmethod
The time series of actual movement by clause. Array shape: (T,N,N,C)
requested_all
abstractmethod
The time series of requested movement for all clauses. Array shape: (T,N,N)
movement_data
movement_data() -> Generator[MovementData, None, None]
Run a simulation in this context in order to collect detailed movement data throughout the simulation run. This returns a MovementData object which can be used -- after this context is exits -- to retrieve the movement data.