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

IndexError in _ecg_findpeaks_manikandan() #1058

Open
cgastaud opened this issue Dec 16, 2024 · 0 comments
Open

IndexError in _ecg_findpeaks_manikandan() #1058

cgastaud opened this issue Dec 16, 2024 · 0 comments

Comments

@cgastaud
Copy link

Describe the bug
In the function, if the window goes outside the signal length, we try (badly) to clip the window, causing an IndexError
See here

To Reproduce
Example steps to reproduce the behaviour. For instance:

signal = np.arange(5)
search_window_half = 10
i = 0
highs = np.arange(i + 1, i + search_window_half + 1)
highs = np.delete(
    highs, np.arange(np.where(highs == len(signal))[0], len(highs) + 1)  # there shouldn't be a +1 here
)

We could remove the +1, but why not simply change highs to:

highs = np.arange(i + 1, min(i + search_window_half + 1, len(signal))

and remove the if block ?

Expected behaviour
Not throw an error

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

1 participant