RecordReducer

class RecordReducer(step_time: float, duration: float, inclusive: bool = False, inplace: bool = False)[source]

Bases: Reducer, ABC

Abstract base class for the reducers utilizing multiple RecordTensors.

Parameters:
  • step_time (float) – length of time between observations.

  • duration (float) – length of time for which observations should be stored.

  • inclusive (bool, optional) – if the duration should be inclusive. Defaults to False.

  • inplace (bool, optional) – if write operations should be performed in-place. Defaults to False.

add_record(*attr: str) None[source]

Add a record attribute

Parameters:

*attr (str) – names of the attributes to set as records.

property dt: float

Length of time between stored values in history.

Parameters:

value (float) – new time step length.

Returns:

length of the time step.

Return type:

float

Note

Altering this property will reset the reducer.

Note

In the same units as duration.

property duration: float

Length of time over which prior values are stored.

Parameters:

value (float) – new length of the history to store.

Returns:

length of the history.

Return type:

float

Note

Altering this property will reset the reducer.

Note

In the same units as dt.

property inplace: bool

If write operations should be performed in-place.

Parameters:

value (bool) – if write operations should be performed in-place.

Returns:

if write operations should be performed in-place.

Return type:

bool

Note

Generally if gradient computation is required, this should be set to False.