Commit 9e6fd31a1a476e2fee93e6ed242460afd37c97a5
1 parent
88c2e557
Add coordsys and proj parameters to cspull.
Showing
2 changed files
with
37 additions
and
25 deletions
cscripts/cspull.py
| ... | ... | @@ -53,6 +53,8 @@ class cspull(ctools.cscript): |
| 53 | 53 | self.m_psfcube = None |
| 54 | 54 | self.m_bckcube = None |
| 55 | 55 | self.m_stackmodels = None |
| 56 | + self.m_coordsys = "CEL" | |
| 57 | + self.m_proj = "TAN" | |
| 56 | 58 | |
| 57 | 59 | # Make sure that parfile exists |
| 58 | 60 | file = self.parfile() |
| ... | ... | @@ -102,9 +104,6 @@ class cspull(ctools.cscript): |
| 102 | 104 | pars.append(gammalib.GApplicationPar("inobs","f","h","NONE","","","Event list, counts cube, or observation definition file")) |
| 103 | 105 | pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) |
| 104 | 106 | pars.append(gammalib.GApplicationPar("outfile","f","a","pull.dat","","","Output file name")) |
| 105 | - #pars.append(gammalib.GApplicationPar("expcube","s","a","NONE","","","Exposure cube file (only needed for stacked analysis)")) | |
| 106 | - #pars.append(gammalib.GApplicationPar("psfcube","s","a","NONE","","","PSF cube file (only needed for stacked analysis)")) | |
| 107 | - #pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) | |
| 108 | 107 | pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) |
| 109 | 108 | pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) |
| 110 | 109 | pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) |
| ... | ... | @@ -113,6 +112,8 @@ class cspull(ctools.cscript): |
| 113 | 112 | pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) |
| 114 | 113 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)")) |
| 115 | 114 | pars.append(gammalib.GApplicationPar("dec","r","a","22.0145","-90","90","Dec of pointing (deg)")) |
| 115 | + pars.append(gammalib.GApplicationPar("coordsys","s","a","CEL","CEL|GAL","","Coordinate system (CEL - celestial, GAL - galactic)")) | |
| 116 | + pars.append(gammalib.GApplicationPar("proj","s","a","TAN","AIT|AZP|CAR|MER|MOL|STG|TAN","","Projection method")) | |
| 116 | 117 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) |
| 117 | 118 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) |
| 118 | 119 | pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) |
| ... | ... | @@ -151,8 +152,10 @@ class cspull(ctools.cscript): |
| 151 | 152 | |
| 152 | 153 | # Read parameters for binned if requested |
| 153 | 154 | if not self.m_enumbins == 0: |
| 154 | - self.m_npix = self["npix"].integer() | |
| 155 | - self.m_binsz = self["binsz"].real() | |
| 155 | + self.m_npix = self["npix"].integer() | |
| 156 | + self.m_binsz = self["binsz"].real() | |
| 157 | + self.m_coordsys = self["coordsys"].string() | |
| 158 | + self.m_proj = self["proj"].string() | |
| 156 | 159 | else: |
| 157 | 160 | # Set dummy values (required by obsutils) |
| 158 | 161 | self.m_npix = 0 |
| ... | ... | @@ -220,8 +223,8 @@ class cspull(ctools.cscript): |
| 220 | 223 | expcube["enumbins"] = self.m_enumbins |
| 221 | 224 | expcube["emin"] = self["emin"].real() |
| 222 | 225 | expcube["emax"] = self["emax"].real() |
| 223 | - expcube["coordsys"] = "CEL" | |
| 224 | - expcube["proj"] = "TAN" | |
| 226 | + expcube["coordsys"] = self.m_coordsys | |
| 227 | + expcube["proj"] = self.m_proj | |
| 225 | 228 | expcube.run() |
| 226 | 229 | |
| 227 | 230 | # Notify exposure computation |
| ... | ... | @@ -239,8 +242,8 @@ class cspull(ctools.cscript): |
| 239 | 242 | psfcube["enumbins"] = self.m_enumbins |
| 240 | 243 | psfcube["emin"] = self["emin"].real() |
| 241 | 244 | psfcube["emax"] = self["emax"].real() |
| 242 | - psfcube["coordsys"] = "CEL" | |
| 243 | - psfcube["proj"] = "TAN" | |
| 245 | + psfcube["coordsys"] = self.m_coordsys | |
| 246 | + psfcube["proj"] = self.m_proj | |
| 244 | 247 | psfcube.run() |
| 245 | 248 | |
| 246 | 249 | # Notify Psf computation |
| ... | ... | @@ -258,8 +261,8 @@ class cspull(ctools.cscript): |
| 258 | 261 | bkgcube["enumbins"] = self.m_enumbins |
| 259 | 262 | bkgcube["emin"] = self["emin"].real() |
| 260 | 263 | bkgcube["emax"] = self["emax"].real() |
| 261 | - bkgcube["coordsys"] = "CEL" | |
| 262 | - bkgcube["proj"] = "TAN" | |
| 264 | + bkgcube["coordsys"] = self.m_coordsys | |
| 265 | + bkgcube["proj"] = self.m_proj | |
| 263 | 266 | bkgcube.run() |
| 264 | 267 | |
| 265 | 268 | # Notify background cube computation |
| ... | ... | @@ -338,16 +341,20 @@ class cspull(ctools.cscript): |
| 338 | 341 | |
| 339 | 342 | # Setup observation definition list |
| 340 | 343 | obsdeflist = obsutils.set_obs_patterns(self.m_pattern, |
| 341 | - ra=self["ra"].real(), dec=self["dec"].real(), | |
| 344 | + ra=self["ra"].real(), | |
| 345 | + dec=self["dec"].real(), | |
| 342 | 346 | offset=self["offset"].real()) |
| 343 | 347 | |
| 344 | 348 | # Create list of observations |
| 345 | 349 | obs = obsutils.set_obs_list(obsdeflist, |
| 346 | - tstart=self["tmin"].real(), duration=self["tmax"].real()-self["tmin"].real(), | |
| 350 | + tstart=self["tmin"].real(), | |
| 351 | + duration=self["tmax"].real()-self["tmin"].real(), | |
| 347 | 352 | deadc=self["deadc"].real(), |
| 348 | - emin=self["emin"].real(), emax=self["emax"].real(), | |
| 353 | + emin=self["emin"].real(), | |
| 354 | + emax=self["emax"].real(), | |
| 349 | 355 | rad=self["rad"].real(), |
| 350 | - irf=self["irf"].string(), caldb=self["caldb"].string()) | |
| 356 | + irf=self["irf"].string(), | |
| 357 | + caldb=self["caldb"].string()) | |
| 351 | 358 | |
| 352 | 359 | # Return observation container |
| 353 | 360 | return obs |
| ... | ... | @@ -371,6 +378,8 @@ class cspull(ctools.cscript): |
| 371 | 378 | seed=seed, |
| 372 | 379 | binsz=self.m_binsz, |
| 373 | 380 | npix=self.m_npix, |
| 381 | + proj=self.m_proj, | |
| 382 | + coord=self.m_coordsys, | |
| 374 | 383 | edisp=self.m_edisp, |
| 375 | 384 | log=self.m_log, |
| 376 | 385 | debug=self.m_debug, | ... | ... |
doc/source/reference_manual/cspull.rst
| ... | ... | @@ -19,6 +19,9 @@ Gaussian centred on 0 and a sigma parameter of 1. |
| 19 | 19 | General parameters |
| 20 | 20 | ------------------ |
| 21 | 21 | |
| 22 | +``inobs [file]`` | |
| 23 | + Event list, counts cube, or observation definition XML file. | |
| 24 | + | |
| 22 | 25 | ``inmodel [file]`` |
| 23 | 26 | XML file that describes the astrophysical sources and the instrumental |
| 24 | 27 | background. |
| ... | ... | @@ -26,15 +29,6 @@ General parameters |
| 26 | 29 | ``outfile [file]`` |
| 27 | 30 | ASCII file containing the individual pull values. |
| 28 | 31 | |
| 29 | -``expcube [file]`` | |
| 30 | - Exposure cube file (only needed for stacked analysis). | |
| 31 | - | |
| 32 | -``psfcube [file]`` | |
| 33 | - PSF cube file (only needed for stacked analysis). | |
| 34 | - | |
| 35 | -``bkgcube [file]`` | |
| 36 | - Background cube file (only needed for stacked analysis). | |
| 37 | - | |
| 38 | 32 | ``caldb [string]`` |
| 39 | 33 | Calibration database. |
| 40 | 34 | |
| ... | ... | @@ -45,7 +39,10 @@ General parameters |
| 45 | 39 | Average deadtime correction factor. |
| 46 | 40 | |
| 47 | 41 | ``(edisp = no) [boolean]`` |
| 48 | - Apply energy dispersion to response computation. | |
| 42 | + Apply energy dispersion to response computation? | |
| 43 | + | |
| 44 | +``(profile = no) [boolean]`` | |
| 45 | + Use likelihood profile method for errors? | |
| 49 | 46 | |
| 50 | 47 | ``ntrials [integer]`` |
| 51 | 48 | Number of samples for generating the pull distribution. |
| ... | ... | @@ -55,6 +52,12 @@ General parameters |
| 55 | 52 | |
| 56 | 53 | ``dec [real]`` |
| 57 | 54 | Declination of CTA pointing (J2000, in degrees). |
| 55 | + | |
| 56 | +``coordsys <CEL|GAL> [string]`` | |
| 57 | + Coordinate system (CEL - celestial, GAL - galactic). | |
| 58 | + | |
| 59 | +``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | |
| 60 | + Projection method. | |
| 58 | 61 | |
| 59 | 62 | ``emin [real]`` |
| 60 | 63 | Lower energy limit of events (in TeV). | ... | ... |