fdtdx.Recorder#

class fdtdx.Recorder(modules)[source]#

Bases: TreeClass

Records and compresses simulation data over time using a sequence of processing modules.

The Recorder manages a pipeline of modules that process simulation data at each timestep. It supports both compression modules that reduce data size and time filters that control when data is recorded. The recorder handles initialization, compression and decompression of simulation data through its module pipeline.

Quick Reference#

Attributes

Methods

Attributes#

Recorder.modules: Sequence[CompressionModule | TimeStepFilter]#

Sequence of processing modules to apply to the simulation data. Can be either CompressionModule for data reduction or TimeStepFilter for controlling recording frequency.

Methods#

Recorder.aset(attr_name, val, create_new_ok=False)#

Sets an attribute of this class. In contrast to the classical .at[].set(), this method updates the class attribute directly and does not only operate on jax pytree leaf nodes. Instead, replaces the full attribute with the new value.

The attribute can either be the attribute name of this class, or for nested classes it can also be the attribute name of a class, which itself is an attribute of this class. The syntax for this operation could look like this: “a->b->[0]->[‘name’]”. Here, the current class has an attribute a, which has an attribute b, which is a list, which we index at index 0, which is an element of type dictionary, which we index using the dictionary key ‘name’.

Note that dictionary keys cannot contain square brackets or single quotes (even if they are escaped).

Parameters:
  • attr_name (str) – Name of attribute to set

  • val (Any) – Value to set the attribute to

  • create_new_ok (bool, optional) – If false (default), throw an error if the attribute does not exist. If true, creates a new attribute if the attribute name does not exist yet.

Returns:

Updated instance with new attribute value

Return type:

Self

Recorder.compress(values, state, time_step, key)[source]#
Return type:

RecordingState

Recorder.decompress(state, time_step, key)[source]#
Return type:

tuple[dict[str, Array], RecordingState]

Recorder.get_class_fields()#
Return type:

list[TreeClassField]

Recorder.get_public_fields()#
Return type:

list[TreeClassField]

Recorder.init_state(input_shape_dtypes, max_time_steps, backend)[source]#
Return type:

tuple[Self, RecordingState]

If you find any errors in the documentation, please report them in the Github Issues!