bemobil_mne.preproc.EpochPreparer#

class bemobil_mne.preproc.EpochPreparer(remaps, *, epoch_tlimes=(-0.2, 0.8), baseline=(-0.2, 0), bandpass_erp=(None, 20.0), tshift=0.06)[source]#

Bases: object

Prepare condition-specific epochs from a cleaned raw recording.

Handles event remapping (from raw trialStart annotations to condition/stimulus labels and then to user-supplied category labels), optional latency correction, bandpass filtering, and epoching.

Parameters:
remapsdict[str, dict[str, str]]

Mapping of condition name → {original_label: target_label}. Only annotations whose remapped value appears in the condition’s remap dict values are retained for epoching.

epoch_tlimestuple of float

(tmin, tmax) in seconds for epochs relative to the event onset.

baselinetuple of float | None

Baseline window (tmin, tmax) passed to mne.Epochs.

bandpass_erptuple of (float | None, float | None)

(l_freq, h_freq) bandpass applied before epoching.

tshiftfloat

Stimulus onset delay in seconds. Annotation onsets are shifted forward by this amount so that t=0 aligns with actual stimulus presentation. Set to 0 to disable.

Parameters:
__init__(remaps, *, epoch_tlimes=(-0.2, 0.8), baseline=(-0.2, 0), bandpass_erp=(None, 20.0), tshift=0.06)[source]#
Parameters:

Methods

__init__(remaps, *[, epoch_tlimes, ...])

run(raw_clean, fname_out, cond, *[, overwrite])

Run event remapping, filtering, and epoching for one condition.

run(raw_clean, fname_out, cond, *, overwrite=False)[source]#

Run event remapping, filtering, and epoching for one condition.

Parameters:
raw_cleanmne.io.BaseRaw

ICA-cleaned raw recording that still carries all annotations.

fname_outstr | Path

Output stem; _epo.fif.gz is appended automatically.

condstr

Condition key that must exist in self.remaps.

overwritebool

Overwrite existing epoch file.

Returns:
epochs_dictdict[str, mne.Epochs]

{label: epochs} for each target label in the condition remap.

Parameters:
Return type:

dict[str, Epochs]