Comparing the same Channel at different timesΒΆ

I’m interested in comparing the amplitude spectrum of a channel between a known ‘good’ time - where the spectrum is what we expect it to be - and a known ‘bad’ time - where some excess noise appeared and the spectrum changed appreciably.

First, we import the TimeSeries

from gwpy.timeseries import TimeSeries

And we set the times of our investigation:

goodtime = 1061800700
badtime = 1061524816
duration = 120

Next we get() the data:

gooddata = TimeSeries.get('L1:PSL-ISS_PDB_OUT_DQ', goodtime, goodtime+duration)
baddata = TimeSeries.get('L1:PSL-ISS_PDB_OUT_DQ', badtime, badtime+duration)

and calculate an amplitude spectral density (ASD) using a 4-second Fourier transform with a 2-second overlap:

goodasd = gooddata.asd(4, 2)
badasd = baddata.asd(4, 2)

Lastly, we make a plot of the data by plotting one FrequencySeries, and then adding the second:

plot = badasd.plot(label='Noisy data')
ax = plot.gca()
ax.plot(goodasd, label='Clean data')
ax.set_xlabel('Frequency [Hz]')
ax.set_xlim(10, 8000)
ax.set_ylabel(r'Noise ASD [1/$\sqrt{\mathrm{Hz}}$]')
ax.set_ylim(1e-6, 5e-4)
ax.grid(True, 'both', 'both')
plot.show()

(Source code, png)

../../_images/compare.png