From b536a10865d9d1ae99739dc0ea4d2936c87dcfcf Mon Sep 17 00:00:00 2001 From: Josh Cardenzana Date: Tue, 2 Jul 2019 21:11:46 +0200 Subject: [PATCH] (#2925) Add 'fits' parameter to 'plot_residuals()' Allows generating residuals plots without having to save csresspec output --- examples/show_residuals.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/show_residuals.py b/examples/show_residuals.py index 8733473..0407bb5 100755 --- a/examples/show_residuals.py +++ b/examples/show_residuals.py @@ -135,7 +135,7 @@ def fill_cmr(row, counts, model, resid, e_counts, e_resid, c_counts, c_model, # ====================== # # Plot residual spectrum # # ====================== # -def plot_residuals(filename, plotfile, hdu): +def plot_residuals(filename, plotfile, hdu, fits=None): """ Plot spectrum @@ -147,9 +147,12 @@ def plot_residuals(filename, plotfile, hdu): Plot file name hdu : int Number of observation to plot + fits : `~gammalib.GFits` + GFits object containing csresspec results """ - # Read spectrum file - fits = gammalib.GFits(filename) + # Read spectrum file + if fits is None: + fits = gammalib.GFits(filename) table = fits.table(1 + hdu) c_emin = table['Emin'] c_emax = table['Emax'] -- libgit2 0.21.4