diff --git a/test/data/crab_offaxis1.fits.gz b/test/data/crab_offaxis1.fits.gz index 67a8082..7ded87e 100644 --- a/test/data/crab_offaxis1.fits.gz +++ b/test/data/crab_offaxis1.fits.gz diff --git a/test/test_csphasecrv.py b/test/test_csphasecrv.py index d5f8b77..0a03563 100755 --- a/test/test_csphasecrv.py +++ b/test/test_csphasecrv.py @@ -44,6 +44,8 @@ class Test(test): # Set test data self._phased_events = self._datadir + '/phased_events.fits' + self._offaxis_events = self._datadir + '/crab_offaxis1.fits' + self._model_onoff = self._datadir + '/crab_onoff.xml' # Return return @@ -207,7 +209,7 @@ class Test(test): # Check phase curve self._check_phase_curve('csphasecrv_py3.fits', 5) - # Finally we set-up a binned csphasecrv + # Binned csphasecrv pcrv = cscripts.csphasecrv() pcrv['inobs'] = self._phased_events pcrv['inmodel'] = self._model @@ -238,6 +240,35 @@ class Test(test): # Check phase curve self._check_phase_curve('csphasecrv_py4.fits', 2) + # On/Off csphasecrv + pcrv = cscripts.csphasecrv() + pcrv['inobs'] = self._offaxis_events + pcrv['inmodel'] = self._model_onoff + pcrv['srcname'] = 'Crab' + pcrv['caldb'] = self._caldb + pcrv['irf'] = self._irf + pcrv['phbinalg'] = 'LIN' + pcrv['phbins'] = 2 + pcrv['method'] = 'ONOFF' + pcrv['statistic'] = 'WSTAT' + pcrv['emin'] = 0.1 + pcrv['emax'] = 100.0 + pcrv['enumbins'] = 10 + pcrv['coordsys'] = 'CEL' + pcrv['xref'] = 83.63 + pcrv['yref'] = 22.01 + pcrv['rad'] = 0.2 + pcrv['outfile'] = 'csphasecrv_py5.fits' + pcrv['logfile'] = 'csphasecrv_py5.log' + pcrv['chatter'] = 4 + + # Execute csphasecrv script + pcrv.logFileOpen() # Make sure we get a log file + pcrv.execute() + + # Check phase curve + self._check_phase_curve('csphasecrv_py5.fits', 2) + # Return return @@ -271,6 +302,12 @@ class Test(test): self.test_assert(table.contains(col), 'FITS file contains "'+col+'" column') + # Check that table has been filled + # Prefactor has right order of magnitude + for s in range(table.nrows()): + self.test_value(table['Prefactor'][s], 4.e-16, 3.e-16, + 'Check prefactor value') + # Close FITS file fits.close()