reno.components.HistoricalValue#

class reno.components.HistoricalValue(tracked_ref, index_eq)#

Bases: Reference

A wrapper class for a reference, specifically for getting a previous value indexed by some other equation.

Methods

__init__(tracked_ref, index_eq)

clip(min, max)

equal(obj)

eval([t, save, force])

Execute the compute graph for this equation, this needs to be implemented in every subclass.

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_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.

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)

Get the string representation for referring to this reference, italicized and as a function of t to highlight it's a different timestep

not_equal(obj)

parse(arg_strs, refs)

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()

seek_refs()

Immediate refs only, depth=1.

series_max()

series_min()

sum([axis])

Attributes

dtype

The type of each underlying value.

model

Get the model associated with this historical value.

shape

The size of the data dimension, 1 by default.

timeseries

Get a timeseries view of the data (includes all historical data across all timesteps.)

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'#
__repr__()#

Return repr(self).

eval(t=0, save=False, force=False, **kwargs)#

Execute the compute graph for this equation, this needs to be implemented in every subclass.

Note that throughout a compute tree, this should effectively recurse through .eval() calls to all subparts as well.

Parameters:
  • t (int) – Timestep along simulation at which to evaluate.

  • save (bool) – Whether to store/track/cache the output in a tracked matrix. This is really only applicable to ``TrackedReference``s, but given recursive nature of this function, needs to always be passed down through all subsequent calls.

  • force (bool) – Whether to ignore a previously cached value and compute regardless.

get_shape()#

For now this is returning an integer because we only allow a single additional dimension. Note that this shape _does not_ incoporate time or batch dimensions, only the “data” dimension if applicable. This should be overridden by subclasses, e.g. operations which would change the shape.

Return type:

int

latex(**kwargs)#

Get the string representation for referring to this reference, italicized and as a function of t to highlight it’s a different timestep

Return type:

str

property model: Model#

Get the model associated with this historical value.

static parse(arg_strs, refs)#
Parameters:
  • arg_strs (list[str])

  • refs (dict[str, Reference])

pt(**refs)#

Get a pytensor graph representing this piece of an equation.

Parameters:

refs (dict[str, TensorVariable])

Return type:

TensorVariable

pt_str(**refs)#

Construct a string containing relevant pytensor code for this piece of the equation. This is useful for “compiling” into pymc code.

Parameters:

refs (dict[str, str])

Return type:

str

qual_name()#