Bandpass filter in python

后端 未结 3 1520
梦如初夏
梦如初夏 2021-01-16 05:04

I\'m trying to get a bandpass filter with a 128-point Hamming window with cutoff frequencies 0.7-4Hz in python. I get my samples for my signal from images. (1 sample = 1 ima

3条回答
  •  长情又很酷
    2021-01-16 05:42

    Trying to filter data with an inconsistent sample rate is very difficult (impossible?). So what you are going to want to do is this:

    1. Create a new signal with a fixed sample rate. The fixed sample rate should be the maximum sample rate or higher. Do this by setting up a new "grid" representing where the new samples should go, and interpolating their values from existing data. A variety of interpolation methods exist depending on how accurate you need to be. Linear interpolation is probably not a bad starting point, but it depends on what you are doing. Ask on https://dsp.stackexchange.com/ if you are unsure.

    2. Once you've done that, you can apply standard signal processing methods to your signal because the samples are evenly placed, such as those described in the post you linked.

    3. If necessary, you may need to interpolate again to get your original sample positions back.

    If you are looking only to analyze your data, you might be interested in the Lomb Periodigram. Instead of band-passing your data and then analyzing, you would use the Lomb Periodigram, and then only look at the relevant frequencies, or weight the results however you wanted. (see also the numerical recipes series. Chapter 13.8 is called "Spectral analysis of unevenly spaced data", which appears to be a friendlier introduction than that wikipedia page)

提交回复
热议问题