Commit d2145d7f4bb967e8243941b14d6341c3b62dfd72

Authored by Jürgen Knödlseder
1 parent 6f456474

Increase slightly the comments density.

cscripts/cslightcrv.par
@@ -39,7 +39,7 @@ tbins, i, a, 5,1,10000, "Number of time bins" @@ -39,7 +39,7 @@ tbins, i, a, 5,1,10000, "Number of time bins"
39 tbinfile, f, a, NONE,,, "File defining the time binning" 39 tbinfile, f, a, NONE,,, "File defining the time binning"
40 emin, r, a, 0.1,,, "Lower energy limit of events (TeV)" 40 emin, r, a, 0.1,,, "Lower energy limit of events (TeV)"
41 emax, r, a, 100.0,,, "Upper energy limit of events (TeV)" 41 emax, r, a, 100.0,,, "Upper energy limit of events (TeV)"
42 -enumbins, i, a, 0,,, "Number of energy bins for binned (0=unbinned)" 42 +enumbins, i, a, 0,0,100, "Number of energy bins for binned (0=unbinned)"
43 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System" 43 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
44 proj, s, a, CAR,AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" 44 proj, s, a, CAR,AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method"
45 xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)" 45 xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)"
cscripts/cslightcrv.py
@@ -73,10 +73,11 @@ class cslightcrv(ctools.cscript): @@ -73,10 +73,11 @@ class cslightcrv(ctools.cscript):
73 # Initialise some members 73 # Initialise some members
74 self._srcname = "" 74 self._srcname = ""
75 self._tbins = gammalib.GGti() 75 self._tbins = gammalib.GGti()
76 - self._ebins = gammalib.GEbounds()  
77 - self._binned = False 76 + self._stacked = False
78 77
79 - # Initialise observation 78 + # Initialise observation container. In case that an observation
  79 + # container is provided on the command line, this container will
  80 + # be used to initialise the class.
80 if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations): 81 if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations):
81 self._obs = argv[0] 82 self._obs = argv[0]
82 argv = argv[1:] 83 argv = argv[1:]
@@ -86,7 +87,7 @@ class cslightcrv(ctools.cscript): @@ -86,7 +87,7 @@ class cslightcrv(ctools.cscript):
86 # Initialise application 87 # Initialise application
87 if len(argv) == 0: 88 if len(argv) == 0:
88 ctools.cscript.__init__(self, self._name, self._version) 89 ctools.cscript.__init__(self, self._name, self._version)
89 - elif len(argv) ==1: 90 + elif len(argv) == 1:
90 ctools.cscript.__init__(self, self._name, self._version, *argv) 91 ctools.cscript.__init__(self, self._name, self._version, *argv)
91 else: 92 else:
92 raise TypeError("Invalid number of arguments given.") 93 raise TypeError("Invalid number of arguments given.")
@@ -126,17 +127,14 @@ class cslightcrv(ctools.cscript): @@ -126,17 +127,14 @@ class cslightcrv(ctools.cscript):
126 # Get time boundaries 127 # Get time boundaries
127 self._tbins = self._create_tbounds() 128 self._tbins = self._create_tbounds()
128 129
129 - # Unbinned or binned analysis?  
130 - self._ebins = self["enumbins"].integer()  
131 - if self._ebins == 0:  
132 - self._binned = False  
133 - else:  
134 - self._binned = True 130 + # Set stacked analysis flag if the requested number of energy bins
  131 + # is not zero; otherwise an unbinned analysis will be done.
  132 + self._stacked = False if self["enumbins"].integer() == 0 else True
