Modality#
- class myoverse.datasets.Modality(data=None, path=None, dims=('channel', 'time'), attrs=<factory>, transform=None)[source]#
Configuration for a data modality.
A modality represents a single data stream (EMG, kinematics, EEG, etc.) with its dimensionality and optional preprocessing.
- Parameters:
data (np.ndarray | dict[str, np.ndarray] | None) – Data array or dict of arrays per task.
path (Path | str | None) – Path to pickle file containing data.
dims (tuple[str, ...]) – Dimension names (last must be ‘time’).
attrs (dict) – Optional attributes to store with the data.
transform (Callable | None) – Transform to apply after loading (receives tensor, returns tensor).
Examples
>>> emg = Modality( ... path="emg.pkl", ... dims=("channel", "time"), ... ) >>> # With preprocessing transform >>> from myoverse.transforms import Compose, Flatten, Index >>> kinematics = Modality( ... path="kinematics.pkl", ... dims=("dof", "time"), ... transform=Compose([ ... Flatten(0, 1), # (21, 3, time) -> (63, time) ... Index(slice(3, None), dim="channel"), # Remove wrist -> (60, time) ... ]), ... )
Methods