KlinzingSleepDS005555#
- class torch_brain.datasets.KlinzingSleepDS005555(root, split_type, recording_ids=None, transform=None, **kwargs)[source]#
Bases:
torch_brain.datasets.OpenNeuroDataset.OpenNeuroDatasetKlinzing Sleep iEEG Dataset (OpenNeuro DS005555).
Preprocessing
To download and prepare this dataset, run
brainsets prepare klinzing_sleep_ds005555
Each dataset instance uses a split strategy (split_type) and can optionally be restricted to specific recordings via recording_ids.
- Parameters:
root (
str) – Root directory containing processed Klinzing Sleep artifacts.split_type (
Literal['intrasession','intersubject','intersession']) – Dataset split strategy, e.g. train/valid/test as designated by the workflow.recording_ids (
Optional[list[str]]) – List of explicit recording IDs to load. If omitted, the dataset uses split-based recording selection.transform (
Optional[Callable]) – Optional transform to apply to each sample.**kwargs – Additional keyword arguments forwarded to OpenNeuroDataset.
References
Klinzing, J. G., et al. (Year). “Sleep iEEG Dataset.” Repository: https://openneuro.org/datasets/ds005555
- apply_namespace(data, namespace)#
Apply a namespace prefix to specified nested attributes in the data.
This method modifies the data object in-place by prepending the namespace to string attributes or string arrays specified in
namespace_attributes.Can be overridden by subclasses to apply the namespace in a custom way.
- Parameters:
- Return type:
- Returns:
The modified
torch_brain.data.Dataobject (same instance, modified in-place).
- get_channel_ids()#
Return sorted channel IDs across recordings.
get_channel_idsaggregatesrec.channels.idfromget_recording(...). Any subject/session uniquification is applied there according tomultichannel_dataset_mixin_uniquify_channel_ids_with_subjectandmultichannel_dataset_mixin_uniquify_channel_ids_with_session.
- get_default_sampling_intervals(recording, split)#
Get the default sampling intervals for a given split. These intervals are behavior agnostic, meaning they do not take into account any task or behavioral (event/label) annotations when creating the train, val, and test splits—interval assignment is performed solely based on session or subject, not on in-task structure.
Notes: - For split_type == “intrasession”, intervals are split causally into train, val, and test based on split_ratios. - For split_type == “intersubject” or “intersession”, only the assigned recordings are included for each split (using k-fold assignment); all others return an empty interval.
- Return type:
- get_recording(recording_id, _namespace='')#
Get lazy-loaded
torch_brain.data.Dataobject for a recording.- Parameters:
recording_id (
str) – The ID of the recording to load (same as fromrecording_ids())._namespace (
str) – Optional namespace prefix to apply to attributes.
- Return type:
- Returns:
Lazy
torch_brain.data.Dataobject containing the full recording.
- get_recording_hook(data)#
Hook method called after loading a recording in
get_recording().Subclasses can override this method to perform custom processing on recordings after they are loaded but before they are returned.
- Parameters:
data (
Data) – The Data object that was just loaded.
- get_sampling_intervals(split=None)#
Retrieve the sampling intervals for each recording according to the specified split.
If split is None, returns the full interval domain for every recording for unrestricted sampling. If a split (“train”, “val”, or “test”) is provided, returns only the intervals (within each recording) eligible for sampling under the current split type and task paradigm.
The selection of intervals is determined according to: - The current self.split_type (intrasession, intersubject, or intersession). - Whether a self.task_paradigm is specified, which influences the interval extraction.
- Parameters:
split (
Optional[Literal['train','val','test']]) – One of “train”, “val”, or “test” to select intervals corresponding to that split, or None to retrieve the entire domain for all recordings.- Return type:
- Returns:
Dictionary mapping recording IDs to their valid Interval objects for sampling in the given split (or full Interval domain if split is None).
- Raises:
ValueError – If the requested split or the dataset’s split_type is not recognized/supported.
KeyError – If a required split or assignment attribute is missing in a recording.
Notes
Intervals are defined based on recording domains and split logic.