Skip to content

Segmentation

Bases: BaseClass

Class for segmentation (Epoching).

Extracts events from the specified stimulation channel and creates epochs around selected markers using MNE's find_events() and Epochs functions.

MNE-functions used: mne.find_events, mne.pick_events

Parameters:

Name Type Description Default
raw Raw

Input data.

required
stim_channel str | None

Name of the stimulation channel used to detect events (e.g., 'Status'). If None, MNE falls back to config variables 'MNE_STIM_CHANNEL', 'STI 014', or the first 'stim'-type channel found.

None
start float

Start time of each epoch in seconds relative to the event.

required
end float

End time of each epoch in seconds relative to the event

required
baseline tuple of (float, float) | None

Time interval for baseline correction passed to MNE Epochs. Use None to disable baseline correction.

None
reference_markers dict

Marker selection configuration with the following optional keys: - "list" : list of int | None
Explicit marker IDs to include. - "range" : str | None
Inclusive marker range as "min-max" (e.g. "10-69").

If both keys are provided, their union is used. If None or empty, all detected events are used.

None
eventsfile str | None

Path to a CSV file defining event labels and their corresponding IDs or ID ranges separated with '-'. The CSV file should have two columns: "label" and "ID".

None
**kwargs

Additional keyword arguments passed to MNE's find_events() and Epochs() functions. Pass arguments for the different functions by using a dictionary with find_events and Epochs as keys.

{}

Attributes:

Name Type Description
processed Epochs

Epoched output data.

Example settings for config file

Example settings in correct format for the config file.

Segmentation:
  _biopap_module: <class 'biopap.modules.segmentation.Segmentation'>
  stim_channel: 'Status'
  start: -0.2
  end: 1
  baseline: None
  reference_markers:
    list:
    - '100'
    - '101'
    - '120'
    range: 10-69
  eventsfile: /path/to/your/events_metadata.csv