physioex.data.MultiDataset#

class physioex.data.MultiDataset(datasets, memmap_cache_size=1000)[source]#

Bases: Dataset

Wraps multiple BasePhysioDataset instances into a single unified dataset.

Provides ConcatDataset-like flat indexing across all datasets, with: - Unified __getitem__ returning the same dict format as BasePhysioDataset - Cross-dataset split coordination via split(fold) - dataset_idx tracking in the returned dict’s subject metadata - Proportional memmap cache distribution across constituent datasets

Parameters:
__init__(datasets, memmap_cache_size=1000)[source]#
Parameters:
Return type:

None

Methods

__init__(datasets[, memmap_cache_size])

available_channels()

Return union of available channels across all datasets.

close()

Close all memmap caches in constituent datasets.

get_n_subjects()

Return total number of subjects across all datasets.

get_subjects()

Return all subject IDs across all datasets.

get_subjects_with_dataset_idx()

Return (dataset_idx, subject_id) pairs for every subject.

memmap_cache_stats()

Aggregate memmap cache statistics across all constituent datasets.

split([fold])

Return train/valid/test indices coordinated across all datasets.

Attributes

datasets

Return the wrapped dataset list (read-only reference).

available_channels()[source]#

Return union of available channels across all datasets.

Return type:

Dict[str, int]

close()[source]#

Close all memmap caches in constituent datasets.

Return type:

None

property datasets: List[BasePhysioDataset]#

Return the wrapped dataset list (read-only reference).

get_n_subjects()[source]#

Return total number of subjects across all datasets.

Return type:

int

get_subjects()[source]#

Return all subject IDs across all datasets.

Note: IDs are not guaranteed to be unique across datasets. If disambiguation is needed, use get_subjects_with_dataset_idx.

Return type:

List[str]

get_subjects_with_dataset_idx()[source]#

Return (dataset_idx, subject_id) pairs for every subject.

Return type:

List[Tuple[int, str]]

memmap_cache_stats()[source]#

Aggregate memmap cache statistics across all constituent datasets.

Returns:

Dict with aggregated stats (total_hits, total_misses, hit_rate, etc.) and per-dataset breakdown.

Return type:

Dict[str, Any]

split(fold=0)[source]#

Return train/valid/test indices coordinated across all datasets.

Training: flat integer indices into this MultiDataset’s __getitem__. Valid/Test: list of (dataset_idx, subject_id) tuples, where dataset_idx is the position of the originating dataset in the datasets list passed to the constructor.

Parameters:

fold (int)

Return type:

Tuple[ndarray, List[Tuple[int, str]], List[Tuple[int, str]]]