Commit 9de14b14c490c06c58d80901f17efc1a108966aa

Authored by Jürgen Knödlseder
1 parent c65f2ac9

Final revision of reference manual

doc/source/users/reference_manual/csebins.rst
@@ -14,7 +14,7 @@ the variation in the effective area and the background template of the response @@ -14,7 +14,7 @@ the variation in the effective area and the background template of the response
14 functions. The script takes either an observation definition XML file or a 14 functions. The script takes either an observation definition XML file or a
15 specific instrument response function on input. 15 specific instrument response function on input.
16 16
17 -csebins writes an energy boundary extension into a FITS file. 17 +:ref:`csebins` writes an energy boundary extension into a FITS file.
18 18
19 19
20 General parameters 20 General parameters
doc/source/users/reference_manual/csfindobs.rst
@@ -17,7 +17,9 @@ to further constrain criteria to select observations. The user can e.g. select @@ -17,7 +17,9 @@ to further constrain criteria to select observations. The user can e.g. select
17 all observations within a certain zenith angle range by specifying the hidden 17 all observations within a certain zenith angle range by specifying the hidden
18 parameter expression. For example 18 parameter expression. For example
19 19
20 -``csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"`` 20 +.. code-block:: bash
  21 +
  22 + $ csfindobs expression="ZEN_PNT<50&&ZEN_PNT>40"
21 23
22 is used to select observations with zenith angle range between 40 and 50 degrees. 24 is used to select observations with zenith angle range between 40 and 50 degrees.
23 25
doc/source/users/reference_manual/csmodelinfo.rst
@@ -17,9 +17,9 @@ quite useful for debugging a fit. Finally the tool also list the TS values of @@ -17,9 +17,9 @@ quite useful for debugging a fit. Finally the tool also list the TS values of
17 each source that was fitted, in order have a quick overview on these quantities 17 each source that was fitted, in order have a quick overview on these quantities
18 on the screen. 18 on the screen.
19 19
20 -In addition the tool is also capable of exporting the input model XML container 20 +In addition the script is also capable of exporting the input model XML container
21 to a region file which is compatible to be read with ds9 or other displying 21 to a region file which is compatible to be read with ds9 or other displying
22 -tools. To create a region file, the hidden parameter "ds9file" needs to be 22 +tools. To create a region file, the hidden parameter ``ds9file`` needs to be
23 specified. There are quite a few further hidden parameters to steer e.g. color, 23 specified. There are quite a few further hidden parameters to steer e.g. color,
24 font, etc of the region file output. 24 font, etc of the region file output.
25 25
doc/source/users/reference_manual/csmodelmerge.rst
@@ -20,7 +20,7 @@ a list of files that should be merged: @@ -20,7 +20,7 @@ a list of files that should be merged:
20 20
21 Note that the "@" needs to be specified in case of an ASCII file name. It is 21 Note that the "@" needs to be specified in case of an ASCII file name. It is
22 also important to note that models with the same name cannot be appended. The 22 also important to note that models with the same name cannot be appended. The
23 -tool will throw and exception if the provided file contain models with the same 23 +script will throw and exception if the provided file contain models with the same
24 name. 24 name.
25 25
26 26
doc/source/users/reference_manual/csobsdef.rst
@@ -9,11 +9,10 @@ Generates an observation definition file. @@ -9,11 +9,10 @@ Generates an observation definition file.
9 Synopsis 9 Synopsis
10 -------- 10 --------
11 11
12 -The csobsdef script generates an observation definition file from  
13 -a pointing list. The pointing list is a comma-separated value (CSV)  
14 -ASCII file with header keywords in the first row followed by a list  
15 -of pointings (one pointing per row). The following header keywords  
16 -are supported (case sensitive, column order irrelevant): 12 +This script generates an observation definition file from a pointing list. The
  13 +pointing list is a comma-separated value (CSV) ASCII file with header keywords
  14 +in the first row followed by a list of pointings (one pointing per row). The
  15 +following header keywords are supported (case sensitive, column order irrelevant):
17 16
18 - name - Observation name string 17 - name - Observation name string
19 - id - Unique observation identifier string 18 - id - Unique observation identifier string
@@ -29,10 +28,10 @@ are supported (case sensitive, column order irrelevant): @@ -29,10 +28,10 @@ are supported (case sensitive, column order irrelevant):
29 - caldb - Calibration database 28 - caldb - Calibration database
30 - irf - Response function name 29 - irf - Response function name
31 30
32 -Only the pairs (ra,dec) or (lon,lat) are mandatory header keywords.  
33 -All other keywords are optional and can be specified when calling  
34 -csobsdef as user parameters. The only exception is the "duration"  
35 -keyword that will automatically be queried. 31 +Only the pairs (ra,dec) or (lon,lat) are mandatory header keywords. All other
  32 +keywords are optional and can be specified when calling :ref:`csobsdef` as user
  33 +parameters. The only exception is the ``duration`` keyword that will automatically
  34 +be queried.
