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