Closed raphaelvallat closed 2 years ago
Hi @raphaelvallat! I think these are very interesting additional properties of the detector, and we should definitely include this somewhere. I'm just not sure if a unit test is the right place. It seems like if these are properties of the algorithm, there's no point in testing that in our test suite, because we will not be able to change that anyway. For example, it seems intuitive that the lower the sampling frequency, the lower the detector performance will get. Is this important information? Yes, definitely? Should we include tests for that? I'm not sure. My feeling is that this would very nicely fit into our docs. WDYT?
Hi @cbrnr,
Absolutely, I think it would be great to have this explicit in the documentation, as I'm sure other people will be looking for these properties. As for unit testing, I guess that it only makes sense if at some point in the future you anticipate that there will be changes in the algorithm. Then, unit tests will ensure that the updates are not breaking these fundamental properties of the algorithm. To be conservative, I would probably add these tests both in the documentation and in the unit tests I think.
Thanks! Raphael
OK then, let's add it to the docs and tests. However, I wouldn't add the padding issue to the tests. We know that the algorithm cannot deal with flat segments, and this will hopefully be addressed in the future. So it is a known issue, and there's no use in testing for a known limitation that will get resolved.
Fixed by #89.
Hi @cbrnr and @hofaflo,
Really awesome work on this package! I have been using the detect_heartbeats function as my default QRS detector in many projects, and I love it. It is super fast and robust.
This issue is related to https://github.com/cbrnr/sleepecg/issues/87. I think that the unit tests in test_heartbeats.py could be more comprehensive. Specifically, the following scenarios should be tested:
I have included below some quick-and-dirty code to check these three scenarios, using SciPy's ECG dataset. Let me know if you think this would be a valuable addition.
Resampling
The F1-score is 0.96 at 72 Hz, 0.97 at 120 Hz and 0.99 at 256 Hz and higher frequencies.
Rescaling
The F1-score is always 1, so the algorithm is indeed unit-independent.
Padding with flat data
Cheers, Raphael