def __init__(self, threshold_freq, order=2, design='cheby1'):
"""
:param threshold_freq: Threshold frequency to filter out, as a fraction of sampling freq. E.g. 0.1
"""
self.b, self.a = \
butter(N=order, Wn=threshold_freq, btype='low') if design == 'butter' else \
cheby1(N=order, rp=0.1, Wn=threshold_freq, btype='low') if design == 'cheby1' else \
bad_value(design)
self.filter_state = lfilter_zi(b=self.b, a=self.a)
评论列表
文章目录