physioex.data.resolve_channels#

physioex.data.resolve_channels(requests, available, fs_map, preferences=None, allow_missing=False)[source]#

Resolve user channel requests against the EDF’s available channels.

Parameters:
  • requests (List[str | Dict]) –

    list of requests. Each may be one of:

    • a modality string (“EEG”, “EOG”, “EMG”, “ECG”) — takes the next unclaimed preference match;

    • a specific channel name (“C4-M2”) — case-insensitive exact match;

    • a dict {"modality": ..., "preference": ...} or {"name": ...}.

  • available (List[str]) – list of physical channel labels from the EDF header

  • fs_map (Dict[str, float]) – mapping physical_label -> sample rate (for fs_in propagation)

  • preferences (Dict[str, List]) – dict[modality -> list[candidate]]. Defaults to DEFAULT_PREFERENCES.

  • allow_missing (bool) – if True, unresolvable requests return None in the output list instead of raising. The subject is not dropped — the caller (BasePhysioDataset._build_item) will zero-fill the missing channel.

Returns:

Ordered list of ResolvedChannel (or None for missing channels when allow_missing=True) matching requests.

Raises:
  • ChannelNotAvailableError if any request cannot be satisfied AND

  • allow_missing` is False

Return type:

List[ResolvedChannel | None]