0

我正在处理长期心房颤动数据集 - https://physionet.org/content/ltafdb/1.0.0/

当我测试 30 秒的数据条时,我的模型没有纠正预测信号。所以我试图处理这个数据集中的噪音。这里看起来如何

在此处输入图像描述

这是要绘制的代码 -

def plot_filter_graphs(data,xmin,xmax,order):
    from numpy import sin, cos, pi, linspace
    from numpy.random import randn
    from scipy import signal
    from scipy.signal import lfilter, lfilter_zi, filtfilt, butter
    

    from matplotlib.pyplot import plot, legend, show, grid, figure, savefig,xlim

    lowcut=1
    highcut=35
    nyq = 0.5 * 300
    low = lowcut / nyq
    high = highcut / nyq
    b, a = signal.butter(order, [low, high], btype='band')


    # Apply the filter to xn.  Use lfilter_zi to choose the initial condition
    # of the filter.
    z = lfilter(b, a,data)

    # Use filtfilt to apply the filter.
    y = filtfilt(b, a, data)
    y = np.flipud(y)
    y = signal.lfilter(b, a, y)
    y = np.flipud(y)

    # Make the plot.
    figure(figsize=(16,5))
    plot(data,'b',linewidth=1.75)
    plot(z, 'r--', linewidth=1.75)
    plot( y, 'k', linewidth=1.75)
    xlim(xmin,xmax)
    legend(('actual',
            'lfilter',
            'filtfilt'),
            loc='best')
    grid(True)
    show()

我正在使用黄油带通滤波器来过滤噪声。我还检查了 filtfilt 和 lfilt 但这也没有给出好的结果。

任何建议,如何去除噪声以使信号准确度良好,然后可用于模型预测

4

0 回答 0