Skip to content

Instantly share code, notes, and snippets.

@andrewgiessel
Last active October 17, 2020 01:42
Show Gist options
  • Save andrewgiessel/4514186 to your computer and use it in GitHub Desktop.
Save andrewgiessel/4514186 to your computer and use it in GitHub Desktop.
butterworth bandpass filter in python
from scipy.signal import butter, lfilter
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
y = lfilter(b, a, data)
return y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment