config

class BaseConfig(**kwargs)

Bases: object

A configuration object for storing key-value pairs.

This class allows for the creation and manipulation of configuration objects.

Examples

>>> cfg = Config(key1="value1", key2=[1.0, 2.0])
>>> cfg["key1"]
'value1'
>>> cfg.keys()
dict_keys(['key1', 'key2'])
>>> cfg.values()
dict_values(['value1', [1.0, 2.0]])
>>> cfg.items()
dict_items([('key1', 'value1'), ('key2', [1.0, 2.0])])
>>> cfg_copy = cfg.copy()
>>> cfg_copy["key1"] = "new_value"
>>> cfg["key1"]
'value1'
>>> cfg_copy["key1"]
'new_value'
>>> print(cfg)
key1: value1
key2:
- 1.0
- 2.0

Config objects can also be set up without passing arguments by assigning attributes:

>>> cfg = Config()
>>> cfg.key1 = "value1"
>>> cfg.key2 = [1.0, 2.0]
>>> cfg.nested = Config(subkey1="subvalue1", subkey2="subvalue2")

Accessing and setting values is also possible with the __getitem__() and __setitem__() methods.

>>> cfg["nested"]["subkey1"]
'subvalue1'
>>> cfg["nested"]["subkey1"] = "subvalue1_modified"
>>> print(cfg)
key1: value1
key2:
- 1.0
- 2.0
nested:
  subkey1: subvalue1_modified
  subkey2: subvalue2
copy()

Return a deep copy of the configuration object.

items()

Return the items (key-value pairs) of the configuration object.

keys()

Return the keys of the configuration object.

values()

Return the values of the configuration object.

class Config(*, trajectory_keys=(), key_identity=None, key_timestamp=None, key_category=None, key_score=None, key_box=None, key_keypoints=None, timestep=None, hash_decimals=9, **kwargs)

Bases: BaseConfig

Config for automated-scoring.

Configurations derived from this class are used to define data access (via keys) for the structures implemented in vassi.data_structures.

Parameters:
  • trajectory_keys (tuple[str, ...], default: ()) – Tuple of keys used to specify trajectory data (e.g., positions, postures, timestamps, bounding boxes, individual identities).

  • key_identity (str | None, default: None) – Key used to specify identities, if applicable.

  • key_timestamp (str | None, default: None) – Key used to specify timestamps, required for timestamped data (e.g., Trajectory).

  • key_category (str | None, default: None) – Key used to specify categories, for example if collections contain instances of different categories (e.g., different species).

  • key_score (str | None, default: None) – Key used to specify scores, for example for detection confidence for each instance in a collection.

  • key_box (str | None, default: None) – Key used to specify bounding boxes.

  • key_keypoints (str | None, default: None) – Key used to specify keypoints (i.e., posture data).

  • timestep (int | float | None, default: None) – Timestep used for temporal data (here, usually in video frames).

  • hash_decimals (int, default: 9) – Number of decimal places used for hashing.