Commit 0ee0ebebdef9f5f7b3f29ef10f118bb964ca32bf

Authored by Jürgen Knödlseder
1 parent 2ccaeea7

Enhance cspull information logging.

Showing 1 changed file with 28 additions and 11 deletions
cscripts/cspull.py
@@ -204,6 +204,11 @@ class cspull(ctools.cscript): @@ -204,6 +204,11 @@ class cspull(ctools.cscript):
204 """ 204 """
205 For stacked analysis prepare stacked irfs 205 For stacked analysis prepare stacked irfs
206 """ 206 """
  207 + # Write header into logger
  208 + if self.logTerse():
  209 + self.log("\n")
  210 + self.log.header1("Compute stacked response")
  211 +
207 # Get stacked exposure 212 # Get stacked exposure
208 expcube = ctools.ctexpcube(self.obs) 213 expcube = ctools.ctexpcube(self.obs)
209 expcube["incube"] = "NONE" 214 expcube["incube"] = "NONE"
@@ -215,24 +220,32 @@ class cspull(ctools.cscript): @@ -215,24 +220,32 @@ class cspull(ctools.cscript):
215 expcube["enumbins"] = self.m_enumbins 220 expcube["enumbins"] = self.m_enumbins
216 expcube["emin"] = self["emin"].real() 221 expcube["emin"] = self["emin"].real()
217 expcube["emax"] = self["emax"].real() 222 expcube["emax"] = self["emax"].real()
218 - expcube["coordsys"] = "GAL" 223 + expcube["coordsys"] = "CEL"
219 expcube["proj"] = "TAN" 224 expcube["proj"] = "TAN"
220 expcube.run() 225 expcube.run()
  226 +
  227 + # Notify exposure computation
  228 + if self.logTerse():
  229 + self.log("Computed exposure cube\n")
221 230
222 # Get stacked Psf 231 # Get stacked Psf
223 psfcube = ctools.ctpsfcube(self.obs) 232 psfcube = ctools.ctpsfcube(self.obs)
224 psfcube["incube"] = "NONE" 233 psfcube["incube"] = "NONE"
225 psfcube["usepnt"] = True 234 psfcube["usepnt"] = True
226 psfcube["ebinalg"] = "LOG" 235 psfcube["ebinalg"] = "LOG"
227 - psfcube["binsz"] = self.m_binsz  
228 - psfcube["nxpix"] = self.m_npix  
229 - psfcube["nypix"] = self.m_npix 236 + psfcube["binsz"] = self.m_binsz*10.0
  237 + psfcube["nxpix"] = self.m_npix/10
  238 + psfcube["nypix"] = self.m_npix/10
230 psfcube["enumbins"] = self.m_enumbins 239 psfcube["enumbins"] = self.m_enumbins
231 psfcube["emin"] = self["emin"].real() 240 psfcube["emin"] = self["emin"].real()
232 psfcube["emax"] = self["emax"].real() 241 psfcube["emax"] = self["emax"].real()
233 - psfcube["coordsys"] = "GAL" 242 + psfcube["coordsys"] = "CEL"
234 psfcube["proj"] = "TAN" 243 psfcube["proj"] = "TAN"
235 psfcube.run() 244 psfcube.run()
  245 +
  246 + # Notify Psf computation
  247 + if self.logTerse():
  248 + self.log("Computed Psf cube\n")
236 249
237 # Get stacked background 250 # Get stacked background
238 bkgcube = ctools.ctbkgcube(self.obs) 251 bkgcube = ctools.ctbkgcube(self.obs)
@@ -245,9 +258,13 @@ class cspull(ctools.cscript): @@ -245,9 +258,13 @@ class cspull(ctools.cscript):
245 bkgcube["enumbins"] = self.m_enumbins 258 bkgcube["enumbins"] = self.m_enumbins
246 bkgcube["emin"] = self["emin"].real() 259 bkgcube["emin"] = self["emin"].real()
247 bkgcube["emax"] = self["emax"].real() 260 bkgcube["emax"] = self["emax"].real()
248 - bkgcube["coordsys"] = "GAL" 261 + bkgcube["coordsys"] = "CEL"
249 bkgcube["proj"] = "TAN" 262 bkgcube["proj"] = "TAN"
250 bkgcube.run() 263 bkgcube.run()
  264 +
  265 + # Notify background cube computation
  266 + if self.logTerse():
  267 + self.log("Computed background cube\n")
251 268
252 # Store results 269 # Store results
253 self.m_exposure = expcube.expcube().copy() 270 self.m_exposure = expcube.expcube().copy()
@@ -270,10 +287,6 @@ class cspull(ctools.cscript): @@ -270,10 +287,6 @@ class cspull(ctools.cscript):
270 # Get parameters 287 # Get parameters
271 self.get_parameters() 288 self.get_parameters()
272 289
273 - # If several observations and binned: prepare stacked irfs  
274 - if self.obs.size() > 1 and self.m_enumbins > 0:  
275 - self.set_stacked_irf()  
276 -  
277 # Write input parameters into logger 290 # Write input parameters into logger
278 if self.logTerse(): 291 if self.logTerse():
279 self.log_parameters() 292 self.log_parameters()
@@ -282,10 +295,14 @@ class cspull(ctools.cscript): @@ -282,10 +295,14 @@ class cspull(ctools.cscript):
282 # Write observation into logger 295 # Write observation into logger
283 if self.logTerse(): 296 if self.logTerse():
284 self.log("\n") 297 self.log("\n")
285 - self.log.header1("Observation") 298 + self.log.header1("Observation(s)")
286 self.log(str(self.obs)) 299 self.log(str(self.obs))
287 self.log("\n") 300 self.log("\n")
288 301
  302 + # If several observations and binned: prepare stacked irfs
  303 + if self.obs.size() > 1 and self.m_enumbins > 0:
  304 + self.set_stacked_irf()
  305 +
289 # Write header 306 # Write header
290 if self.logTerse(): 307 if self.logTerse():
291 self.log("\n") 308 self.log("\n")