Marcos Duarte
Laboratory of Biomechanics and Motor Control
Federal University of ABC, Brazil
import numpy as np
import pandas as pd
%matplotlib notebook
# tk qt notebook inline ipympl
import matplotlib
import matplotlib.pyplot as plt
import sys, os
sys.path.insert(1, r'./../functions')
from resample import resample
y = np.random.randn(100, 3)
freq_new = 100
y = pd.DataFrame(data=y, columns=None)
y.index = y.index/freq_new
y.index.name = y.index.name
y.head()
0 | 1 | 2 | |
---|---|---|---|
0.00 | 1.203531 | -1.026002 | 0.345930 |
0.01 | 0.745963 | 0.944473 | -0.054512 |
0.02 | 0.789788 | -0.049776 | -1.072692 |
0.03 | 2.005024 | -1.013743 | -0.354158 |
0.04 | -1.185777 | -0.818023 | -1.550145 |
y2 = resample(y, freq_old=100, freq_new=1000, limit=1000, method='resample_poly')
y2
0 | 1 | 2 | |
---|---|---|---|
0.000 | 1.204336 | -1.026688 | 0.346161 |
0.001 | 1.298574 | -0.925828 | 0.396714 |
0.002 | 1.364617 | -0.776893 | 0.436292 |
0.003 | 1.398068 | -0.586546 | 0.459980 |
0.004 | 1.396121 | -0.364184 | 0.463271 |
... | ... | ... | ... |
0.995 | -0.672521 | 0.643513 | -0.066679 |
0.996 | -0.541424 | 0.524998 | -0.065225 |
0.997 | -0.399792 | 0.391877 | -0.055730 |
0.998 | -0.256741 | 0.253914 | -0.040121 |
0.999 | -0.120937 | 0.120501 | -0.020723 |
1000 rows × 3 columns