Using the STFT function from scipy.signal has produced unexpected results for me.
I am performing an STFT on 10 seconds of data, sampled at 25,000 Hz. I am using STFT settings of nperseg=256 and noverlap=192.
Using these settings I expected to get 3903 FFTs in my STFT array i.e.
(fs x t - nperseg )/(nperseg-noverlap) (25000 x 10 - 256)/(256-192) = 3902 (no. of windows subsequent to first window, rounded down) so 3902+1 total windows.
That's assuming that the first segment ends at sample 256, and subsequent segments end at integer multiples of 64 above 256 (e.g. 320, 384, 448 etc.) until there are no full 256-sample long windows left.
However, the STFT time array output seems to give time values based on the start of the window e.g. for the first window spanning sample 0 to sample 256, the time is given as 0. It also increments in integer multiples of 64 until terminating at 250048, 48 samples higher than the length of my input array.
Can anyone shed any light on what is going on here?