instance

class Instance(cfg=None, from_scalars=False, **kwargs)

Bases: ConfiguredData

Represents an instance of configured data, handling data initialization and access.

Implements the __getitem__ and __setitem__ methods to provide dictionary-like access to the data.

Parameters:
  • cfg (Config | None, default: None) – The configuration object.

  • from_scalars (bool, default: False) – Whether to convert scalar inputs to arrays.

  • **kwargs – Keyword arguments representing the data to initialize the instance with.

Raises:
  • ValueError – If a required key is missing.

  • ValueError – If a value is not a numpy array when from_scalars=False.

  • ValueError – If a value does not have at least one dimension, or if a value does not own its data.

  • KeyError – If a key in kwargs is not a defined key.