Commit 8fa52c81ee8e57e2ceaff396b1a903d52fb36d2b
1 parent
abb29aa8
Unit tests for multiprocessing of cslightcrv and csphasecrv
Showing
2 changed files
with
56 additions
and
0 deletions
test/test_cslightcrv.py
| ... | ... | @@ -272,6 +272,35 @@ class Test(test): |
| 272 | 272 | # Check light curve |
| 273 | 273 | self._check_light_curve('cslightcrv_py5.fits', 2) |
| 274 | 274 | |
| 275 | + # Set-up cslightcrv without multiprocessing | |
| 276 | + lcrv = cscripts.cslightcrv() | |
| 277 | + lcrv['inobs'] = self._events | |
| 278 | + lcrv['inmodel'] = self._model | |
| 279 | + lcrv['srcname'] = 'Crab' | |
| 280 | + lcrv['caldb'] = self._caldb | |
| 281 | + lcrv['irf'] = self._irf | |
| 282 | + lcrv['tbinalg'] = 'LIN' | |
| 283 | + lcrv['tmin'] = '2020-01-01T00:00:00' | |
| 284 | + lcrv['tmax'] = '2020-01-01T00:05:00' | |
| 285 | + lcrv['tbins'] = 3 | |
| 286 | + lcrv['method'] = '3D' | |
| 287 | + lcrv['enumbins'] = 0 | |
| 288 | + lcrv['emin'] = 0.1 | |
| 289 | + lcrv['emax'] = 100.0 | |
| 290 | + lcrv['outfile'] = 'cslightcrv_py6.fits' | |
| 291 | + lcrv['logfile'] = 'cslightcrv_py6.log' | |
| 292 | + lcrv['chatter'] = 2 | |
| 293 | + lcrv['publish'] = True | |
| 294 | + lcrv['nthreads'] = 1 | |
| 295 | + | |
| 296 | + # Run cslightcrv script and save light curve | |
| 297 | + lcrv.logFileOpen() # Make sure we get a log file | |
| 298 | + lcrv.run() | |
| 299 | + lcrv.save() | |
| 300 | + | |
| 301 | + # Check light curve | |
| 302 | + self._check_light_curve('cslightcrv_py6.fits', 3) | |
| 303 | + | |
| 275 | 304 | # Return |
| 276 | 305 | return |
| 277 | 306 | ... | ... |
test/test_csphasecrv.py
| ... | ... | @@ -268,6 +268,33 @@ class Test(test): |
| 268 | 268 | # Check phase curve |
| 269 | 269 | self._check_phase_curve('csphasecrv_py5.fits', 2) |
| 270 | 270 | |
| 271 | + # Set-up csphasecrv without multiprocessing | |
| 272 | + pcrv = cscripts.csphasecrv() | |
| 273 | + pcrv['inobs'] = self._phased_events | |
| 274 | + pcrv['inmodel'] = self._model | |
| 275 | + pcrv['srcname'] = 'Crab' | |
| 276 | + pcrv['caldb'] = self._caldb | |
| 277 | + pcrv['irf'] = self._irf | |
| 278 | + pcrv['phbinalg'] = 'LIN' | |
| 279 | + pcrv['phbins'] = 5 | |
| 280 | + pcrv['method'] = '3D' | |
| 281 | + pcrv['enumbins'] = 0 | |
| 282 | + pcrv['emin'] = 0.1 | |
| 283 | + pcrv['emax'] = 100.0 | |
| 284 | + pcrv['outfile'] = 'csphasecrv_py6.fits' | |
| 285 | + pcrv['logfile'] = 'csphasecrv_py6.log' | |
| 286 | + pcrv['chatter'] = 2 | |
| 287 | + pcrv['publish'] = True | |
| 288 | + pcrv['nthreads'] = 1 | |
| 289 | + | |
| 290 | + # Run csphasecrv script and save phase curve | |
| 291 | + pcrv.logFileOpen() # Make sure we get a log file | |
| 292 | + pcrv.run() | |
| 293 | + pcrv.save() | |
| 294 | + | |
| 295 | + # Check phase curve | |
| 296 | + self._check_phase_curve('csphasecrv_py6.fits', 5) | |
| 297 | + | |
| 271 | 298 | # Return |
| 272 | 299 | return |
| 273 | 300 | ... | ... |