Commit 7a078c9618215161bd9383b9a4bcf640773a81fb

Authored by Michael Mayer
1 parent 44f48666

Minor updates to csobsinfo

Showing 1 changed file with 25 additions and 25 deletions
cscripts/csobsinfo.py
... ... @@ -137,16 +137,16 @@ class csobsinfo(ctools.cscript):
137 137  
138 138 # Initialise arrays to store certain values for reuse
139 139 # Todo, think about using a python dictionary
140   - self.offsets = []
141   - self.zeniths = []
142   - self.azimuths = []
  140 + self.m_offsets = []
  141 + self.m_zeniths = []
  142 + self.m_azimuths = []
143 143 self.pnt_ra = []
144 144 self.pnt_dec = []
145 145 obs_names = []
146 146  
147 147 # Initialise output to be filled
148   - self.ebounds = gammalib.GEbounds()
149   - self.gti = gammalib.GGti()
  148 + self.m_ebounds = gammalib.GEbounds()
  149 + self.m_gti = gammalib.GGti()
150 150 ontime = 0.0
151 151 livetime = 0.0
152 152 n_events = 0
... ... @@ -197,10 +197,10 @@ class csobsinfo(ctools.cscript):
197 197  
198 198 # If avaliable append energy boundaries
199 199 if obs_bounds.size() > 0 :
200   - self.ebounds.merge(obs_bounds.emin(),obs_bounds.emax())
  200 + self.m_ebounds.append(obs_bounds.emin(),obs_bounds.emax())
201 201  
202 202 # Append time interval
203   - self.gti.merge(obs_gti.tstart(), obs_gti.tstop())
  203 + self.m_gti.append(obs_gti.tstart(), obs_gti.tstop())
204 204  
205 205 # increment global livetime and ontime
206 206 ontime += obs.ontime()
... ... @@ -271,18 +271,18 @@ class csobsinfo(ctools.cscript):
271 271 # Log offset if possible
272 272 if self.m_offset:
273 273 offset = pnt_dir.dist_deg(self.obj_dir)
274   - self.offsets.append(offset)
  274 + self.m_offsets.append(offset)
275 275 self.log.parformat("Offset")
276 276 self.log("%.2f" % (offset))
277 277 self.log("\n")
278 278 else:
279   - self.offsets.append(-1.0)
  279 + self.m_offsets.append(-1.0)
280 280  
281 281 # Retrieve zenith and azimuth and store for later use
282 282 zenith = obs.pointing().zenith()
283 283 azimuth = obs.pointing().azimuth()
284   - self.zeniths.append(zenith)
285   - self.azimuths.append(azimuth)
  284 + self.m_zeniths.append(zenith)
  285 + self.m_azimuths.append(azimuth)
286 286  
287 287 # Log Zenith and Azimuth if required
288 288 if self.logExplicit():
... ... @@ -317,15 +317,15 @@ class csobsinfo(ctools.cscript):
317 317 # Log mean offset if possible
318 318 if self.m_offset:
319 319 self.log.parformat("Mean offset angle")
320   - self.log("%.2f" % (sum(self.offsets)/len(self.offsets)))
  320 + self.log("%.2f" % (sum(self.m_offsets)/len(self.m_offsets)))
321 321 self.log("\n")
322 322  
323 323 # Log mean azimuth and zenith angle
324 324 self.log.parformat("Mean zenith angle")
325   - self.log("%.2f" % (sum(self.zeniths)/len(self.zeniths)))
  325 + self.log("%.2f" % (sum(self.m_zeniths)/len(self.m_zeniths)))
326 326 self.log("\n")
327 327 self.log.parformat("Mean azimuth angle")
328   - self.log("%.2f" % (sum(self.azimuths)/len(self.azimuths)))
  328 + self.log("%.2f" % (sum(self.m_azimuths)/len(self.m_azimuths)))
329 329 self.log("\n")
330 330  
331 331 # Log name of observations if requested
... ... @@ -340,25 +340,25 @@ class csobsinfo(ctools.cscript):
340 340 # Log energy range
341 341 self.log.header3("Energy range")
342 342 self.log.parformat("Emin")
343   - if self.ebounds.size() == 0:
  343 + if self.m_ebounds.size() == 0:
344 344 self.log("undefined")
345 345 else:
346   - self.log(str(self.ebounds.emin()))
  346 + self.log(str(self.m_ebounds.emin()))
347 347 self.log("\n")
348 348 self.log.parformat("Emax")
349   - if self.ebounds.size() == 0:
  349 + if self.m_ebounds.size() == 0:
350 350 self.log("undefined")
351 351 else:
352   - self.log(str(self.ebounds.emax()))
  352 + self.log(str(self.m_ebounds.emax()))
353 353 self.log("\n\n")
354 354  
355 355 # Log time range
356 356 self.log.header3("Time range")
357 357 self.log.parformat("Start [MJD]")
358   - self.log(str(self.gti.tstart().mjd()))
  358 + self.log(str(self.m_gti.tstart().mjd()))
359 359 self.log("\n")
360 360 self.log.parformat("Stop [MJD]")
361   - self.log(str(self.gti.tstop().mjd()))
  361 + self.log(str(self.m_gti.tstop().mjd()))
362 362 self.log("\n")
363 363  
364 364 # Log ontime and livetime in different units
... ... @@ -408,31 +408,31 @@ class csobsinfo(ctools.cscript):
408 408 """
409 409 Return zenith angles
410 410 """
411   - return self.zeniths
  411 + return self.m_zeniths
412 412  
413 413 def azimuths(self):
414 414 """
415 415 Return azimuth angles
416 416 """
417   - return self.azimuths
  417 + return self.m_azimuths
418 418  
419 419 def offsets(self):
420 420 """
421 421 Return offset angles
422 422 """
423   - return self.offsets
  423 + return self.m_offsets
424 424  
425 425 def ebounds(self):
426 426 """
427 427 Return energy boundaries
428 428 """
429   - return self.ebounds
  429 + return self.m_ebounds
430 430  
431 431 def gti(self):
432 432 """
433 433 Return good time intervals
434 434 """
435   - return self.gti
  435 + return self.m_gti
436 436  
437 437 def execute(self):
438 438 """
... ...