.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/segments/open-data.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_segments_open-data.py: .. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.segments Plotting observing segments for O1 ################################## The data from the full `Observing Run 1 (O1) `__ have been released by |GWOSC|_. This example demonstrates how to download segment information into a :class:`DataQualityFlag`, and then plot them. .. GENERATED FROM PYTHON SOURCE LINES 34-37 All we need to do is import the `DataQualityFlag` object, and then call the :meth:`DataQualityFlag.fetch_open_data` method to query for, and download the segments for all of O1: .. GENERATED FROM PYTHON SOURCE LINES 37-45 .. code-block:: Python from gwpy.segments import DataQualityFlag h1segs = DataQualityFlag.fetch_open_data( "H1_DATA", "Sep 12 2015", "Jan 19 2016", ) .. GENERATED FROM PYTHON SOURCE LINES 46-47 We can then generate a plot of the times when LIGO-Hanford was operating: .. GENERATED FROM PYTHON SOURCE LINES 47-51 .. code-block:: Python plot = h1segs.plot(color="gwpy:ligo-hanford") plot.show() .. image-sg:: /examples/segments/images/sphx_glr_open-data_001.png :alt: open data :srcset: /examples/segments/images/sphx_glr_open-data_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 52-54 That's a lot of segments. We can pare-down the list a little to display only the segments from the first month of the run: .. GENERATED FROM PYTHON SOURCE LINES 54-61 .. code-block:: Python h1month1 = DataQualityFlag.fetch_open_data( "H1_DATA", "Sep 12 2015", "Oct 12 2015", ) .. GENERATED FROM PYTHON SOURCE LINES 62-67 We can also download the LIGO-Livingston segments from the same period and display them alongside, as well as those segments during which both interferometers were operating at the same time (see :ref:`gwpy-segments-intersection` for more details on this use of the ``&`` operator): .. GENERATED FROM PYTHON SOURCE LINES 67-79 .. code-block:: Python l1month1 = DataQualityFlag.fetch_open_data( "L1_DATA", "Sep 12 2015", "Oct 12 2015", ) bothon = h1month1 & l1month1 plot = h1month1.plot() ax = plot.gca() ax.plot(l1month1) ax.plot(bothon, label="Both") plot.show() .. image-sg:: /examples/segments/images/sphx_glr_open-data_002.png :alt: open data :srcset: /examples/segments/images/sphx_glr_open-data_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.718 seconds) .. _sphx_glr_download_examples_segments_open-data.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: open-data.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: open-data.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: open-data.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_