msqms.qc.time_domain_metrics module#
Time Domain quality control metric.
Summary#
Classes:#
A class to compute time-domain quality control metrics for MEG signals. |
Reference#
- class msqms.qc.time_domain_metrics.TimeDomainMetric(raw, data_type, origin_raw, n_jobs=1, verbose=False)[source]#
Bases:
MetricsA class to compute time-domain quality control metrics for MEG signals.
- Parameters:
raw (mne.io.Raw) – The raw MEG data.
data_type (MEG_TYPE) – Type of MEG data (e.g., ‘mag’ or ‘grad’).
origin_raw (mne.io.Raw) – Original raw data for reference.
n_jobs (int, optional) – Number of jobs to use for parallel processing, by default 1.
verbose (bool, optional) – Whether to output verbose information, by default False.
- compute_metrics(meg_type)[source]#
Compute time-domain quality metrics for the specified MEG type.
- Parameters:
meg_type (MEG_TYPE) – The type of MEG data (e.g., ‘mag’, ‘grad’) to compute metrics for.
- Returns:
A DataFrame containing the computed metrics.
- Return type:
pandas.DataFrame
- stats_summary(data)[source]#
Compute statistical summaries for the data. mean/max/min/std/median average on times
- Parameters:
data (numpy.ndarray) – Input data of shape (n_channels, n_times).
- Returns:
Statistical summary containing mean, variance, std, max, min, and median values.
- Return type:
pandas.DataFrame
- compute_ptp(data)[source]#
Compute the maximum peak-to-peak amplitude. Maximum Peak-to-peak | Note that there should be instability in mne’s peak_finder algorithm; :param data: 1D array of MEG data for a single channel. :type data: numpy.ndarray
- Returns:
Maximum peak-to-peak amplitude.
- Return type:
float
- compute_max_min_range(data)[source]#
Compute the range of maximum and minimum values for each channel.
- Parameters:
data (numpy.ndarray) – 2D array of MEG data of shape (n_channels, n_times).
- Returns:
Array of max-min range for each channel.
- Return type:
numpy.ndarray
- compute_max_field_change(data)[source]#
Calculate the Max Field Change, which measures the extent of magnetic field fluctuations. Calculate the maximum value of the magnetic field change, and the mean value and variance of the magnetic field change by channel.
- Parameters:
data (numpy.ndarray) – 2D array of MEG data of shape (n_channels, n_times).
- Returns:
Tuple containing arrays of max, mean, and std field changes for each channel.
- Return type:
tuple
- compute_rms(data)[source]#
Compute root-mean-square (RMS) for each channel.
- Parameters:
data (numpy.ndarray) – 2D array of MEG data of shape (n_channels, n_times).
- Returns:
RMS values for each channel.
- Return type:
numpy.ndarray
- compute_1d_arv(data)[source]#
Compute average rectified value (ARV).
- Parameters:
data (numpy.ndarray) – 2D array of MEG data of shape (n_channels, n_times).
- Returns:
ARV values for each channel.
- Return type:
numpy.ndarray
- compute_1d_factors(data)[source]#
Compute signal quality factors, including form factor, peak factor, pulse factor, and margin factor.
- Parameters:
data (numpy.ndarray) – 1D array of MEG data for a single channel.
- Returns:
A tuple of factors (form_factor, peak_factor, pulse_factor, margin_factor).
- Return type:
tuple