Commit b747ad54cb222d0569b92111f8a7ceab390ae9a3
1 parent
a499351c
Add documentation and remove IRF parameters and writing of attributes (this shou…
…ld not be part of the observation definition step).
Showing
1 changed file
with
19 additions
and
38 deletions
scripts/csobsdef.py
| ... | ... | @@ -29,7 +29,25 @@ import sys |
| 29 | 29 | class csobsdef(ctools.cscript): |
| 30 | 30 | """ |
| 31 | 31 | The csobsdef class generates an observation definition file from a |
| 32 | - pointing list. | |
| 32 | + pointing list. The pointing list is a colon separated value ASCII | |
| 33 | + file with header keywords in the first row followed by a list of | |
| 34 | + pointings (one pointing per row). The following header keywords | |
| 35 | + are supported (case sensitive, column order irrelevant): | |
| 36 | + | |
| 37 | + name - Observation name string | |
| 38 | + id - Unique observation identifier string | |
| 39 | + ra - Right Ascension of pointing (deg) | |
| 40 | + dec - Declination of pointing (deg) | |
| 41 | + lon - Galactic longitude of pointing (deg) | |
| 42 | + lat - Galactic latitude of pointing (deg) | |
| 43 | + duration - Duration of pointing (seconds) | |
| 44 | + emin - Lower energy limit (TeV) | |
| 45 | + emax - Upper energy limit (TeV) | |
| 46 | + rad - Radius of region of interest (deg) | |
| 47 | + | |
| 48 | + Only the pairs (ra,dec) or (lon,lat) are mandatory header keywords. | |
| 49 | + All other are optional and are queried as user parameters if they | |
| 50 | + are not specified in the pointing list. | |
| 33 | 51 | """ |
| 34 | 52 | def __init__(self, *argv): |
| 35 | 53 | """ |
| ... | ... | @@ -93,8 +111,6 @@ class csobsdef(ctools.cscript): |
| 93 | 111 | pars = gammalib.GApplicationPars() |
| 94 | 112 | pars.append(gammalib.GApplicationPar("inpnt","f","a","NONE","","","Pointing definition file")) |
| 95 | 113 | pars.append(gammalib.GApplicationPar("outobs","f","a","obs.xml","","","Output observation definition file")) |
| 96 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 97 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 98 | 114 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) |
| 99 | 115 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) |
| 100 | 116 | pars.append(gammalib.GApplicationPar("duration","r","a","1800.0","","","Pointing duration (seconds)")) |
| ... | ... | @@ -218,17 +234,6 @@ class csobsdef(ctools.cscript): |
| 218 | 234 | " definition file.") |
| 219 | 235 | obs.pointing(gammalib.GCTAPointing(pntdir)) |
| 220 | 236 | |
| 221 | - # Set response function | |
| 222 | - if "caldb" in header: | |
| 223 | - caldb = pntdef[row, header.index("caldb")] | |
| 224 | - else: | |
| 225 | - caldb = self["caldb"].string() | |
| 226 | - if "irf" in header: | |
| 227 | - irf = pntdef[row, header.index("irf")] | |
| 228 | - else: | |
| 229 | - irf = self["irf"].string() | |
| 230 | - obs = self.__set_response(obs, caldb, irf) | |
| 231 | - | |
| 232 | 237 | # Set deadtime correction factor |
| 233 | 238 | if "deadc" in header: |
| 234 | 239 | deadc = float(pntdef[row, header.index("deadc")]) |
| ... | ... | @@ -285,30 +290,6 @@ class csobsdef(ctools.cscript): |
| 285 | 290 | # Return |
| 286 | 291 | return |
| 287 | 292 | |
| 288 | - def __set_response(self, obs, caldb, irf): | |
| 289 | - """ | |
| 290 | - Set response for an observation. We create an XML element for that | |
| 291 | - so that the response XML writer will write the database and response | |
| 292 | - name into the observation definition file. | |
| 293 | - """ | |
| 294 | - # Create XML element | |
| 295 | - xml = gammalib.GXmlElement() | |
| 296 | - | |
| 297 | - # Append parameter | |
| 298 | - parameter = "parameter name=\"Calibration\" database=\""+\ | |
| 299 | - caldb+"\" response=\""+irf+"\"" | |
| 300 | - xml.append(gammalib.GXmlElement(parameter)) | |
| 301 | - | |
| 302 | - # Create CTA response | |
| 303 | - response = gammalib.GCTAResponseIrf() | |
| 304 | - response.read(xml) | |
| 305 | - | |
| 306 | - # Attach response to observation | |
| 307 | - obs.response(response) | |
| 308 | - | |
| 309 | - # Return observation | |
| 310 | - return obs | |
| 311 | - | |
| 312 | 293 | |
| 313 | 294 | # ======================== # |
| 314 | 295 | # Main routine entry point # | ... | ... |