physioex.data.dict_collate_fn#

physioex.data.dict_collate_fn(batch)[source]#

Collate a list of dict-returning dataset items.

Stacks tensor fields across the batch dimension. Preserves dict/list metadata as lists-of-dicts (not dicts-of-lists) so individual sample metadata stays accessible.

Expects each item to have at least:

  • signals: dict[str, Tensor]

  • channel_order: list[str]

  • labels: Tensor

Optional fields: epoch_indices, channel_info, subject, recording_length.

Note

Channel names are expected to be in MODALITY_INDEX format (e.g., “EEG_0”, “EOG_1”). The collate sorts channels by (modality, index) for deterministic ordering.

Parameters:

batch (List[Dict[str, Any]])

Return type:

Dict[str, Any]