meeg_utils.qc.Check#

class meeg_utils.qc.Check[source]#

Base class of acquisition-quality checks.

A check answers one question about how well a recording was acquired and never modifies the data. Like a step, it takes all parameters in __init__ (thresholds included, with their source documented; thresholds without an established, dataset-independent value default to None, i.e. the value is only reported); then compute() measures the recording and stores

  • metrics_: the measurements (plain, JSON-serializable values);

  • findings_: one Finding per criterion evaluated, with a verdict "ok", "warn" or "fail", or "info" for a measurement that has no threshold;

and plot() draws the figures listed in plot_kinds.

Subclasses set name, modalities (and optionally systems), implement _compute(), and may override not_applicable() for extra requirements (e.g. an EOG channel).

__init__()#

Methods

__init__()

compute(raw)

Measure the recording.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

not_applicable(raw)

Return why the check cannot run on raw, or None if it can.

plot([kind, inst])

Draw quality-control figures.

set_params(**params)

Set the parameters of this estimator.

Attributes

level

The worst verdict of the findings ("ok" if there are none).

modalities

Data types the check needs at least one of ("meg", "eeg").

name

Key of the check in reports.

plot_kinds

kind -> whether it needs data (inst).

systems

Acquisition systems the check applies to; None means all.

name: ClassVar[str] = ''#

Key of the check in reports.

modalities: ClassVar[frozenset[str]] = frozenset({'eeg', 'meg'})#

Data types the check needs at least one of (“meg”, “eeg”).

systems: ClassVar[frozenset[str] | None] = None#

Acquisition systems the check applies to; None means all.

not_applicable(raw)[source]#

Return why the check cannot run on raw, or None if it can.

Parameters:

raw (Raw) – The recording.

Returns:

The reason, or None.

Return type:

str | None

compute(raw)[source]#

Measure the recording.

Parameters:

raw (Raw) – The preloaded recording; it is not modified.

Returns:

self – The check, with metrics_ and findings_ set.

Return type:

Check

Raises:

ValueError – If the check does not apply to the recording.

property level: str#

The worst verdict of the findings ("ok" if there are none).

"info" when every finding is an unjudged measurement.