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,6 +53,8 @@ class cspull(ctools.cscript): | ||
| 53 | self.m_psfcube = None | 53 | self.m_psfcube = None |
| 54 | self.m_bckcube = None | 54 | self.m_bckcube = None |
| 55 | self.m_stackmodels = None | 55 | self.m_stackmodels = None |
| 56 | + self.m_coordsys = "CEL" | ||
| 57 | + self.m_proj = "TAN" | ||
| 56 | 58 | ||
| 57 | # Make sure that parfile exists | 59 | # Make sure that parfile exists |
| 58 | file = self.parfile() | 60 | file = self.parfile() |
| @@ -102,9 +104,6 @@ class cspull(ctools.cscript): | @@ -102,9 +104,6 @@ class cspull(ctools.cscript): | ||
| 102 | pars.append(gammalib.GApplicationPar("inobs","f","h","NONE","","","Event list, counts cube, or observation definition file")) | 104 | pars.append(gammalib.GApplicationPar("inobs","f","h","NONE","","","Event list, counts cube, or observation definition file")) |
| 103 | pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) | 105 | pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) |
| 104 | pars.append(gammalib.GApplicationPar("outfile","f","a","pull.dat","","","Output file name")) | 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 | pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | 107 | pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) |
| 109 | pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | 108 | pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) |
| 110 | pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) | 109 | pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) |
| @@ -113,6 +112,8 @@ class cspull(ctools.cscript): | @@ -113,6 +112,8 @@ class cspull(ctools.cscript): | ||
| 113 | pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) | 112 | pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) |
| 114 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)")) | 113 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)")) |
| 115 | pars.append(gammalib.GApplicationPar("dec","r","a","22.0145","-90","90","Dec of pointing (deg)")) | 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 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) | 117 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) |
| 117 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) | 118 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) |
| 118 | pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) | 119 | pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) |
| @@ -151,8 +152,10 @@ class cspull(ctools.cscript): | @@ -151,8 +152,10 @@ class cspull(ctools.cscript): | ||
| 151 | 152 | ||
| 152 | # Read parameters for binned if requested | 153 | # Read parameters for binned if requested |
| 153 | if not self.m_enumbins == 0: | 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 | else: | 159 | else: |
| 157 | # Set dummy values (required by obsutils) | 160 | # Set dummy values (required by obsutils) |
| 158 | self.m_npix = 0 | 161 | self.m_npix = 0 |
| @@ -220,8 +223,8 @@ class cspull(ctools.cscript): | @@ -220,8 +223,8 @@ class cspull(ctools.cscript): | ||
| 220 | expcube["enumbins"] = self.m_enumbins | 223 | expcube["enumbins"] = self.m_enumbins |
| 221 | expcube["emin"] = self["emin"].real() | 224 | expcube["emin"] = self["emin"].real() |
| 222 | expcube["emax"] = self["emax"].real() | 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 | expcube.run() | 228 | expcube.run() |
| 226 | 229 | ||
| 227 | # Notify exposure computation | 230 | # Notify exposure computation |
| @@ -239,8 +242,8 @@ class cspull(ctools.cscript): | @@ -239,8 +242,8 @@ class cspull(ctools.cscript): | ||
| 239 | psfcube["enumbins"] = self.m_enumbins | 242 | psfcube["enumbins"] = self.m_enumbins |
| 240 | psfcube["emin"] = self["emin"].real() | 243 | psfcube["emin"] = self["emin"].real() |
| 241 | psfcube["emax"] = self["emax"].real() | 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 | psfcube.run() | 247 | psfcube.run() |
| 245 | 248 | ||
| 246 | # Notify Psf computation | 249 | # Notify Psf computation |
| @@ -258,8 +261,8 @@ class cspull(ctools.cscript): | @@ -258,8 +261,8 @@ class cspull(ctools.cscript): | ||
| 258 | bkgcube["enumbins"] = self.m_enumbins | 261 | bkgcube["enumbins"] = self.m_enumbins |
| 259 | bkgcube["emin"] = self["emin"].real() | 262 | bkgcube["emin"] = self["emin"].real() |
| 260 | bkgcube["emax"] = self["emax"].real() | 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 | bkgcube.run() | 266 | bkgcube.run() |
| 264 | 267 | ||
| 265 | # Notify background cube computation | 268 | # Notify background cube computation |
| @@ -338,16 +341,20 @@ class cspull(ctools.cscript): | @@ -338,16 +341,20 @@ class cspull(ctools.cscript): | ||
| 338 | 341 | ||
| 339 | # Setup observation definition list | 342 | # Setup observation definition list |
| 340 | obsdeflist = obsutils.set_obs_patterns(self.m_pattern, | 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 | offset=self["offset"].real()) | 346 | offset=self["offset"].real()) |
| 343 | 347 | ||
| 344 | # Create list of observations | 348 | # Create list of observations |
| 345 | obs = obsutils.set_obs_list(obsdeflist, | 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 | deadc=self["deadc"].real(), | 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 | rad=self["rad"].real(), | 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 | # Return observation container | 359 | # Return observation container |
| 353 | return obs | 360 | return obs |
| @@ -371,6 +378,8 @@ class cspull(ctools.cscript): | @@ -371,6 +378,8 @@ class cspull(ctools.cscript): | ||
| 371 | seed=seed, | 378 | seed=seed, |
| 372 | binsz=self.m_binsz, | 379 | binsz=self.m_binsz, |
| 373 | npix=self.m_npix, | 380 | npix=self.m_npix, |
| 381 | + proj=self.m_proj, | ||
| 382 | + coord=self.m_coordsys, | ||
| 374 | edisp=self.m_edisp, | 383 | edisp=self.m_edisp, |
| 375 | log=self.m_log, | 384 | log=self.m_log, |
| 376 | debug=self.m_debug, | 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,6 +19,9 @@ Gaussian centred on 0 and a sigma parameter of 1. | ||
| 19 | General parameters | 19 | General parameters |
| 20 | ------------------ | 20 | ------------------ |
| 21 | 21 | ||
| 22 | +``inobs [file]`` | ||
| 23 | + Event list, counts cube, or observation definition XML file. | ||
| 24 | + | ||
| 22 | ``inmodel [file]`` | 25 | ``inmodel [file]`` |
| 23 | XML file that describes the astrophysical sources and the instrumental | 26 | XML file that describes the astrophysical sources and the instrumental |
| 24 | background. | 27 | background. |
| @@ -26,15 +29,6 @@ General parameters | @@ -26,15 +29,6 @@ General parameters | ||
| 26 | ``outfile [file]`` | 29 | ``outfile [file]`` |
| 27 | ASCII file containing the individual pull values. | 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 | ``caldb [string]`` | 32 | ``caldb [string]`` |
| 39 | Calibration database. | 33 | Calibration database. |
| 40 | 34 | ||
| @@ -45,7 +39,10 @@ General parameters | @@ -45,7 +39,10 @@ General parameters | ||
| 45 | Average deadtime correction factor. | 39 | Average deadtime correction factor. |
| 46 | 40 | ||
| 47 | ``(edisp = no) [boolean]`` | 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 | ``ntrials [integer]`` | 47 | ``ntrials [integer]`` |
| 51 | Number of samples for generating the pull distribution. | 48 | Number of samples for generating the pull distribution. |
| @@ -55,6 +52,12 @@ General parameters | @@ -55,6 +52,12 @@ General parameters | ||
| 55 | 52 | ||
| 56 | ``dec [real]`` | 53 | ``dec [real]`` |
| 57 | Declination of CTA pointing (J2000, in degrees). | 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 | ``emin [real]`` | 62 | ``emin [real]`` |
| 60 | Lower energy limit of events (in TeV). | 63 | Lower energy limit of events (in TeV). |