.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_smbh/plot_catalog_corner.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_catalog_corner.py: Full catalog corner plots ========================= Corner plot of select parameters for the full catalog. .. GENERATED FROM PYTHON SOURCE LINES 8-14 .. code-block:: default import matplotlib.pyplot as plt from chainconsumer import ChainConsumer from lisacattools.catalog import GWCatalogs from lisacattools.catalog import GWCatalogType .. GENERATED FROM PYTHON SOURCE LINES 15-16 Load the catalog files .. GENERATED FROM PYTHON SOURCE LINES 16-19 .. code-block:: default catPath = "../../tutorial/data/mbh" catalogs = GWCatalogs.create(GWCatalogType.MBH, catPath, "*.h5") .. GENERATED FROM PYTHON SOURCE LINES 20-21 Read individual DataFrames' .. GENERATED FROM PYTHON SOURCE LINES 21-23 .. code-block:: default meta = catalogs.metadata .. GENERATED FROM PYTHON SOURCE LINES 24-25 sort metadata by observation week, putting most recent catalog last in the list .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: default meta = meta.sort_values(by="observation week") .. GENERATED FROM PYTHON SOURCE LINES 28-29 load the detections of the most recent catalog .. GENERATED FROM PYTHON SOURCE LINES 29-33 .. code-block:: default last_cat = catalogs.get_last_catalog() attr_detections = last_cat.get_attr_detections() detections = last_cat.get_detections(attr_detections) .. GENERATED FROM PYTHON SOURCE LINES 34-35 Create the corner plot with ChainConsumer .. GENERATED FROM PYTHON SOURCE LINES 35-64 .. code-block:: default c = ChainConsumer() # selected parameters to plot parameters = ["Mass 1", "Mass 2", "Luminosity Distance"] # how parameter names should be formatted in figure parameter_symbols = [ r"$m_1\ [{\rm M}_\odot]$", r"$m_2\ [{\rm M}_\odot]$", r"$D_L\ [{\rm Gpc}]$", ] sources = last_cat.get_detections() for source in sources: # get chain samples samples_attr = last_cat.get_attr_source_samples(source) samples = last_cat.get_source_samples(source, samples_attr) # get dataframe into numpy array df = samples[parameters].values # add samples to chainconsumer c.add_chain(df, parameters=parameter_symbols, name=source) # plot! c.configure(plot_hists=False) fig = c.plotter.plot(figsize=1.5, log_scales=True) plt.show() .. image:: /examples_smbh/images/sphx_glr_plot_catalog_corner_001.png :alt: plot catalog corner :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 4.107 seconds) .. _sphx_glr_download_examples_smbh_plot_catalog_corner.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_catalog_corner.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_catalog_corner.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_