Signal quality indicies

SQI definitions and some internal calculations based on:

  1. Tang, M. Wang, Y. Hu, B. Guo, and T. Li, “Automated Signal Quality Assessment for Heart Sound Signal by Novel Features and Evaluation in Open Public Datasets,” BioMed Research International, vol. 2021. Hindawi Limited, pp. 1–15, Feb. 24, 2021.

https://www.hindawi.com/journals/bmri/2021/7565398/

pyPCG.sqi.autocorr_max(sig: pcg_signal, bpm_min: float = 100, bpm_max: float = 200) float[source]

Calculate SQI based on autocorrelation.

Larger -> Better

Parameters:
  • sig (pcg_signal) – input signal (envelope)

  • bpm_min (float, optional) – minimum expected BPM. Defaults to 100.

  • bpm_max (float, optional) – maximum expected BPM. Defaults to 200.

Returns:

autocorrelation maximum

Return type:

float

pyPCG.sqi.env_std(sig: pcg_signal, precalc: bool = False) float[source]

Calculate standard deviation of the envelope values

Smaller -> Better

Parameters:
  • sig (pcg_signal) – input signal

  • precalc (bool, optional) – is the input a precalculated envelope. Defaults to False.

Returns:

standard deviation of envelope

Return type:

float

pyPCG.sqi.periodicity_score(sig: pcg_signal, f1: float = 0.3, f2: float = 2.5, k: int = 200) float[source]

Calculate SQI based on cylcic periodicity.

Larger -> Better

Parameters:
  • sig (pcg_signal) – input signal (envelope)

  • f1 (float, optional) – min Hz to search. Defaults to 0.3.

  • f2 (float, optional) – max Hz to search. Defaults to 2.5.

  • k (int, optional) – weight parameter. Defaults to 200.

Returns:

Periodicity score

Return type:

float

pyPCG.sqi.raw_kurt(sig: pcg_signal) float[source]

Calculate kurtosis of raw signal values

Larger -> Better

Parameters:

sig (pcg_signal) – input signal

Returns:

kurtosis of signal

Return type:

float

pyPCG.sqi.sentropy(sig: pcg_signal, win: int = 2, r: float = 0.2, precalc: bool = False) float[source]

Calculate sample entropy SQI

Smaller -> Better

Parameters:
  • sig (pcg_signal) – input signal

  • win (int, optional) – window size. Defaults to 2.

  • r (float, optional) – weight parameter. Defaults to 0.2.

  • precalc (bool, optional) – is the input a precalculated envelope. Defaults to False.

Returns:

sample entropy

Return type:

float