meeg_utils.qc.Bridging#

class meeg_utils.qc.Bridging(*, lm_cutoff=16.0, epoch_threshold=0.5, l_freq=0.5, h_freq=30.0, epoch_duration=2.0, min_correlation=0.98, confirm_band=(15.0, 30.0), bad_limit=4)[source]#

Electrode bridging: neighbouring electrodes shorted by gel or sweat.

Bridged electrodes record nearly the same signal, so the electrical distance (variance of their difference) is close to zero. Uses mne.preprocessing.compute_bridged_electrodes(), the local-minimum method of Tenke & Kayser (2001, Clin Neurophysiol 112:545) and Greischar et al. (2004, Clin Neurophysiol 115:710) as implemented in MNE, with MNE’s defaults. The method looks for a local minimum in the distribution of small distances, so it needs enough bridged samples: a single bridged pair in a short recording can go undetected (the "distances" figure still shows it as a separate cluster near zero).

The electrical distance is absolute (µV²), so in recordings with small signals, neighbouring electrodes that are not bridged can fall below the cutoff too (seen in HAD-MEEG, where 0.5-30 Hz EEG is about 7 µV). Each candidate pair is therefore confirmed by its correlation after average referencing, in a band above slow artifacts (15-30 Hz by default): a bridge is a physical short, so the two electrodes record nearly identical signals at every frequency and their correlation is close to 1, while unbridged neighbours with small signals are not, and broad slow artifacts (sweat, movement), which correlate distant electrodes at low frequencies, are excluded. In HAD-MEEG (sub-01), bridged rows of electrodes kept correlations of 0.98-0.99 from 15 to 90 Hz, unbridged neighbours 0.6-0.8.

Parameters:
  • lm_cutoff (float) – Electrical-distance cutoff (µV²) below which a local minimum of the distance distribution indicates bridging (MNE default 16).

  • epoch_threshold (float) – Fraction of 2-s epochs in which a pair must be bridged (MNE default 0.5).

  • l_freq (float) – Band-pass applied before computing distances (MNE default 0.5-30 Hz).

  • h_freq (float) – Band-pass applied before computing distances (MNE default 0.5-30 Hz).

  • epoch_duration (float) – Epoch length in seconds (MNE default 2).

  • min_correlation (float | None) – Candidate pairs whose correlation (average reference, confirm_band) is below this are not counted as bridged. There is no published value; 0.98 is this library’s choice. None keeps every pair MNE finds.

  • confirm_band (tuple of float) – Band of the confirming correlation (Hz).

  • bad_limit (int) – A group of more bridged electrodes than this cannot be repaired by mne.preprocessing.interpolate_bridged_electrodes() (MNE default 4); such a group is a "fail". Any bridge is a "warn": the electrodes should be fixed during the session, as bridged channels carry no independent information.

metrics_#

n_pairs, pairs (channel-name pairs), groups (connected bridged electrodes) and largest_group, after confirmation; n_candidates (pairs found by MNE) and unconfirmed (candidate pairs with their correlation below min_correlation).

Type:

dict

Notes

Figures: "topomap" (mne.viz.plot_bridged_electrodes(); needs electrode positions) and "distances" (distribution of electrical distances with the cutoff).

__init__(*, lm_cutoff=16.0, epoch_threshold=0.5, l_freq=0.5, h_freq=30.0, epoch_duration=2.0, min_correlation=0.98, confirm_band=(15.0, 30.0), bad_limit=4)[source]#

Methods

__init__(*[, lm_cutoff, epoch_threshold, ...])

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] = 'bridging'#

Key of the check in reports.

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

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

plot_kinds: ClassVar[dict[str, bool]] = {'distances': False, 'topomap': False}#

kind -> whether it needs data (inst). Each kind is drawn by a _plot_<kind>(inst, **kwargs) method.

Type:

Figures the object can draw once fitted

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