wfdb-python
wfdb-python copied to clipboard
Complain when `p_signal` has low bit depth so that saving works reliably
- Fixes https://github.com/MIT-LCP/wfdb-python/issues/515
This may not be the best solution, but it's one that works.
I tried modifying adc to convert to 64 bit automatically instead on demand, but that wasn't enough. Only converting p_signal for all of the wrsamp process works. So there's definitely other factors at play.
An alternative solution might be to make the bounds calculation work with 32 bit, or at least be robust to it. But I'm not sure how feasible this is, since I can't figure out where exactly it's going wrong. Making sure people use high-precision data for saving accuracy makes sense to me anyhow. Data may be lost elsewhere otherwise accidentally.