36 35
37 Here some usage examples: 36 Here some usage examples:
38 37
doc/source/users/reference_manual/csphagen.rst
@@ -9,18 +9,50 @@ Creates files necessary to perform a region-based spectral On/Off analysis. @@ -9,18 +9,50 @@ Creates files necessary to perform a region-based spectral On/Off analysis.
9 Synopsis 9 Synopsis
10 -------- 10 --------
11 11
12 -This script can be used to derive from an observation or a set of observations  
13 -the count spectra in a source region and in background regions, as well as the  
14 -detector response (effective area, energy redistribution matrix), that can be  
15 -used to perform a classical 1D spectral analysis. Regions can be placed  
16 -automatically or by hand. The output files are saved in the OGIP format normally  
17 -used in X-ray astronomy (PHA, ARF, RMF).  
18 -`See here <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node5.html>`__.  
19 -  
20 -The outputs are:  
21 -  
22 -1) the PHA, ARF, RMF files, either separately for each observation, or stacked  
23 - for a set of observations; 12 +This script generates the files that are necessary for a region-based spectral
  13 +On/Off analysis from one or several event lists. The output files are saved in
  14 +the OGIP format normally used in X-ray astronomy (PHA, ARF, RMF),
  15 +`see here for a description of the format <https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node5.html>`__.
  16 +
  17 +If the ``bkgmethod`` parameter is ``REFLECTED``, the script will use an On region
  18 +shape defined by the ``srcshape`` parameter and generate reflected regions by
  19 +placing regions of the same shape that are reflected with respect to the pointing
  20 +direction. So far only circular regions are supported, with a center that is
  21 +specified by the ``ra`` and ``dec`` parameters if ``coordsys=CEL`` or the ``glon``
  22 +and ``glat`` parameters if ``coordsys=GAL``, and a radius that is specified by the
  23 +``rad`` parameter. Reflected regions are only generated for offset angles with
  24 +respect to the pointing direction that are smaller than the value specified by
  25 +the ``maxoffset`` parameter. If less than ``bkgregmin`` reflected regions can be
  26 +found because the offset angle between source and pointing direction is too small,
  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.
  31 +
  32 +Alternatively, if ``bkgmethod=CUSTOM`` is specified, the source and background
  33 +regions will be specified using the ``srcregfile`` and ``bkgregfile`` parameters,
  34 +respectively. Both parameters accept either a ds9 region file or a sky map where
  35 +all non-zero pixel values define a region. In case that an observation definition
  36 +XML file is specified as input using the ``inobs``, background region files can
  37 +be specified separately for each observation using the ``OffRegions`` parameter
  38 +in the format
  39 +
  40 +.. code-block:: xml
  41 +
  42 + <observation name="Crab" id="00001" instrument="CTA">
  43 + <parameter name="OffRegions" file="ds9.reg"/>
  44 + ...
  45 + </observation>
  46 +
  47 +The :ref:`csphagen` script will produce on output an observation definition XML
  48 +file that points to all relevant files. All relevant files will be prefixed with
  49 +the string specified by the ``prefix`` parameter. If several observations are
  50 +contained in the input observation definition XML file the script can either
  51 +generate region based files for each of the observations or stack all
  52 +observations into single files (controlled via the ``stack`` parameter). The
  53 +script will write out:
  54 +
  55 +1) the PHA, ARF, RMF files;
24 2) DS9 regions files listing the source and background regions for each 56 2) DS9 regions files listing the source and background regions for each
25 observation; 57 observation;
26 3) a new observation definition XML file. 58 3) a new observation definition XML file.
@@ -39,8 +71,8 @@ General parameters @@ -39,8 +71,8 @@ General parameters
39 Instrument response function. 71 Instrument response function.
40 72
41 ``(inexclusion = NONE) [file]`` 73 ``(inexclusion = NONE) [file]``
42 - Optional FITS file containing a WCS map in the first hdu that defines sky  
43 - regions not to be used for background estimation (where map value != 0). 74 + Optional FITS file containing a WCS map in the first extension that defines
  75 + sky regions not to be used for background estimation (where map value != 0).
44 76
45 ``outobs [string]`` 77 ``outobs [string]``
46 Output observation definition XML file. 78 Output observation definition XML file.
@@ -72,10 +104,11 @@ General parameters @@ -72,10 +104,11 @@ General parameters
72 You may use :ref:`csebins` to generate a file with appropriate energy binning. 104 You may use :ref:`csebins` to generate a file with appropriate energy binning.
73 105
74 ``(srcshape = CIRCLE) <CIRCLE> [string]`` 106 ``(srcshape = CIRCLE) <CIRCLE> [string]``
75 - Shape of the source region (``CIRCLE``: circular region around given position). 107 + Shape of the source region. So far only ``CIRCLE`` exists which defines a
  108 + circular region around given position.
