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

Plot Interpolation? #29

Closed
mikedorin opened this issue Nov 19, 2023 · 3 comments
Closed

Plot Interpolation? #29

mikedorin opened this issue Nov 19, 2023 · 3 comments

Comments

@mikedorin
Copy link

I am probably missing something, but how do I plot the df_interep?
It does not seem to be popping up as nicely as your examples. (At least for me)
The picture looks the same with interpolation or without it.
Thank you!
-Mike

@erdogant
Copy link
Owner

Have you tried the examples at the documentation pages? I am not sure which plot you exactly mean.

@mikedorin
Copy link
Author

Sorry, you caught me. I had not tried the demo.
But there might still be a tiny bit of trouble.

Demo from pre-processing: https://erdogant.github.io/findpeaks/pages/html/Pre-processing.html

# Import library
import findpeaks
# Small dataset
X = [10,11,9,23,21,11,45,20,11,12]
# Interpolate the data using linear by factor 10
Xi = findpeaks.interpolate_line1d(X, method='linear', n=10, showfig=True)
# Print message
print('Input data lenth: %s, interpolated length: %s' %(len(X), len(Xi)))
# Input data lenth: 10, interpolated length: 100

Gives me:
python.exe C:\Users\bsd_m\PycharmProjects\chaski-linguistics-oct15\FindPeaksDemo.py
Traceback (most recent call last):
File "FindPeaksDemo.py", line 6, in
Xi = findpeaks.interpolate_line1d(X, method='linear', n=10, showfig=True)
AttributeError: module 'findpeaks' has no attribute 'interpolate_line1d'

Process finished with exit code 1

However, this demo works fine: https://erdogant.github.io/findpeaks/pages/html/Examples.html#interpolation

# Load library
from findpeaks import findpeaks
# Data
X = [9,60,377,985,1153,672,501,1068,1110,574,135,23,3,47,252,812,1182,741,263,33]
# Initialize
fp = findpeaks(lookahead=1, interpolate=1)
results = fp.fit(X)
# Plot
fp.plot()

Thank you! Sorry for the trouble!

@erdogant
Copy link
Owner

This was a good example. I fixed the issue by adding interpolate into the init file!
Update to the latest version with:
pip install -U findpeaks

@erdogant erdogant closed this as completed Dec 2, 2023
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