I was trying to use the ASI_segmentor, implemented by @TiagoTostas, and noticed that it wasn't working as expected. I tested using the example ECG signal available in the repo and it gave me this:
As it can be seen, the threshold decays too quickly, resulting in the detection of false peaks. After reading the paper regarding this algorithm Rodrigues et al. (2021), I noticed that something was off with the Pth parameter on the Python implementation.
The authors state that Pth is a free parameter and chose the value 5 as the best one. On the Python implementation, I found that:
https://github.com/PIA-Group/BioSPPy/blob/ff940abbac86e4a405979a4ea7a1c7abcd06d7bf/biosppy/signals/ecg.py#L1328
Which, using a sampling frequency of 1000, results in a Pth of 10.2 - making the threshold way too sensitive.
I don't think the Pth value should be dependent on the sampling frequency since, as the authors state in the paper and can be seen in the code, the exponential decay is already dependent on the sampling frequency:
https://github.com/PIA-Group/BioSPPy/blob/ff940abbac86e4a405979a4ea7a1c7abcd06d7bf/biosppy/signals/ecg.py#L1371
After changing the Pth to a const value, e.g. 4, the results greatly improved:
Therefore, I propose that the Pth becomes an argument of the ASI_segmentor with the default value 5.0 (proposed in the paper).
I was trying to use the
As it can be seen, the threshold decays too quickly, resulting in the detection of false peaks. After reading the paper regarding this algorithm Rodrigues et al. (2021), I noticed that something was off with the
ASI_segmentor
, implemented by @TiagoTostas, and noticed that it wasn't working as expected. I tested using the example ECG signal available in the repo and it gave me this:Pth
parameter on the Python implementation. The authors state thatPth
is a free parameter and chose the value5
as the best one. On the Python implementation, I found that: https://github.com/PIA-Group/BioSPPy/blob/ff940abbac86e4a405979a4ea7a1c7abcd06d7bf/biosppy/signals/ecg.py#L1328 Which, using a sampling frequency of1000
, results in aPth
of10.2
- making the threshold way too sensitive. I don't think thePth
value should be dependent on the sampling frequency since, as the authors state in the paper and can be seen in the code, the exponential decay is already dependent on the sampling frequency: https://github.com/PIA-Group/BioSPPy/blob/ff940abbac86e4a405979a4ea7a1c7abcd06d7bf/biosppy/signals/ecg.py#L1371After changing the![improved](https://user-images.githubusercontent.com/30601767/176665538-ce2f1067-4549-4608-a0fa-95041deb05b1.png)
Pth
to a const value, e.g.4
, the results greatly improved:Therefore, I propose that the
Pth
becomes an argument of theASI_segmentor
with the default value5.0
(proposed in the paper).