diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index 94fc226..c1196b9 100644 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -195,6 +195,7 @@ testdata = $(top_srcdir)/test/data/crab.xml \ $(top_srcdir)/test/data/sensitivity_integral.dat \ $(top_srcdir)/test/data/skymap.fits \ $(top_srcdir)/test/data/spectrum.fits \ + $(top_srcdir)/test/data/residual.fits \ $(top_srcdir)/test/data/lightcurve.fits \ $(top_srcdir)/test/data/ts.dat \ $(top_srcdir)/test/data/models_spatial.xml \ diff --git a/cscripts/cslightcrv.py b/cscripts/cslightcrv.py index 590b079..0ca4547 100755 --- a/cscripts/cslightcrv.py +++ b/cscripts/cslightcrv.py @@ -558,12 +558,12 @@ class cslightcrv(ctools.csobservation): # fill results table with zeros else: self._log_value(gammalib.TERSE, 'Warning', - 'No observations available in this time bin', - 'Skip bin.') + 'No observations available in this time bin, ' + 'skip bin.') # Set all results to 0 for par in pars: - result['values'][par] = 0.0 + result['values'][par] = 0.0 result['values']['e_' + par] = 0.0 # Append result diff --git a/examples/show_residuals.py b/examples/show_residuals.py index d4d3d93..eb61fc1 100755 --- a/examples/show_residuals.py +++ b/examples/show_residuals.py @@ -286,7 +286,7 @@ def show_residuals(): Show residuals """ # Set usage string - usage = 'show_spectrum.py [-p plotfile] [-h hdu] [file]' + usage = 'show_residual.py [-p plotfile] [-h hdu] [file]' # Set default options options = [{'option': '-p', 'value': ''}, @@ -297,7 +297,7 @@ def show_residuals(): # Extract script parameters from options plotfile = options[0]['value'] - hdu = options[1]['value'] + hdu = options[1]['value'] # Show residuals plot_residuals(args[0], plotfile, hdu) diff --git a/test/data/residual.fits b/test/data/residual.fits new file mode 100644 index 0000000..cc7ceb8 --- /dev/null +++ b/test/data/residual.fits diff --git a/test/test_examples.py.in b/test/test_examples.py.in index 935ac61..17f1822 100755 --- a/test/test_examples.py.in +++ b/test/test_examples.py.in @@ -2,7 +2,7 @@ # ========================================================================== # Performs unit tests for the ctools example scripts # -# Copyright (C) 2016-2017 Juergen Knoedlseder +# Copyright (C) 2016-2018 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -89,26 +89,8 @@ class Test(gammalib.GPythonTestSuite): self.name('examples') # Append tests - #self.append(self.test_generate_prod3_irfs, - # 'Test generate_prod3_irfs.py') self.append(self.test_make_pointings, 'Test make_pointings.py') - #self.append(self.test_make_spectrum, - # 'Test make_spectrum.py') - #self.append(self.test_make_ts_distributions, - # 'Test make_ts_distributions.py') - #self.append(self.test_pipeline_binned_disk, - # 'Test pipeline_binned_disk.py') - #self.append(self.test_pipeline_binned_mem, - # 'Test pipeline_binned_mem.py') - #self.append(self.test_pipeline_stacked_disk, - # 'Test pipeline_stacked_disk.py') - #self.append(self.test_pipeline_stacked_mem, - # 'Test pipeline_stacked_mem.py') - #self.append(self.test_pipeline_unbinned_disk, - # 'Test pipeline_unbinned_disk.py') - #self.append(self.test_pipeline_unbinned_mem, - # 'Test pipeline_unbinned_mem.py') self.append(self.test_show_butterfly, 'Test show_butterfly.py') self.append(self.test_show_irf, @@ -123,6 +105,8 @@ class Test(gammalib.GPythonTestSuite): 'Test show_pull_evolution.py') self.append(self.test_show_pull_histogram, 'Test show_pull_histogram.py') + self.append(self.test_show_residuals, + 'Test show_residuals.py') self.append(self.test_show_response, 'Test show_response.py') self.append(self.test_show_sensitivity, @@ -384,6 +368,20 @@ class Test(gammalib.GPythonTestSuite): # Return return + # Test show_residuals + def test_show_residuals(self): + """ + Test show_residuals + """ + # Set arguments + args = '-p example_show_residuals.eps %s/residual.fits' % self._datadir + + # Execute script + self._execute_python('show_residuals', args=args) + + # Return + return + # Test show_response def test_show_response(self): """