DeepTrackDataObject#
- class deeptrack.backend.core.DeepTrackDataObject#
Bases:
objectBasic data container for DeepTrack2.
DeepTrackDataObject is a simple data container to store some data and to track its validity.
Attributes#
- _data: Any
The stored data. Defaults to None.
- _valid: bool
Flag indicating whether the stored data is valid. Defaults to False.
Methods#
- store(data) -> None
Store data in the container and mark it as valid.
- current_value() -> Any
Return the currently stored data.
- is_valid() -> bool
Return whether the stored data is valid.
- invalidate() -> None
Mark the data as invalid.
- validate() -> None
Mark the data as valid.
- __repr__() -> str
Return the string representation of the object.
Example#
>>> import deeptrack as dt
Create a DeepTrackDataObject:
>>> data_obj = dt.DeepTrackDataObject() >>> data_obj DeepTrackDataObject(data=None, valid=False)
Store a value in this container:
>>> data_obj.store(42) >>> data_obj DeepTrackDataObject(data=42, valid=True)
Access the currently stored value:
>>> data_obj.current_value() 42
Check if the stored data is valid:
>>> data_obj.is_valid() True
Invalidate the stored data:
>>> data_obj.invalidate() >>> data_obj DeepTrackDataObject(data=42, valid=False)
>>> data_obj.is_valid() False
Validate the data to restore its valid status:
>>> data_obj.validate() >>> data_obj DeepTrackDataObject(data=42, valid=True)
>>> data_obj.is_valid() True
Methods Summary
Retrieve the stored data.
Mark the stored data as invalid.
is_valid()Return whether the stored data is valid.
store(data)Store data and mark it as valid.
validate()Mark the stored data as valid.
Methods Documentation
- invalidate() None#
Mark the stored data as invalid.
- is_valid() bool#
Return whether the stored data is valid.
Returns#
- bool
True if the data is valid, False otherwise.
- store(data: Any) None#
Store data and mark it as valid.
Parameters#
- data: Any
The data to be stored in the container.
- validate() None#
Mark the stored data as valid.