cbrnr / sleepecg

Sleep stage detection using ECG
BSD 3-Clause "New" or "Revised" License
90 stars 23 forks source link

`scipy.misc.electrocardiogram` has been deprecated #166

Closed tompollard closed 10 months ago

tompollard commented 1 year ago

This is a quick issue relating to the JOSS review comments at: https://github.com/openjournals/joss-reviews/issues/5411#issuecomment-1548163405

The example code at https://sleepecg.readthedocs.io/en/stable/heartbeat_detection/#usage (and elsewhere) uses scipy.misc.electrocardiogram which has been deprecated.

ecg = electrocardiogram()

<stdin>:1: DeprecationWarning: scipy.misc.electrocardiogram has been deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. Dataset methods have moved into the scipy.datasets module. Use scipy.datasets.electrocardiogram instead.

At some point the examples should be updated to use the new location: (scipy.datasets.electrocardiogram).

cbrnr commented 1 year ago

I have already addressed this in the tests, but AFAIK the only way to do so is pretty ugly:

try:
    from scipy.datasets import electrocardiogram
except ImportError:
    from scipy.misc import electrocardiogram

Which I think would be distracting in the examples. But then again, the DeprecationWarning is also distracting, so I'm a bit unsure how to proceed.

cbrnr commented 1 year ago

One possible solution could be to wrap this example dataset into our own object (e.g. in sleepecg.utils). Thoughts?

tompollard commented 1 year ago

Hmm, you could keep this issue open and update the dependency and documentation later? Either that or just bump the scipy dependency to 1.10.0 now and get it out of the way!

cbrnr commented 1 year ago

Let's keep it open then. I'd like to wait until SciPy 1.11 or 1.12 before I bump it to 1.10. People don't always have access to the latest package versions immediately.

cbrnr commented 11 months ago

If we take these support windows defined by the Scientific Python project, we can drop support for SciPy < 1.10 on 28 Jul 2024.