PropertyDict#
- class deeptrack.properties.PropertyDict(node_name: str | None = None, **kwargs: Any)#
Bases:
DeepTrackNode,dictDictionary 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#
- node_name: str | None, optional
The name of this node. Defaults to None.
- **kwargs: 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#
- __getitem__(key) -> Any
Retrieves a value from the dictionary using a key.
Examples#
>>> import deeptrack as dt
Initialize a PropertyDict with different types of properties:
>>> import numpy as np >>> >>> prop_dict = dt.PropertyDict( ... constant=42, ... dependent=lambda constant: constant + 10, ... random=lambda: np.random.rand(), ... )
Access the properties:
>>> prop_dict["constant"]() 42
>>> prop_dict["dependent"]() 52
>>> prop_dict["random"]() 0.33112452108057056