From 8fa52c81ee8e57e2ceaff396b1a903d52fb36d2b Mon Sep 17 00:00:00 2001 From: Luigi Tibaldo Date: Wed, 4 Jul 2018 14:01:14 +0200 Subject: [PATCH] Unit tests for multiprocessing of cslightcrv and csphasecrv --- test/test_cslightcrv.py | 29 +++++++++++++++++++++++++++++ test/test_csphasecrv.py | 27 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 0 deletions(-) diff --git a/test/test_cslightcrv.py b/test/test_cslightcrv.py index cad4547..b0251a7 100755 --- a/test/test_cslightcrv.py +++ b/test/test_cslightcrv.py @@ -272,6 +272,35 @@ class Test(test): # Check light curve self._check_light_curve('cslightcrv_py5.fits', 2) + # Set-up cslightcrv without multiprocessing + lcrv = cscripts.cslightcrv() + lcrv['inobs'] = self._events + lcrv['inmodel'] = self._model + lcrv['srcname'] = 'Crab' + lcrv['caldb'] = self._caldb + lcrv['irf'] = self._irf + lcrv['tbinalg'] = 'LIN' + lcrv['tmin'] = '2020-01-01T00:00:00' + lcrv['tmax'] = '2020-01-01T00:05:00' + lcrv['tbins'] = 3 + lcrv['method'] = '3D' + lcrv['enumbins'] = 0 + lcrv['emin'] = 0.1 + lcrv['emax'] = 100.0 + lcrv['outfile'] = 'cslightcrv_py6.fits' + lcrv['logfile'] = 'cslightcrv_py6.log' + lcrv['chatter'] = 2 + lcrv['publish'] = True + lcrv['nthreads'] = 1 + + # Run cslightcrv script and save light curve + lcrv.logFileOpen() # Make sure we get a log file + lcrv.run() + lcrv.save() + + # Check light curve + self._check_light_curve('cslightcrv_py6.fits', 3) + # Return return diff --git a/test/test_csphasecrv.py b/test/test_csphasecrv.py index df65fc2..0afa539 100755 --- a/test/test_csphasecrv.py +++ b/test/test_csphasecrv.py @@ -268,6 +268,33 @@ class Test(test): # Check phase curve self._check_phase_curve('csphasecrv_py5.fits', 2) + # Set-up csphasecrv without multiprocessing + pcrv = cscripts.csphasecrv() + pcrv['inobs'] = self._phased_events + pcrv['inmodel'] = self._model + pcrv['srcname'] = 'Crab' + pcrv['caldb'] = self._caldb + pcrv['irf'] = self._irf + pcrv['phbinalg'] = 'LIN' + pcrv['phbins'] = 5 + pcrv['method'] = '3D' + pcrv['enumbins'] = 0 + pcrv['emin'] = 0.1 + pcrv['emax'] = 100.0 + pcrv['outfile'] = 'csphasecrv_py6.fits' + pcrv['logfile'] = 'csphasecrv_py6.log' + pcrv['chatter'] = 2 + pcrv['publish'] = True + pcrv['nthreads'] = 1 + + # Run csphasecrv script and save phase curve + pcrv.logFileOpen() # Make sure we get a log file + pcrv.run() + pcrv.save() + + # Check phase curve + self._check_phase_curve('csphasecrv_py6.fits', 5) + # Return return -- libgit2 0.21.4