msqms.qc.metrics module#

Abstract class for metrics

Summary#

Classes:#

Metrics

Abstract base class for defining metrics for MEG data quality control.

Reference#

class msqms.qc.metrics.Metrics(raw, data_type, origin_raw=None, n_jobs=-1, verbose=False)[source]#

Bases: ABC

Abstract base class for defining metrics for MEG data quality control.

This class provides common functionality and structure for specific metric implementations, such as entropy, fractal, and frequency domain metrics.

Parameters:
  • raw (mne.io.BaseRaw) – The raw MEG data object.

  • data_type (str) – Type of MEG data, such as ‘squid’ or ‘opm’.

  • origin_raw (mne.io.Raw, optional) – The original raw MEG data for comparison. Default is None.

  • n_jobs (int, optional) – Number of parallel jobs to use for computation. Default is -1 (use all available cores).

  • verbose (bool, optional) – If True, enables verbose output. Default is False.

raw#

The raw MEG data object.

Type:

mne.io.BaseRaw

origin_raw#

The original raw MEG data for comparison.

Type:

mne.io.Raw or None

samp_freq#

Sampling frequency of the MEG data.

Type:

float

meg_names#

Names of selected MEG channels, determined by the meg_type.

Type:

np.ndarray or None

meg_type#

Type of MEG channels (‘mag’ or ‘grad’). Default is ‘mag’.

Type:

str

meg_data#

Data of selected MEG channels.

Type:

np.ndarray or None

data_type#

Type of MEG data, such as ‘squid’ or ‘opm’.

Type:

str

verbose#

Enables verbose output if True.

Type:

bool

n_jobs#

Number of parallel jobs for computation.

Type:

int

config_default#

Default configuration parameters.

Type:

dict

data_type_specific_config#

Data type-specific configuration parameters.

Type:

dict

zero_mask#

Cached mask for zero-value data points (for reporting purposes).

Type:

np.ndarray or None

nan_mask#

Cached mask for NaN data points (for reporting purposes).

Type:

np.ndarray or None

bad_chan_mask#

Cached mask for bad channels.

Type:

np.ndarray or None

bad_seg_mask#

Cached mask for bad segments.

Type:

np.ndarray or None

flat_mask#

Cached mask for flat-line data points.

Type:

np.ndarray or None

bad_chan_names#

List of names of bad channels.

Type:

list or None

bad_chan_index#

List of indices of bad channels.

Type:

list or None

get_configure()[source]#

Retrieve configuration parameters from the configuration file.

The configuration is specific to the MEG data type (‘squid’ or ‘opm’).

Return type:

Dict

Returns:

config_dict – Configuration dictionary containing default and data type-specific parameters.

Return type:

dict

abstract compute_metrics(meg_type)[source]#

Abstract method for computing quality control metrics.

Subclasses must implement this method to define the specific metrics computation for the chosen MEG type.

Parameters:

meg_type (MEG_TYPE) – Type of MEG channels to process (‘mag’ or ‘grad’).