miek / inspectrum

Radio signal analyser
GNU General Public License v3.0
2.04k stars 263 forks source link

Zero pad to compensate for nonzero FFT length #219

Closed jacobagilbert closed 9 months ago

jacobagilbert commented 1 year ago

Instantaneous energy and the spectrogram tiles do not line up correctly in Inspectrum. This is most obvious when using larger FFT lengths and the amplitude plot, but also very noticeable with SigMF Annotations, for example, in the screenshot below shows the spectrogram tile showing energy well before the annotation and actual time domain energy begins:

image

At larger FFT sizes this misalignment becomes more obvious as the temporal ambiguity (same number of samples as FFT length) increases.

To resolve this, the data should be zero padded with length NFFT/2 in which case the spectrogram will be nicely aligned (with expected temporal smearing still of course):

image
daniestevez commented 9 months ago

Just seen this issue. I've also realized this problem, and sent a PR that solves the problem in a slightly different way (#227).

miek commented 9 months ago

Fixed in #227