3

I have an array of date whose sampling rate is 160GHz, and I wish to apply 30kHz-100kHz bandpass filter to the data. I write as follows:

import scipy.signal as dsp
import numpy as np
fs=160e9
data=np.random.rand(int(1e-4*fs))
b, a = dsp.butter(5, [30e3/(fs/2),100e3/(fs/2)],btype='band')
result=dsp.filtfilt(b,a,data)

However, result is nan. But if I reduce the sampling rate like this, it works:

import scipy.signal as dsp
import numpy as np
fs=160e9
data=np.random.rand(int(1e-4*fs))
data=data[::10000] # 100 does not work
fs=fs/10000
b, a = dsp.butter(5, [30e3/(fs/2),100e3/(fs/2)],btype='band')
result=dsp.filtfilt(b,a,data)

In this way I can get correct result, but the analysis is really rough. So it seems while filter frequency is much lower than sampling rate, the Butterworth filter cannot work correctly. How can I solve this problem?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Zhang Boyu
  • 39
  • 1
  • 4
  • That's a very narrow range of normalized frequencies, so a Butterworth filter might end up filtering out everything. You can look at the frequency response of the filter by calling `scipy.signal.freqz` and plotting the results. – bnaecker May 09 '18 at 16:20

0 Answers0