76 109
77 ``coordsys <CEL|GAL> [string]`` 110 ``coordsys <CEL|GAL> [string]``
78 - Coordinate system (``CEL``: celestial; ``GAL``: galactic). 111 + Coordinate system (CEL - celestial, GAL - galactic).
79 112
80 ``ra [real]`` 113 ``ra [real]``
81 Right Ascension of source region centre (deg). 114 Right Ascension of source region centre (deg).
doc/source/users/reference_manual/cstsdist.rst
@@ -15,7 +15,7 @@ sets. The Test Statistics is defined as twice the log-likelihood difference @@ -15,7 +15,7 @@ sets. The Test Statistics is defined as twice the log-likelihood difference
15 that is obtained when fitting simulated data with and without a given 15 that is obtained when fitting simulated data with and without a given
16 source model component. 16 source model component.
17 17
18 -cstsdist will create an ASCII file in comma-separated value (CSV) format, 18 +:red:`cstsdist` will create an ASCII file in comma-separated value (CSV) format,
19 containing one row per TS computation. The first row is a header row providing 19 containing one row per TS computation. The first row is a header row providing
20 the column names. The following rows give the TS value, the log-likelihood 20 the column names. The following rows give the TS value, the log-likelihood
21 values of the fit with or without the source, the number of observed and 21 values of the fit with or without the source, the number of observed and
doc/source/users/reference_manual/ctbkgcube.rst
@@ -16,7 +16,7 @@ The energy binning may be either linear, logarithmic, or custom defined using @@ -16,7 +16,7 @@ The energy binning may be either linear, logarithmic, or custom defined using
16 an input file. The input model is used to predict the expected number of 16 an input file. The input model is used to predict the expected number of
17 background counts in each background cube bin. 17 background counts in each background cube bin.
18 18
19 -ctbkgcube requires on input the event list or observation definition file 19 +:ref:`ctbkgcube` requires on input the event list or observation definition file
20 that has been used in the generation of the counts cube using :doc:`ctbin`. 20 that has been used in the generation of the counts cube using :doc:`ctbin`.
21 21
22 To assure consistency between an existing counts cube and the 22 To assure consistency between an existing counts cube and the
@@ -29,12 +29,12 @@ Note that there should at least be 25 bins per energy decade in the background @@ -29,12 +29,12 @@ Note that there should at least be 25 bins per energy decade in the background
29 cube to assure that the energy dependence of the background rate is sufficiently 29 cube to assure that the energy dependence of the background rate is sufficiently
30 well sampled (in particular at low energies). 30 well sampled (in particular at low energies).
31 31
32 -ctbkgcube generates a background cube FITS file comprising two extensions. 32 +:ref:`ctbkgcube` generates a background cube FITS file comprising two extensions.
33 The primary extension contains a 3-dimensional image that contains the 33 The primary extension contains a 3-dimensional image that contains the
34 background cube values. The next extension named ``ENERGIES`` contains a 34 background cube values. The next extension named ``ENERGIES`` contains a
35 binary table that defines the energies of the background cube. 35 binary table that defines the energies of the background cube.
36 36
37 -ctbkgcube generates also an output model XML file that can serve as input 37 +:ref:`ctbkgcube` generates also an output model XML file that can serve as input
38 for a maximum likelihood analysis. The output model XML file is a copy of 38 for a maximum likelihood analysis. The output model XML file is a copy of
39 the input model XML file where the input background model has been replaced 39 the input model XML file where the input background model has been replaced
40 by a background model of type ``CTACubeBackground``. The ``CTACubeBackground`` 40 by a background model of type ``CTACubeBackground``. The ``CTACubeBackground``
doc/source/users/reference_manual/ctbutterfly.rst
@@ -23,11 +23,11 @@ law models that fall within the error ellipse of the prefactor and index @@ -23,11 +23,11 @@ law models that fall within the error ellipse of the prefactor and index
23 parameters. The error ellipse is derived from the covariance matrix of a 23 parameters. The error ellipse is derived from the covariance matrix of a
24 maximum likelihood fit. 24 maximum likelihood fit.
25 25
26 -ctbutterfly assumes that the input model (parameter ``inmodel``) has been 26 +:ref:`ctbutterfly` assumes that the input model (parameter ``inmodel``) has been
27 adjusted using :doc:`ctlike` to the data, but if this is not the case you 27 adjusted using :doc:`ctlike` to the data, but if this is not the case you
28 can request a maximum likelihood fit by setting the hidden parameter ``fit=yes``. 28 can request a maximum likelihood fit by setting the hidden parameter ``fit=yes``.
29 29
30 -ctbutterfly writes the butterfly diagram into an ASCII file with 4 columns 30 +:ref:`ctbutterfly` writes the butterfly diagram into an ASCII file with 4 columns
31 separated by a whitespace. Each row in the result file corresponds to a specific 31 separated by a whitespace. Each row in the result file corresponds to a specific
32 energy. The meaning of the columns are: 32 energy. The meaning of the columns are:
33 33
doc/source/users/reference_manual/ctcubemask.rst
@@ -13,7 +13,7 @@ This tool masks out specific regions from a counts cube by setting the @@ -13,7 +13,7 @@ This tool masks out specific regions from a counts cube by setting the
13 corresponding bin values to -1. Bins with negative values will be ignored 13 corresponding bin values to -1. Bins with negative values will be ignored
14 in a maximum likelihood analysis. A mask is applied spatially and spectrally. 14 in a maximum likelihood analysis. A mask is applied spatially and spectrally.
15 15
16 -ctcubemask applies a spatial mask that is comprised of a circular selection 16 +:ref:`ctcubemask` applies a spatial mask that is comprised of a circular selection
17 region and a list of circular exclusion regions. The circular selection region 17 region and a list of circular exclusion regions. The circular selection region
18 is specified by the sky direction of the centre and the radius of the circle. 18 is specified by the sky direction of the centre and the radius of the circle.
19 The circular exclusion regions are specified by an ASCII file in ds9 format. 19 The circular exclusion regions are specified by an ASCII file in ds9 format.
@@ -24,10 +24,10 @@ The ASCII file contains one row per exclusion region, given in the format @@ -24,10 +24,10 @@ The ASCII file contains one row per exclusion region, given in the format
24 where ``83.63`` and ``21.5`` are the Right Ascension and Declination of 24 where ``83.63`` and ``21.5`` are the Right Ascension and Declination of
25 the centre and ``0.4`` is the radius (in degrees) of the exclusion circle. 25 the centre and ``0.4`` is the radius (in degrees) of the exclusion circle.
26 26
27 -ctcubemask also selects only counts cube energy layers that are fully comprised 27 +:ref:`ctcubemask` also selects only counts cube energy layers that are fully comprised
28 in the energy interval specified by the ``emin`` and ``emax`` parameters. 28 in the energy interval specified by the ``emin`` and ``emax`` parameters.
29 29
30 -ctcubemask generates a counts cube FITS file that is a copy of the input 30 +:ref:`ctcubemask` generates a counts cube FITS file that is a copy of the input
31 counts cube and for which all masked bins have been set to -1. 31 counts cube and for which all masked bins have been set to -1.
32 32
33 33
doc/source/users/reference_manual/ctedispcube.rst
@@ -16,7 +16,7 @@ which is the ratio between reconstructed and true photon energy. The energy @@ -16,7 +16,7 @@ which is the ratio between reconstructed and true photon energy. The energy
16 binning of the cube may be either linear, logarithmic, or custom defined 16 binning of the cube may be either linear, logarithmic, or custom defined
17 using an input file 17 using an input file
18 18
19 -ctedispcube requires on input the event list or observation definition XML 19 +:ref:`ctedispcube` requires on input the event list or observation definition XML
20 file that has been used in the generation of the counts cube using :doc:`ctbin`. 20 file that has been used in the generation of the counts cube using :doc:`ctbin`.
21 21
22 It is not recommended to use the counts cube for the energy dispersion 22 It is not recommended to use the counts cube for the energy dispersion
@@ -28,7 +28,7 @@ only little over the field of view of the camera it is recommended to use a @@ -28,7 +28,7 @@ only little over the field of view of the camera it is recommended to use a
28 rather coarse spatial binning to keep the file size manageable (with a typical 28 rather coarse spatial binning to keep the file size manageable (with a typical
29 value of ``binsz=1.0``). 29 value of ``binsz=1.0``).
30 30
31 -ctedispcube generates an energy dispersion cube FITS file comprising three 31 +:ref:`ctedispcube` generates an energy dispersion cube FITS file comprising three
32 extensions. The primary extension contains a 4-dimensional image that contains 32 extensions. The primary extension contains a 4-dimensional image that contains
33 the energy disperison values. The next extension named ``ENERGIES`` contains 33 the energy disperison values. The next extension named ``ENERGIES`` contains
34 a binary table that defines the energies of the energy dispersion cube. The 34 a binary table that defines the energies of the energy dispersion cube. The
doc/source/users/reference_manual/cterror.rst
@@ -16,7 +16,7 @@ of the likelihood that corresponds to a given confidence level. By default a @@ -16,7 +16,7 @@ of the likelihood that corresponds to a given confidence level. By default a
16 confidence level of 68% is used, but this level can be adjusted using the hidden 16 confidence level of 68% is used, but this level can be adjusted using the hidden
17 ``confidence`` parameter. 17 ``confidence`` parameter.
18 18
19 -cterror generates an output model XML file that contains the values of the 19 +:ref:`cterror` generates an output model XML file that contains the values of the
20 best fitting model parameters. For all free parameters, an ``error`` attribute 20 best fitting model parameters. For all free parameters, an ``error`` attribute
21 is added that provides the statistical uncertainty in the parameter estimate 21 is added that provides the statistical uncertainty in the parameter estimate
22 as obtained from the likelihood profile. While cterror computes asymmetrical 22 as obtained from the likelihood profile. While cterror computes asymmetrical
doc/source/users/reference_manual/ctexpcube.rst
@@ -15,7 +15,7 @@ Declination or Galactic latitude, and energy, that gives the exposure @@ -15,7 +15,7 @@ Declination or Galactic latitude, and energy, that gives the exposure
15 as function of true sky direction and energy. The energy binning of the cube 15 as function of true sky direction and energy. The energy binning of the cube
16 may be either linear, logarithmic, or custom defined using an input file. 16 may be either linear, logarithmic, or custom defined using an input file.
17 17
18 -ctexpcube requires on input the event list or observation definition file 18 +:ref:`ctexpcube` requires on input the event list or observation definition file
19 that has been used in the generation of the counts cube using :doc:`ctbin`. 19 that has been used in the generation of the counts cube using :doc:`ctbin`.
20 20
21 The binning of an exposure cube does not need to correspond to the binning 21 The binning of an exposure cube does not need to correspond to the binning
@@ -36,7 +36,7 @@ Note that there should at least be 25 bins per energy decade in the exposure @@ -36,7 +36,7 @@ Note that there should at least be 25 bins per energy decade in the exposure
36 cube to assure that the energy dependence of the exposure is sufficiently 36 cube to assure that the energy dependence of the exposure is sufficiently
37 well sampled (in particular at low energies). 37 well sampled (in particular at low energies).
38 38
39 -ctexpcube generates an exposure cube FITS file comprising three extensions. 39 +:ref:`ctexpcube` generates an exposure cube FITS file comprising three extensions.
40 The primary extension contains a 3-dimensional image that contains the 40 The primary extension contains a 3-dimensional image that contains the
41 exposure values. The next extension named ``ENERGIES`` contains a binary table 41 exposure values. The next extension named ``ENERGIES`` contains a binary table
42 that defines the energies of the exposure cube. The last extension named ``GTI`` 42 that defines the energies of the exposure cube. The last extension named ``GTI``
doc/source/users/reference_manual/ctlike.rst
@@ -17,12 +17,12 @@ The tool can mix the analysis of unbinned and binned data, and is also able @@ -17,12 +17,12 @@ The tool can mix the analysis of unbinned and binned data, and is also able
17 to perform a joint maximum likelihood analysis of data collected in 17 to perform a joint maximum likelihood analysis of data collected in
18 separate observations or with different instruments. 18 separate observations or with different instruments.
19 19
20 -ctlike will automatically switch between unbinned, binned and joint analysis 20 +:ref:`ctlike` will automatically switch between unbinned, binned and joint analysis
21 on basis of the file provided on input (parameter ``inobs``). Providing an 21 on basis of the file provided on input (parameter ``inobs``). Providing an
22 event list will lead to an unbinned analysis while providing a counts cube 22 event list will lead to an unbinned analysis while providing a counts cube
23 will lead to a binned analysis. If several observations have been stacked 23 will lead to a binned analysis. If several observations have been stacked
24 into a single counts cube, an exposure cube, a point spread function cube and 24 into a single counts cube, an exposure cube, a point spread function cube and
25 -a background cube need also to be provided. ctlike will automatically prompt 25 +a background cube need also to be provided. :ref:`ctlike` will automatically prompt
26 for these parameters in case that a counts cube is given. Answering ``NONE`` 26 for these parameters in case that a counts cube is given. Answering ``NONE``
27 will ignore the exposure cube, point spread function cube and background cube 27 will ignore the exposure cube, point spread function cube and background cube
28 and handle the data as a single observation using the specified instrument 28 and handle the data as a single observation using the specified instrument
@@ -33,19 +33,19 @@ can be handled by specifying an observation definition file on input. Each of @@ -33,19 +33,19 @@ can be handled by specifying an observation definition file on input. Each of
33 the observations will be kept separately and associated with its appropriate 33 the observations will be kept separately and associated with its appropriate
34 instrument response functions, as opposed to a stacked analysis where average 34 instrument response functions, as opposed to a stacked analysis where average
35 response functions, computed using :doc:`ctexpcube`, :doc:`ctpsfcube` and :doc:`ctbkgcube`, 35 response functions, computed using :doc:`ctexpcube`, :doc:`ctpsfcube` and :doc:`ctbkgcube`,
36 -are used. If an observation definition file is provided, ctlike will use the 36 +are used. If an observation definition file is provided, :ref:`ctlike` will use the
37 joint likelihood of all the observations for parameter optimisation. 37 joint likelihood of all the observations for parameter optimisation.
38 38
39 -By default, ctlike will use the Poisson statistics for likelihood computation, 39 +By default, :ref:`ctlike` will use the Poisson statistics for likelihood computation,
40 but for binned analysis also Gaussian statistics can be specified (parameter 40 but for binned analysis also Gaussian statistics can be specified (parameter
41 ``stat``). Optionally, a refit can be requested after an initial fit (parameter 41 ``stat``). Optionally, a refit can be requested after an initial fit (parameter
42 ``refit``), but normally this is not needed. For all model components that 42 ``refit``), but normally this is not needed. For all model components that
43 -have the ``tscalc="1"`` attribute set, ctlike will also compute the Test 43 +have the ``tscalc="1"`` attribute set, :ref:`ctlike` will also compute the Test
44 Statistics value that is a measure of the source significance. Optionally, 44 Statistics value that is a measure of the source significance. Optionally,
45 the spatial model parameters can be kept fixed during that computation 45 the spatial model parameters can be kept fixed during that computation
46 (parameter ``fix_spat_for_ts``). 46 (parameter ``fix_spat_for_ts``).
47 47
48 -ctlike generates an output model XML file that contains the values of the 48 +:ref:`ctlike` generates an output model XML file that contains the values of the
49 best fitting model parameters. For all free parameters, an ``error`` attribute 49 best fitting model parameters. For all free parameters, an ``error`` attribute
50 is added that provides the statistical uncertainty in the parameter estimate. 50 is added that provides the statistical uncertainty in the parameter estimate.
51 If computation of the Test Statistics has been requested for a model component, 51 If computation of the Test Statistics has been requested for a model component,
doc/source/users/reference_manual/ctmapcube.rst
@@ -16,7 +16,7 @@ map corresponds to a specific photon energy. The energy binning of the map @@ -16,7 +16,7 @@ map corresponds to a specific photon energy. The energy binning of the map
16 cube may be either linear, logarithmic, or custom defined using an input 16 cube may be either linear, logarithmic, or custom defined using an input
17 file. 17 file.
18 18
19 -ctmapcube generates a map cube FITS file comprising two extensions. The 19 +:ref:`ctmapcube` generates a map cube FITS file comprising two extensions. The
20 primary extension contains a 3-dimensional image containing the map cube 20 primary extension contains a 3-dimensional image containing the map cube
21 values. A second extension named ``ENERGIES`` contains a binary table that 21 values. A second extension named ``ENERGIES`` contains a binary table that
22 defines the energy values of each map in the cube. 22 defines the energy values of each map in the cube.
doc/source/users/reference_manual/ctmodel.rst
@@ -15,10 +15,10 @@ function of Right Ascension or Galactic longitude, Declination or Galactic @@ -15,10 +15,10 @@ function of Right Ascension or Galactic longitude, Declination or Galactic
15 latitude, and energy. The energy binning may be either linear, logarithmic, 15 latitude, and energy. The energy binning may be either linear, logarithmic,
16 or custom defined using an input file. 16 or custom defined using an input file.
17 17
18 -ctmodel requires on input either a counts cube, an event list or an observation 18 +:ref:`ctmodel` requires on input either a counts cube, an event list or an observation
19 definition file. 19 definition file.
20 20
21 -If a counts cube is provided, ctmodel will use the definition of this cube 21 +If a counts cube is provided, :ref:`ctmodel` will use the definition of this cube
22 (such as sky coordinates and projection, number of pixels, pixel scale, 22 (such as sky coordinates and projection, number of pixels, pixel scale,
23 energy binning) to compute a model cube. In case that the counts cube combines 23 energy binning) to compute a model cube. In case that the counts cube combines
24 multiple observations (i.e. for a so-called "stacked cube"), an exposure cube, 24 multiple observations (i.e. for a so-called "stacked cube"), an exposure cube,
@@ -26,17 +26,17 @@ a point spread function cube and a background cube have to be provided @@ -26,17 +26,17 @@ a point spread function cube and a background cube have to be provided
26 (otherwise you may just enter ``NONE`` when the names of these files are 26 (otherwise you may just enter ``NONE`` when the names of these files are
27 queried). 27 queried).
28 28
29 -If an event list is provided, ctmodel will query for a counts cube to 29 +If an event list is provided, :ref:`ctmodel` will query for a counts cube to
30 extract the model cube definition (parameter ``incube``). If no counts cube 30 extract the model cube definition (parameter ``incube``). If no counts cube
31 -is provided (``incube=NONE``), ctmodel tools will query for cube definition 31 +is provided (``incube=NONE``), :ref:`ctmodel` will query for cube definition
32 parameters. 32 parameters.
33 33
34 -If an observation definition file is provided, ctmodel will query for a counts 34 +If an observation definition file is provided, :ref:`ctmodel` will query for a counts
35 cube to extract the model cube definition, unless the observation definition 35 cube to extract the model cube definition, unless the observation definition
36 file contains a single binned observation (in that case, the counts cube of 36 file contains a single binned observation (in that case, the counts cube of
37 that observation will be used to extract the model cube definition). 37 that observation will be used to extract the model cube definition).
38 38
39 -ctmodel generates a model cube FITS file comprising three extensions. The 39 +:ref:`ctmodel` generates a model cube FITS file comprising three extensions. The
40 primary extension contains a 3-dimensional image that contains the model 40 primary extension contains a 3-dimensional image that contains the model
41 cube values. The next extension named ``EBOUNDS`` contains a binary table 41 cube values. The next extension named ``EBOUNDS`` contains a binary table
42 that defines the energy boundaries of the background cube. The last extension 42 that defines the energy boundaries of the background cube. The last extension
doc/source/users/reference_manual/ctobssim.rst
@@ -21,14 +21,14 @@ a numerical random number generator for the simulations with a seed value @@ -21,14 +21,14 @@ a numerical random number generator for the simulations with a seed value
21 provided by the hidden ``seed`` parameter. Changing this parameter for 21 provided by the hidden ``seed`` parameter. Changing this parameter for
22 subsequent runs will lead to different event samples. 22 subsequent runs will lead to different event samples.
23 23
24 -ctobssim performs a safety check on the maximum photon rate for all model 24 +:ref:`ctobssim` performs a safety check on the maximum photon rate for all model
25 components to avoid that the tool locks up and requests huge memory 25 components to avoid that the tool locks up and requests huge memory
26 resources, which may happen if a mistake was made in setting up the input 26 resources, which may happen if a mistake was made in setting up the input
27 model (for example if an error in the flux units is made). The maximum allowed 27 model (for example if an error in the flux units is made). The maximum allowed
28 photon rate is controlled by the hidden ``maxrate`` parameter, which by default 28 photon rate is controlled by the hidden ``maxrate`` parameter, which by default
29 is set to 1e6. 29 is set to 1e6.
30 30
31 -ctobssim can also generate multiple event lists if an observation definition 31 +:ref:`ctobssim` can also generate multiple event lists if an observation definition
32 file is specified on input using the hidden ``inobs`` parameter. In that 32 file is specified on input using the hidden ``inobs`` parameter. In that
33 case, simulation information will be gathered from the file, and for each 33 case, simulation information will be gathered from the file, and for each
34 observation an event list will be created. 34 observation an event list will be created.
doc/source/users/reference_manual/ctpsfcube.rst
@@ -16,7 +16,7 @@ and offset angle between true and measured arrival direction of a photon. @@ -16,7 +16,7 @@ and offset angle between true and measured arrival direction of a photon.
16 The energy binning of the cube may be either linear, logarithmic, or custom 16 The energy binning of the cube may be either linear, logarithmic, or custom
17 defined using an input file. 17 defined using an input file.
18 18
19 -ctpsfcube requires on input the event list or observation definition XML 19 +:ref:`ctpsfcube` requires on input the event list or observation definition XML
20 file that has been used in the generation of the counts cube using :doc:`ctbin`. 20 file that has been used in the generation of the counts cube using :doc:`ctbin`.
21 21
22 It is not recommended to use the counts cube for the point spread function 22 It is not recommended to use the counts cube for the point spread function
@@ -28,7 +28,7 @@ function varies only slowly over the field of view of the camera it is @@ -28,7 +28,7 @@ function varies only slowly over the field of view of the camera it is
28 recommended to use a rather coarse spatial binning to keep the file size 28 recommended to use a rather coarse spatial binning to keep the file size
29 manageable (with a typical value of ``binsz=1.0``). 29 manageable (with a typical value of ``binsz=1.0``).
30 30
31 -ctpsfcube generates a point spread function cube FITS file comprising three 31 +:ref:`ctpsfcube` generates a point spread function cube FITS file comprising three
32 extensions. The primary extension contains a 4-dimensional image that contains 32 extensions. The primary extension contains a 4-dimensional image that contains
33 the point spread function values. The next extension named ``ENERGIES`` contains 33 the point spread function values. The next extension named ``ENERGIES`` contains
34 a binary table that defines the energies of the point spread function cube. 34 a binary table that defines the energies of the point spread function cube.
doc/source/users/reference_manual/ctskymap.rst
@@ -20,7 +20,7 @@ parameter. By default, no background model is subtracted (method ``NONE``). @@ -20,7 +20,7 @@ parameter. By default, no background model is subtracted (method ``NONE``).
20 If ``IRF`` is selected, the background template that are shipped with the 20 If ``IRF`` is selected, the background template that are shipped with the
21 Instrument Response Functions will be used for background subtraction. 21 Instrument Response Functions will be used for background subtraction.
22 22
23 -ctskymap generates a FITS file comprising a sky map as primary extension. 23 +:ref:`ctskymap` generates a FITS file comprising a sky map as primary extension.
24 If a background subtraction method was selected, the FITS file will contain 24 If a background subtraction method was selected, the FITS file will contain
25 the additional extensions ``BACKGROUND`` and ``SIGNIFICANCE`` that contain 25 the additional extensions ``BACKGROUND`` and ``SIGNIFICANCE`` that contain
26 the background map and a significance map, respectively. For the latter, the 26 the background map and a significance map, respectively. For the latter, the
doc/source/users/reference_manual/cttsmap.rst
@@ -19,7 +19,7 @@ that excludes the specified source. The square-root of the TS values @@ -19,7 +19,7 @@ that excludes the specified source. The square-root of the TS values
19 corresponds roughly to the pre-trial detection significance of the source (in 19 corresponds roughly to the pre-trial detection significance of the source (in
20 Gaussian sigma). 20 Gaussian sigma).
21 21
22 -cttsmap generates a FITS file comprising a sky map of TS values followed by 22 +:ref:`cttsmap` generates a FITS file comprising a sky map of TS values followed by
23 one extension per free parameter that contains sky maps of the fitted 23 one extension per free parameter that contains sky maps of the fitted
24 parameter values. To save computation time, the errors are not computed by 24 parameter values. To save computation time, the errors are not computed by
25 default. Specifying the hidden parameter ``errors=yes`` will switch on the 25 default. Specifying the hidden parameter ``errors=yes`` will switch on the
doc/source/users/reference_manual/ctulimit.rst
@@ -16,7 +16,7 @@ to a decrease of the likelihood that corresponds to a given confidence level. @@ -16,7 +16,7 @@ to a decrease of the likelihood that corresponds to a given confidence level.
16 By default a confidence level of 95% is used, but this level can be adjusted 16 By default a confidence level of 95% is used, but this level can be adjusted
17 using the hidden ``confidence`` parameter. 17 using the hidden ``confidence`` parameter.
18 18
19 -ctulimit writes the differential upper flux limit at a given reference 19 +:ref:`ctulimit` writes the differential upper flux limit at a given reference
20 energy (specified by the hidden parameter ``eref``) and the integrated 20 energy (specified by the hidden parameter ``eref``) and the integrated
21 upper flux limit (specified by the hidden parameters ``emin`` and ``emax``) 21 upper flux limit (specified by the hidden parameters ``emin`` and ``emax``)
22 into the log file. 22 into the log file.
doc/source/users/reference_manual/usage.rst
1 .. _sec_usage: 1 .. _sec_usage:
2 2
3 -Description of ctools parameters in the :ref:`reference`  
4 -======================================================== 3 +ctools parameter interface
  4 +==========================
