reno.ops.slice#

class reno.ops.slice(a, start=None, stop=None)#

Bases: Operation

Can be applied along with timeseries op in metrics for getting specific time segments, or can be applied generally in equations when dealing with vector data.

Similar to normal python slices, top is exclusive

String notation: (slice A [START] [STOP])

Methods

__init__(a[, start, stop])

Create an operation node involving the passed sub equation parts.

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.

equal(obj)

Returns a symbolic operation for checking equality with passed object.

eval([t, save, force])

'wrap' all operation eval functions so we get better error handling.

find_parts_of_type(search_type[, ...])

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

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)

Get a string of latex representing this op.

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.

op_eval(t, **kwargs)

Any new operations should implement this method.

op_latex(**kwargs)

Output the latex string for this operation.

op_repr()

Get a string representation for the op name/label.

op_types()

Get a list of all defined operations/Operation subclasses.

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.

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.

Attributes

OP_REPR

If defined, this is what gets printed as the 'label' for the operation in the repr, and is what's used during parsing.

dtype

The type of each underlying value.

shape

The size of the data dimension, 1 by default.

timeseries

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

non_repr_part_indices

Use this to "hide" a sub_equation_part in the string repr, e.g. if it's important for computation but isn't part of parsing.

Parameters:
  • a (EquationOrValue)

  • start (EquationOrValue)

  • stop (EquationOrValue)

__annotations__ = {}#
__module__ = 'reno.ops'#
op_eval(t, **kwargs)#

Any new operations should implement this method.

Put all evaluation logic in here, as opposed to overriding eval.

Parameters:
  • t (int)

  • kwargs (dict)

Return type:

list | ndarray

op_latex(**kwargs)#

Output the latex string for this operation. Override this in subclasses.

Parameters:

kwargs (dict)

Return type:

str

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