.. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.timeseries 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` .. code-block:: python from gwpy.timeseries import TimeSeries And we set the times of our investigation: .. code-block:: python goodtime = 1061800700 badtime = 1061524816 duration = 120 Next we :meth:`~TimeSeries.get` the data: .. code-block:: python 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: .. code-block:: python goodasd = gooddata.asd(4, 2) badasd = baddata.asd(4, 2) Lastly, we make a plot of the data by `plotting ` one `~gwpy.frequencyseries.FrequencySeries`, and then adding the second: .. code-block:: python 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() .. plot:: ../examples/frequencyseries/compare.py