5 5
6 For a generic introduction to ctools and user parameters see 6 For a generic introduction to ctools and user parameters see
7 `here <../user_manual/introduction.html>`__. 7 `here <../user_manual/introduction.html>`__.
@@ -9,29 +9,27 @@ For a generic introduction to ctools and user parameters see @@ -9,29 +9,27 @@ For a generic introduction to ctools and user parameters see
9 Automatic parameters 9 Automatic parameters
10 -------------------- 10 --------------------
11 11
12 -``par_name [ = value ] <valid values> type``  
13 - Where par_name is the name of the parameter, value is the default value,  
14 - valid values are valid parameter values, separated by | characters, and  
15 - type is the type of the parameter.  
16 - The type is enclosed in square brackets. 12 +``par_name <first valid value|second valid value|...> [type]``
  13 + Where ``par_name`` is the name of the parameter, ``first valid value`` and
  14 + ``second valid value`` are valid parameter values, separated by ``|`` characters,
  15 + and ``type`` is the type of the parameter.
17 16
18 17
19 Hidden parameters 18 Hidden parameters
20 ----------------- 19 -----------------
21 20
22 -``(par_name = value) type``  
23 - Where par_name is the name of the parameter, value is the default value,  
24 - and type is the type of the parameter.  
25 - The type is enclosed in square brackets. 21 +``(par_name = value) [type]``
  22 + Where ``par_name`` is the name of the parameter, ``value`` is the default value,
  23 + and ``type`` is the type of the parameter.
