PropertyDict#

class deeptrack.properties.PropertyDict(**kwargs: Dict[str, Any])#

Bases: DeepTrackNode, dict

Dictionary with Property elements.

A PropertyDict is a specialized dictionary where values are instances of Property. It provides additional utility functions to update, sample, reset, and retrieve properties. This is particularly useful for managing feature-specific properties in a structured manner.

Parameters#

**kwargsDict[str, Any]

Key-value pairs used to initialize the dictionary, where values are either directly used to create Property instances or are dependent on other Property values.

Methods#

__init__(**kwargs: Dict[str, Any])

Initializes the PropertyDict, resolving Property dependencies.

__getitem__(key: str) -> Any

Retrieves a value from the dictionary using a key.

Examples#

Initialize a PropertyDict with different types of properties:

>>> import deeptrack as dt
>>> prop_dict = dt.PropertyDict(
...     constant=42,
...     dependent=lambda constant: constant + 10,
...     random=lambda: np.random.rand(),
... )

Access the properties:

>>> print(prop_dict["constant"]())  # Returns 42
>>> print(prop_dict["dependent"]())  # Returns 52
>>> print(prop_dict["random"]())