135 133
136 # Make sure that other parameters are queried now and not later 134 # Make sure that other parameters are queried now and not later
137 self["emin"].real() 135 self["emin"].real()
138 self["emax"].real() 136 self["emax"].real()
139 - if self._binned: 137 + if self._stacked:
140 self["coordsys"].string() 138 self["coordsys"].string()
141 self["proj"].string() 139 self["proj"].string()
142 self["xref"].real() 140 self["xref"].real()
@@ -420,7 +418,7 @@ class cslightcrv(ctools.cscript): @@ -420,7 +418,7 @@ class cslightcrv(ctools.cscript):
420 bin["binsz"] = self["binsz"].real() 418 bin["binsz"] = self["binsz"].real()
421 bin["nxpix"] = self["nxpix"].integer() 419 bin["nxpix"] = self["nxpix"].integer()
422 bin["nypix"] = self["nypix"].integer() 420 bin["nypix"] = self["nypix"].integer()
423 - bin["enumbins"] = self._ebins 421 + bin["enumbins"] = self["enumbins"].integer()
424 bin["emin"] = self["emin"].real() 422 bin["emin"] = self["emin"].real()
425 bin["emax"] = self["emax"].real() 423 bin["emax"] = self["emax"].real()
426 bin["coordsys"] = self["coordsys"].string() 424 bin["coordsys"] = self["coordsys"].string()
@@ -441,7 +439,7 @@ class cslightcrv(ctools.cscript): @@ -441,7 +439,7 @@ class cslightcrv(ctools.cscript):
441 expcube["binsz"] = self["binsz"].real() 439 expcube["binsz"] = self["binsz"].real()
442 expcube["nxpix"] = self["nxpix"].integer() 440 expcube["nxpix"] = self["nxpix"].integer()
443 expcube["nypix"] = self["nypix"].integer() 441 expcube["nypix"] = self["nypix"].integer()
444 - expcube["enumbins"] = self._ebins 442 + expcube["enumbins"] = self["enumbins"].integer()
445 expcube["emin"] = self["emin"].real() 443 expcube["emin"] = self["emin"].real()
446 expcube["emax"] = self["emax"].real() 444 expcube["emax"] = self["emax"].real()
447 expcube["coordsys"] = self["coordsys"].string() 445 expcube["coordsys"] = self["coordsys"].string()
@@ -462,7 +460,7 @@ class cslightcrv(ctools.cscript): @@ -462,7 +460,7 @@ class cslightcrv(ctools.cscript):
462 psfcube["binsz"] = self["binsz"].real() 460 psfcube["binsz"] = self["binsz"].real()
463 psfcube["nxpix"] = self["nxpix"].integer() 461 psfcube["nxpix"] = self["nxpix"].integer()
464 psfcube["nypix"] = self["nypix"].integer() 462 psfcube["nypix"] = self["nypix"].integer()
465 - psfcube["enumbins"] = self._ebins 463 + psfcube["enumbins"] = self["enumbins"].integer()
466 psfcube["emin"] = self["emin"].real() 464 psfcube["emin"] = self["emin"].real()
467 psfcube["emax"] = self["emax"].real() 465 psfcube["emax"] = self["emax"].real()
468 psfcube["coordsys"] = self["coordsys"].string() 466 psfcube["coordsys"] = self["coordsys"].string()
@@ -486,7 +484,7 @@ class cslightcrv(ctools.cscript): @@ -486,7 +484,7 @@ class cslightcrv(ctools.cscript):
486 edispcube["binsz"] = self["binsz"].real() 484 edispcube["binsz"] = self["binsz"].real()
487 edispcube["nxpix"] = self["nxpix"].integer() 485 edispcube["nxpix"] = self["nxpix"].integer()
488 edispcube["nypix"] = self["nypix"].integer() 486 edispcube["nypix"] = self["nypix"].integer()
489 - edispcube["enumbins"] = self._ebins 487 + edispcube["enumbins"] = self["enumbins"].integer()
490 edispcube["emin"] = self["emin"].real() 488 edispcube["emin"] = self["emin"].real()
491 edispcube["emax"] = self["emax"].real() 489 edispcube["emax"] = self["emax"].real()
492 edispcube["coordsys"] = self["coordsys"].string() 490 edispcube["coordsys"] = self["coordsys"].string()
@@ -507,7 +505,7 @@ class cslightcrv(ctools.cscript): @@ -507,7 +505,7 @@ class cslightcrv(ctools.cscript):
507 bkgcube["binsz"] = self["binsz"].real() 505 bkgcube["binsz"] = self["binsz"].real()
508 bkgcube["nxpix"] = self["nxpix"].integer() 506 bkgcube["nxpix"] = self["nxpix"].integer()
509 bkgcube["nypix"] = self["nypix"].integer() 507 bkgcube["nypix"] = self["nypix"].integer()
510 - bkgcube["enumbins"] = self._ebins 508 + bkgcube["enumbins"] = self["enumbins"].integer()
511 bkgcube["emin"] = self["emin"].real() 509 bkgcube["emin"] = self["emin"].real()
512 bkgcube["emax"] = self["emax"].real() 510 bkgcube["emax"] = self["emax"].real()
513 bkgcube["coordsys"] = self["coordsys"].string() 511 bkgcube["coordsys"] = self["coordsys"].string()
@@ -624,7 +622,7 @@ class cslightcrv(ctools.cscript): @@ -624,7 +622,7 @@ class cslightcrv(ctools.cscript):
624 # If a stacked analysis is requested then bin the events 622 # If a stacked analysis is requested then bin the events
625 # and compute the stacked response functions and setup 623 # and compute the stacked response functions and setup
626 # an observation container with a single stacked observation. 624 # an observation container with a single stacked observation.
627 - if self._binned: 625 + if self._stacked:
628 obs = self._bin_observation(obs) 626 obs = self._bin_observation(obs)
629 627
630 # Header 628 # Header
@@ -700,7 +698,7 @@ class cslightcrv(ctools.cscript): @@ -700,7 +698,7 @@ class cslightcrv(ctools.cscript):
700 # Create FITS table from results 698 # Create FITS table from results
701 table = self._create_fits_table(results) 699 table = self._create_fits_table(results)
702 700
703 - # Create FITS file and append FITS table 701 + # Create FITS file and append FITS table to FITS file
704 self._fits = gammalib.GFits() 702 self._fits = gammalib.GFits()
705 self._fits.append(table) 703 self._fits.append(table)
706 704