# [Numpy-discussion] zoom FFT with numpy?

Warren Focke focke@slac.stanford....
Thu Mar 15 13:58:40 CDT 2007

```
On Wed, 14 Mar 2007, Charles R Harris wrote:

> On 3/14/07, Ray Schumacher <subscriber100@rjs.org> wrote:
> >
> > What I had been doing is a 2048 N full real_FFT with a Hann window, and
> > further analyzing the side lobe/bin energy (via linear interp) to try to
> > more precisely determine the f within the peak's bin. (How legitimately
> > valuable that is I'm not sure... IANAM)
>
>
> That's usually fine. You might want to zero fill to get more samples through
> the band. It would help if you gave the sample frequency in Hz too. Anyway,
> unless time is important, I would just zero fill by a factor of 4-8 and
> transform. You can get the same effect with a chirp-z transform, but again
> this is depends on how much programming work you want to do. If you just
> have a couple of lines in the band that you want to locate you could also
> try maximum entropy methods.

Or do

1) explicit multipy by the transform matrix but only use a few rows.

but evaluate the transform matrix on a frequency grid finer than the
1/(2048*tsamp) that is actually independent.  Then fit sin(f)/f to the
power spectrum.  Either of these should give better interpolation than
linear.  I've seen this done (and pass peer review) to determine pulsar
frequencies.  I also remain unconvinced that interpolation provides a
better result, but that can be determined by analyzing fake data with a
known frequency.

If you're trying to determine the significance of the result, the fit
should somehow take into account the fact that the interpolated data
points are not real degrees of freedom.  But your power estimates are
already not independent since you've applied a Hann window.  Probably
should also fit to the line response of a Hann window rather than
sin(f)/f.  Plus something (flat?) for the noise.  You could determine the
real # of degrees of freedom by simulating the procedure many times (with
noise) and fitting a chisquare function to the distribution of fit
chisquare values that you see.  This would also give an empirical estimate
of how well you were determining the frequency, which is probably better
than mucking about with degrees of freedom, anyway.

w

```