biosppy.quality

biosppy.quality

This provides functions to assess the quality of several biosignals.

copyright:
  1. 2015-2026 by Instituto de Telecomunicacoes

license:

BSD 3-clause, see LICENSE for more details.

Functions

cSQI([rpeaks, verbose])

For the ECG signal, calculate the Coefficient of Variation of RR Intervals (cSQI).

ecg_sqi_level3(segment, sampling_rate, ...)

Compute the quality index for one ECG segment.

eda_sqi_bottcher([x, sampling_rate, verbose])

Suggested by Böttcher et al. Scientific Reports, 2022, for wearable wrist EDA.

hosSQI([signal, quantitative, verbose])

For the ECG signal.

quality_ecg(segment[, methods, ...])

Compute the quality index for one ECG segment.

quality_eda([x, methods, sampling_rate, verbose])

Compute the quality index for one EDA segment.

biosppy.quality.cSQI(rpeaks=None, verbose=1)[source]

For the ECG signal, calculate the Coefficient of Variation of RR Intervals (cSQI).

Parameters:
  • rpeaks (array-like) – Array containing R-peak locations. Should be filtered? How many seconds are adequate?

  • verbose (int) – If 1, a commentary is printed regarding the quality of the signal and details of the function. Default is 1.

Returns:

cSQI (float) – Coefficient of Variation of RR Intervals. cSQI - best near 0

References

[Zhao18]

Zhao, Z., & Zhang, Y. (2018).

SQI quality evaluation mechanism of single-lead ECG signal based on simple heuristic fusion and fuzzy comprehensive evaluation. Frontiers in Physiology, 9, 727.

biosppy.quality.ecg_sqi_level3(segment, sampling_rate, threshold, bit)[source]

Compute the quality index for one ECG segment. The segment should have 10 seconds.

Parameters:
  • segment (array) – Input signal to test.

  • sampling_rate (int) – Sampling frequency (Hz).

  • threshold (float) – Threshold for the correlation coefficient.

  • bit (int) – Number of bits of the ADC.? Resolution bits, for the BITalino is 10 bits.

Returns:

quality (string) – Signal Quality Index ranging between 0 (LQ), 0.5 (MQ) and 1.0 (HQ).

biosppy.quality.eda_sqi_bottcher(x=None, sampling_rate=None, verbose=1)[source]

Suggested by Böttcher et al. Scientific Reports, 2022, for wearable wrist EDA. This is given by a binary score 0/1 defined by the following rules: - mean of the segment of 2 seconds should be > 0.05 - rate of amplitude change (given by racSQI) should be < 0.2 This score is calculated for each 2 seconds window of the segment. The average of the scores is the final SQI. This method was designed for a segment of 60s

Parameters:
  • x (array) – Input signal to test.

  • sampling_rate (int) – Sampling frequency (Hz).

  • verbose (int) – If 1, a commentary is printed regarding the quality of the signal and details of the function. Default is 1.

Returns:

quality_score (string) – Signal Quality Index.

biosppy.quality.hosSQI(signal=None, quantitative=False, verbose=1)[source]

For the ECG signal. Calculate the Higher-order-statistics-SQI (hosSQI).

Parameters:
  • signal (array-like) – ECG signal. Should be filtered? How many seconds are adequate?

  • verbose (bool) – If True, a warning message is printed. Default is True.

Returns:

hosSQI (float) – Higher-order-statistics-SQI. hosSQI - best near 1

References

[Nardelli20]

Nardelli, M., Lanata, A., Valenza, G., Felici, M., Baragli, P., & Scilingo, E.P. (2020).

A tool for the real-time evaluation of ECG signal quality and activity: Application to submaximal treadmill test in horses. Biomedical Signal Processing and Control, 56, 101666. doi: 10.1016/j.bspc.2019.101666. .. [Rahman22] Rahman, Md. Saifur, Karmakar, Chandan, Natgunanathan, Iynkaran, Yearwood, John, & Palaniswami, Marimuthu. (2022). Robustness of electrocardiogram signal quality indices. Journal of The Royal Society Interface, 19. doi: 10.1098/rsif.2022.0012.

biosppy.quality.quality_ecg(segment, methods=['Level3'], sampling_rate=None, fisher=True, f_thr=0.01, threshold=0.9, bit=0, nseg=1024, num_spectrum=[5, 20], dem_spectrum=None, mode_fsqi='simple', verbose=1)[source]

Compute the quality index for one ECG segment.

Parameters:
  • segment (array) – Input signal to test.

  • method (string) – Method to assess quality. One of the following: ‘Level3’, ‘pSQI’, ‘kSQI’, ‘fSQI’.

  • sampling_rate (int) – Sampling frequency (Hz).

  • threshold (float) – Threshold for the correlation coefficient.

  • bit (int) – Number of bits of the ADC. Resolution bits, for the BITalino is 10 bits.

  • verbose (int) – If 1, a commentary is printed regarding the quality of the signal and details of the function. Default is 1.

Returns:

  • args (tuple) – Tuple containing the quality index for each method.

  • names (tuple) – Tuple containing the name of each method.

biosppy.quality.quality_eda(x=None, methods=['bottcher'], sampling_rate=None, verbose=1)[source]

Compute the quality index for one EDA segment.

Parameters:
  • x (array) – Input signal to test.

  • methods (list) – Method to assess quality. One or more of the following: ‘bottcher’.

  • sampling_rate (int) – Sampling frequency (Hz).

  • verbose (int) – If 1, a commentary is printed regarding the quality of the signal and details of the function. Default is 1.

Returns:

  • args (tuple) – Tuple containing the quality index for each method.

  • names (tuple) – Tuple containing the name of each method.