.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_ucb/plot_freq_amp.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_freq_amp.py: Scatter plots ======================== Scatter plot of detections' point estimates and LISA sensitivity curve. .. GENERATED FROM PYTHON SOURCE LINES 8-67 .. image:: /examples_ucb/images/sphx_glr_plot_freq_amp_001.png :alt: Point estimates for 6195 sources found in catalog aws_6mo_v2 :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/lisacattools/lisacattools/docs/examples_ucb/plot_freq_amp.py:46: MatplotlibDeprecationWarning: Unable to determine Axes to steal space for Colorbar. Using gca(), but will raise in the future. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes. cbar = fig.colorbar(scalarMap) | .. code-block:: default import matplotlib.cm as cm import matplotlib.colors as colors import matplotlib.pyplot as plt import numpy as np from lisacattools import getSciRD from lisacattools.catalog import GWCatalogs from lisacattools.catalog import GWCatalogType # load catalog catPath = "../../tutorial/data/ucb" catalogs = GWCatalogs.create(GWCatalogType.UCB, catPath, "cat15728640_v2.h5") meta = catalogs.metadata final_catalog = catalogs.get_last_catalog() detections_attr = final_catalog.get_attr_detections() detections = final_catalog.get_detections(detections_attr) # set up matplotlib figure fig = plt.figure(figsize=(12, 6), dpi=100) ax = plt.axes() plt.yscale("log") plt.xscale("log") plt.xlabel("Frequency (Hz)", fontsize=14) plt.ylabel("Strain Amplitude", fontsize=14) plt.title( "Point estimates for %i sources found in catalog %s" % (len(detections), meta.index[0]), fontsize=18, ) # color points in scatter plot by SNR cNorm = colors.LogNorm( vmin=detections["SNR"].min(), vmax=detections["SNR"].max() ) # re-wrapping normalization scalarMap = cm.ScalarMappable(norm=cNorm, cmap=plt.cm.get_cmap("cool")) cbar = fig.colorbar(scalarMap) cbar.set_label("SNR", fontsize=14) # the scatter plot detections.plot( kind="scatter", x="Frequency", y="Amplitude", marker=".", c=scalarMap.to_rgba(np.array(detections["SNR"])), ax=ax, ) # add sensitivity curve f = np.logspace(-4, 0, 512) ax.plot(f, getSciRD(f, meta.iloc[0]["Observation Time"]), color="k") ax.legend(["Instrument Sensitivity", "resolved GBs"], fontsize=14) ax.grid() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.605 seconds) .. _sphx_glr_download_examples_ucb_plot_freq_amp.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_freq_amp.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_freq_amp.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_