Commit df492129c12c9bdd790c7a7960eee3e2999194cb

Authored by Michael Mayer
1 parent 98256666

Added minor improvements to two cscripts

cscripts/csiactdata.py
... ... @@ -163,8 +163,11 @@ class csiactdata(ctools.cscript):
163 163 hdu = os.path.join(self.datapath, config["hduindx"])
164 164 obs = os.path.join(self.datapath, config["obsindx"])
165 165  
  166 + filename_hdu = gammalib.GFilename(str(hdu)+"[HDU_INDEX]")
  167 + filename_obs = gammalib.GFilename(str(obs)+"[OBS_INDEX]")
  168 +
166 169 # Check if index files are available
167   - if not (gammalib.is_fits(str(hdu)) and gammalib.is_fits(str(obs))):
  170 + if not (filename_hdu.is_fits() and filename_obs.is_fits()):
168 171 self.log.parformat(str(config["name"]))
169 172 self.log("Not available")
170 173 self.log("\n")
... ... @@ -180,13 +183,31 @@ class csiactdata(ctools.cscript):
180 183 hdu = os.path.join(self.datapath, config["hduindx"])
181 184 obs = os.path.join(self.datapath, config["obsindx"])
182 185  
  186 + filename_hdu = gammalib.GFilename(str(hdu)+"[HDU_INDEX]")
  187 + filename_obs = gammalib.GFilename(str(obs)+"[OBS_INDEX]")
  188 +
183 189 # Check if index files are available
184   - if gammalib.is_fits(str(hdu)) and gammalib.is_fits(str(obs)):
  190 + if (filename_hdu.is_fits() and filename_obs.is_fits()):
185 191  
186 192 # Log data information
187 193 self.log("\n")
188 194 self.log.header3(str(config["name"]))
  195 +
  196 + # Print important informations first
  197 + self.log.parformat("Name")
  198 + self.log(str(config["name"]))
  199 + self.log("\n")
  200 + self.log.parformat("Observation index")
  201 + self.log(str(config["obsindx"]))
  202 + self.log("\n")
  203 + self.log.parformat("HDU index")
  204 + self.log(str(config["hduindx"]))
  205 + self.log("\n")
  206 +
  207 + # Print additional information
189 208 for key in config:
  209 + if key in ["name","hduindx","obsindx"]:
  210 + continue
190 211 self.log.parformat(str(key))
191 212 self.log(str(config[key]))
192 213 self.log("\n")
... ...
cscripts/csiactobs.py
... ... @@ -220,6 +220,25 @@ class csiactobs(ctools.cscript):
220 220 # Return
221 221 return
222 222  
  223 + def runlist(self, runlist):
  224 + """
  225 + Set observation list
  226 + """
  227 +
  228 + # Type check
  229 + if isinstance(runlist, list):
  230 +
  231 + # Store a copy of input argument
  232 + self.runlist = list(runlist)
  233 +
  234 + else:
  235 +
  236 + # raise error if wrong type detected
  237 + raise RuntimeError("Argument of csiactobs.runlist() must be of type 'list'")
  238 +
  239 + # Return
  240 + return
  241 +
223 242 def background_spectrum(self, run, prefactor, index, emin = 0.01, emax = 100.0):
224 243  
225 244 # Handle constant spectral model
... ...