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 39 tbinfile, f, a, NONE,,, "File defining the time binning"
40 40 emin, r, a, 0.1,,, "Lower energy limit of events (TeV)"
41 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 43 coordsys, s, a, CEL,CEL|GAL,, "Coordinate System"
44 44 proj, s, a, CAR,AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method"
45 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 73 # Initialise some members
74 74 self._srcname = ""
75 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 81 if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations):
81 82 self._obs = argv[0]
82 83 argv = argv[1:]
... ... @@ -86,7 +87,7 @@ class cslightcrv(ctools.cscript):
86 87 # Initialise application
87 88 if len(argv) == 0:
88 89 ctools.cscript.__init__(self, self._name, self._version)
89   - elif len(argv) ==1:
  90 + elif len(argv) == 1:
90 91 ctools.cscript.__init__(self, self._name, self._version, *argv)
91 92 else:
92 93 raise TypeError("Invalid number of arguments given.")
... ... @@ -126,17 +127,14 @@ class cslightcrv(ctools.cscript):
126 127 # Get time boundaries
127 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 134 # Make sure that other parameters are queried now and not later
137 135 self["emin"].real()
138 136 self["emax"].real()
139   - if self._binned:
  137 + if self._stacked:
140 138 self["coordsys"].string()
141 139 self["proj"].string()
142 140 self["xref"].real()
... ... @@ -420,7 +418,7 @@ class cslightcrv(ctools.cscript):
420 418 bin["binsz"] = self["binsz"].real()
421 419 bin["nxpix"] = self["nxpix"].integer()
422 420 bin["nypix"] = self["nypix"].integer()
423   - bin["enumbins"] = self._ebins
  421 + bin["enumbins"] = self["enumbins"].integer()
424 422 bin["emin"] = self["emin"].real()
425 423 bin["emax"] = self["emax"].real()
426 424 bin["coordsys"] = self["coordsys"].string()
... ... @@ -441,7 +439,7 @@ class cslightcrv(ctools.cscript):
441 439 expcube["binsz"] = self["binsz"].real()
442 440 expcube["nxpix"] = self["nxpix"].integer()
443 441 expcube["nypix"] = self["nypix"].integer()
444   - expcube["enumbins"] = self._ebins
  442 + expcube["enumbins"] = self["enumbins"].integer()
445 443 expcube["emin"] = self["emin"].real()
446 444 expcube["emax"] = self["emax"].real()
447 445 expcube["coordsys"] = self["coordsys"].string()
... ... @@ -462,7 +460,7 @@ class cslightcrv(ctools.cscript):
462 460 psfcube["binsz"] = self["binsz"].real()
463 461 psfcube["nxpix"] = self["nxpix"].integer()
464 462 psfcube["nypix"] = self["nypix"].integer()
465   - psfcube["enumbins"] = self._ebins
  463 + psfcube["enumbins"] = self["enumbins"].integer()
466 464 psfcube["emin"] = self["emin"].real()
467 465 psfcube["emax"] = self["emax"].real()
468 466 psfcube["coordsys"] = self["coordsys"].string()
... ... @@ -486,7 +484,7 @@ class cslightcrv(ctools.cscript):
486 484 edispcube["binsz"] = self["binsz"].real()
487 485 edispcube["nxpix"] = self["nxpix"].integer()
488 486 edispcube["nypix"] = self["nypix"].integer()
489   - edispcube["enumbins"] = self._ebins
  487 + edispcube["enumbins"] = self["enumbins"].integer()
490 488 edispcube["emin"] = self["emin"].real()
491 489 edispcube["emax"] = self["emax"].real()
492 490 edispcube["coordsys"] = self["coordsys"].string()
... ... @@ -507,7 +505,7 @@ class cslightcrv(ctools.cscript):
507 505 bkgcube["binsz"] = self["binsz"].real()
508 506 bkgcube["nxpix"] = self["nxpix"].integer()
509 507 bkgcube["nypix"] = self["nypix"].integer()
510   - bkgcube["enumbins"] = self._ebins
  508 + bkgcube["enumbins"] = self["enumbins"].integer()
511 509 bkgcube["emin"] = self["emin"].real()
512 510 bkgcube["emax"] = self["emax"].real()
513 511 bkgcube["coordsys"] = self["coordsys"].string()
... ... @@ -624,7 +622,7 @@ class cslightcrv(ctools.cscript):
624 622 # If a stacked analysis is requested then bin the events
625 623 # and compute the stacked response functions and setup
626 624 # an observation container with a single stacked observation.
627   - if self._binned:
  625 + if self._stacked:
628 626 obs = self._bin_observation(obs)
629 627  
630 628 # Header
... ... @@ -700,7 +698,7 @@ class cslightcrv(ctools.cscript):
700 698 # Create FITS table from results
701 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 702 self._fits = gammalib.GFits()
705 703 self._fits.append(table)
706 704  
... ...