.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/miscellaneous/range-timeseries.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_miscellaneous_range-timeseries.py: .. sectionauthor:: Duncan Macleod .. currentmodule:: gwpy.timeseries Generating an inspiral range timeseries ####################################### One standard figure-of-merit for the sensitivity of a gravitational-wave detector is the distance to which a binary neutron star (BNS) inspiral with two 1.4 solar mass components would be detected with a signal-to-noise ratio (SNR) of 8. We can estimate this using :func:`gwpy.astro.range_timeseries` directly from the strain readout for a detector. .. GENERATED FROM PYTHON SOURCE LINES 34-39 Data access ----------- First, we need to load some data. We can `fetch` the `public data `__ around the GW170817 BNS merger: .. GENERATED FROM PYTHON SOURCE LINES 39-44 .. code-block:: Python from gwpy.timeseries import TimeSeries h1 = TimeSeries.fetch_open_data("H1", 1187006834, 1187010930) l1 = TimeSeries.fetch_open_data("L1", 1187006834, 1187010930) .. GENERATED FROM PYTHON SOURCE LINES 45-49 Range estimation ---------------- Then, we can measure the inspiral range directly, at 30 second granularity with a 4-second FFT length starting at 10 Hz: .. GENERATED FROM PYTHON SOURCE LINES 49-54 .. code-block:: Python from gwpy.astro import range_timeseries h1range = range_timeseries(h1, 30, fftlength=4, fmin=10) l1range = range_timeseries(l1, 30, fftlength=4, fmin=10) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/duncan.macleod/gwpy-nightly-build/conda/envs/gwpy-nightly-3.11/lib/python3.11/site-packages/inspiral_range/waveform.py:369: DeprecationWarning: `trapz` is deprecated. Use `trapezoid` instead, or one of the numerical integration functions in `scipy.integrate`. return np.sqrt(4*np.trapz((h**2)/psd, self.freq)) .. GENERATED FROM PYTHON SOURCE LINES 55-59 Visualisation ------------- We can now plot these trends to see the variation in LIGO sensitivity over an hour or so surrounding GW170817: .. GENERATED FROM PYTHON SOURCE LINES 59-73 .. code-block:: Python plot = h1range.plot( label="LIGO-Hanford", color="gwpy:ligo-hanford", figsize=(12, 5), ) ax = plot.gca() ax.plot(l1range, label="LIGO-Livingston", color="gwpy:ligo-livingston") ax.set_ylabel("Angle-averaged sensitive distance [Mpc]") ax.set_title("LIGO sensitivity to BNS around GW170817") ax.set_epoch(1187008882) # <- set 0 on plot to GW170817 ax.legend() plot.show() .. image-sg:: /examples/miscellaneous/images/sphx_glr_range-timeseries_001.png :alt: LIGO sensitivity to BNS around GW170817 :srcset: /examples/miscellaneous/images/sphx_glr_range-timeseries_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 74-78 Note, the extreme dip in LIGO-Livingston's sensitivity near GW170817 is caused by a loud, transient noise event, see `Phys. Rev. Lett. vol. 119, p. 161101 `_ for more information. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.206 seconds) .. _sphx_glr_download_examples_miscellaneous_range-timeseries.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: range-timeseries.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: range-timeseries.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: range-timeseries.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_