PULSE-code / pulse /errors.py
velvet-pine-22's picture
PULSE-code: benchmark code for the PULSE dataset (camera-ready release)
dffbc1f verified
Raw History Blame Contribute Delete
1.73 kB
"""Exception types.
The data layer never skips a recording silently. A recording is either
expected by the task manifest (and then every requested stream must load, or
one of these errors is raised) or excluded by a documented rule before loading.
"""
class PulseDataError(RuntimeError):
"""Base class for all data-layer errors."""
class DataRootError(PulseDataError):
"""The dataset root is missing or does not look like a PULSE release."""
class MissingFileError(PulseDataError, FileNotFoundError):
"""A file that the metadata or manifest says must exist is absent."""
class AmbiguousFileError(PulseDataError):
"""A file was found in more than one supported location."""
class ModalityUnavailableError(PulseDataError):
"""The stream exists but does not provide the requested modality.
Example: the IMU file of volunteer v5 has 72 columns (4 sensors) instead of
180 (10 sensors), so it is treated as a missing modality. ``reason`` is a
short machine-readable code that is stored in the availability table.
"""
def __init__(self, message: str, reason: str):
super().__init__(message)
self.reason = reason
class DataQualityError(PulseDataError):
"""The stream loads but fails a documented quality rule."""
def __init__(self, message: str, reason: str):
super().__init__(message)
self.reason = reason
class ManifestMismatchError(PulseDataError):
"""The recordings a task loaded differ from its expected manifest."""
class SplitError(ValueError):
"""A split file is malformed or a fold/partition is inconsistent."""
class ProvenanceError(ValueError):
"""Results with inconsistent provenance were about to be merged."""