.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_smbh/plot_source_list.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_smbh_plot_source_list.py: Source list ==================== Display a table of catalog files, detection list, and timeline of mergers.. .. GENERATED FROM PYTHON SOURCE LINES 9-21 .. code-block:: default import matplotlib.pyplot as plt import numpy as np from chainconsumer import ChainConsumer from lisacattools.catalog import GWCatalogs from lisacattools.catalog import GWCatalogType # get list catalog files catPath = "../../tutorial/data/mbh" catalogs = GWCatalogs.create(GWCatalogType.MBH, catPath, "*.h5") last_cat = catalogs.get_last_catalog() .. GENERATED FROM PYTHON SOURCE LINES 22-24 Load detections from final catalog. Because catalogs are cummulative, this will include all sources .. GENERATED FROM PYTHON SOURCE LINES 24-53 .. code-block:: default detections_attr = last_cat.get_attr_detections() detections = last_cat.get_detections(detections_attr) detections[["Log Likelihood", "Mass 1", "Mass 2", "Luminosity Distance"]] detections.sort_values( by="Barycenter Merge Time", ascending=True, inplace=True ) mergeTimes = detections["Barycenter Merge Time"] mergeT = np.insert(np.array(mergeTimes) / 86400, 0, 0) mergeCount = np.arange(0, len(mergeTimes) + 1) # setup plot fig, ax = plt.subplots(figsize=[8, 6], dpi=100) # configure axes ax.step(mergeT, mergeCount, where="post") ax.set_xlabel("Observation Time [days]") ax.set_ylabel("Merger Count") ax.grid() # loop over events by merger time and make annotated figure for m in range(0, len(mergeTimes)): plt.annotate( mergeTimes.index[m], # this is the text (mergeTimes[m] / 86400, mergeCount[m]), # this is the point to label textcoords="offset points", # how to position the text xytext=(2, 5), # distance from text to points (x,y) ) plt.show() .. image:: /examples_smbh/images/sphx_glr_plot_source_list_001.png :alt: plot source list :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.343 seconds) .. _sphx_glr_download_examples_smbh_plot_source_list.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_source_list.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_source_list.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_