Commit d95b44cefea7325cc031d2fe7d9628f5a31a3023
1 parent
75c1aae6
Added tests for command line execution.
Showing
2 changed files
with
50 additions
and
0 deletions
test/data/obs_unbinned_two.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| 2 | +<observation_list title="observation list"> | |
| 3 | + <observation name="" id="00001" instrument="CTA"> | |
| 4 | + <parameter name="EventList" file="$(TEST_DATA)/crab_events.fits" /> | |
| 5 | + <parameter name="EffectiveArea" file="$(TEST_DATA)/irf_file.fits" /> | |
| 6 | + <parameter name="PointSpreadFunction" file="$(TEST_DATA)/irf_file.fits" /> | |
| 7 | + <parameter name="EnergyDispersion" file="$(TEST_DATA)/irf_file.fits" /> | |
| 8 | + <parameter name="Background" file="$(TEST_DATA)/irf_file.fits" /> | |
| 9 | + </observation> | |
| 10 | + <observation name="" id="00002" instrument="CTA"> | |
| 11 | + <parameter name="EventList" file="$(TEST_DATA)/crab_events.fits" /> | |
| 12 | + <parameter name="EffectiveArea" file="$(TEST_DATA)/irf_file.fits" /> | |
| 13 | + <parameter name="PointSpreadFunction" file="$(TEST_DATA)/irf_file.fits" /> | |
| 14 | + <parameter name="EnergyDispersion" file="$(TEST_DATA)/irf_file.fits" /> | |
| 15 | + <parameter name="Background" file="$(TEST_DATA)/irf_file.fits" /> | |
| 16 | + </observation> | |
| 17 | +</observation_list> | ... | ... |
test/test_ctbin.py
| ... | ... | @@ -113,6 +113,39 @@ class Test(test): |
| 113 | 113 | evt = gammalib.GCTAEventCube('cntmap_cmd3.fits') |
| 114 | 114 | self._check_cube(evt, 115) |
| 115 | 115 | |
| 116 | + # Check joint (unstacked) binning | |
| 117 | + | |
| 118 | + # Setup ctbin command | |
| 119 | + cmd = ctbin+' inobs="obs_unbinned_two.xml"'+ \ | |
| 120 | + ' outcube="cntmap_cmd4.fits"'+\ | |
| 121 | + ' emin=1.0 emax=100.0 enumbins=10 ebinalg="LOG"'+ \ | |
| 122 | + ' nxpix=40 nypix=40 binsz=0.1 coordsys="CEL"'+ \ | |
| 123 | + ' xref=83.63 yref=22.01 proj="CAR"'+ \ | |
| 124 | + ' logfile="ctbin_cmd4.log" chatter=1 stack=no' | |
| 125 | + | |
| 126 | + # Check if execution was successful | |
| 127 | + self.test_value(self._execute(cmd), 0, | |
| 128 | + 'Check successful execution from command line with stack=no') | |
| 129 | + | |
| 130 | + # Load counts cubes and check content. | |
| 131 | + evt = gammalib.GCTAEventCube('cntmap_cmd4_00001.fits') | |
| 132 | + self._check_cube(evt, 245) | |
| 133 | + | |
| 134 | + # Load counts cubes and check content. | |
| 135 | + evt = gammalib.GCTAEventCube('cntmap_cmd4_00002.fits') | |
| 136 | + self._check_cube(evt, 245) | |
| 137 | + | |
| 138 | + # Check observation definition out file | |
| 139 | + obs = gammalib.GObservations('obs_unbinned_two_binned.xml') | |
| 140 | + self.test_value(obs.size(), 2, 'Check for 2 observations in XML file') | |
| 141 | + | |
| 142 | + # Check for content of observations file | |
| 143 | + self.test_value(obs[0].eventfile().file(), 'cntmap_cmd4_00001.fits', | |
| 144 | + 'Check counts cube file name') | |
| 145 | + self.test_value(obs[1].eventfile().file(), 'cntmap_cmd4_00002.fits', | |
| 146 | + 'Check counts cube file name') | |
| 147 | + | |
| 148 | + | |
| 116 | 149 | # Check ctbin --help |
| 117 | 150 | self._check_help(ctbin) |
| 118 | 151 | ... | ... |