.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_ucb/plot_source_Mc_DL.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_ucb_plot_source_Mc_DL.py: Resampling posteriors ===================== Convert sampling parameters to derived parameters .. GENERATED FROM PYTHON SOURCE LINES 9-14 This example shows how to change parameterization of the posterior samples. The GBMCMC sampler uses frequency, frequency derivative, and GW amplitude in its waveform model. For systems whose dynamics are driven by GR, those parameters can be converted to chirp mass and luminosity distance. Here is a demonstration of how to do that by producing a chirpmass-distance corner plot. Import modules .. GENERATED FROM PYTHON SOURCE LINES 14-52 .. code-block:: default import matplotlib.pyplot as plt from chainconsumer import ChainConsumer from lisacattools import get_DL from lisacattools import get_Mchirp from lisacattools.catalog import GWCatalog from lisacattools.catalog import GWCatalogs from lisacattools.catalog import GWCatalogType # Start by loading the main catalog file processed from GBMCMC outputs catPath = "../../tutorial/data/ucb" catalogs = GWCatalogs.create(GWCatalogType.UCB, catPath, "cat15728640_v2.h5") final_catalog = catalogs.get_last_catalog() detections_attr = final_catalog.get_attr_detections() detections = final_catalog.get_detections(detections_attr) # Sort table by SNR and select highest SNR source detections.sort_values(by="SNR", ascending=False, inplace=True) sourceId = detections.index[0] samples = final_catalog.get_source_samples(sourceId) # Reject chain samples with negative fdot (enforce GR-driven prior) samples_GR = samples[(samples["Frequency Derivative"] > 0)] # Add distance and chirpmass to samples get_DL(samples_GR) get_Mchirp(samples_GR) # Make corner plot parameters = ["Chirp Mass", "Luminosity Distance"] parameter_symbols = [r"$\mathcal{M}\ [{\rm M}_\odot]$", r"$D_L\ [{\rm kpc}]$"] df = samples_GR[parameters].values c = ChainConsumer().add_chain(df, parameters=parameter_symbols, cloud=True) c.configure(flip=False) fig = c.plotter.plot(figsize=1.5) plt.show() .. image:: /examples_ucb/images/sphx_glr_plot_source_Mc_DL_001.png :alt: $\mathcal{M}\ [{\rm M}_\odot] = \left( 427.7^{+3.6}_{-4.8} \right) \times 10^{-3}$, $D_L\ [{\rm kpc}] = 0.522^{+0.014}_{-0.025}$ :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Init the memory cache (lisacattools.utils._read_chain_file:130) 2023-02-06 17:36:29,480 INFO utils newfunc Init the memory cache Cache LDC0092117281-cat15728640_v2_chains_1100s.h5 (lisacattools.utils._read_chain_file:133) 2023-02-06 17:36:29,480 INFO utils newfunc Cache LDC0092117281-cat15728640_v2_chains_1100s.h5 INFO:matplotlib.mathtext:Substituting symbol M from STIXNonUnicode INFO:matplotlib.mathtext:Substituting symbol M from STIXNonUnicode INFO:matplotlib.mathtext:Substituting symbol M from STIXNonUnicode .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.576 seconds) .. _sphx_glr_download_examples_ucb_plot_source_Mc_DL.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_Mc_DL.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_source_Mc_DL.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_