pybemobil.preproc.EpochPreparer#
- class pybemobil.preproc.EpochPreparer(remaps, *, epoch_tlims=(-0.2, 0.8), baseline=(-0.2, 0), bandpass_erp=(None, 20.0), tshift=0.0)[source]#
Bases:
objectPrepare condition-specific epochs from a cleaned raw recording.
Handles event remapping (from raw
trialStartannotations to condition/stimulus labels and then to user-supplied category labels), optional latency correction, bandpass filtering, and epoching.- Parameters:
- remaps
dict[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_tlims
tupleoffloat (tmin, tmax)in seconds for epochs relative to the event onset.- baseline
tupleoffloat|None Baseline window
(tmin, tmax)passed tomne.Epochs.- bandpass_erp
tupleof(float|None,float|None) (l_freq, h_freq)bandpass applied before epoching.- tshift
float Stimulus onset delay in seconds. Event annotation onsets are shifted forward by this amount so that
t=0aligns with the actual stimulus presentation;BAD_*/EDGEannotations are not shifted. Default0(no shift). The delay between a marker and the stimulus depends on the display and trigger setup of each lab, so measure it (e.g. with a photodiode on the screen) and pass it here. The value used is recorded in the provenance descriptor of the epochs.
- remaps
- Parameters:
Notes
BAD_*annotations (e.g. breaks or missing auxiliary data) are kept, so epochs overlapping them are rejected bymne.Epochs.- __init__(remaps, *, epoch_tlims=(-0.2, 0.8), baseline=(-0.2, 0), bandpass_erp=(None, 20.0), tshift=0.0)[source]#
Methods
__init__(remaps, *[, epoch_tlims, baseline, ...])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_clean
mne.io.BaseRaw ICA-cleaned raw recording that still carries all annotations.
- fname_out
str|Path Output stem;
_epo.fif.gzis appended automatically (a trailing.fif/.fif.gzis removed first).- cond
str Condition key that must exist in
self.remaps.- overwritebool
Overwrite existing epoch file.
- raw_clean
- Returns:
- epochs_dict
dict[str,mne.Epochs] {label: epochs}for each target label in the condition remap that occurs in the data (missing labels are logged and skipped).
- epochs_dict
- Parameters:
- Return type: