filters.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ECG_Respiratory_Monitor 作者: gabrielibagon 项目源码 文件源码
def __init__(self,window_size, low, high):
        fs_Hz = 250;
        fn = fs_Hz/2
        self.filtered_data = np.array((window_size,1))


        #######################################
        # Filter Creation
        # -------------------------------------
        #
        # Create a filter using the scipy module,
        # based on specifications suggested by
        # Pan-Tompkins (bandpass from 5-15Hz)
        #
        #
        # 1) Establish constants:
        #       a) filter_order = 2
        #       b) high pass cutoff = 15Hz
        #       c) low pass cutoff = 5Hz
        # 2) Calculate the coefficients, store in variables

        filter_order = 2
        f_high = high
        f_low = low
        self.high_pass_coefficients = signal.butter(filter_order,f_low/fn, 'high')
        self.low_pass_coefficients = signal.butter(filter_order,f_high/fn, 'low')


    #######################################
    # Bandpass filter
    # -------------------------------------
    # Filter the data, using a bandpass of 
    # 5-15Hz.
    # 
    # Input: 
    #           the data buffer from Data_Buffer class
    # Output:
    #           filtered data as a numpy array
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号