In [1]:
from scipy import signal
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
In [164]:
d = pd.read_csv('data/data_many.csv')
d.head()
Out[164]:
In [165]:
X = np.array(d.ix[:, 1:5])
sig = X[:, 0]
In [180]:
freq, y = signal.welch(sig, fs=200.0)
plt.plot(freq, np.log(y))
In [171]:
b, a = signal.butter(8, (6.5/100.0, 40.0/100), btype='bandpass')
sig_f = signal.lfilter(b, a, sig)[1000:]
In [187]:
plt.plot(sig_f)
Out[187]:
In [188]:
fftfreq, fft = signal.welch(sig_f, fs=200.0)
plt.plot(fftfreq, fft)
plt.xlim(5, 40)
Out[188]:
In [192]:
_ = plt.specgram(sig, Fs=200.0)
In [193]:
_ = plt.specgram(sig_f, Fs=200.0, NFFT=256, noverlap=128)
In [ ]:
In [ ]:
In [ ]: