File size: 1,732 Bytes
dffbc1f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """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."""
|