ibl_alignment_gui.utils.parse_yaml

Functions

load_alignment_yaml

Load and parse alignment configuration YAML file.

resolve_path

Resolve dataset path using hierarchical path resolution.

Classes

AlignmentYAML

Root-level YAML configuration structure.

Configuration

Configuration for a single experimental configuration.

DatasetPaths

Container for resolved dataset paths for a single probe.

Datasets

Dataset configuration with optional path and backend specification.

Probe

Configuration for a single probe.

class ibl_alignment_gui.utils.parse_yaml.AlignmentYAML(**data)[source]

Bases: BaseModel

Root-level YAML configuration structure.

defaults

Default dataset configurations applied to all probes

Type:

dict[str, Datasets]

configurations

Dictionary mapping configuration names to their configurations

Type:

dict[str, Configuration]

path

Global root path for resolving all relative paths

Type:

Path | None

configurations: dict[str, Configuration]
defaults: dict[str, Datasets] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

path: Path | None
class ibl_alignment_gui.utils.parse_yaml.Configuration(**data)[source]

Bases: BaseModel

Configuration for a single experimental configuration.

probes

Dictionary mapping probe names to their configurations

Type:

dict[str, Probe]

path

Configuration-level base path for resolving relative probe paths

Type:

Path | None

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

path: Path | None
probes: dict[str, Probe]
class ibl_alignment_gui.utils.parse_yaml.DatasetPaths(**data)[source]

Bases: BaseModel

Container for resolved dataset paths for a single probe.

spike_sorting

Path to spike sorting output directory

Type:

Path | None

processed_ephys

Path to processed electrophysiology data directory

Type:

Path | None

raw_ephys

Path to raw electrophysiology recordings directory

Type:

Path | None

task

Path to task data directory

Type:

Path | None

raw_task

Path to raw task data directory

Type:

Path | None

picks

Path to probe trajectory pick files directory

Type:

Path | None

histology

Path to histology volume directory

Type:

Path | None

output

Path to alignment output directory

Type:

Path | None

histology: Path | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: Path | None
picks: Path | None
processed_ephys: Path | None
raw_ephys: Path | None
raw_task: Path | None
spike_sorting: Path | None
task: Path | None
class ibl_alignment_gui.utils.parse_yaml.Datasets(**data)[source]

Bases: BaseModel

Dataset configuration with optional path and backend specification.

path

Relative or absolute path to the dataset directory

Type:

Path

backend

Data format backend (e.g., ‘phylib’, ‘spikeglx’)

Type:

str | None

backend: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

path: Path | None
class ibl_alignment_gui.utils.parse_yaml.Probe(**data)[source]

Bases: BaseModel

Configuration for a single probe.

datasets

Dictionary mapping dataset names to their configurations

Type:

dict[str, Datasets] | None

path

Probe-level base path for resolving relative dataset paths

Type:

Path | None

datasets: dict[str, Datasets] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

path: Path | None
ibl_alignment_gui.utils.parse_yaml.load_alignment_yaml(yaml_file)[source]

Load and parse alignment configuration YAML file.

Resolves all dataset paths using hierarchical path resolution and applies defaults. Creates output directories if they don’t exist.

Parameters:

yaml_file (str) – Path to the YAML configuration file

Return type:

tuple[list[str], list[str], dict[str, dict[str, DatasetPaths]]]

Returns:

  • configs (list of str) – List of configuration names

  • probes (list of str) – List of unique probe names across all configurations

  • data_paths (A dict of dicts of DatasetPaths) – Nested dictionary of resolved paths: data_paths[config_name][probe_name] -> DatasetPaths

Notes

  • If no ‘configurations’ section exists, creates a ‘default’ configuration

  • Falls back to raw_ephys path if processed_ephys is not specified

  • Falls back to spike_sorting path if output path is not specified

  • Creates output directories automatically with parents

ibl_alignment_gui.utils.parse_yaml.resolve_path(dataset_path=None, probe_path=None, config_path=None, global_path=None, default_path=None)[source]

Resolve dataset path using hierarchical path resolution.

If path is absolute at any stage, it is returned immediately. Otherwise path is resolved progressively through the provided paths.

Return type:

Path | None

Resolution order:

dataset probe / dataset config / probe/ dataset global / config / probe / dataset

If that path is still relative at the end, an error is raised.