- Aug 15, 2006
- 375
- 1
- 81
First off, let me announce that I know very little about DSP, and I'm coming at this from a mathematical perspective so my language may be....different....
I have a set of data stored in a 3D array of size 64x128x128 which I would like to decompose into "large scale" and "small scale" components. Practically, this means I would like to do a low and high pass filter respectively. The cut-off frequency I'm interested in, corresponds to about the first 10 Fourier components (whatever that works out to).
My first attempt involved a simple brick wall filter, I fft'ed the data, then set everything but the first 10 (and last 10) components along each axis to zero and called this a low-pass. To get the high-pass, I took the original dataset and subtracted the low-pass result from it.
After some research, I came to the realization that this was introducing sinc ringing in my time domain signal and I should do some sort of windowing.
So, instead of the brick wall filter, I made a Tukey window (like a tunable Hanning window) and applied it in the same way as the brick wall filter. This seems to give better results on a test array made of noise (it looks like a lowpass filter).
My question is, can I do better and are there some "gotcha" type scenarios that I need to watch out for? I'm programming this all in python (numpy, scipy, matplotlib etc).
I'm investigating the use of time domain filtering, but I can't wrap my head around the DSP language and the nuances involved. One of the things which may complicate everything is that the data is periodic (produced from a simulation with periodic boundary conditions).
Notably, using numpy.signal and firwin along with lfilter is there a way to take advantage of the periodicity to prime the filter, and how would I do it?
P.S.
I haven't included any code, since it's a mess and I kind of want a fresh approach.
I have a set of data stored in a 3D array of size 64x128x128 which I would like to decompose into "large scale" and "small scale" components. Practically, this means I would like to do a low and high pass filter respectively. The cut-off frequency I'm interested in, corresponds to about the first 10 Fourier components (whatever that works out to).
My first attempt involved a simple brick wall filter, I fft'ed the data, then set everything but the first 10 (and last 10) components along each axis to zero and called this a low-pass. To get the high-pass, I took the original dataset and subtracted the low-pass result from it.
After some research, I came to the realization that this was introducing sinc ringing in my time domain signal and I should do some sort of windowing.
So, instead of the brick wall filter, I made a Tukey window (like a tunable Hanning window) and applied it in the same way as the brick wall filter. This seems to give better results on a test array made of noise (it looks like a lowpass filter).
My question is, can I do better and are there some "gotcha" type scenarios that I need to watch out for? I'm programming this all in python (numpy, scipy, matplotlib etc).
I'm investigating the use of time domain filtering, but I can't wrap my head around the DSP language and the nuances involved. One of the things which may complicate everything is that the data is periodic (produced from a simulation with periodic boundary conditions).
Notably, using numpy.signal and firwin along with lfilter is there a way to take advantage of the periodicity to prime the filter, and how would I do it?
P.S.
I haven't included any code, since it's a mess and I kind of want a fresh approach.