Spectrogram2 sometimes has wrong scaling
Created by: andrew-lundgren
For certain choices of fftlength and overlap, spectrogram2 is scaled wrong. In the example, the data is 6 seconds but the plot is squashed into 5.76 seconds. I injected a delta function, and it shows up at the wrong time, consistent with the squashing. This is only really noticeable for certain choices and not for others. Maybe there's a weird rounding error?
from gwpy.timeseries import TimeSeries
start_time = 1113031000
dur = 6
probe = 4.
darm=TimeSeries.fetch('L1:OAF-CAL_DARM_DQ',start_time,start_time+dur)
idx = int(16384*probe)
darm[idx] = 0.*darm[idx]
specgram = darm.spectrogram2(fftlength=0.05, overlap=0.049) ** (1/2.)
medratio = specgram.ratio('median')
plot = medratio.plot(norm='log', vmin=0.5, vmax=10)
plot.set_yscale('log')
plot.set_ylim(32, 8192)
plot.set_xlim(start_time, start_time+dur)
ax = plot.gca()
ax.axvline(start_time+probe,c='k',label='correct loc')
ax.axvline(start_time+(5.76/6.)*probe,c='r',label='scaled by .96')
ax.legend()
plot.savefig('test-specgram.png')