Commit 211b5eb0dc0cfa4002ee5a4f0e6e0bc5ba89102c

Authored by Jürgen Knödlseder
1 parent 2f7db38b

Add hidden "use_irf_bkg" parameter to csphagen (#2659)

ChangeLog
1   -2018-08-01
  1 +2018-08-03
2 2  
3 3 * Version 1.6.0 released
4 4 ========================
5 5  
  6 + Add hidden "use_irf_bkg" parameter to csphagen (#2659)
6 7 Use full RMF true energy range for On/Off analysis in csspec (#2656)
7 8 Defer import of ROOT module in csroot2caldb to run method (#2652)
8 9 Transparently update parameter files (#2513)
... ...
1 1 New Features and Important Changes in ctools 1.6.0
2 2  
3   -1 August 2018
  3 +3 August 2018
4 4  
5 5  
6 6 Introduction
... ... @@ -248,6 +248,17 @@ Use time reference of input observations if time selection is given in MET
248 248  
249 249 csphagen - Generate On/Off observations
250 250 ---------------------------------------
  251 +Add hidden "use_irf_bkg" parameter. By default the parameter is set to "yes",
  252 +which means that the background acceptance provided in the IRF is used for
  253 +the computation of the alpha parameter and the background rate, stored in the
  254 +"BACKSCAL" column of the On spectrum and the "BACKRESP" column of the Off
  255 +spectrum, respectively. If the parameter is set to "no" it is assumed that the
  256 +background rate in the On and Off regions are the same, and the IRF background
  257 +template is not used. In that case, the "BACKSCAL" column gives the ratio of
  258 +the solid angles between On and Off regions, and the "BACKRESP" column is set
  259 +to zero. The resulting data can only be fitted using the "wstat" statistic
  260 +(#2659).
  261 +
251 262 Add hidden "nthreads" parameter and implement parallelisation of computations
252 263 (#2421).
253 264  
... ...
cscripts/csphagen.par
... ... @@ -28,27 +28,28 @@ prefix, s, h, onoff,,, "Prefix for output files"
28 28 #
29 29 # Script parameters
30 30 #==================
31   -ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
32   -emin, r, a, 0.1,,, "Start value for first energy bin in TeV"
33   -emax, r, a, 100.0,,, "Stop value for last energy bin in TeV"
34   -enumbins, i, a, 120,,, "Number of energy bins"
35   -ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
36   -srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region"
37   -coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
38   -ra, r, a, 83.63,0,360, "Right Ascension of source region centre (deg)"
39   -dec, r, a, 22.01,-90,90, "Declination of source region centre (deg)"
40   -glon, r, a, 184.56,0,360, "Galactic longitude of source region centre (deg)"
41   -glat, r, a, -5.79,-90,90, "Galactic latitude of source region centre (deg)"
42   -rad, r, a, 0.2,0,180, "Radius of source region circle (deg)"
43   -srcregfile, f, a, on.reg,,, "Source region file (ds9 or FITS WCS)"
44   -bkgmethod, s, a, REFLECTED,REFLECTED|CUSTOM,, "Method for background estimation"
45   -bkgregfile, f, a, bkg.reg,,, "Background regions file (ds9 or FITS WCS)"
46   -bkgregmin, i, h, 2,1,1000, "Minimum number of background regions"
47   -maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation"
48   -stack, b, a, no,,, "Stack multiple observations into single PHA, ARF and RMF files?"
49   -etruemin, r, h, 0.01,,, "Minimum true energy (TeV)"
50   -etruemax, r, h, 300.0,,, "Maximum true energy (TeV)"
51   -etruebins, i, h, 30,,, "Number of bins per decade for true energy bins"
  31 +ebinalg, s, a, LOG,FILE|LIN|LOG,, "Algorithm for defining energy bins"
  32 +emin, r, a, 0.1,,, "Start value for first energy bin in TeV"
  33 +emax, r, a, 100.0,,, "Stop value for last energy bin in TeV"
  34 +enumbins, i, a, 120,,, "Number of energy bins"
  35 +ebinfile, f, a, NONE,,, "Name of the file containing the energy bin definition"
  36 +srcshape, s, h, CIRCLE,CIRCLE,, "Shape of the source region"
  37 +coordsys, s, a, CEL,CEL|GAL,, "Coordinate system (CEL - celestial, GAL - galactic)"
  38 +ra, r, a, 83.63,0,360, "Right Ascension of source region centre (deg)"
  39 +dec, r, a, 22.01,-90,90, "Declination of source region centre (deg)"
  40 +glon, r, a, 184.56,0,360, "Galactic longitude of source region centre (deg)"
  41 +glat, r, a, -5.79,-90,90, "Galactic latitude of source region centre (deg)"
  42 +rad, r, a, 0.2,0,180, "Radius of source region circle (deg)"
  43 +srcregfile, f, a, on.reg,,, "Source region file (ds9 or FITS WCS)"
  44 +bkgmethod, s, a, REFLECTED,REFLECTED|CUSTOM,, "Method for background estimation"
  45 +bkgregfile, f, a, bkg.reg,,, "Background regions file (ds9 or FITS WCS)"
  46 +bkgregmin, i, h, 2,1,1000, "Minimum number of background regions"
  47 +use_irf_bkg, b, h, yes,,, "Use IRF background template?"
  48 +maxoffset, r, h, 4.0,,, "Maximum offset of source from camera center to accept observation"
  49 +stack, b, a, no,,, "Stack multiple observations into single PHA, ARF and RMF files?"
  50 +etruemin, r, h, 0.01,,, "Minimum true energy (TeV)"
  51 +etruemax, r, h, 300.0,,, "Maximum true energy (TeV)"
  52 +etruebins, i, h, 30,,, "Number of bins per decade for true energy bins"
52 53  
53 54 #
54 55 # Standard parameters
... ...
cscripts/csphagen.py
... ... @@ -157,6 +157,9 @@ class csphagen(ctools.csobservation):
157 157 self._rad = self['rad'].real()
158 158 self._src_reg.append(gammalib.GSkyRegionCircle(self._src_dir, self._rad))
159 159  
  160 + # Query usage of IRF background template
  161 + self['use_irf_bkg'].boolean()
  162 +
160 163 # Return
161 164 return
162 165  
... ... @@ -478,6 +481,12 @@ class csphagen(ctools.csobservation):
478 481 # Set background regions for this observation
479 482 bkg_reg = self._set_background_regions(obs)
480 483  
  484 + # Get IRF background template usage flag
  485 + use_irf_bkg = self['use_irf_bkg'].boolean()
  486 + if not use_irf_bkg:
  487 + self._log_string(gammalib.NORMAL, 'IRF background template '
  488 + 'not used, assume constant backround rate.')
  489 +
481 490 # If there are background regions then create On/Off observation
482 491 # and append it to the output container
483 492 if bkg_reg.size() >= self['bkgregmin'].integer():
... ... @@ -486,7 +495,8 @@ class csphagen(ctools.csobservation):
486 495 self._etruebounds,
487 496 self._ebounds,
488 497 self._src_reg,
489   - bkg_reg)
  498 + bkg_reg,
  499 + use_irf_bkg)
490 500 onoff.id(obs.id())
491 501  
492 502 else:
... ... @@ -519,6 +529,7 @@ class csphagen(ctools.csobservation):
519 529 """
520 530 # If the results contain an On/Off observation
521 531 if result['onoff'].classname() == 'GCTAOnOffObservation':
  532 +
522 533 # Append observation to observation container
523 534 outobs.append(result['onoff'])
524 535  
... ...
doc/source/admin/release_history/1.6.rst
... ... @@ -32,6 +32,8 @@ Bug fixes
32 32 Improvements
33 33 ------------
34 34  
  35 +* [`2659 <https://cta-redmine.irap.omp.eu/issues/2659>`_] -
  36 + Add hidden ``use_irf_bkg`` parameter to :ref:`csphagen`
35 37 * [`2656 <https://cta-redmine.irap.omp.eu/issues/2656>`_] -
36 38 Use full ``RMF`` true energy range for On/Off analysis in :ref:`csspec`
37 39 * [`2513 <https://cta-redmine.irap.omp.eu/issues/2513>`_] -
... ...
doc/source/users/reference_manual/csphagen.rst
... ... @@ -167,6 +167,20 @@ General parameters
167 167 If this number of background regions is not available the observation is
168 168 skipped.
169 169  
  170 +``(use_irf_bkg = yes) [boolean]``
  171 + Specifies whether the IRF background template should be used for the
  172 + computation of the ``alpha`` parameter and the predicted background rate in
  173 + the Off region that is stored in the ``BACKRESP`` column of the Off spectrum.
  174 +
  175 + If the parameter is set to ``no`` the IRF background template is not used and
  176 + the background rate is assumed identical within the On and Off regions. This
  177 + is the classical IACT analysis method that is used when using reflected Off
  178 + regions. In that case the ``alpha`` parameter becomes independent of energy
  179 + and only reflects the ratio between the solid angles of the On and Off
  180 + regions. The ``BACKRESP`` column in the Off spectrum will be filled with zeros.
  181 + The data need to be fitted with the ``wstat`` statistic, fitting with ``cstat``
  182 + will not work.
  183 +
170 184 ``(maxoffset = 4.0) [real]``
171 185 Maximum offset in degrees of source from camera center to accept the
172 186 observation.
... ...