msqms.qc.statistic_metrics module#
Statistics Domain quality control metric.
Summary#
Classes:#
Compute statistical domain quality metrics for MEG data. |
Reference#
- class msqms.qc.statistic_metrics.StatsDomainMetric(raw, data_type, origin_raw=None, n_jobs=-1, verbose=False)[source]#
Bases:
MetricsCompute statistical domain quality metrics for MEG data.
Includes baseline offset, skewness, kurtosis, and identification of bad channels, segments, and flat signals.
- compute_metrics(meg_type)[source]#
Compute statistical quality metrics for MEG data(all_channels * all_timepoints).
- Parameters:
meg_type (MEG_TYPE) – The MEG channel type (‘mag’, ‘grad’, or ‘eeg’).
- Returns:
DataFrame containing average and standard deviation of the metrics.
- Return type:
pd.DataFrame
- identify_bad_channels()[source]#
Identify bad channels using multiple methods and create a mask.
- Returns:
float – Ratio of bad channels.
list – List of bad channel names.
np.ndarray – Mask indicating bad channels.
- compute_skewness(data)[source]#
Skewness: measure the shape of the distribution
# skewness = 0, normally distributed # skewness > 0, more weight in the left tail of the distribution. # skewnees < 0, more weight in the right tail of the distribution.
compute the ratio of left tail of the distributrion.[by channels] compute the mean of skewness.
- compute_kurtosis(data)[source]#
Kurtosis: # It is also a statistical term and an important characteristic of frequency distribution. # It determines whether a distribution is heavy-tailed in respect of the distribution. # It provides information about the shape of a frequency distribution. # Kurtosis for normal distribution is equal to 3. # For a distribution having kurtosis < 3: It is called playkurtic. # For a distribution having kurtosis > 3, It is called leptokurtic # and it signifies that it tries to produce more outliers rather than the normal distribution.
compute mean kurtosis by channel. compute the playkurtic ratio by channel.
- find_bad_channels_by_psd()[source]#
Calculate the PSD (power spectral density) of all channels. find the ones that exceed the mean plus 3*standard deviation, and determine them as bad channels.
- find_zero_values(data)[source]#
Detect zero values. :param data:
- Returns:
zero_mask (np.ndarray) – the mask of zero values.
zero_ratio (float) – the ratio of zero values.
- find_NaN_values(data)[source]#
Detect NaN values :param data:
- Returns:
NaN mask matrix
NaN ratio, accounts for all data points.