meeg_utils.steps.Epoch#
- class meeg_utils.steps.Epoch(event_id=None, tmin=-0.2, tmax=0.5, *, baseline=(None, 0.0), events='auto', stim_channel=None, reject=None, flat=None, reject_by_annotation=True, decim=1, detrend=None, metadata=None, event_repeated='error')[source]#
Cut the recording into epochs around events.
Events come from the annotations (excluding
BAD/EDGE; for BIDS data these are thetrial_typeofevents.tsv) or from the stimulus channel. The event names and codes are fixed when fitting, so every run transformed with the fitted step uses the same codes.- Parameters:
event_id (None | str | list of str | dict) – Events to epoch:
Nonefor all; names (or MNE’s/-separated tags, e.g."video"matches"video/on"); or a dict mapping names to codes.tmin (float) – Epoch start and end relative to the events, in seconds.
tmax (float) – Epoch start and end relative to the events, in seconds.
baseline (tuple | None) – Baseline interval subtracted by
mne.Epochs(MNE’s default(None, 0));Noneto leave it toBaseline.events ({"auto", "annotations", "stim"}) – Where to find the events;
"auto"uses the annotations if there are event annotations, otherwise the stimulus channel.stim_channel (str | None) – Stimulus channel (default: MNE’s choice).
reject (dict | None) – Peak-to-peak rejection limits per channel type (see
mne.Epochs).flat (dict | None) – Peak-to-peak rejection limits per channel type (see
mne.Epochs).reject_by_annotation (bool) – Drop epochs overlapping
BADannotations.decim (int) – Decimation factor (low-pass the data first).
detrend (int | None) – 0 to remove the mean, 1 to remove a linear trend of each epoch.
metadata (None | "bids" | str) –
"bids"adds the rows of the recording’s BIDSevents.tsv(matched by onset); a path adds the rows of a TSV/CSV file with one row per selected event. Needs pandas.event_repeated ({"error", "drop", "merge"}) – What to do with several events at the same sample.
- qc_#
n_events(per condition),n_kept,n_dropped,fraction_keptanddrop_reasons(count per reason).- Type:
Notes
Figures (
plot()):"drop_log"(mne.viz.plot_drop_log()) and"evoked"(averages per condition,mne.viz.plot_compare_evokeds(), one figure per channel type).- __init__(event_id=None, tmin=-0.2, tmax=0.5, *, baseline=(None, 0.0), events='auto', stim_channel=None, reject=None, flat=None, reject_by_annotation=True, decim=1, detrend=None, metadata=None, event_repeated='error')[source]#
Methods
__init__([event_id, tmin, tmax, baseline, ...])fit(inst[, y, system])Learn the step's state from the data.
fit_transform(inst[, y, system, copy])Fit the step on the data and transform the same data.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
plot([kind, inst])Draw quality-control figures.
set_fit_request(*[, inst, system])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_transform_request(*[, copy, inst])Configure whether metadata should be requested to be passed to the
transformmethod.transform(inst, *[, copy])Apply the fitted step to the data.
Attributes
Data types the step accepts.
adds_annotationsWhether the step may add
BAD_annotations (existing ones are kept).changes_channelsWhether the step may add, drop or reorder channels.
Whether the step may change the time axis (e.g. resampling, cropping).
drops_epochsWhether the step may drop epochs (e.g. artifact rejection).
kind -> whether it needs data (
inst).systemsAcquisition systems the step applies to;
Nonemeans all systems.- accepts: ClassVar[tuple[type, ...]] = (<class 'mne.io.base.BaseRaw'>,)#
Data types the step accepts.
- returns#
alias of
BaseEpochs