Unverified Commit 6a855ee4 authored by Akke Viitanen's avatar Akke Viitanen
Browse files

add a CLI to the plot

parent d869d426
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -304,3 +304,6 @@ figures_20251024:

coverage:
	pytest --cov=src --cov-report=html tests/

fig/black_hole_mass_function_redshift.pdf: src/scripts/plots/plot_black_hole_mass_function_redshift.py
	python3 $< $@
+11 −5
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
Plots the (non-local) black hole mass function at higher redshifts.
"""

from argparse import ArgumentParser

import numpy as np
from lsst_inaf_agile import kelly2013, util
from lsst_inaf_agile.catalog_combined import CatalogCombined
@@ -54,11 +56,17 @@ def plot_bhmf_catalog(fig, ax, catalog, redshift, dlogMBH=0.40, dz=0.30):


def main():
    parser = ArgumentParser(description="Plot the truth catalog against Shen & Kelly 2013.")
    parser.add_argument("savefig", help="output plot filename")
    parser.add_argument(
        "--dirname", default="data/catalog/dr1_new_new", help="directory name of the truth catalog"
    )
    args = parser.parse_args()

    fig, axes = kelly2013._get_figax()
    kelly2013._plot_bhmf(fig, axes, kelly2013.REDSHIFTS)

    catalog = CatalogCombined(
        "data/catalog/dr1_new_new",
        args.dirname,
        sql_query="""
            SELECT Z, M, log_LX_2_10, MBH, log_L_bol,
                   is_optical_type2, is_agn, is_agn_ctn, is_agn_ctk,
@@ -66,11 +74,9 @@ def main():
            FROM Truth
        """,
    )
    # Shen has deltaz of 0.20, 0.35, 0.55. Choose deltaz = 0.20 for now as the
    # binsize
    for redshift, ax in zip(kelly2013.REDSHIFTS, axes.flatten(), strict=False):
        plot_bhmf_catalog(fig, ax, catalog, redshift)
    fig.savefig("tmp.pdf")
    fig.savefig(args.savefig)


if __name__ == "__main__":