.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/spectrogram/rayleighgram.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_spectrogram_rayleighgram.py: .. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.timeseries Plotting a `Spectrogram` of the Rayleigh statistic ################################################## As described in :ref:`sphx_glr_examples_frequencyseries_rayleigh.py`, the Rayleigh statistic can be used to study non-Gaussianity in a timeseries. We can study the time variance of these features by plotting a time-frequency spectrogram where we calculate the Rayleigh statistic for each time bin. .. GENERATED FROM PYTHON SOURCE LINES 34-36 To demonstate this, we can load some data from the LIGO Livingston interferometer around the time of the GW151226 gravitational wave detection: .. GENERATED FROM PYTHON SOURCE LINES 36-44 .. code-block:: Python from gwpy.timeseries import TimeSeries gwdata = TimeSeries.fetch_open_data( "L1", "Dec 26 2015 03:37", "Dec 26 2015 03:47", ) .. GENERATED FROM PYTHON SOURCE LINES 45-49 Next, we can calculate a Rayleigh statistic `Spectrogram` using the :meth:`~gwpy.timeseries.TimeSeries.rayleigh_spectrogram` method of the `~gwpy.timeseries.TimeSeries` and a 5-second stride with a 2-second FFT and 1-second overlap (50%): .. GENERATED FROM PYTHON SOURCE LINES 49-51 .. code-block:: Python rayleigh = gwdata.rayleigh_spectrogram(5, fftlength=2, overlap=1) .. GENERATED FROM PYTHON SOURCE LINES 52-53 and can make a plot using the :meth:`~Spectrogram.plot` method .. GENERATED FROM PYTHON SOURCE LINES 53-60 .. code-block:: Python plot = rayleigh.plot(norm="log", vmin=0.25, vmax=4) ax = plot.gca() ax.set_yscale("log") ax.set_ylim(30, 1500) ax.set_title("Sensitivity of LIGO-Livingston around GW151226") ax.colorbar(cmap="coolwarm", label="Rayleigh statistic") plot.show() .. image-sg:: /examples/spectrogram/images/sphx_glr_rayleighgram_001.png :alt: Sensitivity of LIGO-Livingston around GW151226 :srcset: /examples/spectrogram/images/sphx_glr_rayleighgram_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.082 seconds) .. _sphx_glr_download_examples_spectrogram_rayleighgram.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: rayleighgram.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: rayleighgram.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: rayleighgram.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_