SimulationTickFunction
simulation.SimulationTickFunction()
A function which runs in the context of a RUME to produce a value (as a numpy array) which is expected to vary over the run of a simulation.
SimulationTickFunction is an abstract class. In typical usage you will not implement a SimulationTickFunction directly, but rather one of its more-specific child classes.
SimulationTickFunction is generic in the type of result it produces (ResultT
).
See Also
The only notable child class of SimulationTickFunction is the movement model MovementClause
.
Attributes
requirements: Sequence[AttributeDef] | property
-
The attribute definitions describing the data requirements for this function.
For advanced use-cases, you may specify requirements as a property if you need it to be dynamically computed.
randomized: bool
-
Should this function be re-evaluated every time it’s referenced in a RUME? (Mostly useful for randomized results.) If False, even a function that utilizes the context RNG will only be computed once, resulting in a single random value that is shared by all references during evaluation.
class_name: str
-
The class name of the SimulationFunction.
name: AbsoluteName
-
The name under which this attribute is being evaluated.
scope:
GeoScope
-
The simulation GeoScope.
time_frame: TimeFrame
-
The simulation TimeFrame.
ipm: BaseCompartmentModel
-
The simulation IPM.
rng: np.random.Generator
-
The simulation’s random number generator.
dim:
Dimensions
-
The simulation’s dimensional information. This is a re-packaging of information contained in other context elements, like the geo scope.
Methods
Name | Description |
---|---|
validate |
Override this method to validate the function evaluation result. Implementations should raise an appropriate error if results are not valid. |
with_context |
Constructs a clone of this instance which has access to the given context. |
data |
Retrieve the value of a requirement. You must declare the attribute in this function’s requirements list. |
evaluate |
Implement this method to provide logic for the function. Use self methods and properties to access the simulation context or defer processing to another function. |
defer |
Defer processing to another instance of a SimulationTickFunction, returning the result of evaluation. |