MetaData

MetaData#

class MetaData#

Bases: object

Class to hold metadata information of the processed data.

The Frames, when loading data from disk will collect information to work as MetaData, which will be used to provide an option of avoiding the repeated computation of exactly the same dataset. This class provides an easy interface to hold such data, write and load it to disk, and compare equality between two MetaData objects.

The data stored inside this object is divided by subInstruments, with each having a unique set of values, that is not shared with other subInstruments. Comparisons of equality are supported at the subInstrument level.

__init__(data_to_hold=None)#
subInstrument_comparison(other, subInstrument)#

Compare the Metadata of a given subInstrument. CHecks that must pass for equality:

  • The same keys are present in the two objects

  • A given key has the same value in the two objects

Parameters:
  • other – Other MetaData object

  • subInstrument (str) – SubInstrument to compare

Returns:

comparison_result – True if the MetaData matchess

Return type:

bool

store_json(path)#

Store the class as a json files

Parameters:

path (Path) – Path in which this object will be stored

add_info(key, info, subInstrument)#

Add a new metric to be tracked, with the values being collected over all available frames.

Parameters:
  • key (str) – Name of the metric

  • info (Union[str, Iterable]) – data to be stored

  • subInstrument (str) – subInstrument to which the info belongs to

Raises:

TypeError – If the info is not a list nor an iterable

classmethod load_from_json(path)#