diff --git a/cscripts/csobsinfo.py b/cscripts/csobsinfo.py index 585e784..00ae10d 100755 --- a/cscripts/csobsinfo.py +++ b/cscripts/csobsinfo.py @@ -137,16 +137,16 @@ class csobsinfo(ctools.cscript): # Initialise arrays to store certain values for reuse # Todo, think about using a python dictionary - self.offsets = [] - self.zeniths = [] - self.azimuths = [] + self.m_offsets = [] + self.m_zeniths = [] + self.m_azimuths = [] self.pnt_ra = [] self.pnt_dec = [] obs_names = [] # Initialise output to be filled - self.ebounds = gammalib.GEbounds() - self.gti = gammalib.GGti() + self.m_ebounds = gammalib.GEbounds() + self.m_gti = gammalib.GGti() ontime = 0.0 livetime = 0.0 n_events = 0 @@ -197,10 +197,10 @@ class csobsinfo(ctools.cscript): # If avaliable append energy boundaries if obs_bounds.size() > 0 : - self.ebounds.merge(obs_bounds.emin(),obs_bounds.emax()) + self.m_ebounds.append(obs_bounds.emin(),obs_bounds.emax()) # Append time interval - self.gti.merge(obs_gti.tstart(), obs_gti.tstop()) + self.m_gti.append(obs_gti.tstart(), obs_gti.tstop()) # increment global livetime and ontime ontime += obs.ontime() @@ -271,18 +271,18 @@ class csobsinfo(ctools.cscript): # Log offset if possible if self.m_offset: offset = pnt_dir.dist_deg(self.obj_dir) - self.offsets.append(offset) + self.m_offsets.append(offset) self.log.parformat("Offset") self.log("%.2f" % (offset)) self.log("\n") else: - self.offsets.append(-1.0) + self.m_offsets.append(-1.0) # Retrieve zenith and azimuth and store for later use zenith = obs.pointing().zenith() azimuth = obs.pointing().azimuth() - self.zeniths.append(zenith) - self.azimuths.append(azimuth) + self.m_zeniths.append(zenith) + self.m_azimuths.append(azimuth) # Log Zenith and Azimuth if required if self.logExplicit(): @@ -317,15 +317,15 @@ class csobsinfo(ctools.cscript): # Log mean offset if possible if self.m_offset: self.log.parformat("Mean offset angle") - self.log("%.2f" % (sum(self.offsets)/len(self.offsets))) + self.log("%.2f" % (sum(self.m_offsets)/len(self.m_offsets))) self.log("\n") # Log mean azimuth and zenith angle self.log.parformat("Mean zenith angle") - self.log("%.2f" % (sum(self.zeniths)/len(self.zeniths))) + self.log("%.2f" % (sum(self.m_zeniths)/len(self.m_zeniths))) self.log("\n") self.log.parformat("Mean azimuth angle") - self.log("%.2f" % (sum(self.azimuths)/len(self.azimuths))) + self.log("%.2f" % (sum(self.m_azimuths)/len(self.m_azimuths))) self.log("\n") # Log name of observations if requested @@ -340,25 +340,25 @@ class csobsinfo(ctools.cscript): # Log energy range self.log.header3("Energy range") self.log.parformat("Emin") - if self.ebounds.size() == 0: + if self.m_ebounds.size() == 0: self.log("undefined") else: - self.log(str(self.ebounds.emin())) + self.log(str(self.m_ebounds.emin())) self.log("\n") self.log.parformat("Emax") - if self.ebounds.size() == 0: + if self.m_ebounds.size() == 0: self.log("undefined") else: - self.log(str(self.ebounds.emax())) + self.log(str(self.m_ebounds.emax())) self.log("\n\n") # Log time range self.log.header3("Time range") self.log.parformat("Start [MJD]") - self.log(str(self.gti.tstart().mjd())) + self.log(str(self.m_gti.tstart().mjd())) self.log("\n") self.log.parformat("Stop [MJD]") - self.log(str(self.gti.tstop().mjd())) + self.log(str(self.m_gti.tstop().mjd())) self.log("\n") # Log ontime and livetime in different units @@ -408,31 +408,31 @@ class csobsinfo(ctools.cscript): """ Return zenith angles """ - return self.zeniths + return self.m_zeniths def azimuths(self): """ Return azimuth angles """ - return self.azimuths + return self.m_azimuths def offsets(self): """ Return offset angles """ - return self.offsets + return self.m_offsets def ebounds(self): """ Return energy boundaries """ - return self.ebounds + return self.m_ebounds def gti(self): """ Return good time intervals """ - return self.gti + return self.m_gti def execute(self): """