meeg_utils.steps.AutoReject#
- class meeg_utils.steps.AutoReject(method='local', *, n_interpolate=None, consensus=None, cv=None, thresh_method='bayesian_optimization', random_state=42, n_jobs=1)[source]#
Reject or repair bad epochs with thresholds learned from the data.
Wraps autoreject (Jas et al., 2017, NeuroImage 159:417):
"local":autoreject.AutoRejectlearns a peak-to-peak threshold per channel by cross-validation; in each epoch the worst channels are interpolated, and epochs with too many bad channels are dropped. Needs sensor positions."global":autoreject.get_rejection_threshold()learns one peak-to-peak threshold per channel type; epochs exceeding it are dropped.
- Parameters:
method ({"local", "global"}) – See above.
n_interpolate (list of int | None) – Local: candidate numbers of channels to interpolate per epoch (
None: autoreject’s default, 1, 4 and 32).consensus (list of float | None) – Local: candidate fractions of bad channels that make an epoch bad (
None: autoreject’s default, 0 to 1 in steps of 0.1).cv (int) – Cross-validation folds (autoreject defaults: 10 local, 5 global).
thresh_method ({"bayesian_optimization", "random_search"}) – Local: how thresholds are searched.
random_state (int | None) – Seed.
n_jobs (int) – Parallel jobs.
- reject_log_#
Bad epochs and channel labels on the fitted data.
- Type:
autoreject.RejectLog
- qc_#
n_epochs,n_dropped,fraction_dropped,n_interpolated(channels interpolated per epoch, mean) and the most interpolated channels.- Type:
Notes
Figures (
plot()):"reject_log"(epochs x channels: bad, interpolated, dropped) and"thresholds".- __init__(method='local', *, n_interpolate=None, consensus=None, cv=None, thresh_method='bayesian_optimization', random_state=42, n_jobs=1)[source]#
Methods
__init__([method, n_interpolate, consensus, ...])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.
changes_timesWhether the step may change the time axis (e.g. resampling, cropping).
Whether the step may drop epochs (e.g. artifact rejection).
kind -> whether it needs data (
inst).returnsData type the step returns;
Nonemeans the same type as its input.systemsAcquisition systems the step applies to;
Nonemeans all systems.