Signal Quality¶
Compute a composite signal quality index (SQI) in [0, 1] |
|
Classify signal quality as a human-readable category |
|
Estimate signal-to-noise ratio in dB |
The SQI is a heuristic screening score, not a validated clinical measure. It is the mean of four sub-scores, each in [0, 1]. Band components are obtained with zero-phase Butterworth filters, so the scores do not depend on the sample rate. The signal must be 1-D, finite and at least 1 s long.
Sub-score |
Definition |
Scoring |
|---|---|---|
Kurtosis |
Excess kurtosis of the signal (after Li, Clark and Clifford 2008) |
1 from 3 to 20, |
Power ratio |
Variance of the 1–40 Hz band / variance of the mean-removed signal |
|
Peak regularity |
Coefficient of variation (CV) of RR intervals from |
|
Baseline stability |
Variance below 1 Hz / variance of the 1–40 Hz band |
|
classify_quality() maps the SQI to "excellent" (> 0.8), "acceptable" (0.5–0.8) or "unacceptable" (< 0.5).
Note
Irregular rhythms (atrial fibrillation, frequent ectopy) lower the peak-regularity score even when the recording is clean.
SNR estimate. snr_estimate() takes the noise floor as the mean power spectral density above 100 Hz (Welch, 1 s segments), assumes it is white, and extrapolates it over the 1–40 Hz ECG band. The result is the 1–40 Hz power divided by that noise power, in dB. Limits:
It returns
nanat 200 Hz or below, where there is no band above 100 Hz (the half-weight Nyquist bin is excluded from the noise band).It returns
infwhen no noise is measured.It measures only broadband noise reaching above 100 Hz (EMG, electronic noise). Baseline wander, powerline interference and in-band motion artefacts are not counted.
Recordings low-pass filtered below 100 Hz by the device read as noise-free.
- ecgdatakit.processing.signal_quality_index(lead, *, fs=None)[source]¶
Compute a composite signal quality index (SQI) in the range [0, 1].
Mean of four sub-scores: kurtosis, power ratio, R-peak regularity and baseline stability (see the module documentation for definitions and thresholds).
- Parameters:
- Returns:
Score between 0.0 (unusable) and 1.0 (excellent).
- Return type:
- Raises:
ValueError – Signal shorter than 1 s, not 1-D, or containing NaN or infinite values.
- ecgdatakit.processing.classify_quality(lead, *, fs=None)[source]¶
Classify signal quality as a human-readable category.
- ecgdatakit.processing.snr_estimate(lead, *, fs=None)[source]¶
Estimate signal-to-noise ratio in dB.
The noise floor is the mean power spectral density (Welch, 1 s segments) above 100 Hz, assumed white and extrapolated over the 1–40 Hz ECG band. The SNR is the 1–40 Hz power divided by that extrapolated noise power.
Limits: only broadband noise that reaches above 100 Hz (EMG, electronic noise) is measured. Baseline wander, powerline interference and in-band motion artefacts are not counted, and recordings low-pass filtered below 100 Hz by the device read as noise-free.
- Parameters:
- Returns:
Estimated SNR in dB.
nanwhen the sample rate is 200 Hz or lower (no band above 100 Hz);infwhen no noise is measured.- Return type: