巴特沃思滤波器无法改善我的神经信号

时间:2019-02-14 17:38:26

标签: python scipy signal-processing butterworth

我有一个来自(自然)神经元的信号,该信号来自一个18.2 kHz的16位ADC。我正在尝试检测该信号中的尖峰。对于那些不熟悉此技术的人:当神经元激发时,它们会发出特定信号:信号以陡峭的上升(或下降,取决于神经元和电极的方向)开始,大多数情况下会以陡峭的速度上升下降,然后恢复正常。当然,只有一个神经元的信号很小,因此噪声也很明显:

赞:

https://www.hindawi.com/journals/cin/2010/659050.fig.002.jpg

我关注的出版物建议使用Butterworth过滤器: https://www.hindawi.com/journals/cin/2010/659050/ “首先,使用二阶巴特沃斯滤波器(150 Hz–2,500 Hz)对信号进行带通滤波。” 我已经做到了,但是我的信号并没有改善。当我使用参数时,只会使情况变得更糟。例如。使用500-5000Hz滤波器或类似的滤波器。

import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter, lfilter_zi

#this is only for S.O. to get the data..
import base64
import zlib
input_as_str=b'eNqNnVl2xLiubP9rNBJJsJn/xO6rlFwZwAbyvB8vLzsbiSLRBAKB3vsc//T/97P9+3Ocf3/a/vzF/v25nt+P/OX6/n1//jLn512fzxnPz89/bX1eeX/fa/Jffc3+fOb+/Hff32sw+/58Xv9c7f73XePa//38e9f43kXrn58m97Xk+uf3ytdzF+v7Oe8dybtMrv+5lz3jNTyf8N7d/X3v82ny+vcurH8/U3+uz9/Xc6ft+/t7nc+VPM/r88ltyXuv71Xd138/n29/3zv4NJd8sn2v7b1yXWf5nP75xuu5hud+r3xlzvXf57x396zznrgv3UUmd9e/V7vP9+7eq1rfPfm8xmR3PZ/w7IfnCtd3v/2t0vzu53e/YR1MVum9iyvukCHXMGVfrfZ97lNOxPPJz2ueM/iug56g9b22Z92eb5/y3J/rbLIDn7/jWbwr9q6SvOve8gnf0/H3riPP8Xnv5zVdv/fku13Ppn7X+J73vx3bZcfKCdLza/It7/ntsp6y5rQ5Jq/Z8i2fHfV39mUF9Ly7Z6pn8Hyv6t0VcX/+nX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If5PtV+VqH/r/XrQo3fsTtc3+iO+DP1xMpJdnHWYdZFeyL/00WbK6/l6YnQPflYYxcD79iH8nY8tagrdVZkIKs6TVsFl6BD4fMUNW5MWk96Iu4Yh6jygGFO67S8i0dnFSVdlhb7NagqlkRBB1Fxz3vQKozUWs4EcLti5r7YZdZX0S2LjiqnnjpzHrgoeHg/PgqV4GK+fJJZz5xLtipW54g4rWMkLtT+Co0gVdndI+pQue+9ikrryuuVoxWrfcDZGDlvwbH6x4+YzffxtegZnf7AQrZ4FegiGGID83R4ptiXaphVR6Yo656Oq8DJ1DrhiKpNJ1aOKlWrKV02L4rbIk8pmSp4Ilt7YgrYKuqAg7nzBcZ7KziTN5RgoUcxrOgvGCFy9rw+sDpnoSkxe8TT3IQ7TGu1kzMTkrkqK3IVTOc6Nel2hDXmhOVphQ7n/tnNpOgK6iBr5bHWAt5Ce+s8r+prNWj7jKg+Map5qeuXat+LY9yBO+cz4lX0+Fy5jtzaqM4DGeN0MIfXNWRAwJ32VdRYV65etYgC9aLCbnkFdpBbewrtwYFVmtFSzfFLI8XxtaADZoV6iUO0dv68DCyFajpAYh8Q5boZJQU/ilq4yeTlXnTdgg2i3RacQOR0PFBdcrOGe1CB9tYb0zYV5VNWPy2n4yIWes5WTIs7co9Jrj0RvdyR98hTNqG2MZlLtoIhOaIWblI9vxHhcFbpRk0QKj3OI/QY5QoTLKu0epTs/wB6JSVa'
arr=np.array(str.split(zlib.decompress(base64.b64decode(input_as_str)).decode("utf-8"),"\n")[:-1],dtype=np.uint16)

def butter_bandpass(lowcut, highcut, fs, order):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = butter(order, [low, high], btype='band')
    return b, a

def butter_bandpass_filter_zi(data, lowcut, highcut, fs, order=5):
    b, a = butter_bandpass(lowcut, highcut, fs, order=order)
    zi = lfilter_zi(b, a)
    y,zo = lfilter(b, a, data, zi=zi*data[0])
    return y

#apply the filter
filtered=butter_bandpass_filter_zi(arr, 150.0, 2500.0, 18200.0, 2)

#plot both the original and the filtered signal
fig=plt.figure()
ax1=fig.add_subplot(1,2,1)
ax2=fig.add_subplot(1,2,2)
ax1.plot(arr)
ax2.plot(filtered)
plt.show()

我期望噪声会更小,以使尖峰突出,并且更易于检测。但事实并非如此。该过滤器似乎可以正常工作(在生成的窦性输入上对其进行了测试)。我在做什么错了?

编辑:

时域输入和输出 Input and output in time domain 原始和滤波后的信号及其频谱 original and filtered signal with their spectrums

0 个答案:

没有答案