Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import scipy.signal as signal

def design_butterworth(order, cutoff, fs, btype='low'):
"""Designs a digital Butterworth filter."""
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = signal.butter(order, normal_cutoff, btype=btype, analog=False)
return b, a

def design_chebyshev(order, rp, cutoff, fs, btype='low'):
"""Designs a digital Chebyshev Type I filter."""
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = signal.cheby1(order, rp, normal_cutoff, btype=btype, analog=False)
return b, a
Loading