Skip to content

Instantly share code, notes, and snippets.

@non117
Created January 29, 2013 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save non117/4663030 to your computer and use it in GitHub Desktop.
Save non117/4663030 to your computer and use it in GitHub Desktop.
バターワースフィルタを設計して, LPFかけた信号を返してくれるえらいやつ
from scipy import signal
def lpf(x, cutoff_freq, samp_rate):
norm_pass = cutoff_freq/(samp_rate/2)
norm_stop = 1.5*norm_pass
N, Wn = signal.buttord(wp=norm_pass, ws=norm_stop, gpass=2, gstop=30, analog=0)
b, a = signal.butter(N, Wn, btype='low', analog=0, output='ba')
y = signal.lfilter(b, a, x)
return y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment