Commit e231d0c0ec35f469f9aff084db2470f0fb02ef8b

Authored by Luigi Tibaldo
1 parent c64145b5

default to `EXCLUSION` extension for exclusion map

cscripts/csphagen.py
... ... @@ -287,6 +287,15 @@ class csphagen(ctools.csobservation):
287 287 self._has_exclusion = True
288 288 elif self['inexclusion'].is_valid():
289 289 inexclusion = self['inexclusion'].filename()
  290 + # If the user has not specified the extension to use
  291 + # and there is an extension called 'EXCLUSION' ...
  292 + if not inexclusion.has_extname()\
  293 + and not inexclusion.has_extno()\
  294 + and gammalib.GFits(inexclusion).contains('EXCLUSION'):
  295 + # ... choose it for the exclusion map
  296 + extname = inexclusion.url() + '[EXCLUSION]'
  297 + inexclusion = gammalib.GFilename(extname)
  298 + # Otherwise will pick the default (primary) HDU
290 299 self._excl_reg = gammalib.GSkyRegionMap(inexclusion)
291 300 self._has_exclusion = True
292 301 else:
... ...
doc/source/users/reference_manual/csphagen.rst
... ... @@ -25,9 +25,13 @@ respect to the pointing direction that are smaller than the value specified by
25 25 the ``maxoffset`` parameter. If less than ``bkgregmin`` reflected regions can be
26 26 found because the offset angle between source and pointing direction is too small,
27 27 the observation will be skipped. Regions to be excluded for background
28   -determination can be specified using a mask file that is specified using the
29   -``inexclusion`` parameter. A mask file is a sky map where all pixel values that
30   -differ from zero will be used as exclusion region.
  28 +determination can be specified using a FITS mask file that is specified using the
  29 +``inexclusion`` parameter. A mask is a sky map where all pixel values that
  30 +differ from zero will be used as exclusion region. If the FITS file
  31 +contains multiple extensions and the user does not specify which one
  32 +to use, the extention ``EXCLUSION`` will be used if available (e.g.,
  33 +if you use a skymap generated by :ref:`ctskymap`).
  34 +Otherwise the primary extension will be used.
31 35  
32 36 Alternatively, if ``bkgmethod=CUSTOM`` is specified, the source and background
33 37 regions will be specified using the ``srcregfile`` and ``bkgregfile`` parameters,
... ... @@ -240,4 +244,7 @@ Standard parameters
240 244 Related tools or scripts
241 245 ------------------------
242 246  
243   -None
  247 +:doc:`ctskymap`
  248 +:doc:`csphasecrv`
  249 +:doc:`cslightcrv`
  250 +
... ...