Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumPy DeprecationWarning thrown in neurokit2.signal.signal_filter._signal_filter_butterworth #997

Open
MarcBalle opened this issue Jun 11, 2024 · 3 comments

Comments

@MarcBalle
Copy link

Describe the bug
When running neurokit2.ecg_clean there is the following numpy deprecation warning:
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Debugging into it, I suspect that the error happens when calling scipy.signal.butter in neurokit2.signal.signal_filter._signal_filter_butterworth. The Wn argument in scipy.signal.butter should be a scalar when btype is lowpass or highpass, but in this case freqs is a list.

To Reproduce

  1. Install neurokit2==0.2.9, scipy==1.13.1, numpy==1.26.4
  2. Run neurokit2.ecg_clean(ecg_signal=np.random.rand(20), sampling_rate=300.0, method="neurokit") (I use a random sequence here, but it is enough to reproduce the error. It also happens with an actual ecg signal)

System Specifications

Running on Windows 10, python 3.9.18. Example:

import neurokit2 as nk
nk.ecg_clean(np.random.rand(20), sampling_rate=300.0, method="neurokit")

Warning:
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Copy link

welcome bot commented Jun 11, 2024

Hi 👋 Thanks for reaching out and opening your first issue here! We'll try to come back to you as soon as possible. ❤️ kenobi

@DominiqueMakowski
Copy link
Member

Hi @MarcBalle thanks! Would you mind making a PR to address this?

@MarcBalle
Copy link
Author

@DominiqueMakowski Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants