reno.components.Flag#

class reno.components.Flag(eq=None, label=None)#

Bases: Metric

Boolean value tracked for each step and sample in the simulation.

Methods

__init__([eq, label])

Create a Flag metric node.

astype(dtype)

Returns a symbolic operation to convert the output of this equation to the specified type.

clip(min, max)

Returns a symbolic operation for enforcing the output is between the passed min and max.

debug_equation(t[, sample])

Get a latex string output with the debug version of this equation.

equal(obj)

Returns a symbolic operation for checking equality with passed object.

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_parts_of_type(search_type[, ...])

Recursively search for all EquationParts in the tree of the specified type.

from_dict(data, refs)

Deserialize reference and parse data from dictionary previously saved from to_dict().

get_shape()

Get the size of the additional "data" dimension.

get_type()

Get the type of the target output of this equation expression.

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.

mean([axis])

Returns a symbolic operation to find the series-wise mean of the array.

not_equal(obj)

Returns a symbolic operation for checking inequality with passed object.

populate(n, steps)

Initialize the matrix of values with size n x 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([include_ref_types])

Recursively find a list of all References immediately underneath this part.

series_max()

Returns a symbolic operation to find the series-wise maximum of the array.

series_min()

Returns a symbolic operation to find the series-wise minimum of the array.

sum([axis])

Returns a symbolic operation to find the series-wise sum of the array.

to_dict()

Serialize class into a dictionary for saving to file.

Attributes

dtype

The type of each underlying value.

indices

Get equation for the timesteps where the value changes from 0 to 1.

shape

The size of the data dimension, 1 by default.

timeseries

Returns symbolic operation for getting a timeseries view of the data.

model

Keep a reference to container model, makes it easier to compare refs across multiple models.

label

Label is what's used in any visual representation (e.g. allows spaces where name does not.).

doc

A docstring to explain/describe the reference.

Parameters:
__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)

  • kwargs (dict)

Return type:

int | float | ndarray

property indices: Operation#

Get equation for the timesteps where the value changes from 0 to 1.

Note that this returns a “jagged” array, padded with NaN. If indexing into this array, you will likely need to use the nanindex op.

populate(n, steps)#

Initialize the matrix of values with size n x steps.

Parameters:
  • n (int) – The number of samples to simulate.

  • steps (int) – How many steps will be run in the simulation.

Return type:

None