Filter Signals using scipy


/ Published in: Python
Save to your folder(s)

This portion of code allows to do bandpass filtering over time series


Copy this code and paste it in your HTML
  1. import scipy.signal as sp
  2. nyf= sampfr/2 #Sampling Frequency/2 (Nyquist Frequency)
  3. low=0.5/nyf #Lower cut of the filter
  4. high=50/fso2 #High Cut of the filter
  5. b,a = sp.butter(5,[low,high], btype='band') #Butter generates the coefficients for the filter
  6. dataF=sp.lfilter(b, a, data) #Does the convoultion, and the output is the filtered signal

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.