.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/frequencyseries/rayleigh.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_frequencyseries_rayleigh.py: .. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.timeseries Plotting a Rayleigh-statistic `Spectrum` ######################################## In LIGO the 'Rayleigh' statistic is a calculation of the `coefficient of variation `_ of the power spectral density (PSD) of a given set of data. It is used to measure the 'Gaussianity' of those data, where a value of 1 indicates Gaussian behaviour, less than 1 indicates coherent variations, and greater than 1 indicates incoherent variation. It is a useful measure of the quality of the strain data being generated and recorded at a LIGO site. .. GENERATED FROM PYTHON SOURCE LINES 38-40 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 40-48 .. 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 49-52 Next, we can calculate a Rayleigh statistic `FrequencySeries` using the :meth:`~gwpy.timeseries.TimeSeries.rayleigh_spectrum` method of the `~gwpy.timeseries.TimeSeries` with a 2-second FFT and 1-second overlap (50%): .. GENERATED FROM PYTHON SOURCE LINES 52-55 .. code-block:: Python rayleigh = gwdata.rayleigh_spectrum(2, 1) .. GENERATED FROM PYTHON SOURCE LINES 56-58 For easy comparison, we can calculate the spectral sensitivity ASD of the strain data and plot both on the same figure: .. GENERATED FROM PYTHON SOURCE LINES 58-79 .. code-block:: Python from gwpy.plot import Plot plot = Plot( gwdata.asd(2, 1), rayleigh, geometry=(2, 1), sharex=True, xscale="log", xlim=(30, 1500), ) asdax, rayax = plot.axes # update ASD Axes asdax.set_title("Sensitivity of LIGO-Livingston around GW151226") asdax.set_yscale("log") asdax.set_ylim(5e-24, 1e-21) asdax.set_ylabel(r"[strain/$\sqrt{\mathrm{Hz}}$]") # update Rayleigh Axes rayax.set_ylim(0, 2) rayax.set_ylabel("Rayleigh statistic") plot.show() .. image-sg:: /examples/frequencyseries/images/sphx_glr_rayleigh_001.png :alt: Sensitivity of LIGO-Livingston around GW151226 :srcset: /examples/frequencyseries/images/sphx_glr_rayleigh_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 80-84 So, we see sharp dips at certain frequencies associated with 'lines' in spectrum where noise at a fixed frequency is very coherent (e.g. harmonics of the 60Hz mains power supply), and bumps in specific frequency bands where the interferometer noise is non-stationary. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.794 seconds) .. _sphx_glr_download_examples_frequencyseries_rayleigh.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: rayleigh.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: rayleigh.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: rayleigh.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_