26 24
27 25
28 Examples 26 Examples
29 -------- 27 --------
30 28
31 ``infile [file]`` 29 ``infile [file]``
32 - Describes an automatic (queried) file-type parameter with no default value. 30 + Describes an automatic (queried) file-type parameter.
33 31
34 -``irf = South_50h <North_50h|South_50h> [string]`` 32 +``irf <North_50h|South_50h> [string]``
35 Describes an automatic (queried) string-type parameter with two value 33 Describes an automatic (queried) string-type parameter with two value
36 options. 34 options.
37 35
src/Makefile.am
1 ############################################################################# 1 #############################################################################
2 # Makefile.am for ctools module # 2 # Makefile.am for ctools module #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 -# Copyright (C) 2016-2017 Juergen Knoedlseder # 4 +# Copyright (C) 2016-2018 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # This program is free software: you can redistribute it and/or modify # 7 # This program is free software: you can redistribute it and/or modify #
@@ -101,6 +101,8 @@ help-install: @@ -101,6 +101,8 @@ help-install:
101 $(INSTALL_DATA) "$$file" $(DESTDIR)$(datadir)/help/"$$helpname" ; \ 101 $(INSTALL_DATA) "$$file" $(DESTDIR)$(datadir)/help/"$$helpname" ; \
102 sed -i.bak -e 's/``//g' -e 's/`//g' -e 's/:ref://g' -e 's/:doc://g' \ 102 sed -i.bak -e 's/``//g' -e 's/`//g' -e 's/:ref://g' -e 's/:doc://g' \
103 -e 's/.. note::/Note/g' -e 's/.. warning::/Warning/g' -e '1d' \ 103 -e 's/.. note::/Note/g' -e 's/.. warning::/Warning/g' -e '1d' \
  104 + -e 's/.. code-block:: bash//g' -e 's/.. code-block:: xml//g' \
  105 + -e 's/>__/>/g' -e 's/>_/>/g' \
