clabe.data_mapper ¶
DataMapper ¶
Bases: Service, ABC, Generic[TMapTo]
Abstract base class for data mappers.
Defines the interface for mapping data from various sources to specific target formats or schemas.
mapped
property
¶
Retrieves the mapped data object.
Returns:
| Type | Description |
|---|---|
TMapTo
|
The mapped data object |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the data has not been mapped yet |
run ¶
Executes the data mapping process.
Returns:
| Type | Description |
|---|---|
TMapTo
|
The mapped data object |
map
abstractmethod
¶
get_cameras ¶
get_cameras(
rig_instance: Rig,
exclude_without_video_writer: bool = True,
) -> dict[str, CameraTypes]
Retrieves cameras from a rig instance.
Extracts camera information from camera controllers within the rig model, optionally filtering based on video writer availability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rig_instance
|
Rig
|
The rig model instance containing camera controllers |
required |
exclude_without_video_writer
|
bool
|
If True, exclude cameras without a video writer |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, CameraTypes]
|
A dictionary mapping camera names to their types |
Source code in src/clabe/data_mapper/helpers.py
snapshot_bonsai_environment ¶
snapshot_bonsai_environment(
config_file: PathLike = Path("./bonsai/bonsai.config"),
) -> dict[str, str]
Captures a snapshot of the Bonsai environment from a configuration file.
Parses the Bonsai configuration file to extract information about installed packages and their versions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
PathLike
|
Path to the Bonsai configuration file |
Path('./bonsai/bonsai.config')
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dictionary of package IDs and their versions |
Source code in src/clabe/data_mapper/helpers.py
snapshot_python_environment ¶
Captures a snapshot of the current Python environment.
Creates a record of all currently installed Python packages and their versions,
useful for reproducibility and debugging purposes. Inside a run, these are the distributions the run's
manifest (run.json) recorded, so the mapped metadata and the manifest agree.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dictionary of package names and their versions |