.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_ucb/plot_time_evolving_parameters.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_time_evolving_parameters.py: Connecting catalogs =================== Locate a source in an updated catalog and compare parameters. .. GENERATED FROM PYTHON SOURCE LINES 9-12 This example shows how to find a particular source after the catalog has been updated based on the `parent` meta data, and produces a corner plot showing how the parameter estimation evolves with time. .. GENERATED FROM PYTHON SOURCE LINES 12-22 .. code-block:: default import os import numpy as np import pandas as pd from chainconsumer import ChainConsumer from lisacattools.catalog import GWCatalog from lisacattools.catalog import GWCatalogs from lisacattools.catalog import GWCatalogType .. GENERATED FROM PYTHON SOURCE LINES 23-24 Start by loading the 03 month catalog and selecting a source to follow .. GENERATED FROM PYTHON SOURCE LINES 24-41 .. code-block:: default catPath = "../../tutorial/data/ucb" meta_catalog = GWCatalogs.create( GWCatalogType.UCB, catPath, "cat7864320_v3.h5" ) old_catalog = meta_catalog.get_last_catalog() detections_attr = old_catalog.get_attr_detections() old_cat = old_catalog.get_detections(detections_attr) # pick a source, any source old_source = "LDC0027827268" sample_attr = old_catalog.get_attr_source_samples(old_source) old_samples = old_catalog.get_source_samples(old_source, sample_attr) old_cat.loc[[old_source], ["SNR", "Frequency", "Amplitude"]] .. raw:: html
SNR Frequency Amplitude
name
LDC0027827268 69.6613 0.002783 2.514195e-22


.. GENERATED FROM PYTHON SOURCE LINES 42-43 Load the 06 month catalog and find the current name for `old_source` .. GENERATED FROM PYTHON SOURCE LINES 43-60 .. code-block:: default meta_catalog = GWCatalogs.create( GWCatalogType.UCB, catPath, "cat15728640_v2.h5" ) new_catalog = meta_catalog.get_last_catalog() detections_attr = new_catalog.get_attr_detections() new_cat = new_catalog.get_detections(detections_attr) # select source that lists old_source as parent new_cat = new_cat[(new_cat["parent"] == old_source)] new_source = new_cat.index.values[0] sample_attr = new_catalog.get_attr_source_samples(new_source) new_samples = new_catalog.get_source_samples(new_source, sample_attr) new_cat.loc[[new_source], ["parent", "SNR", "Frequency", "Amplitude"]] .. raw:: html
parent SNR Frequency Amplitude
name
LDC0027827155 LDC0027827268 101.446 0.002783 2.147934e-22


.. GENERATED FROM PYTHON SOURCE LINES 61-62 Plot the posteriors for the 03 and 06 months inferences for the source .. GENERATED FROM PYTHON SOURCE LINES 62-104 .. code-block:: default c = ChainConsumer() # Select which parameters to plot & format the axes labels parameters = [ "Frequency", "Amplitude", "Ecliptic Longitude", "Ecliptic Latitude", "Inclination", ] parameter_labels = [ r"$f_0\ [{\rm Hz}]$", r"$\mathcal{A}$", r"$\phi\ [{\rm rad}]$", r"$\theta\ [{\rm rad}]$", r"$\iota\ [{\rm rad}]$", ] # add chains c.add_chain( old_samples[parameters].values, parameters=parameter_labels, cloud=True, name=old_source, ) c.add_chain( new_samples[parameters].values, parameters=parameter_labels, cloud=True, name=new_source, ) # plot! c.configure( sigmas=[1, 2, 3], linestyles=["-", "--"], legend_color_text=False, legend_kwargs={"fontsize": 18}, ) fig = c.plotter.plot(figsize=1.5) .. image:: /examples_ucb/images/sphx_glr_plot_time_evolving_parameters_001.png :alt: plot time evolving parameters :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.785 seconds) .. _sphx_glr_download_examples_ucb_plot_time_evolving_parameters.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_time_evolving_parameters.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_time_evolving_parameters.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_