vital_sqi.sqi package

Submodules

vital_sqi.sqi.compute_sqi module

vital_sqi.sqi.dtw_sqi module

vital_sqi.sqi.dtw_sqi.dtw_sqi(x, template_type=0)[source]

Using DTW to get the mapping point distance between a signal and its template. The DTW SQI is the ratio of the distance sum to the trace of cost matrix. The closer to 1 the better SQI.

Parameters
  • x – array_like, signal containing int or float values.

  • template_type – int, 0: ppg_absolute_dual_skewness_template, 1: ppg_dual_double_frequency_template, 2: ppg_nonlinear_dynamic_system_template, 3: ecg_dynamic_template default = 0

Returns

float, the matching score with the chosen template

Return type

type

vital_sqi.sqi.rpeaks_sqi module

Signal quality indexes based on R peak detection

vital_sqi.sqi.rpeaks_sqi.correlogram_sqi(data_sample, sample_rate=100, time_lag=3, n_selection=3)[source]

The method is based on the paper ‘Classification of the Quality of Wristband-based Photoplethysmography Signals’ :param data_sample: :param sample_rate: :param time_lag:

vital_sqi.sqi.rpeaks_sqi.get_all_features_heartpy(data_sample, sample_rate=100, rpeak_detector=0)[source]
vital_sqi.sqi.rpeaks_sqi.get_all_features_hrva(data_sample, sample_rate=100, rpeak_method=0)[source]
Parameters
  • data_sample

  • sample_rate

  • rpeak_method

Returns

vital_sqi.sqi.rpeaks_sqi.get_peak_error_features(data_sample, sample_rate=100, rpeak_detector=0, low_rri=300, high_rri=2000)[source]

vital_sqi.sqi.standard_sqi module

Signal quality indexes based on dynamic template matching

vital_sqi.sqi.standard_sqi.entropy_sqi(x, qk=None, base=None, axis=0)[source]

Expose Calculate the entropy information from the template distribution. Using scipy package function.

Parameters
  • x – list the input signal

  • qk – list, array against which the relative entropy is computed (Default value = None)

  • base – float, (Default value = None)

  • axis – return: (Default value = 0)

vital_sqi.sqi.standard_sqi.kurtosis_sqi(x, axis=0, fisher=True, bias=True, nan_policy='propagate')[source]

Expose Kurtosis is a measure of whether the data are heavy-tailed or light-tailed relative to a normal distribution. That is, data sets with high kurtosis tend to have heavy tails, or outliers. Data sets with low kurtosis tend to have light tails, or lack of outliers. A uniform distribution would be the extreme case.

Kurtosis is a statistical measure used to describe the distribution of observed data around the mean. It represents a heavy tail and peakedness or a light tail and flatness of a distribution relative to the normal distribution, which is defined as:

Parameters
  • x – list, the array of signal

  • axis – (Default value = 0)

  • fisher – (Default value = True)

  • bias – (Default value = True)

  • nan_policy – (Default value = ‘propagate’)

vital_sqi.sqi.standard_sqi.mean_crossing_rate_sqi(y, threshold=1e-10, ref_magnitude=None, pad=True, zero_pos=True, axis=- 1)[source]

Expose Same as zero crossing rate but this function interests in the rate of crossing signal mean

Parameters
  • y – param threshold:

  • ref_magnitude – param pad: (Default value = None)

  • zero_pos – param axis: (Default value = True)

  • threshold – (Default value = 1e-10)

  • pad – (Default value = True)

  • axis – (Default value = -1)

vital_sqi.sqi.standard_sqi.perfusion_sqi(x, y)[source]

The perfusion index is the ratio of the pulsatile blood flow to the nonpulsatile or static blood in peripheral tissue. In other words, it is the difference of the amount of light absorbed through the pulse of when light is transmitted through the finger, which can be defined as follows: PSQI=[(ymax−ymin)/x¯|]×100 where PSQI is the perfusion index, x¯ is the statistical mean of the x signal (raw PPG signal), and y is the filtered PPG signal

Parameters
  • x – float, mean of the raw signal

  • y – list, array of filtered signal

vital_sqi.sqi.standard_sqi.signal_to_noise_sqi(a, axis=0, ddof=0)[source]

Expose A measure used in science and engineering that compares the level of a desired signal to the level of background noise.

Parameters
  • a – param axis:

  • ddof – return: (Default value = 0)

  • axis – (Default value = 0)

vital_sqi.sqi.standard_sqi.skewness_sqi(x, axis=0, bias=True, nan_policy='propagate')[source]

Expose Skewness is a measure of symmetry, or more precisely, the lack of symmetry. A distribution, or data set, is symmetric if it looks the same to the left and right of the center point.

Skewness is a measure of the symmetry (or the lack of it) of a probability distribution, which is defined as: SSQI=1/N∑i=1N[xi−μˆx/σ]3 where μˆx and σ are the empirical estimate of the mean and standard deviation of xi,respectively; and N is the number of samples in the PPG signal.

Parameters
  • x – list, the array of signal

  • axis – (Default value = 0)

  • bias – (Default value = True)

  • nan_policy – (Default value = ‘propagate’)

vital_sqi.sqi.standard_sqi.zero_crossings_rate_sqi(y, threshold=1e-10, ref_magnitude=None, pad=True, zero_pos=True, axis=- 1)[source]

Reuse the function from librosa package. This is the rate of sign-changes in the processed signal, that is, the rate at which the signal changes from positive to negative or back.

Parameters
  • y – list, array of signal

  • threshold – float > 0, default=1e-10 if specified, values where -threshold <= y <= threshold are clipped to 0.

  • ref_magnitude – float >0 If numeric, the threshold is scaled relative to ref_magnitude. If callable, the threshold is scaled relative to ref_magnitude(np.abs(y)). (Default value = None)

  • pad – boolean, if True, then y[0] is considered a valid zero-crossing. (Default value = True)

  • zero_pos – the crossing marker. (Default value = True)

  • axis – axis along which to compute zero-crossings. (Default value = -1)

Returns

float, indicator array of zero-crossings in y along the selected axis.

Return type

type

Module contents

vital_sqi.sqi

A subpackage for signal quality index calculation, including:
  • Standard: Statistical domain and xx

  • Dynamic template maching based

  • Peak detection based

  • Heart rate variability based