I want to do time-frequency analysis of a signal. So i decided to use spectrogram function from scipy. This function returns, three parameters f,t,Sxx. I am using below arguements:
x : my signal
fs : 1000 Hz
window : hann, with size = 300
nperseg : 300, same as window size
noverlap : 25
My question is about returned time segments of this function.
As far as I understand the first time segment for which we calculate fft must be 300 samples, then subtract 25 from it calculate fft for next window of 300 samples,and so on. So the signal of length 1s must be divided in 4 time segments. .275,.500,.775,1. , but the function returns :
Out: array([ 0.15 , 0.425, 0.7 ])
can someone please suggest if I am thinking wrong or there is a bug in spectrogram function.