104 $(DESTDIR)$(datadir)/help/"$$helpname" ; \ 106 $(DESTDIR)$(datadir)/help/"$$helpname" ; \
105 rm -rf $(DESTDIR)$(datadir)/help/"$$helpname".bak ; \ 107 rm -rf $(DESTDIR)$(datadir)/help/"$$helpname".bak ; \
106 done 108 done
test/test_ctmodel.py
@@ -72,7 +72,8 @@ class Test(test): @@ -72,7 +72,8 @@ class Test(test):
72 ' inmodel="'+self._model+'"'+ \ 72 ' inmodel="'+self._model+'"'+ \
73 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 73 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
74 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \ 74 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \
75 - ' emin=0.1 emax=100.0 enumbins=10 nxpix=40 nypix=40'+ \ 75 + ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  76 + ' nxpix=40 nypix=40'+ \
76 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \ 77 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \
77 ' xref=83.63 yref=22.01'+ \ 78 ' xref=83.63 yref=22.01'+ \
78 ' logfile="ctmodel_cmd1.log" chatter=1' 79 ' logfile="ctmodel_cmd1.log" chatter=1'
@@ -91,7 +92,8 @@ class Test(test): @@ -91,7 +92,8 @@ class Test(test):
91 ' inmodel="model_that_does_not_exist.xml"'+ \ 92 ' inmodel="model_that_does_not_exist.xml"'+ \
92 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 93 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
93 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \ 94 ' rad=5.0 ra=83.63 dec=22.01 tmin=0.0 tmax=1800'+ \
94 - ' emin=0.1 emax=100.0 enumbins=10 nxpix=40 nypix=40'+ \ 95 + ' emin=0.1 emax=100.0 enumbins=10 ebinalg="LOG"'+ \
  96 + ' nxpix=40 nypix=40'+ \
95 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \ 97 ' binsz=0.1 coordsys="CEL" proj="CAR"'+ \
96 ' xref=83.63 yref=22.01'+ \ 98 ' xref=83.63 yref=22.01'+ \
97 ' logfile="ctmodel_cmd2.log" debug=yes chatter=1' 99 ' logfile="ctmodel_cmd2.log" debug=yes chatter=1'
@@ -142,6 +144,7 @@ class Test(test): @@ -142,6 +144,7 @@ class Test(test):
142 model['dec'] = 22.01 144 model['dec'] = 22.01
143 model['tmin'] = 0 145 model['tmin'] = 0
144 model['tmax'] = 1800 146 model['tmax'] = 1800
  147 + model['ebinalg'] = 'LOG'
145 model['emin'] = 0.1 148 model['emin'] = 0.1
146 model['emax'] = 100.0 149 model['emax'] = 100.0
147 model['enumbins'] = 10 150 model['enumbins'] = 10