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 204 """
205 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 212 # Get stacked exposure
208 213 expcube = ctools.ctexpcube(self.obs)
209 214 expcube["incube"] = "NONE"
... ... @@ -215,24 +220,32 @@ class cspull(ctools.cscript):
215 220 expcube["enumbins"] = self.m_enumbins
216 221 expcube["emin"] = self["emin"].real()
217 222 expcube["emax"] = self["emax"].real()
218   - expcube["coordsys"] = "GAL"
  223 + expcube["coordsys"] = "CEL"
219 224 expcube["proj"] = "TAN"
220 225 expcube.run()
  226 +
  227 + # Notify exposure computation
  228 + if self.logTerse():
  229 + self.log("Computed exposure cube\n")
221 230  
222 231 # Get stacked Psf
223 232 psfcube = ctools.ctpsfcube(self.obs)
224 233 psfcube["incube"] = "NONE"
225 234 psfcube["usepnt"] = True
226 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 239 psfcube["enumbins"] = self.m_enumbins
231 240 psfcube["emin"] = self["emin"].real()
232 241 psfcube["emax"] = self["emax"].real()
233   - psfcube["coordsys"] = "GAL"
  242 + psfcube["coordsys"] = "CEL"
234 243 psfcube["proj"] = "TAN"
235 244 psfcube.run()
  245 +
  246 + # Notify Psf computation
  247 + if self.logTerse():
  248 + self.log("Computed Psf cube\n")
236 249  
237 250 # Get stacked background
238 251 bkgcube = ctools.ctbkgcube(self.obs)
... ... @@ -245,9 +258,13 @@ class cspull(ctools.cscript):
245 258 bkgcube["enumbins"] = self.m_enumbins
246 259 bkgcube["emin"] = self["emin"].real()
247 260 bkgcube["emax"] = self["emax"].real()
248   - bkgcube["coordsys"] = "GAL"
  261 + bkgcube["coordsys"] = "CEL"
249 262 bkgcube["proj"] = "TAN"
250 263 bkgcube.run()
  264 +
  265 + # Notify background cube computation
  266 + if self.logTerse():
  267 + self.log("Computed background cube\n")
251 268  
252 269 # Store results
253 270 self.m_exposure = expcube.expcube().copy()
... ... @@ -270,10 +287,6 @@ class cspull(ctools.cscript):
270 287 # Get parameters
271 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 290 # Write input parameters into logger
278 291 if self.logTerse():
279 292 self.log_parameters()
... ... @@ -282,10 +295,14 @@ class cspull(ctools.cscript):
282 295 # Write observation into logger
283 296 if self.logTerse():
284 297 self.log("\n")
285   - self.log.header1("Observation")
  298 + self.log.header1("Observation(s)")
286 299 self.log(str(self.obs))
287 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 306 # Write header
290 307 if self.logTerse():
291 308 self.log("\n")
... ...