I am going to remove the noise from a brain recorded signal. It was a continuous recording and with sample rate=30kHz, it was digitized. So now it is a digital signal. I have written the code here for denoising this signal and I put two figures (the red one is the denoised one) including one big picture figure and the second one is by using zoom in. Below is the code.

wn=0.01 n=4 #order b, a= signal.butter(n, wn, btype='low', analog=False, output='ba') filtered = signal.lfilter(b, a, data_raw) plt.plot(data_raw, 'b', filtered,'r') plt.show()

enter image description here

enter image description here

Now I have several questions please (sorry if they are easy as I am a beginner):

1) Here we only determined the normalized frequency (wn). So if I want to know the low frequency of the filter, what is the default amount of sampling frequency for the Signal.butter function, please?

2) If I want to determine the sampling frequency of the butter filter by my self, is it the same sampling frequency as the data was digitized with? I mean the 30 kHz? If not what is the amount for this frequency, please? How should I determine it?

3) Do you have any other recommendations to filter this signal better and with less noise? Thanks a lot

  • $\begingroup$ I would not recommend using analog filter prototypes (Butterworth, Chebyschev, etc...). See this post which may help you: dsp.stackexchange.com/questions/63643/… $\endgroup$ Commented Feb 20, 2020 at 12:05
  • $\begingroup$ Thanks a lot, Dan. I will study it for sure and will ask any possible question, but meanwhile, do you know the response for questions 1 and 2, please? Just to know more about the sampling frequency that I should consider here and the default amount for Buterworth. Thanks $\endgroup$
    – Zeinab Mo
    Commented Feb 20, 2020 at 16:27
  • $\begingroup$ No there really isn’t an easy answer to your question as it depends on the actual characteristics of your signal - if you read that other post hopefully those reasons will be clear to you. $\endgroup$ Commented Feb 20, 2020 at 16:42
  • $\begingroup$ But the sampling frequency of your filter is the sampling frequency of your signal (normalized; just divide by the sampling rate)—- but you might be better off resampling to a lower frequency as part of the filter design. That depends on the actual bandwidth of your signal. $\endgroup$ Commented Feb 20, 2020 at 16:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.