reno.components.Flag#
- class reno.components.Flag(eq=None, label=None)#
Bases:
MetricBoolean value tracked for each step and sample in the simulation.
Methods
__init__([eq, label])clip(min, max)debug_equation(t[, sample])equal(obj)equation(**kwargs)Get the representation of the full equation for the metric as a latex string.
eval([t, save, force])If the timestep is less than our internal_step tracker, return the corresponding previous column in the tracking matrix, since that timestep has already been computed.
find_refs_of_type(search_type[, already_checked])Actually recursive as opposed to seek_refs, returns a list of all equation parts matching passed type.
Get the timestep for the first time the value is 1.
from_dict(data, refs)Deserialize reference and parse data from dictionary previously saved from
to_dict()get_shape()For now this is returning an integer because we only allow a single additional dimension.
get_type()Similar to shape, this gets computed recursively, used to automatically determine if the value needs to be initialized with a certain numpy type.
indices()Get the timesteps where the value changes from 0 to 1.
is_static()Convenience shortcut for
reno.utils.is_static()- True if this equation doesn't rely on any dynamic values (thus constant), False if it does.latex(**kwargs)String representation suitable for a latex display.
not_equal(obj)populate(n, steps)pt(**refs)Get a pytensor graph representing this piece of an equation.
pt_str(**refs)Construct a string containing relevant pytensor code for this piece of the equation.
qual_name([dot])Get a string with both the model and the reference name if this model is a submodel of something else.
seek_refs()Immediate refs only, depth=1.
series_max()series_min()sum([axis])to_dict()Serialize class into a dictionary for saving to file.
Attributes
dtypeThe type of each underlying value.
shapeThe size of the data dimension, 1 by default.
timeseriesGet a timeseries view of the data (includes all historical data across all timesteps.)
modelKeep a reference to container model, makes it easier to compare refs across multiple models.
labelLabel is what's used in any visual representation (e.g. allows spaces where name does not.).
docA docstring to explain/describe the reference.
- Parameters:
eq (EquationPart)
label (str)
- __annotations__ = {}#
- __module__ = 'reno.components'#
- eval(t=0, save=False, force=False, **kwargs)#
If the timestep is less than our internal_step tracker, return the corresponding previous column in the tracking matrix, since that timestep has already been computed. Otherwise, compute, store, and update the internal step to t+1.
Note that evaluation output is only stored in the tracking matrix if save is
True, this class and subclasses are why save is being passed through all other.eval()methods.- Parameters:
t (int)
save (bool)
force (bool)
- Return type:
int | float | ndarray
- first_event()#
Get the timestep for the first time the value is 1.
- indices()#
Get the timesteps where the value changes from 0 to 1.
- populate(n, steps)#
- Parameters:
n (int)
steps (int)