Skip to content

Commit

Permalink
in make_acq_plots.plot_params, turned it into a list, added descripti…
Browse files Browse the repository at this point in the history
…on key, renamed the "class" key to "function", and give the function directly instead of giving keys to a separate dictionary
  • Loading branch information
javierggt committed Oct 30, 2024
1 parent c6566a5 commit d1acd2b
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions acq_stat_reports/acq_stat_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,36 +153,31 @@ def make_acq_plots(acqs, tstart=0, tstop=None, outdir=None):
),
}

functions = {
"acq_stars_plot": acq_stars_plot,
"mag_scatter_plot": mag_scatter_plot,
"utils.binned_data_fraction_plot": utils.binned_data_fraction_plot,
"utils.binned_data_plot": utils.binned_data_plot,
"utils.binned_data_probability_plot": utils.binned_data_probability_plot,
"fail_rate_plot": fail_rate_plot,
}

plot_params = {
"acq_stars": {
plot_params = [
{
"description": "Timeline of the number of identified acq stars in the last two years",
"data": "two_year_acqs",
"class": "acq_stars_plot",
"function": acq_stars_plot,
"parameters": {"filename": "id_acq_stars.png", "figscale": (2, 1)},
},
"expected_fails": {
{
"description": "Timeline of the acquisition failure rate in the last two years",
"data": "binned_time",
"class": "fail_rate_plot",
"function": fail_rate_plot,
"parameters": {"filename": "fail_rate_plot.png", "figscale": (2, 1)},
},
"mag_scatter": {
{
"description": "Scatter plot of observed magnitude Vs catalog magnitude",
"data": "all_acq",
"class": "mag_scatter_plot",
"function": mag_scatter_plot,
"parameters": {
"filename": "delta_mag_scatter.png",
},
},
"mag_histogram": {
{
"description": "Histogram of magnitudes of acquisition failures",
"data": "binned_mag",
"class": "utils.binned_data_plot",
"function": utils.binned_data_plot,
"parameters": {
"xlabel": "Star magnitude (mag)",
"ylabel": "N stars",
Expand All @@ -194,9 +189,10 @@ def make_acq_plots(acqs, tstart=0, tstop=None, outdir=None):
"filename": "mag_histogram.png",
},
},
"t_ccd_histogram": {
{
"description": "Histogram of T_CCD of acquisition failures",
"data": "binned_t_ccd",
"class": "utils.binned_data_plot",
"function": utils.binned_data_plot,
"parameters": {
"xlabel": "T$_{CCD}$",
"ylabel": "N stars",
Expand All @@ -208,37 +204,40 @@ def make_acq_plots(acqs, tstart=0, tstop=None, outdir=None):
"filename": "t_ccd_histogram.png",
},
},
"mag_pointhist": {
{
"description": "",
"data": "variable_binned_mag",
"class": "utils.binned_data_fraction_plot",
"function": utils.binned_data_fraction_plot,
"parameters": {
"xlabel": "Star magnitude (mag)",
"ylabel": "Fraction Acquired",
"title": "Acquisition Success vs Mag",
"filename": "mag_pointhist.png",
},
},
"t_ccd_pointhist": {
{
"description": "Fraction of acquisition successes vs T_CCD",
"data": "binned_t_ccd",
"class": "utils.binned_data_fraction_plot",
"function": utils.binned_data_fraction_plot,
"parameters": {
"xlabel": "T$_{CCD}$",
"ylabel": "Fraction Acquired",
"title": "Acquisition Success vs T$_{CCD}$",
"filename": "t_ccd_pointhist.png",
},
},
"prob_scatter": {
{
"description": "Fraction of acquisition successes vs Magnitude",
"data": "binned_p_acq",
"class": "utils.binned_data_probability_plot",
"function": utils.binned_data_probability_plot,
"parameters": {
"filename": "prob_scatter.png",
},
},
}
]

for params in plot_params.values():
functions[params["class"]](datasets[params["data"]], **params["parameters"])
params["function"](datasets[params["data"]], **params["parameters"])


@utils.mpl_plot(
Expand Down

0 comments on commit d1acd2b

Please sign in to comment.