.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/table/rate.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_table_rate.py: .. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.table Calculating (and plotting) rate versus time for an `EventTable` ############################################################### I would like to study the rate at which event triggers are generated by the `ExcessPower` gravitational-wave burst detection algorithm, over a small stretch of data. The data from which these events were generated contain a simulated gravitational-wave signal, or hardware injection, used to validate the performance of the LIGO detectors and downstream data analysis procedures. .. GENERATED FROM PYTHON SOURCE LINES 36-39 First, we import the `EventTable` object and read in a set of events from a LIGO_LW-format XML file containing a :class:`sngl_burst ` table .. GENERATED FROM PYTHON SOURCE LINES 39-46 .. code-block:: Python from gwpy.table import EventTable events = EventTable.read( "H1-LDAS_STRAIN-968654552-10.xml.gz", tablename="sngl_burst", columns=["peak", "snr"], ) .. GENERATED FROM PYTHON SOURCE LINES 47-54 .. note:: Here we manually specify the `columns` to read in order to optimise the `read()` operation to parse only the data we actually need. We can calculate the rate of events (in Hertz) using the :meth:`~EventTable.event_rate` method: .. GENERATED FROM PYTHON SOURCE LINES 54-57 .. code-block:: Python rate = events.event_rate(1, start=968654552, end=968654562) .. GENERATED FROM PYTHON SOURCE LINES 58-61 The :meth:`~EventTable.event_rate` method has returned a `~gwpy.timeseries.TimeSeries`, so we can display this using the :meth:`~gwpy.timeseries.TimeSeries.step` method of that object: .. GENERATED FROM PYTHON SOURCE LINES 61-68 .. code-block:: Python plot = rate.step() ax = plot.gca() ax.set_xlim(968654552, 968654562) ax.set_ylabel("Event rate [Hz]") ax.set_title("LIGO Hanford Observatory event rate for HW100916") plot.show() .. image-sg:: /examples/table/images/sphx_glr_rate_001.png :alt: LIGO Hanford Observatory event rate for HW100916 :srcset: /examples/table/images/sphx_glr_rate_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.261 seconds) .. _sphx_glr_download_examples_table_rate.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: rate.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: rate.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: rate.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_