Commit f1204a0c8055725d5e02e24ff6f71b992b176789

Authored by Jürgen Knödlseder
1 parent 6c0a5e3b

Enhance ctbin Python module unit test to see that read_ahead() gets enabled.

Showing 1 changed file with 18 additions and 11 deletions
test/test_ctbin.py
@@ -150,10 +150,9 @@ class Test(gammalib.GPythonTestSuite): @@ -150,10 +150,9 @@ class Test(gammalib.GPythonTestSuite):
150 self._test_observation(bin, 5542, multiplier=3) 150 self._test_observation(bin, 5542, multiplier=3)
151 self._test_cube(bin.cube(), 5542, multiplier=3) 151 self._test_cube(bin.cube(), 5542, multiplier=3)
152 152
153 - # Set-up ctbin with invalid event file  
154 - bin = ctools.ctbin()  
155 - bin["inobs"] = "event_file_that_does_not_exist.fits"  
156 - bin["outcube"] = "cntmap.fits" 153 + # Set-up ctbin using an observation container
  154 + bin = ctools.ctbin(obs)
  155 + bin["outcube"] = "cntmap2.fits"
157 bin["ebinalg"] = "LOG" 156 bin["ebinalg"] = "LOG"
158 bin["emin"] = 0.1 157 bin["emin"] = 0.1
159 bin["emax"] = 100.0 158 bin["emax"] = 100.0
@@ -166,13 +165,21 @@ class Test(gammalib.GPythonTestSuite): @@ -166,13 +165,21 @@ class Test(gammalib.GPythonTestSuite):
166 bin["xref"] = 83.63 165 bin["xref"] = 83.63
167 bin["yref"] = 22.01 166 bin["yref"] = 22.01
168 167
169 - # Run ctbin tool  
170 - self.test_try("Run ctbin with invalid event file")  
171 - try:  
172 - bin.run()  
173 - self.test_try_failure()  
174 - except:  
175 - self.test_try_success() 168 + # Execute ctbin tool
  169 + bin.execute()
  170 +
  171 + # Load counts cube and check content.
  172 + evt = gammalib.GCTAEventCube("cntmap2.fits")
  173 + self._test_cube(evt, 5542, multiplier=3)
  174 +
  175 + # Clear tool
  176 + #bin.clear()
  177 +#what(): *** ERROR in GApplicationPars::write(std::string&): Unable to open parameter file "pfiles/".
  178 +
  179 + # Check content of observation and cube
  180 + #self.test_value(bin.obs().size(), 0, "There is no observation")
  181 + #self.test_value(bin.cube().size(), 0, "0 event bins")
  182 + #self.test_value(bin.cube().number(), 0, "0 events")
176 183
177 # Return 184 # Return
178 return 185 return