erdogant/findpeaks

Plot Interpolation?

Closed this issue · 3 comments

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

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

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!

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