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

data-dependent issues with interpolate #4

Closed
davedgd opened this issue Jun 28, 2021 · 2 comments
Closed

data-dependent issues with interpolate #4

davedgd opened this issue Jun 28, 2021 · 2 comments

Comments

@davedgd
Copy link

davedgd commented Jun 28, 2021

@erdogant: thanks for the great package!

I've encountered a small issue where interpolate causes problems that depend on the input data. Here's a small reproducible example using numpy:

import numpy as np
from findpeaks import findpeaks

np.random.seed(200)
peakDat = np.random.randint(200, size = 400)

fp = findpeaks(method = 'topology',
               interpolate = 10, 
               lookahead = 1)

results = fp.fit(peakDat)

This produces the following error: ValueError: cannot set using a list-like indexer with a different length than the value

By contrast, a different seed works fine with these arguments:

import numpy as np
from findpeaks import findpeaks

np.random.seed(100)
peakDat = np.random.randint(200, size = 400)

fp = findpeaks(method = 'topology',
               interpolate = 10, 
               lookahead = 1)

results = fp.fit(peakDat)

Changing the interpolate factor from 10 can fix the issue for a given data set, but it's unclear from the documentation if there's a better way to avoid having to tweak the settings at the data-set level.

@erdogant
Copy link
Owner

erdogant commented Jun 28, 2021

I fixed the bug which happened in case a peak is detected twice that can occur when using random data. A loc statement returns unique events and is now changed into iloc which solves the bug.

Update as below and give it a try!

pip install -U findpeaks

@davedgd
Copy link
Author

davedgd commented Jun 28, 2021

Hi @erdogant: thanks for the amazingly quick reply! This does appear to resolve the issue -- I really appreciate it. =)

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