Commit 85bed88b05fb72328ed39778638b59fb6c8bf2c4

Authored by Jürgen Knödlseder
1 parent 611b1893

Update user documentation.

Showing 37 changed files with 860 additions and 643 deletions
doc/source/installation.rst
... ... @@ -4,8 +4,8 @@ Installation
4 4  
5 5 .. note ::
6 6  
7   - These installation instructions apply to gammalib-00-04-10 and
8   - later. gammalib-00-04-10 has been built, installed and tested
  7 + These installation instructions apply to gammalib-0.10.0 and
  8 + later. gammalib-0.10.0 has been built, installed and tested
9 9 successfully on Debian, Ubuntu, Mandriva, OpenSUSE, Scientific Linux,
10 10 CentOS, gentoo, Mac OS X, FreeBSD, and OpenSolaris (using gcc), so
11 11 hopefully it also installs on your distribution. In case you encounter
... ... @@ -64,12 +64,12 @@ Building GammaLib
64 64 Download the latest source tarball, save it in an appropriate location,
65 65 and type ::
66 66  
67   - $ tar xvfz GammaLib-XX-XX-XX.tar.gz
  67 + $ tar xvfz gammalib-x.y.z.tar.gz
68 68  
69   -where ``XX-XX-XX`` is the version number of the library. Step in the created
  69 +where ``x.y.z`` is the version number of the library. Step in the created
70 70 directory using ::
71 71  
72   - $ cd gammalib-XX-XX-XX
  72 + $ cd gammalib-x.y.z
73 73  
74 74 and build GammaLib by typing ::
75 75  
... ...
doc/source/quickstart.rst
... ... @@ -5,7 +5,7 @@ First steps with GammaLib
5 5 -------------------------
6 6  
7 7 GammaLib comes with a Python interface, and as first step you should
8   -verify that the Python interfaces workes correctly. You do this by
  8 +verify that the Python interface works correctly. You do this by
9 9 typing::
10 10  
11 11 >>> import gammalib
... ... @@ -62,13 +62,13 @@ Now let's append a model to this container. For this, type::
62 62 Constant .................: 1 (relative value) (fixed,scale=1,gradient)
63 63  
64 64 With this sequence of commands you first defined a sky direction in
65   -celestial coordinates using ``GSkyDir``. You may easily recognise that this
  65 +celestial coordinates using ``GSkyDir``. You may recognise that this
66 66 is the position of the Crab. You then used this position to define the
67 67 spatial component of a sky model using ``GModelSpatialPointSource``. As the name
68 68 suggests, the spatial component is a point source. Next, you defined the
69 69 spectral component using ``GModelSpactralPlaw``: a power law with
70   -normalisation of 1 and index of -2. Then, you combined the spatial and
71   -spectral components in a point source model using ``GModelSky``. And
  70 +normalisation of 1 and a spectral index of -2. Then, you combined the spatial
  71 +and spectral components in a point source model using ``GModelSky``. And
72 72 finally you appended the point source to the model container allocated
73 73 previously using the append method. When you then print the model
74 74 container you see that is contains now one model with 6 parameters.
... ...
doc/source/user_manual/getting.rst
... ... @@ -144,8 +144,8 @@ https://sourceforge.net/projects/gammalib/. The code can be downloaded
144 144 from this site by clicking on the download button. Alternatively, the
145 145 code can be downloaded and unpacked from the UNIX prompt using::
146 146  
147   - $ wget --no-check-certificate https://downloads.sourceforge.net/project/gammalib/gammalib/gammalib-00-10-00.tar.gz
148   - $ tar xfz gammalib-00-10-00.tar.gz
  147 + $ wget --no-check-certificate https://downloads.sourceforge.net/project/gammalib/gammalib/gammalib-0.10.0.tar.gz
  148 + $ tar xfz gammalib-0.10.0.tar.gz
149 149  
150 150 The GammaLib source code can also be cloned using git. This method is
151 151 recommended if you plan to contribute to the development of the GammaLib
... ... @@ -484,7 +484,7 @@ Generating the reference documentation
484 484 The reference documentation for GammaLib is generated directly from the source
485 485 code using the `Doxygen <http://www.doxygen.org/>`_ documentation system.
486 486 The latest GammaLib reference manual can be found at
487   -http://gammalib.sourceforge.net/doxygen/.
  487 +http://cta.irap.omp.eu/gammalib/doxygen/.
488 488  
489 489 The reference documentation is not shipped together with the source code
490 490 as this would considerably increase the size of the tarball. In case
... ...
doc/source/user_manual/internals.rst
... ... @@ -6,4 +6,4 @@ Under the hood
6 6 Registry classes
7 7 ----------------
8 8  
9   -TBW: Describe what a registry class is.
  9 +To be written (describe what a registry class is) ...
... ...
doc/source/user_manual/introduction.rst
... ... @@ -4,8 +4,8 @@ Introduction
4 4 Scope
5 5 -----
6 6  
7   -This User Manual provides a complete description of the GammaLib C++ library. It
8   -is equally well suited for beginners as well as experienced users.
  7 +This User Manual provides a complete description of the GammaLib C++ library.
  8 +It is equally well suited for beginners as for experienced users.
9 9  
10 10 Overview
11 11 --------
... ... @@ -34,16 +34,19 @@ that allows for consistent broad-band spectral fitting or imaging.
34 34  
35 35 GammaLib source code is freely available under the GNU General Public license
36 36 version 3. The latest source code can be downloaded from
37   -https://sourceforge.net/projects/gammalib/ which also provides bug
38   -trackers and mailing lists. Further information and documentation on
39   -GammaLib can be found on http://gammalib.sourceforge.net/. The present document
40   -applies to GammaLib version 0.10.
  37 +https://sourceforge.net/projects/gammalib/.
  38 +The issue tracker can be found at
  39 +https://cta-redmine.irap.omp.eu/projects/gammalib/issues.
  40 +Further information and documentation on GammaLib can be found at
  41 +http://cta.irap.omp.eu/gammalib/.
  42 +The present document applies to GammaLib version 0.10.
41 43  
42 44 GammaLib is designed to compile on any POSIX compliant platform. So far,
43 45 GammaLib has been successfully compiled and tested on Mac OS X, OpenBSD, OpenSolaris
44 46 (using the gcc compiler) and many Linux flavours. Pre-packed binary
45 47 versions of the code are also available for Mac OS X. For known problems
46   -with specific platforms, please refer to section :ref:`sec_known_problems`.
  48 +with specific platforms, please refer to the :ref:`sec_known_problems`
  49 +section.
47 50  
48 51 GammaLib makes heavily use of C++ classes. Instrument independency is achieved
49 52 by using abstract virtual base classes, which are implemented as derived
... ...
doc/source/user_manual/modules/app.rst
... ... @@ -6,6 +6,17 @@ Creation of ftools applications
6 6 Overview
7 7 ~~~~~~~~
8 8  
  9 +The following figure presents an overview over the C++ classes of the
  10 +application module and their relations.
  11 +
  12 +.. _fig_uml_app:
  13 +
  14 +.. figure:: uml_app.png
  15 + :width: 35%
  16 + :align: center
  17 +
  18 + *Application module*
  19 +
9 20 The application module provides classes to create ftools applications
10 21 using GammaLib. A ftool application provides a parameter interface
11 22 following the IRAF standard that is widely used in high-energy
... ... @@ -16,12 +27,3 @@ parameter implemented by the :doxy:`GApplicationPar` class. In addition, an
16 27 application contains a logger, implemented by the :doxy:`GLog` class, which
17 28 allows message passing to the console and/or a dedicated log file.
18 29  
19   -:ref:`fig_uml_app` present an overview over the C++ classes of the
20   -application module and their relations.
21   -
22   -.. _fig_uml_app:
23   -
24   -.. figure:: uml_app.png
25   - :width: 50%
26   -
27   - Application module
... ...
doc/source/user_manual/modules/calltree_model.png

75.1 KB | W: | H:

50.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/com.rst
... ... @@ -6,16 +6,18 @@ COMPTEL interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -The COMPTEL module provides an instrument interface for the COMPTEL
10   -telescope that has been operated on the Compton Gamma-Ray Observatory
11   -(CGRO) from 1991 to 2000.
12   -
13   -:ref:`fig_uml_com` present an overview over the C++ classes of the COMPTEL
  9 +The following figure presents an overview over the C++ classes of the COMPTEL
14 10 module and their relations.
15 11  
16 12 .. _fig_uml_com:
17 13  
18 14 .. figure:: uml_com.png
19   - :width: 80%
  15 + :width: 70%
  16 + :align: center
  17 +
  18 + *COMPTEL module*
  19 +
  20 +The COMPTEL module provides an instrument interface for the COMPTEL
  21 +telescope that has been operated on the Compton Gamma-Ray Observatory
  22 +(CGRO) from 1991 to 2000.
20 23  
21   - COMPTEL module
... ...
doc/source/user_manual/modules/cta.rst
... ... @@ -3,426 +3,10 @@
3 3 CTA interface
4 4 -------------
5 5  
6   -Overview
7   -~~~~~~~~
  6 +.. toctree::
  7 + :maxdepth: 2
8 8  
9   -The CTA module provides an instrument interface for Imaging Air Cherenkov
10   -Telescopes (IACT). The interface currently supports the event list data
11   -format developed in the context of the Cherenkov Telescope Array (CTA)
12   -project and provides support for various instrument response formats that
13   -are currently used in the CTA consortium or that are under study. The interface
14   -provides support for unbinned and binned maximum likelihood analysis, and
15   -implements Monte Carlo simulations of high-level data based on the
16   -instrumental response functions.
17   -
18   -:ref:`fig_uml_cta` present an overview over the C++ classes of the CTA
19   -module and their relations.
20   -
21   -.. _fig_uml_cta:
22   -
23   -.. figure:: uml_cta.png
24   - :width: 100%
25   -
26   - CTA module
27   -
28   -Two types of observations are implemented so far:
29   -:doxy:`GCTAObservation` that derives from :doxy:`GObservation` and that
30   -describes either a binned or unbinned data set, and
31   -:doxy:`GCTAOnOffObservation` that describes an On-Off observation
32   -used in classical Cherenkov Telescope data analysis.
33   -Binned or unbinned observations are collected in the
34   -:doxy:`GObservations` container class, while the On-Off observations
35   -are collected in a specific :doxy:`GCTAOnOffObservations` container
36   -class (note that the :doxy:`GCTAOnOffObservations` container may vanish
37   -in the future when :doxy:`GCTAOnOffObservation` objects will also be
38   -collected by the :doxy:`GObservations` container class).
39   -
40   -The data of binned observations are stored by the
41   -:doxy:`GCTAEventCube` class. The :doxy:`GCTAEventCube` class holds the
42   -binned event data in form of a sky map, implemented by the
43   -:doxy:`GSkymap` class. The sky coordinates of all sky map pixels
44   -are stored in an array of CTA instrument directions, implemented
45   -by the :doxy:`GCTAInstDir` class which holds a single :doxy:`GSkyDir`
46   -object. The mean energies of the event cube
47   -are stored in an array of :doxy:`GEnergy` objects, and the mean
48   -time is stored by a :doxy:`GTime` object. The :doxy:`GCTAEventCube` class
49   -holds in fact only a single event bin, implemented by the
50   -:doxy:`GCTAEventBin` class. When the event bin is accessed using
51   -the :doxy:`GCTAEventCube::operator[]` operator, the operator updates
52   -references to the event cube data so that the :doxy:`GCTAEventBin`
53   -object represents the selected event bin. This allows a memory-efficient
54   -storage of event bin information (without storing for example the
55   -instrument direction or the energy for each bin), while preserving
56   -the abstract data model where an event cube of abstract type
57   -:doxy:`GEventCube` is composed of event bins of abstract type
58   -:doxy:`GEventBin` (see :ref:`sec_obs`).
59   -
60   -The data of unbinned observations are stored by the :doxy:`GCTAEventList`
61   -class. The :doxy:`GCTAEventList` class is a container of :doxy:`GCTAEventAtom`
62   -objects that represent individual events. Each event is composed of
63   -a :doxy:`GCTAInstDir` object, a :doxy:`GEnergy` object and a :doxy:`GTime` object.
64   -The region of interest covered by an event list is described by the
65   -:doxy:`GCTARoi` class that derives from the abstract :doxy:`GRoi` class.
66   -
67   -In addition to the event, each :doxy:`GCTAObservation` holds a
68   -pointing object, implemented by the :doxy:`GCTAPointing` class, and
69   -a response object, implemented by the :doxy:`GCTAResponse` class.
70   -The :doxy:`GCTAPointing` class holds a single sky direction of type
71   -:doxy:`GSkyDir` to describe the fixed pointing direction of the
72   -observation. The :doxy:`GCTAResponse` class provides the instrument
73   -response factorised in an effective area term, a point spread
74   -function term and an energy dispersion term
75   -(see :ref:`sec_cta_response` for details on the response
76   -implementation).
77   -
78   -Models of the instrumental background are provided by the
79   -:doxy:`GCTAModelCubeBackground` and :doxy:`GCTAModelRadialAcceptance`
80   -classes that derive from the abstract :doxy:`GModelData` base
81   -class
82   -(see :ref:`sec_cta_background` for details on the background
83   -model implementation).
84   -
85   -.. _sec_cta_xml:
86   -
87   -Describing CTA observations using XML
88   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89   -
90   -CTA observations can be described in GammaLib using an ASCII file in XML
91   -format (see :ref:`sec_obsxml`). The CTA specific section of this file has
92   -the format:
93   -
94   -.. code-block:: xml
95   -
96   - <observation name="..." id="..." instrument="...">
97   - <parameter name="EventList" file="..."/>
98   - <parameter name="EffectiveArea" file="..."/>
99   - <parameter name="PointSpreadFunction" file="..."/>
100   - <parameter name="EnergyDispersion" file="..."/>
101   - <parameter name="Background" file="..."/>
102   - </observation>
103   -
104   -for an unbinned observation and:
105   -
106   -.. code-block:: xml
107   -
108   - <observation name="..." id="..." instrument="...">
109   - <parameter name="CountsCube" file="..."/>
110   - <parameter name="EffectiveArea" file="..."/>
111   - <parameter name="PointSpreadFunction" file="..."/>
112   - <parameter name="EnergyDispersion" file="..."/>
113   - <parameter name="Background" file="..."/>
114   - </observation>
115   -
116   -for a binned observation. Each parameter within the ``<observation>`` tag
117   -specifies the filename for a specific file that is needed for the analysis.
118   -The difference between an unbinned and a binned observation is that the
119   -first uses an event list (requiring a parameter with name ``EventList``)
120   -while the latter uses an event cube (requiring a parameter with name
121   -``CountsCube``). The ``EffectiveArea``, ``PointSpreadFunction`` and
122   -``EnergyDispersion`` parameters provide the filenames of the instrument
123   -specific response function components for each observation
124   -(see :ref:`sec_cta_response`). Note that for compatibility reasons,
125   -``ARF`` may be used instead of ``EffectiveArea``, ``PSF`` instead
126   -of ``PointSpreadFunction``, and ``RMF`` instead of ``EnergyDispersion``.
127   -The ``EffectiveArea`` parameter supports the additional optional
128   -attributes ``sigma``, ``scale`` and ``thetacut`` to provide information
129   -about the off-axis reponse and event selection (see
130   -:ref:`sec_cta_response`).
131   -So far, energy dispersion is not supported by GammaLib, hence the
132   -``file`` attribute for the ``EnergyDispersion`` parameter can be left
133   -blank.
134   -The ``Background`` parameter allows specifying of a file that contains
135   -the instrument background model for the observation.
136   -
137   -The ``instrument`` attribute of CTA observations can be one of
138   -``CTA``, ``HESS``, ``MAGIC`` or ``VERITAS``. This allows mixing of
139   -observations from difference IACTs within a single analysis.
140   -Note that no code that is specific to any of these four instruments is
141   -implemented in GammaLib, but the ``instrument`` attribute is used to
142   -tie models to instruments, allowing thus to provide specific background
143   -models for each of the instruments in a combined analysis.
144   -
145   -
146   -.. _sec_cta_background:
147   -
148   -Modelling CTA background
149   -~~~~~~~~~~~~~~~~~~~~~~~~
150   -
151   -The generic class for modelling the CTA background is the
152   -:doxy:`GCTAModelCubeBackground` class. This class derives from the :doxy:`GModelData`
153   -base class and provides a description of the background count rate as
154   -function of reconstructued sky direction, measured energy and event trigger
155   -time.
156   -
157   -The XML description of the background model has the following format:
158   -
159   -.. code-block:: xml
160   -
161   - <source name="CTABackgroundModel" type="CTABackground" instrument="CTA">
162   - <spatialModel type="...">
163   - ...
164   - </spatialModel>
165   - <spectrum type="...">
166   - ...
167   - </spectrum>
168   - <temporalModel type="...">
169   - ...
170   - </temporalModel>
171   - </source>
172   -
173   -The ``<temporalModel>`` tag is optional and can generally be omitted from
174   -the XML file. In that case, the background rate is assumed to be constant
175   -in time.
176   -
177   -The ``<spatialModel>`` may be any of the spatial model components available
178   -in GammaLib. In particular, a diffuse map cube can be used to provide an
179   -energy dependent template of the background count rate over the field of
180   -view:
181   -
182   -.. code-block:: xml
183   -
184   - <source name="CTABackgroundModel" type="CTABackground" instrument="CTA">
185   - <spatialModel type="MapCubeFunction" file="my_background_template.fits">
186   - <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="0"/>
187   - </spatialModel>
188   - <spectrum type="ConstantValue">
189   - <parameter name="Value" scale="1.0" min="0.01" max="1000.0" value="1.0" free="1"/>
190   - </spectrum>
191   - </source>
192   -
193   -In the above example, the file ``my_background_template.fits`` contains
194   -an image cube in the primary extension of the FITS file which describes the
195   -count rate per solid angle and energy
196   -(in units of :math:`counts \, s^{-1} sr^{-1} MeV^{-1}`).
197   -The energy of each map is provided in a binary table extension with name
198   -``ENERGIES`` which contains a single column with name ``Energy`` (the
199   -energy unit may be specified by the ``TUNIT1`` keyword; if the keyword is
200   -omitted, MeV is assumed as unit).
201   -
202   -The ``ConstantValue`` spectrum corresponds to a single scaling factor for
203   -the background model, which in the above example is fitted in the maximum
204   -likelihood analysis. Any spectral model available in GammaLib can be used
205   -as the spectral component, such as for example a power law:
206   -
207   -.. code-block:: xml
208   -
209   - <source name="CTABackgroundModel" type="CTABackground" instrument="CTA">
210   - <spatialModel type="MapCubeFunction" file="my_background_template.fits">
211   - <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="0"/>
212   - </spatialModel>
213   - <spectrum type="PowerLaw">
214   - <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/>
215   - <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/>
216   - <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
217   - </spectrum>
218   - </source>
219   -
220   -In the above example, the map cube spectrum is multiplied by a power law.
221   -
222   -.. _sec_cta_response:
223   -
224   -Handling the instrument response
225   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
226   -
227   -Overview
228   -^^^^^^^^
229   -
230   -The CTA specific instrument response is described by the
231   -:doxy:`GCTAResponseIrf` class (see :ref:`sec_response` for a general description of response
232   -handling in GammaLib). The CTA response is factorised into
233   -the effective area :math:`A_{\rm eff}(d, p, E, t)` (units :math:`cm^2`),
234   -the point spread function :math:`PSF(p' | d, p, E, t)`,
235   -and the energy dispersion :math:`E_{\rm disp}(E' | d, p, E, t)`
236   -following:
237   -
238   -.. math::
239   - R(p', E', t' | d, p, E, t) =
240   - A_{\rm eff}(d, p, E, t) \,
241   - PSF(p' | d, p, E, t) \,
242   - E_{\rm disp}(E' | d, p, E, t)
243   - :label: irf
244   -
245   -
246   -Effective area
247   -^^^^^^^^^^^^^^
248   -
249   -The :math:`A_{\rm eff}(d, p, E, t)` term is described by the abstract
250   -:doxy:`GCTAAeff` base class. The effective area is determined using
251   -the:
252   -
253   -.. code-block:: cpp
254   -
255   - double GCTAAeff::operator()(const double& logE,
256   - const double& theta = 0.0,
257   - const double& phi = 0.0,
258   - const double& zenith = 0.0,
259   - const double& azimuth = 0.0,
260   - const bool& etrue = true) const;
261   -
262   -operator, where ``logE`` is the base 10 logarithm of the photon energy.
263   -If ``etrue`` is true, ``logE`` is the true photon energy; otherwise,
264   -``logE`` is the measured photon energy.
265   -``theta`` and ``phi`` are the offset and azimuth angle of the incident
266   -photon with respect to the camera pointing,
267   -``zenith`` and ``azimuth`` are the zenith and azimuth angle of the
268   -camera pointing.
269   -
270   -The effective area response is implemented by one of the classes
271   -:doxy:`GCTAAeffPerfTable`, :doxy:`GCTAAeffArf` and :doxy:`GCTAAeff2D` that
272   -implement the different response formats that are currently used in
273   -the CTA project. Dependent on the specified response file, the
274   -method :doxy:`GCTAResponseIrf::load_aeff` allocates the appropriate response
275   -class. :doxy:`GCTAAeff2D` is allocated if the response file is a FITS file
276   -containing an extension named ``EFFECTIVE AREA``; :doxy:`GCTAAeffArf` is
277   -allocated if an extension named ``SPECRESP`` is found; otherwise,
278   -:doxy:`GCTAAeffPerfTable` is allocated.
279   -
280   -
281   -GCTAAeffPerfTable
282   -"""""""""""""""""
283   -
284   -:doxy:`GCTAAeffPerfTable` reads the effective area information from an ASCII
285   -file that has been defined by the CTA Monte Carlo workpackage
286   -(see :ref:`sec_cta_perftable`). This file provides the full effective detection
287   -area in units of :math:`m^2` after the background cut as function of
288   -the base 10 logarithm of the true photon energy. No theta cut is
289   -applied. For a given energy, the effective area is computed by
290   -interpolating the performance table in the base 10 logarithm of energy.
291   -Effective areas will always be non-negative.
292   -As the response table provides only the on-axis effective area,
293   -off-axis effective areas are estimated assuming that the radial
294   -distribution follows a Gaussian distribution in offset angle squared:
295   -
296   -.. math::
297   - A_{\rm eff}(\theta) = A_{\rm eff}(0)
298   - \exp \left( -\frac{1}{2} \frac{\theta^4}{\sigma^2} \right)
299   - :label: cta_aeff_offset
300   -
301   -where :math:`\sigma` characterises the size of the field of view. The
302   -:math:`\sigma` parameter is set and retrieved using the
303   -:doxy:`GCTAAeffPerfTable::sigma` methods. When response information is
304   -specified by an XML file (see :ref:`sec_cta_xml`), the :math:`\sigma`
305   -parameter can be set using the optional ``sigma`` attribute.
306   -If the :math:`\sigma` parameter is not explicitly set,
307   -:math:`\sigma=3 \, {\rm deg}^2` is assumed as default.
308   -
309   -
310   -GCTAAeffArf
311   -"""""""""""
312   -
313   -:doxy:`GCTAAeffArf` extracts the effective area information from a XSPEC
314   -compatible ancilliary response file (ARF). The ARF contains the effective
315   -area for a specific angular (or theta) cut. It should be noted that the
316   -:doxy:`GCTAAeffArf` class has been introduced as a work around for digesting
317   -the ARF response provided for the 1st CTA Data Challenge (1DC). It is not
318   -intended to use this class any longer in the future.
319   -
320   -To recover the full effective detection area, the value of the theta cut
321   -as well as the form of the point spread function needs to be known. When
322   -an ARF file is loaded using the :doxy:`GCTAAeffArf::load` method, the ARF
323   -values are read and stored as they are encountered in the ARF file. To
324   -recover the full effective detection area the theta cut value has to be
325   -specified using the :doxy:`GCTAAeffArf::thetacut` method, and the
326   -:doxy:`GCTAAeffArf::remove_thetacut` method needs to be called to rescale the ARF
327   -values. Note that :doxy:`GCTAAeffArf::remove_thetacut` shall only be called
328   -once after reading the ARF, as every call of the method will modify the
329   -effective area values by multiplying it with a scaling factor.
330   -The scaling factor required to recover the full effective area
331   -will be obtained by integrating the area under the point spread function
332   -out to the specified theta cut value. This provides the fraction of all
333   -events that should fall within the theta cut. The applied scaling factor is
334   -the inverse of this fraction:
335   -
336   -.. math::
337   - A_{\rm eff}(E) =
338   - \frac{1}
339   - {\int_0^{\theta_{\rm cut}} 2\pi PSF(\theta | E) \sin \theta {\rm d}\theta}
340   - ARF(E)
341   -
342   -An alternative way of selecting the events is to adopt an energy dependent
343   -theta cut so that the selection always contains a fixed fraction of the
344   -events. This type of cut can be accomodated by specifying a scaling factor
345   -using the :doxy:`GCTAAeffArf::scale` method prior to loading the ARF data. For
346   -example, if the containment fraction was fixed to 80%, a scaling of 1.25
347   -should be applied to recover the full effective detection area.
348   -When response information is specified by an XML file (see :ref:`sec_cta_xml`),
349   -the ``thetacut`` and ``scale`` parameters can be defined using optional
350   -attributes to the ``EffectiveArea`` parameter.
351   -
352   -The ARF format does not provide any information on the off-axis dependence
353   -of the response, as the ARF values are supplied for a specific source
354   -position, and hence for a specific off-axis angle with respect to the
355   -camera centre. By default, the same effective area values are thus applied
356   -to all off-axis angles :math:`\theta`.
357   -An off-axis dependence may however be introduced by supplying a positive
358   -value for the :math:`\sigma` parameter using the :doxy:`GCTAAeffArf::sigma`
359   -method, or by adding the ``sigma`` attribute to the ``EffectiveArea``
360   -parameter in the XML file. In that case, equation :eq:`cta_aeff_offset`
361   -is used for the off-axis dependence, with the supplied ARF values being
362   -taken as the on-axis values.
363   -
364   -
365   -GCTAAeff2D
366   -""""""""""
367   -
368   -:doxy:`GCTAAeff2D` reads the full effective area as function of energies
369   -and off-axis angle from a FITS table. The FITS table is expected to be
370   -in the :ref:`sec_cta_rsptable` format. From this two-dimensional table,
371   -the effective area values are determine by bi-linear interpolation in
372   -the base 10 logarithm of photon energy and the offset angle.
373   -
374   -
375   -.. _sec_cta_perftable:
376   -
377   -Performance table
378   -^^^^^^^^^^^^^^^^^
379   -
380   -Below an example of a CTA performance table::
381   -
382   - log(E) Area r68 r80 ERes. BG Rate Diff Sens
383   - -1.7 261.6 0.3621 0.4908 0.5134 0.0189924 6.88237e-11
384   - -1.5 5458.2 0.2712 0.3685 0.4129 0.1009715 1.72717e-11
385   - -1.3 15590.0 0.1662 0.2103 0.2721 0.0575623 6.16963e-12
386   - -1.1 26554.1 0.1253 0.1567 0.2611 0.0213008 2.89932e-12
387   - -0.9 52100.5 0.1048 0.1305 0.1987 0.0088729 1.39764e-12
388   - -0.7 66132.1 0.0827 0.1024 0.1698 0.0010976 6.03531e-13
389   - -0.5 108656.8 0.0703 0.0867 0.1506 0.0004843 3.98147e-13
390   - -0.3 129833.0 0.0585 0.0722 0.1338 0.0001575 3.23090e-13
391   - -0.1 284604.3 0.0531 0.0656 0.1008 0.0001367 2.20178e-13
392   - 0.1 263175.3 0.0410 0.0506 0.0831 0.0000210 1.87452e-13
393   - 0.3 778048.6 0.0470 0.0591 0.0842 0.0000692 1.53976e-13
394   - 0.5 929818.8 0.0391 0.0492 0.0650 0.0000146 1.18947e-13
395   - 0.7 1078450.0 0.0335 0.0415 0.0541 0.0000116 1.51927e-13
396   - 0.9 1448579.1 0.0317 0.0397 0.0516 0.0000047 1.42439e-13
397   - 1.1 1899905.0 0.0290 0.0372 0.0501 0.0000081 1.96670e-13
398   - 1.3 2476403.8 0.0285 0.0367 0.0538 0.0000059 2.20695e-13
399   - 1.5 2832570.6 0.0284 0.0372 0.0636 0.0000073 3.22523e-13
400   - 1.7 3534065.3 0.0290 0.0386 0.0731 0.0000135 4.84153e-13
401   - 1.9 3250103.4 0.0238 0.0308 0.0729 0.0000044 6.26265e-13
402   - 2.1 3916071.6 0.0260 0.0354 0.0908 0.0000023 7.69921e-13
403   - ---------------------------------------------
404   - 1) log(E) = log10(E/TeV) - bin centre
405   - 2) Eff Area - in square metres after background cut (no theta cut)
406   - 3) Ang. Res - 68% containment radius of gamma-ray PSF post cuts - in degrees
407   - 4) Ang. Res - 80% containment radius of gamma-ray PSF post cuts - in degrees
408   - 5) Fractional Energy Resolution (rms)
409   - 6) BG Rate - inside point-source selection region - post call cuts - in Hz
410   - 7) Diff Sens - differential sensitivity for this bin expressed as E^2 dN/dE
411   - - in erg cm^-2 s^-1 - for a 50 hours exposure - 5 sigma significance including
412   - systematics and statistics and at least 10 photons.
413   -
414   -
415   -.. _sec_cta_rsptable:
416   -
417   -Response table
418   -^^^^^^^^^^^^^^
419   -
420   -The CTA response table class :doxy:`GCTAResponseTable` provides a generic
421   -handle for multi-dimensional response information. It is based on the
422   -response format used for storing response information for the
423   -*Fermi*/LAT telescope. In this format, all information is stored in
424   -a single row of a FITS binary table. Each element of the row contains
425   -a vector column, that describes the axes of the multi-dimensional response
426   -cube and the response information. Note that this class may in the future
427   -be promoted to the GammaLib core, as a similar class has been implemented
428   -in the *Fermi*/LAT interface.
  9 + cta_overview
  10 + cta_xml
  11 + cta_bkg
  12 + cta_irf
... ...
doc/source/user_manual/modules/cta_bkg.rst 0 → 100644
  1 +.. _sec_cta_background:
  2 +
  3 +Modelling CTA background
  4 +~~~~~~~~~~~~~~~~~~~~~~~~
  5 +
  6 +The standard method for modelling the CTA instrumental background makes
  7 +use of background rate information that is included in the instrument
  8 +response functions.
  9 +For unbinned or binned analysis the background model is implemented by
  10 +the :doxy:`GCTAModelIrfBackground` class that derives from the
  11 +abstract :doxy:`GModelData` class.
  12 +The XML description of the background model has the following format:
  13 +
  14 +.. code-block:: xml
  15 +
  16 + <source name="Background" type="CTAIrfBackground" instrument="CTA">
  17 + <spectrum type="PowerLaw">
  18 + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e3" free="1"/>
  19 + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/>
  20 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  21 + </spectrum>
  22 + </source>
  23 +
  24 +The type of the model is ``CTAIrfBackground``.
  25 +The tag ``<spectrum>`` allows to specify a spectral model with which the
  26 +background model in the IRF will be multiplied.
  27 +Any spectral model available in GammaLib can be used as the spectral
  28 +component of the model.
  29 +This allows to adjust the energy distribution of the background template
  30 +to the data.
  31 +In the above example the background rates are multiplied with a power law.
  32 +
  33 +For stacked analysis there is an equivalent model that makes use of the
  34 +background model provided in the ``BkgCube`` parameter of the observation
  35 +definition XML file:
  36 +
  37 +.. code-block:: xml
  38 +
  39 + <source name="Background" type="CTACubeBackground" instrument="CTA">
  40 + <spectrum type="PowerLaw">
  41 + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e3" free="1"/>
  42 + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/>
  43 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  44 + </spectrum>
  45 + </source>
  46 +
  47 +The structure of the XML model is identical to the one shown before, but
  48 +the type of the model is now ``CTACubeBackground``.
  49 +
  50 +Finally, a third type of background model exists that assumes that the
  51 +spatial and spectral component of the background can be factorised and
  52 +that the spatial component is radially symmetric.
  53 +This background model is rather simplistic, and is mainly still there for
  54 +historic reasons.
  55 +Here an example of the XML definition.
  56 +The type of the model is ``RadialAcceptance``.
  57 +
  58 +.. code-block:: xml
  59 +
  60 + <source name="Background" type="RadialAcceptance" instrument="CTA">
  61 + <spectrum type="PowerLaw">
  62 + <parameter name="Prefactor" scale="1e-6" value="61.8" min="0.0" max="1000.0" free="1"/>
  63 + <parameter name="Index" scale="-1" value="1.85" min="0.0" max="+5.0" free="1"/>
  64 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  65 + </spectrum>
  66 + <radialModel type="Gaussian">
  67 + <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/>
  68 + </radialModel>
  69 + </source>
  70 +
  71 +The spatial component of the model is a Gaussian in offset angle squared.
  72 +Alternativly, a profile can be specified:
  73 +
  74 +.. code-block:: xml
  75 +
  76 + <source name="Background" type="RadialAcceptance" instrument="CTA">
  77 + <spectrum type="PowerLaw">
  78 + <parameter name="Prefactor" scale="1e-6" value="61.8" min="0.0" max="1000.0" free="1"/>
  79 + <parameter name="Index" scale="-1" value="1.85" min="0.0" max="+5.0" free="1"/>
  80 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  81 + </spectrum>
  82 + <radialModel type="Profile">
  83 + <parameter name="Width" scale="1.0" value="1.5" min="0.1" max="1000.0" free="1"/>
  84 + <parameter name="Core" scale="1.0" value="3.0" min="0.1" max="1000.0" free="1"/>
  85 + <parameter name="Tail" scale="1.0" value="5.0" min="0.1" max="1000.0" free="1"/>
  86 + </radialModel>
  87 + </source>
  88 +
  89 +Or a polynom:
  90 +
  91 +.. code-block:: xml
  92 +
  93 + <source name="Background" type="RadialAcceptance" instrument="CTA">
  94 + <spectrum type="PowerLaw">
  95 + <parameter name="Prefactor" scale="1e-6" value="61.8" min="0.0" max="1000.0" free="1"/>
  96 + <parameter name="Index" scale="-1" value="1.85" min="0.0" max="+5.0" free="1"/>
  97 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  98 + </spectrum>
  99 + <radialModel type="Polynom">
  100 + <parameter name="Coeff0" scale="1.0" value="+1.00000" min="-10.0" max="10.0" free="0"/>
  101 + <parameter name="Coeff1" scale="1.0" value="-0.1239176" min="-10.0" max="10.0" free="1"/>
  102 + <parameter name="Coeff2" scale="1.0" value="+0.9751791" min="-10.0" max="10.0" free="1"/>
  103 + <parameter name="Coeff3" scale="1.0" value="-3.0584577" min="-10.0" max="10.0" free="1"/>
  104 + <parameter name="Coeff4" scale="1.0" value="+2.9089535" min="-10.0" max="10.0" free="1"/>
  105 + <parameter name="Coeff5" scale="1.0" value="-1.3535372" min="-10.0" max="10.0" free="1"/>
  106 + <parameter name="Coeff6" scale="1.0" value="+0.3413752" min="-10.0" max="10.0" free="1"/>
  107 + <parameter name="Coeff7" scale="1.0" value="-0.0449642" min="-10.0" max="10.0" free="1"/>
  108 + <parameter name="Coeff8" scale="1.0" value="+0.0024321" min="-10.0" max="10.0" free="1"/>
  109 + </radialModel>
  110 + </source>
... ...
doc/source/user_manual/modules/cta_irf.rst 0 → 100644
  1 +.. _sec_cta_response:
  2 +
  3 +Handling the instrument response
  4 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5 +
  6 +Overview
  7 +^^^^^^^^
  8 +
  9 +The CTA specific instrument response is described by the
  10 +:doxy:`GCTAResponseIrf` class (see :ref:`sec_response` for a general
  11 +description of response handling in GammaLib).
  12 +The CTA response is factorised into
  13 +the effective area :math:`A_{\rm eff}(d, p, E, t)` (units :math:`cm^2`),
  14 +the point spread function :math:`PSF(p' | d, p, E, t)`,
  15 +and the energy dispersion :math:`E_{\rm disp}(E' | d, p, E, t)`
  16 +following:
  17 +
  18 +.. math::
  19 + R(p', E', t' | d, p, E, t) =
  20 + A_{\rm eff}(d, p, E, t) \times
  21 + PSF(p' | d, p, E, t) \times
  22 + E_{\rm disp}(E' | d, p, E, t)
  23 + :label: irf
  24 +
  25 +Three different formats are implemented to specify the response
  26 +information for CTA: Performance Tables, Xspec response files and
  27 +Response Tables.
  28 +The following sections describe these formats.
  29 +
  30 +
  31 +.. _sec_cta_perftable:
  32 +
  33 +Performance table
  34 +^^^^^^^^^^^^^^^^^
  35 +
  36 +Below an example of a CTA performance table::
  37 +
  38 + log(E) Area r68 r80 ERes. BG Rate Diff Sens
  39 + -1.7 261.6 0.3621 0.4908 0.5134 0.0189924 6.88237e-11
  40 + -1.5 5458.2 0.2712 0.3685 0.4129 0.1009715 1.72717e-11
  41 + -1.3 15590.0 0.1662 0.2103 0.2721 0.0575623 6.16963e-12
  42 + -1.1 26554.1 0.1253 0.1567 0.2611 0.0213008 2.89932e-12
  43 + -0.9 52100.5 0.1048 0.1305 0.1987 0.0088729 1.39764e-12
  44 + -0.7 66132.1 0.0827 0.1024 0.1698 0.0010976 6.03531e-13
  45 + -0.5 108656.8 0.0703 0.0867 0.1506 0.0004843 3.98147e-13
  46 + -0.3 129833.0 0.0585 0.0722 0.1338 0.0001575 3.23090e-13
  47 + -0.1 284604.3 0.0531 0.0656 0.1008 0.0001367 2.20178e-13
  48 + 0.1 263175.3 0.0410 0.0506 0.0831 0.0000210 1.87452e-13
  49 + 0.3 778048.6 0.0470 0.0591 0.0842 0.0000692 1.53976e-13
  50 + 0.5 929818.8 0.0391 0.0492 0.0650 0.0000146 1.18947e-13
  51 + 0.7 1078450.0 0.0335 0.0415 0.0541 0.0000116 1.51927e-13
  52 + 0.9 1448579.1 0.0317 0.0397 0.0516 0.0000047 1.42439e-13
  53 + 1.1 1899905.0 0.0290 0.0372 0.0501 0.0000081 1.96670e-13
  54 + 1.3 2476403.8 0.0285 0.0367 0.0538 0.0000059 2.20695e-13
  55 + 1.5 2832570.6 0.0284 0.0372 0.0636 0.0000073 3.22523e-13
  56 + 1.7 3534065.3 0.0290 0.0386 0.0731 0.0000135 4.84153e-13
  57 + 1.9 3250103.4 0.0238 0.0308 0.0729 0.0000044 6.26265e-13
  58 + 2.1 3916071.6 0.0260 0.0354 0.0908 0.0000023 7.69921e-13
  59 + ---------------------------------------------
  60 + 1) log(E) = log10(E/TeV) - bin centre
  61 + 2) Eff Area - in square metres after background cut (no theta cut)
  62 + 3) Ang. Res - 68% containment radius of gamma-ray PSF post cuts - in degrees
  63 + 4) Ang. Res - 80% containment radius of gamma-ray PSF post cuts - in degrees
  64 + 5) Fractional Energy Resolution (rms)
  65 + 6) BG Rate - inside point-source selection region - post call cuts - in Hz
  66 + 7) Diff Sens - differential sensitivity for this bin expressed as E^2 dN/dE
  67 + - in erg cm^-2 s^-1 - for a 50 hours exposure - 5 sigma significance including
  68 + systematics and statistics and at least 10 photons.
  69 +
  70 +
  71 +Xspec response format
  72 +^^^^^^^^^^^^^^^^^^^^^
  73 +
  74 +To be written ...
  75 +
  76 +
  77 +.. _sec_cta_rsptable:
  78 +
  79 +Response table
  80 +^^^^^^^^^^^^^^
  81 +
  82 +The CTA response table class :doxy:`GCTAResponseTable` provides a generic
  83 +handle for multi-dimensional response information. It is based on the
  84 +response format used for storing response information for the
  85 +*Fermi*/LAT telescope. In this format, all information is stored in
  86 +a single row of a FITS binary table. Each element of the row contains
  87 +a vector column, that describes the axes of the multi-dimensional response
  88 +cube and the response information. Note that this class may in the future
  89 +be promoted to the GammaLib core, as a similar class has been implemented
  90 +in the *Fermi*/LAT interface.
  91 +
  92 +
  93 +Effective area
  94 +^^^^^^^^^^^^^^
  95 +
  96 +The :math:`A_{\rm eff}(d, p, E, t)` term is described by the abstract
  97 +:doxy:`GCTAAeff` base class. The effective area is determined using
  98 +the:
  99 +
  100 +.. code-block:: cpp
  101 +
  102 + double GCTAAeff::operator()(const double& logE,
  103 + const double& theta = 0.0,
  104 + const double& phi = 0.0,
  105 + const double& zenith = 0.0,
  106 + const double& azimuth = 0.0,
  107 + const bool& etrue = true) const;
  108 +
  109 +operator, where ``logE`` is the base 10 logarithm of the photon energy.
  110 +If ``etrue`` is true, ``logE`` is the true photon energy; otherwise,
  111 +``logE`` is the measured photon energy.
  112 +``theta`` and ``phi`` are the offset and azimuth angle of the incident
  113 +photon with respect to the camera pointing,
  114 +``zenith`` and ``azimuth`` are the zenith and azimuth angle of the
  115 +camera pointing.
  116 +
  117 +The effective area response is implemented by one of the classes
  118 +:doxy:`GCTAAeffPerfTable`, :doxy:`GCTAAeffArf` and :doxy:`GCTAAeff2D` that
  119 +implement the different response formats that are currently used in
  120 +the CTA project. Dependent on the specified response file, the
  121 +method :doxy:`GCTAResponseIrf::load_aeff` allocates the appropriate response
  122 +class. :doxy:`GCTAAeff2D` is allocated if the response file is a FITS file
  123 +containing an extension named ``EFFECTIVE AREA``; :doxy:`GCTAAeffArf` is
  124 +allocated if an extension named ``SPECRESP`` is found; otherwise,
  125 +:doxy:`GCTAAeffPerfTable` is allocated.
  126 +
  127 +
  128 +GCTAAeffPerfTable
  129 +"""""""""""""""""
  130 +
  131 +:doxy:`GCTAAeffPerfTable` reads the effective area information from an ASCII
  132 +file that has been defined by the CTA Monte Carlo workpackage
  133 +(see :ref:`sec_cta_perftable`). This file provides the full effective detection
  134 +area in units of :math:`m^2` after the background cut as function of
  135 +the base 10 logarithm of the true photon energy. No theta cut is
  136 +applied. For a given energy, the effective area is computed by
  137 +interpolating the performance table in the base 10 logarithm of energy.
  138 +Effective areas will always be non-negative.
  139 +As the response table provides only the on-axis effective area,
  140 +off-axis effective areas are estimated assuming that the radial
  141 +distribution follows a Gaussian distribution in offset angle squared:
  142 +
  143 +.. math::
  144 + A_{\rm eff}(\theta) = A_{\rm eff}(0)
  145 + \exp \left( -\frac{1}{2} \frac{\theta^4}{\sigma^2} \right)
  146 + :label: cta_aeff_offset
  147 +
  148 +where :math:`\sigma` characterises the size of the field of view. The
  149 +:math:`\sigma` parameter is set and retrieved using the
  150 +:doxy:`GCTAAeffPerfTable::sigma` methods. When response information is
  151 +specified by an XML file (see :ref:`sec_cta_xml`), the :math:`\sigma`
  152 +parameter can be set using the optional ``sigma`` attribute.
  153 +If the :math:`\sigma` parameter is not explicitly set,
  154 +:math:`\sigma=3 \, {\rm deg}^2` is assumed as default.
  155 +
  156 +
  157 +GCTAAeffArf
  158 +"""""""""""
  159 +
  160 +:doxy:`GCTAAeffArf` extracts the effective area information from a XSPEC
  161 +compatible ancilliary response file (ARF). The ARF contains the effective
  162 +area for a specific angular (or theta) cut. It should be noted that the
  163 +:doxy:`GCTAAeffArf` class has been introduced as a work around for digesting
  164 +the ARF response provided for the 1st CTA Data Challenge (1DC). It is not
  165 +intended to use this class any longer in the future.
  166 +
  167 +To recover the full effective detection area, the value of the theta cut
  168 +as well as the form of the point spread function needs to be known. When
  169 +an ARF file is loaded using the :doxy:`GCTAAeffArf::load` method, the ARF
  170 +values are read and stored as they are encountered in the ARF file. To
  171 +recover the full effective detection area the theta cut value has to be
  172 +specified using the :doxy:`GCTAAeffArf::thetacut` method, and the
  173 +:doxy:`GCTAAeffArf::remove_thetacut` method needs to be called to rescale the ARF
  174 +values. Note that :doxy:`GCTAAeffArf::remove_thetacut` shall only be called
  175 +once after reading the ARF, as every call of the method will modify the
  176 +effective area values by multiplying it with a scaling factor.
  177 +The scaling factor required to recover the full effective area
  178 +will be obtained by integrating the area under the point spread function
  179 +out to the specified theta cut value. This provides the fraction of all
  180 +events that should fall within the theta cut. The applied scaling factor is
  181 +the inverse of this fraction:
  182 +
  183 +.. math::
  184 + A_{\rm eff}(E) =
  185 + \frac{1}
  186 + {\int_0^{\theta_{\rm cut}} 2\pi PSF(\theta | E) \sin \theta {\rm d}\theta}
  187 + ARF(E)
  188 +
  189 +An alternative way of selecting the events is to adopt an energy dependent
  190 +theta cut so that the selection always contains a fixed fraction of the
  191 +events. This type of cut can be accomodated by specifying a scaling factor
  192 +using the :doxy:`GCTAAeffArf::scale` method prior to loading the ARF data. For
  193 +example, if the containment fraction was fixed to 80%, a scaling of 1.25
  194 +should be applied to recover the full effective detection area.
  195 +When response information is specified by an XML file (see :ref:`sec_cta_xml`),
  196 +the ``thetacut`` and ``scale`` parameters can be defined using optional
  197 +attributes to the ``EffectiveArea`` parameter.
  198 +
  199 +The ARF format does not provide any information on the off-axis dependence
  200 +of the response, as the ARF values are supplied for a specific source
  201 +position, and hence for a specific off-axis angle with respect to the
  202 +camera centre. By default, the same effective area values are thus applied
  203 +to all off-axis angles :math:`\theta`.
  204 +An off-axis dependence may however be introduced by supplying a positive
  205 +value for the :math:`\sigma` parameter using the :doxy:`GCTAAeffArf::sigma`
  206 +method, or by adding the ``sigma`` attribute to the ``EffectiveArea``
  207 +parameter in the XML file. In that case, equation :eq:`cta_aeff_offset`
  208 +is used for the off-axis dependence, with the supplied ARF values being
  209 +taken as the on-axis values.
  210 +
  211 +
  212 +GCTAAeff2D
  213 +""""""""""
  214 +
  215 +:doxy:`GCTAAeff2D` reads the full effective area as function of energies
  216 +and off-axis angle from a FITS table. The FITS table is expected to be
  217 +in the :ref:`sec_cta_rsptable` format. From this two-dimensional table,
  218 +the effective area values are determine by bi-linear interpolation in
  219 +the base 10 logarithm of photon energy and the offset angle.
... ...
doc/source/user_manual/modules/cta_overview.rst 0 → 100644
  1 +
  2 +Overview
  3 +~~~~~~~~
  4 +
  5 +The following figure presents an overview over the C++ classes of the CTA
  6 +module and their relations.
  7 +
  8 +.. _fig_uml_cta:
  9 +
  10 +.. figure:: uml_cta.png
  11 + :width: 100%
  12 + :align: center
  13 +
  14 + *CTA module*
  15 +
  16 +The CTA module provides an instrument interface for Imaging Air Cherenkov
  17 +Telescopes (IACT). The interface currently supports the event list data
  18 +format developed in the context of the Cherenkov Telescope Array (CTA)
  19 +project and provides support for various instrument response formats that
  20 +are currently used in the CTA consortium or that are under study. The interface
  21 +provides support for unbinned and binned maximum likelihood analysis, and
  22 +implements Monte Carlo simulations of high-level data based on the
  23 +instrumental response functions.
  24 +
  25 +Two types of observations are implemented so far:
  26 +:doxy:`GCTAObservation` that derives from :doxy:`GObservation` and that
  27 +describes either a binned or unbinned data set, and
  28 +:doxy:`GCTAOnOffObservation` that describes an On-Off observation
  29 +used in classical Cherenkov Telescope data analysis.
  30 +Binned or unbinned observations are collected in the
  31 +:doxy:`GObservations` container class, while the On-Off observations
  32 +are collected in a specific :doxy:`GCTAOnOffObservations` container
  33 +class (note that the :doxy:`GCTAOnOffObservations` container may vanish
  34 +in the future when :doxy:`GCTAOnOffObservation` objects will also be
  35 +collected by the :doxy:`GObservations` container class).
  36 +
  37 +The data of binned observations are stored by the
  38 +:doxy:`GCTAEventCube` class. The :doxy:`GCTAEventCube` class holds the
  39 +binned event data in form of a sky map, implemented by the
  40 +:doxy:`GSkymap` class. The sky coordinates of all sky map pixels
  41 +are stored in an array of CTA instrument directions, implemented
  42 +by the :doxy:`GCTAInstDir` class which holds a single :doxy:`GSkyDir`
  43 +object. The mean energies of the event cube
  44 +are stored in an array of :doxy:`GEnergy` objects, and the mean
  45 +time is stored by a :doxy:`GTime` object. The :doxy:`GCTAEventCube` class
  46 +holds in fact only a single event bin, implemented by the
  47 +:doxy:`GCTAEventBin` class. When the event bin is accessed using
  48 +the :doxy:`GCTAEventCube::operator[]` operator, the operator updates
  49 +references to the event cube data so that the :doxy:`GCTAEventBin`
  50 +object represents the selected event bin. This allows a memory-efficient
  51 +storage of event bin information (without storing for example the
  52 +instrument direction or the energy for each bin), while preserving
  53 +the abstract data model where an event cube of abstract type
  54 +:doxy:`GEventCube` is composed of event bins of abstract type
  55 +:doxy:`GEventBin` (see :ref:`sec_obs`).
  56 +
  57 +The data of unbinned observations are stored by the :doxy:`GCTAEventList`
  58 +class. The :doxy:`GCTAEventList` class is a container of :doxy:`GCTAEventAtom`
  59 +objects that represent individual events. Each event is composed of
  60 +a :doxy:`GCTAInstDir` object, a :doxy:`GEnergy` object and a :doxy:`GTime` object.
  61 +The region of interest covered by an event list is described by the
  62 +:doxy:`GCTARoi` class that derives from the abstract :doxy:`GRoi` class.
  63 +
  64 +In addition to the event, :doxy:`GCTAObservation` holds pointing
  65 +information implemented by the :doxy:`GCTAPointing` class.
  66 +:doxy:`GCTAObservation` holds furthermore response information.
  67 +Response information derives from the abstract :doxy:`GCTAResponse` class
  68 +that is impleted either as a factorized Instrument Response
  69 +Function by :doxy:`GCTAResponseIrf` or as a precomputed response for
  70 +stacked analysis by :doxy:`GCTAResponseCube`.
  71 +For stacked analysis the response is composed of the exposure
  72 +(implemented by :doxy:`GCTACubeExposure`), the livetime averaged point
  73 +spread function (implemented by :doxy:`GCTACubePsf`) and the livetime
  74 +averaged background rate (implemented by :doxy:`GCTACubeBackground`).
  75 +For all other analysis, the factorized IRFs are used directly.
  76 +Dependent on the response format, the components of the factorization
  77 +are stored in classes that derive from the abstract :doxy:`GCTAAeff`,
  78 +:doxy:`GCTAPsf`, :doxy:`GCTAEdisp`, and :doxy:`GCTABackground` classes
  79 +(see :ref:`sec_cta_response` for more details on the response
  80 +implementation).
  81 +
  82 +Different models of the instrumental background are provided by the
  83 +:doxy:`GCTAModelIrfBackground`, :doxy:`GCTAModelCubeBackground`, and
  84 +:doxy:`GCTAModelRadialAcceptance` classes.
  85 +All these classes implement the abstract :doxy:`GModelData` base
  86 +class.
  87 +:doxy:`GCTAModelIrfBackground` and :doxy:`GCTAModelCubeBackground`
  88 +will use the background rate information that is attached to the
  89 +response function for background modelling.
  90 +Specifically, :doxy:`GCTAModelIrfBackground` will use information
  91 +provided by :doxy:`GCTABackground` and :doxy:`GCTAModelCubeBackground`
  92 +will use information provided by :doxy:`GCTACubeBackground`
  93 +(see :ref:`sec_cta_background` for details on the background
  94 +model implementation).
... ...
doc/source/user_manual/modules/cta_xml.rst 0 → 100644
  1 +.. _sec_cta_xml:
  2 +
  3 +Describing CTA observations using XML
  4 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5 +
  6 +CTA observations can be described in GammaLib using an ASCII file in XML
  7 +format (see :ref:`sec_obsxml`). The CTA specific section of this file has
  8 +the format:
  9 +
  10 +.. code-block:: xml
  11 +
  12 + <observation name="..." id="..." instrument="...">
  13 + <parameter name="EventList" file="..."/>
  14 + <parameter name="EffectiveArea" file="..."/>
  15 + <parameter name="PointSpreadFunction" file="..."/>
  16 + <parameter name="EnergyDispersion" file="..."/>
  17 + <parameter name="Background" file="..."/>
  18 + </observation>
  19 +
  20 +for an unbinned observation and
  21 +
  22 +.. code-block:: xml
  23 +
  24 + <observation name="..." id="..." instrument="...">
  25 + <parameter name="CountsCube" file="..."/>
  26 + <parameter name="EffectiveArea" file="..."/>
  27 + <parameter name="PointSpreadFunction" file="..."/>
  28 + <parameter name="EnergyDispersion" file="..."/>
  29 + <parameter name="Background" file="..."/>
  30 + </observation>
  31 +
  32 +for a binned observation.
  33 +Each parameter within the ``<observation>`` tag specifies the filename
  34 +for a specific file that is needed for the analysis.
  35 +The difference between an unbinned and a binned observation is that the
  36 +first uses an event list (requiring a parameter with name ``EventList``)
  37 +while the latter uses an event cube (requiring a parameter with name
  38 +``CountsCube``).
  39 +The ``EffectiveArea``, ``PointSpreadFunction``, ``EnergyDispersion`` and
  40 +``Background`` parameters provide the filenames of the instrument
  41 +specific response function components for each observation
  42 +(see :ref:`sec_cta_response`).
  43 +Alternatively, the calibration database and response name can be
  44 +specified, e.g.
  45 +
  46 +.. code-block:: xml
  47 +
  48 + <observation name="..." id="..." instrument="...">
  49 + <parameter name="EventList" file="..."/>
  50 + <parameter name="Calibration" database="..." response="..."/>
  51 + </observation>
  52 +
  53 +A variant of the binned analysis is the stacked analysis.
  54 +While in a binned analysis an event cube is generated for each
  55 +observation, event cubes will be summed in a stacked analysis.
  56 +Summing the events requires computation of the total exposure,
  57 +the average point spread function and the average background
  58 +rate (energy dispersion is not yet handled for stacked analysis).
  59 +Information for a stacked observation is provided in the
  60 +following format:
  61 +
  62 +.. code-block:: xml
  63 +
  64 + <observation name="..." id="..." instrument="...">
  65 + <parameter name="CountsCube" file="..."/>
  66 + <parameter name="ExposureCube" file="..."/>
  67 + <parameter name="PsfCube" file="..."/>
  68 + <parameter name="BkgCube" file="..."/>
  69 + </observation>
  70 +
  71 +The stacked analysis uses also an event cube but now requires the
  72 +pre-computed response cubes.
  73 +The ``ExposureCube``, ``PsfCube``, and ``BkgCube`` parameters
  74 +provide the filenames of the required components.
  75 +
  76 +The ``instrument`` attribute of CTA observations can be one of
  77 +``CTA``, ``HESS``, ``MAGIC`` or ``VERITAS``. This allows mixing of
  78 +observations from difference IACTs within a single analysis.
  79 +Note that no code that is specific to any of these four instruments is
  80 +implemented in GammaLib, but the ``instrument`` attribute is used to
  81 +tie models to instruments, allowing thus to provide specific background
  82 +models for each of the instruments in a combined analysis.
  83 +
  84 +The ``id`` attribute specifies an identifier for the observation that
  85 +needs to be unique for a given instrument.
  86 +The identifier allows to connect an observation to a specific model
  87 +component.
  88 +
  89 +Optionally, an observation can also have user defined minimum and maximum
  90 +energy boundaries.
  91 +These boundaries are specified as optional attributes in the XML file, e.g.
  92 +
  93 +.. code-block:: xml
  94 +
  95 + <observation name="..." id="..." instrument="..." emin="0.1" emax="100.0">
  96 + ...
  97 + </observation>
  98 +
  99 +**Note that the energy boundaries are specified in units of TeV.**
  100 +
  101 +In case that neither an event list nor an event cube is available, a
  102 +CTA observation can be defined by specifying the pointing direction,
  103 +the Good Time Intervals, the region of interest, and optionally the
  104 +deadtime correction factor.
  105 +Here an example of the expected XML format:
  106 +
  107 +.. code-block:: xml
  108 +
  109 + <observation name="GPS" id="000001" instrument="CTA">
  110 + <parameter name="Pointing" ra="186.721" dec="-61.4328" />
  111 + <parameter name="GoodTimeIntervals" tmin="0" tmax="35100" />
  112 + <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" />
  113 + <parameter name="RegionOfInterest" ra="186.721" dec="-61.4328" rad="5" />
  114 + <parameter name="Deadtime" deadc="0.95" />
  115 + <parameter name="Calibration" database="prod2" response="South_50h" />
  116 + </observation>
  117 +
  118 +Note that the time reference for the Good Time Intervals is specified
  119 +using the ``TimeReference`` parameter.
... ...
doc/source/user_manual/modules/fits.rst
... ... @@ -6,15 +6,16 @@ FITS file interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -:ref:`fig_uml_fits` present an overview over the C++ classes of the FITS
  9 +The following figure presents an overview over the C++ classes of the FITS
10 10 module and their relations.
11 11  
12 12 .. _fig_uml_fits:
13 13  
14 14 .. figure:: uml_fits.png
15   - :width: 100%
  15 + :width: 75%
  16 + :align: center
16 17  
17   - FITS module
  18 + *FITS module*
18 19  
19 20 The FITS module provides a high-level interface to FITS files. The module
20 21 is based on the cfitsio library for file access. The C++ classes of the
... ... @@ -158,6 +159,7 @@ above example is shown below.
158 159 .. _fig_fits_example:
159 160  
160 161 .. figure:: fits_example.png
161   - :width: 100%
  162 + :width: 90%
  163 + :align: center
162 164  
163   - FITS file example
  165 + *FITS file example*
... ...
doc/source/user_manual/modules/inst.rst
... ... @@ -4,7 +4,7 @@ Instrument-specific interfaces
4 4 ==============================
5 5  
6 6 .. toctree::
7   - :maxdepth: 2
  7 + :maxdepth: 3
8 8  
9 9 cta
10 10 lat
... ...
doc/source/user_manual/modules/intro.rst
... ... @@ -8,7 +8,7 @@ classes and their primary usage, as well as their underlying
8 8 arithmetics. However, we do not provide a detailed description of the
9 9 interface and the inner workings of each C++ class. This information is
10 10 provided in the reference documentation, which can be found online at
11   -http://gammalib.sourceforge.net/doxygen/, or which can be installed
  11 +http://cta.irap.omp.eu/gammalib/doxygen/, or which can be installed
12 12 locally on your machine (see section :ref:`sec_doxygen`).
13 13  
14 14 Each GammaLib module is presented in a dedicated section, following the overview
... ...
doc/source/user_manual/modules/lat.rst
... ... @@ -6,15 +6,17 @@
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -The LAT module provides an instrument interface for the Large Area
10   -Telescope aboard NASA's Fermi satellite.
11   -
12   -:ref:`fig_uml_lat` present an overview over the C++ classes of the LAT
  9 +The following figure presents an overview over the C++ classes of the LAT
13 10 module and their relations.
14 11  
15 12 .. _fig_uml_lat:
16 13  
17 14 .. figure:: uml_lat.png
18   - :width: 100%
  15 + :align: center
  16 + :width: 80%
  17 +
  18 + *LAT module*
  19 +
  20 +The LAT module provides an instrument interface for the Large Area
  21 +Telescope aboard NASA's Fermi satellite.
19 22  
20   - LAT module
... ...
doc/source/user_manual/modules/linalg.rst
... ... @@ -6,6 +6,17 @@ Linear algebra
6 6 Overview
7 7 ~~~~~~~~
8 8  
  9 +The following figure presents an overview over the C++ classes of
  10 +the linear algebra module and their relations.
  11 +
  12 +.. _fig_uml_linalg:
  13 +
  14 +.. figure:: uml_linalg.png
  15 + :width: 55%
  16 + :align: center
  17 +
  18 + *Linear algebra module*
  19 +
9 20 The linear algebra module provides classes for vector and matrix
10 21 manipulation. The :doxy:`GVector` class implements a double precision
11 22 floating point vector, the classes :doxy:`GMatrix`, :doxy:`GMatrixSymmetric`
... ... @@ -15,16 +26,6 @@ a sparse matrix, respectively. All matrix classes derive from the
15 26 abstract :doxy:`GMatrixBase` base class that provides common functionalities
16 27 to all matrix classes.
17 28  
18   -:ref:`fig_uml_linalg` presents an overview over the C++ classes of
19   -the linear algebra module and their relations.
20   -
21   -.. _fig_uml_linalg:
22   -
23   -.. figure:: uml_linalg.png
24   - :width: 70%
25   -
26   - Linear algebra module
27   -
28 29 The classes :doxy:`GSparseNumeric` and :doxy:`GSparseSymbolic` are classes
29 30 that are used by :doxy:`GMatrixSparse` but these classes are not
30 31 exposed to the outside world (i.e. the class definitions are not
... ...
doc/source/user_manual/modules/model.rst
... ... @@ -6,18 +6,19 @@ Model handling
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -:ref:`fig_uml_model` present an overview over the C++ classes of the model
  9 +The following figure presents an overview over the C++ classes of the model
10 10 module and their relations.
11 11  
12 12 .. _fig_uml_model:
13 13  
14 14 .. figure:: uml_model.png
  15 + :align: center
15 16 :width: 100%
16 17  
17   - Model module
  18 + *Overview over the model module*
18 19  
19 20 The central C++ class of the model module is the abstract base class
20   -:doxy:`GModel` which defines a model component. Model compnents are combined
  21 +:doxy:`GModel` which defines a model component. Model components are combined
21 22 using the :doxy:`GModels` container C++ class.
22 23  
23 24  
... ... @@ -29,34 +30,33 @@ method. The ``GObservation::npred`` provides the number of predicted
29 30 events by all models within the relevant dataspace for a given observation.
30 31  
31 32 :ref:`fig_calltree_model` shows the call tree of the
32   -``GObservation::model()`` (left) and ``GObservation::npred`` (right)
33   -methods. The top section shows the abstract methods, the bottom section
34   -shows the methods that are called for :doxy:`GModelSky` models, i.e. models of
35   -celestial sources that are folded by the instrument response.
  33 +``GObservation::model`` (left) and ``GObservation::npred`` (right)
  34 +methods.
36 35  
37 36 For model evaluation, the :doxy:``GObservation::model`` method loops over all
38 37 models in the :doxy:`GModels` container and calls the
39   -:doxy:`GModel::eval_gradients` method of each model. For :doxy:`GModelSky` models,
40   -this invokes an integration over true time, true energy and all possible
41   -true photon arrival directions that may result in the observed event
42   -direction. The latter computation is performed by the abstract :doxy:`GResponse::irf`
43   -method that needs to be implemented for each instrument.
  38 +:doxy:`GModel::eval_gradients` method of each model.
  39 +For :doxy:`GModelSky` models this method invokes the :doxy:`GResponse::convolve`
  40 +method that calls among others the :doxy:`GResponse::irf` method.
  41 +That method needs to be implement for each instruments.
44 42  
45 43 The ``GObservation::npred`` method performs an integration over observed
46   -time, observed energy and observed arrival direction. The two former are
47   -performed by the ``GObservation::npred_temp`` and
48   -``GObservation::npred_spec`` methods within the :doxy:`GObservation` class,
49   -the spatial integral is done within the :doxy:`GModel` class by invoking the
50   -``GModel::npred`` method. For :doxy:`GModelSky` models, the integral is
51   -performed by the abstract :doxy:`GResponse::nroi` method that needs to be
52   -implemented for each instrument.
  44 +time, observed energy and observed arrival direction.
  45 +The integrate over observed time is for the moment a simple multiplication
  46 +with ontime.
  47 +The intergal over observed energy is performed by the
  48 +``GObservation::npred_spec`` method that calls the
  49 +:doxy:`GModel::eval_gradients` method.
  50 +For :doxy:`GModelSky` models this method calls the :doxy:`GResponse::nroi`
  51 +method that needs to be implement for each instruments.
53 52  
54 53 .. _fig_calltree_model:
55 54  
56 55 .. figure:: calltree_model.png
57   - :width: 100%
  56 + :width: 70%
  57 + :align: center
58 58  
59   - Call tree for model evaluation
  59 + *Call tree for model evaluation*
60 60  
61 61  
62 62 Spectral models
... ... @@ -83,6 +83,66 @@ The XML format for specifying a constant is:
83 83 </spectrum>
84 84  
85 85  
  86 +Node function
  87 +^^^^^^^^^^^^^
  88 +
  89 +The generalisation of the broken power law is the node function, which is
  90 +defined by a set of energy and intensity values, the so called nodes,
  91 +which are connected by power laws.
  92 +
  93 +The XML format for specifying a node function is:
  94 +
  95 +.. code-block:: xml
  96 +
  97 + <spectrum type="NodeFunction">
  98 + <node>
  99 + <parameter scale="1.0" name="Energy" min="0.1" max="1.0e20" value="1.0" free="0"/>
  100 + <parameter scale="1e-07" name="Intensity" min="1e-07" max="1000.0" value="1.0" free="1"/>
  101 + </node>
  102 + <node>
  103 + <parameter scale="1.0" name="Energy" min="0.1" max="1.0e20" value="10.0" free="0"/>
  104 + <parameter scale="1e-07" name="Intensity" min="1e-07" max="1000.0" value="0.1" free="1"/>
  105 + </node>
  106 + </spectrum>
  107 +
  108 +(in this example there are two nodes; the number of nodes in a node
  109 +function is arbitrary).
  110 +
  111 +
  112 +File function
  113 +^^^^^^^^^^^^^
  114 +
  115 +A function defined using an input ASCII file with columns of energy and
  116 +differential flux values. The energy units are assumed to be MeV and the
  117 +flux values are assumed to
  118 +:math:`{\rm cm}^{-2} {\rm s}^{-1} {\rm MeV}^{-1}`
  119 +(the only exception being a model for which the spatial component is
  120 +a constant diffuse model :doxy:`GModelSpatialDiffuseConst`; in this case,
  121 +the units are
  122 +:math:`{\rm cm}^{-2} {\rm s}^{-1} {\rm MeV}^{-1} {\rm sr}^{-1}`).
  123 +The sole parameter is a multiplicative normalization:
  124 +
  125 +.. math::
  126 + \frac{dN}{dE} = N_0 \left. \frac{dN}{dE} \right\rvert_{\rm file}
  127 +
  128 +where the parameters in the XML definition have the following mappings:
  129 +
  130 +* :math:`N_0` = ``Normalization``
  131 +
  132 +The XML format for specifying a file function is:
  133 +
  134 +.. code-block:: xml
  135 +
  136 + <spectrum type="FileFunction" file="data/filefunction.txt">
  137 + <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/>
  138 + </spectrum>
  139 +
  140 +If the file is given as relative path, the path is relative to the working
  141 +directory of the executable. Alternatively, an absolute path may be
  142 +specified. Any environment variable present in the path name will be
  143 +expanded.
  144 +
  145 +
86 146 Power law
87 147 ^^^^^^^^^
88 148  
... ... @@ -142,11 +202,12 @@ the errors if one is using the PowerLaw form.
142 202 Exponentially cut-off power law
143 203 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144 204  
145   -The :doxy:`GModelSpectralExpPlaw` class implements the exponentially cut-off power law function
  205 +The :doxy:`GModelSpectralExpPlaw` class implements the exponentially
  206 +cut-off power law function
146 207  
147 208 .. math::
148 209 \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma}
149   - \exp \left( \frac{-E}{\tt E_{\rm cut}} \right)
  210 + \exp \left( \frac{-E}{E_{\rm cut}} \right)
150 211  
151 212 where the parameters in the XML definition have the following mappings:
152 213  
... ... @@ -167,6 +228,37 @@ The XML format for specifying an exponentially cut-off power law is:
167 228 </spectrum>
168 229  
169 230  
  231 +Super exponentially cut-off power law
  232 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  233 +
  234 +The :doxy:`GModelSpectralSuperExpPlaw` class implements the super
  235 +exponentially cut-off power law function
  236 +
  237 +.. math::
  238 + \frac{dN}{dE} = k_0 \left( \frac{E}{E_0} \right)^{\gamma}
  239 + \exp \left(
  240 + -\left( \frac{E}{E_{\rm cut}} \right)^{\alpha}
  241 + \right)
  242 +
  243 +where the parameters in the XML definition have the following mappings:
  244 +
  245 +* :math:`k_0` = ``Prefactor``
  246 +* :math:`\gamma` = ``Index1``
  247 +* :math:`\alpha` = ``Index2``
  248 +* :math:`E_0` = ``Scale``
  249 +* :math:`E_{\rm cut}` = ``Cutoff``
  250 +
  251 +.. code-block:: xml
  252 +
  253 + <spectrum type="PLSuperExpCutoff">
  254 + <parameter name="Prefactor" scale="1e-16" value="1.0" min="1e-07" max="1000.0" free="1"/>
  255 + <parameter name="Index1" scale="-1" value="2.0" min="0.0" max="+5.0" free="1"/>
  256 + <parameter name="Cutoff" scale="1e6" value="1.0" min="0.01" max="1000.0" free="1"/>
  257 + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/>
  258 + <parameter name="Index2" scale="1.0" value="1.5" min="0.1" max="5.0" free="1"/>
  259 + </spectrum>
  260 +
  261 +
170 262 Broken power law
171 263 ^^^^^^^^^^^^^^^^
172 264  
... ... @@ -226,32 +318,6 @@ The XML format for specifying a Gaussian is:
226 318 </spectrum>
227 319  
228 320  
229   -Node function
230   -^^^^^^^^^^^^^
231   -
232   -The generalisation of the broken power law is the node function, which is
233   -defined by a set of energy and intensity values, the so called nodes,
234   -which are connected by power laws.
235   -
236   -The XML format for specifying a node function is:
237   -
238   -.. code-block:: xml
239   -
240   - <spectrum type="NodeFunction">
241   - <node>
242   - <parameter scale="1.0" name="Energy" min="0.1" max="1.0e20" value="1.0" free="0"/>
243   - <parameter scale="1e-07" name="Intensity" min="1e-07" max="1000.0" value="1.0" free="1"/>
244   - </node>
245   - <node>
246   - <parameter scale="1.0" name="Energy" min="0.1" max="1.0e20" value="10.0" free="0"/>
247   - <parameter scale="1e-07" name="Intensity" min="1e-07" max="1000.0" value="0.1" free="1"/>
248   - </node>
249   - </spectrum>
250   -
251   -(in this example there are two nodes; the number of nodes in a node
252   -function is arbitrary).
253   -
254   -
255 321 Log parabola
256 322 ^^^^^^^^^^^^
257 323  
... ... @@ -294,37 +360,3 @@ where
294 360  
295 361 * ``alpha`` = -``Index``
296 362 * ``beta`` = -``Curvature``
297   -
298   -
299   -File function
300   -^^^^^^^^^^^^^
301   -
302   -A function defined using an input ASCII file with columns of energy and
303   -differential flux values. The energy units are assumed to be MeV and the
304   -flux values are assumed to
305   -:math:`{\rm cm}^{-2} {\rm s}^{-1} {\rm MeV}^{-1}`
306   -(the only exception being a model for which the spatial component is
307   -a constant diffuse model :doxy:`GModelSpatialDiffuseConst`; in this case,
308   -the units are
309   -:math:`{\rm cm}^{-2} {\rm s}^{-1} {\rm MeV}^{-1} {\rm sr}^{-1}`).
310   -The sole parameter is a multiplicative normalization:
311   -
312   -.. math::
313   - \frac{dN}{dE} = N_0 \left. \frac{dN}{dE} \right\rvert_{\rm file}
314   -
315   -where the parameters in the XML definition have the following mappings:
316   -
317   -* :math:`N_0` = ``Normalization``
318   -
319   -The XML format for specifying a file function is:
320   -
321   -.. code-block:: xml
322   -
323   - <spectrum type="FileFunction" file="data/filefunction.txt">
324   - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/>
325   - </spectrum>
326   -
327   -If the file is given as relative path, the path is relative to the working
328   -directory of the executable. Alternatively, an absolute path may be
329   -specified. Any environment variable present in the path name will be
330   -expanded.
... ...
doc/source/user_manual/modules/mwl.rst
... ... @@ -6,17 +6,19 @@ Multi-wavelength interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -The multi-wavelength module provides an interface for spectral energy
10   -distributions (SEDs). The SED defines the observed photon flux as function
11   -of energy (or frequency) from a particular source, and this information
12   -can be used in a fit to determine spectral source parameters.
13   -
14   -:ref:`fig_uml_mwl` present an overview over the C++ classes of the
  9 +The following figure presents an overview over the C++ classes of the
15 10 multi-wavelength module and their relations.
16 11  
17 12 .. _fig_uml_mwl:
18 13  
19 14 .. figure:: uml_mwl.png
20   - :width: 40%
  15 + :width: 30%
  16 + :align: center
  17 +
  18 + *Multi-wavelength module*
  19 +
  20 +The multi-wavelength module provides an interface for spectral energy
  21 +distributions (SEDs). The SED defines the observed photon flux as function
  22 +of energy (or frequency) from a particular source, and this information
  23 +can be used in a fit to determine spectral source parameters.
21 24  
22   - Multi-wavelength module
... ...
doc/source/user_manual/modules/numerics.rst
... ... @@ -37,6 +37,7 @@ Constant Value
37 37 ``gammalib::ln2`` :math:`\log 2` (natural logarithm of 2)
38 38 ``gammalib::ln10`` :math:`\log 10` (natural logarithm of 10)
39 39 ``gammalib::inv_ln2`` :math:`(\log 2)^{-1}`
  40 +``gammalib::inv_ln10`` :math:`(\log 10)^{-1}`
40 41 ``gammalib::onethird`` :math:`1/3`
41 42 ``gammalib::twothird`` :math:`2/3`
42 43 ``gammalib::fourthird`` :math:`4/3`
... ... @@ -64,6 +65,8 @@ Function Description
64 65 ``gammalib::atan2d`` Arc tangens function for argument x/y given in degrees
65 66 ``gammalib::sincosd`` Returns sine and cosine for argument given in degrees
66 67 ``gammalib::gammln`` Natural logarithm of gamma function
  68 +``gammalib::erfcc`` Complementary error function
  69 +``gammalib::erfinv`` Inverse error function
67 70 ``gammalib::modulo`` Remainder of division x/y
68 71 ===================== ===========
69 72  
... ...
doc/source/user_manual/modules/obs.rst
... ... @@ -6,15 +6,16 @@ Observation handling
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -:ref:`fig_uml_obs` present an overview over the C++ classes of the obs
  9 +The following figure presents an overview over the C++ classes of the obs
10 10 module and their relations.
11 11  
12 12 .. _fig_uml_obs:
13 13  
14 14 .. figure:: uml_obs.png
  15 + :align: center
15 16 :width: 100%
16 17  
17   - Observation module
  18 + *Overview over the obs module*
18 19  
19 20 The central C++ class of the obs module is the abstract base class
20 21 :doxy:`GObservation` which defines the instrument-independent interface for a
... ... @@ -115,15 +116,17 @@ for an unbinned observation and by:
115 116 .. code-block:: xml
116 117  
117 118 <observation name="..." id="..." instrument="...">
118   - <parameter name="CountsMap" file="..."/>
  119 + <parameter name="CountsCube" file="..."/>
119 120 <parameter name="EffectiveArea" file="..."/>
120 121 <parameter name="PointSpreadFunction" file="..."/>
121 122 <parameter name="EnergyDispersion" file="..."/>
122 123 </observation>
123 124  
124 125 for a binned observation. Here, ``EventList`` specifies a FITS file containing
125   -an event list and ``CountsMap`` specifies a FITS file containing a counts map.
126   -The other tags specify the components of the instrumental response function.
  126 +an event list and ``CountsCube`` specifies a FITS file containing a counts
  127 +cube.
  128 +The other tags specify the components of the instrumental response function
  129 +and are optional.
127 130 Similar definitions exist for the other instruments.
128 131  
129 132 The observations are loaded from the XML file descriptor using the load
... ... @@ -281,7 +284,9 @@ which provides the time dependent deadtime correction factor.
281 284 Setting up and using a calibration database
282 285 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283 286  
284   -TBW: Describe how to setup and how to use a calibration database.
  287 +To be written (describe how to setup and how to use a calibration
  288 +database) ...
  289 +
285 290  
286 291 .. _sec_time:
287 292  
... ... @@ -356,12 +361,14 @@ OGIP compliant header keywords.
356 361 Energies in GammaLib
357 362 ~~~~~~~~~~~~~~~~~~~~
358 363  
359   -TBW: Describe how energies are implemented in GammaLib. Mention that the
360   -internal energy is MeV. This section should also handle EBOUNDS.
  364 +To be written (describe how energies are implemented in GammaLib; mention
  365 +that the internal energy is MeV; this section should also handle EBOUNDS)
  366 +...
361 367  
362 368 .. _sec_roi:
363 369  
364 370 Regions of Interest
365 371 ~~~~~~~~~~~~~~~~~~~
366 372  
367   -TBW: Describe what a ROI is and why this is needed (unbinned analysis).
  373 +To be written (describe what a ROI is and that this is needed for unbinned
  374 +analysis) ...
... ...
doc/source/user_manual/modules/opt.rst
... ... @@ -6,6 +6,17 @@ Optimizers
6 6 Overview
7 7 ~~~~~~~~
8 8  
  9 +The following figure presents an overview over the C++ classes of
  10 +the optimizer module and their relations.
  11 +
  12 +.. _fig_uml_opt:
  13 +
  14 +.. figure:: uml_opt.png
  15 + :width: 50%
  16 + :align: center
  17 +
  18 + *Optimizer module*
  19 +
9 20 The optimizer module provides classes for function optimization.
10 21 The abstract :doxy:`GOptimizerFunction` base class defines the interface
11 22 for the function that should be optimized. The :doxy:`GOptimizerPar`
... ... @@ -16,17 +27,6 @@ the only optimizer algorithm implemented in GammaLib is the
16 27 Levenberg-Marquardt algorithm, implemented by the class
17 28 :doxy:`GOptimizerLM`.
18 29  
19   -
20   -:ref:`fig_uml_opt` presents an overview over the C++ classes of
21   -the optimizer module and their relations.
22   -
23   -.. _fig_uml_opt:
24   -
25   -.. figure:: uml_opt.png
26   - :width: 60%
27   -
28   - Optimizer module
29   -
30 30 The model parameter class :doxy:`GModelPar`, as a specific implementation
31 31 of the optimizer parameter class, derives from :doxy:`GOptimizerPar`.
32 32 One implementation of an optimizer function is the
... ...
doc/source/user_manual/modules/sky.rst
... ... @@ -6,6 +6,17 @@ Sky maps, sky coordinates and sky regions
6 6 Overview
7 7 ~~~~~~~~
8 8  
  9 +The following figure presents an overview over the C++ classes of the sky
  10 +module and their relations.
  11 +
  12 +.. _fig_uml_sky:
  13 +
  14 +.. figure:: uml_sky.png
  15 + :align: center
  16 + :width: 75%
  17 +
  18 + *Sky module*
  19 +
9 20 The sky module provides classes to handle sky maps, sky coordinates
10 21 and sky regions.
11 22 Sky maps are implemented by the :doxy:`GSkymap` class which stores
... ... @@ -20,9 +31,9 @@ implements the relation for the HEALPix pixelisation scheme, the
20 31 abstract :doxy:`GWcs` base class represents the relation for World
21 32 Coordinate Systems. Specific World Coordinate System projections
22 33 are implemented by the :doxy:`GWcsAIT`, :doxy:`GWcsAZP`, :doxy:`GWcsCAR`,
23   -:doxy:`GWcsMER`, :doxy:`GWcsSTG` and :doxy:`GWcsTAN` classes. Instances of
24   -all specific World Coordinate System classes are collected in
25   -the :doxy:`GWcsRegistry` registry class.
  34 +:doxy:`GWcsMER`, :doxy:`GWcsMOL`, :doxy:`GWcsSTG` and :doxy:`GWcsTAN`
  35 +classes. Instances of all specific World Coordinate System classes
  36 +are collected in the :doxy:`GWcsRegistry` registry class.
26 37  
27 38 Sky coordinates are implemented by the :doxy:`GSkyDir` class that
28 39 specifies celestial coordinates in either equatorial (Right Ascension
... ... @@ -36,12 +47,5 @@ So far, only a simple circular sky region is implemented by the
36 47 :doxy:`GSkyRegionCircle` class. Sky regions are collected in the
37 48 :doxy:`GSkyRegions` container class.
38 49  
39   -:ref:`fig_uml_sky` present an overview over the C++ classes of the sky
40   -module and their relations.
41   -
42   -.. _fig_uml_sky:
43   -
44   -.. figure:: uml_sky.png
45   - :width: 100%
46   -
47   - Sky module
  50 +Coordinates in the horizon system (altitude and azimuth) are implemented
  51 +by the :doxy:`GHorizDir` class.
48 52 \ No newline at end of file
... ...
doc/source/user_manual/modules/support.rst
... ... @@ -6,6 +6,18 @@ Support functions and classes
6 6 Overview
7 7 ~~~~~~~~
8 8  
  9 +The following figure presents an overview over the C++ classes of the
  10 +support module and their relations.
  11 +
  12 +.. _fig_uml_support:
  13 +
  14 +.. figure:: uml_support.png
  15 + :width: 75%
  16 + :align: center
  17 +
  18 + *Support module*
  19 +
  20 +
9 21 The support module contains a number of functions and classes that are
10 22 needed to support core functionnalities of GammaLib. An overview of the
11 23 functions and C++ classes present in this module is given in
... ... @@ -25,13 +37,6 @@ and :doxy:`GUrlString` are derived from :doxy:`GUrl` and implement a file storag
25 37 and a string storage, respectively. As most of the classes are unrelated,
26 38 they will be described individually in the following sections.
27 39  
28   -.. _fig_uml_support:
29   -
30   -.. figure:: uml_support.png
31   - :width: 100%
32   -
33   - Support module
34   -
35 40  
36 41 Column Separated Value tables
37 42 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... ... @@ -207,7 +212,7 @@ The :doxy:`GRan::chisq2` method draws random numbers from the propability
207 212 distribution
208 213  
209 214 .. math::
210   - p(x) = \frac{1}{2\pi} x \exp( -\frac{1}{2} x^2 )
  215 + p(x) = \frac{1}{2\pi} x \exp \left( -\frac{1}{2} x^2 \right)
211 216  
212 217 This method can be used to simulate the random radial offset of a measured
213 218 source position from the true source position, assuming an azimuthally
... ... @@ -225,14 +230,17 @@ Constants
225 230  
226 231 The following constants are available:
227 232  
228   -======================== =====
229   -Constant Value
230   -======================== =====
231   -``gammalib::MeV2erg`` :math:`1.6021765 \times 10^{-6}` (converts MeV to erg)
232   -``gammalib::erg2MeV`` :math:`624150.96` (converts erg to MeV)
233   -``gammalib::pc2cm`` :math:`3.08568025 \times 10^{18}` (converts pc to cm)
234   -``gammalib::sec_in_day`` :math:`86400.0` (number of seconds in one day)
235   -======================== =====
  233 +========================== =====
  234 +Constant Value
  235 +========================== =====
  236 +``gammalib::MeV2erg`` :math:`1.6021765 \times 10^{-6}` (converts MeV to erg)
  237 +``gammalib::erg2MeV`` :math:`624150.96` (converts erg to MeV)
  238 +``gammalib::MeV2Angstrom`` :math:`1.239841875e-2` (converts MeV to Angstrom)
  239 +``gammalib::pc2cm`` :math:`3.08568025 \times 10^{18}` (converts pc to cm)
  240 +``gammalib::sec_in_day`` :math:`86400.0` (number of seconds in one day)
  241 +``gammalib::sec2day`` :math:`1/86400` (converts seconds to days)
  242 +``gammalib::tai2tt`` :math:`32.184` (converts TAI to TT system)
  243 +========================== =====
236 244  
237 245  
238 246 Functions
... ... @@ -246,6 +254,7 @@ Function Description
246 254 ``gammalib::strip_whitespace`` Strips all leading and trailing whitespace from string.
247 255 ``gammalib::strip_chars`` Strips all leading and trailing characters from string.
248 256 ``gammalib::expand_env`` Replace any environment variables in string by its value.
  257 +``gammalib::filepath`` Build path from filename and path.
249 258 ``gammalib::str`` Conversion of C-types to strings.
250 259 ``gammalib::tochar`` Conversion of string to ``char``.
251 260 ``gammalib::toshort`` Conversion of string to ``short``.
... ... @@ -268,11 +277,20 @@ Function Description
268 277 ``gammalib::parformat`` Format string for parameter value display.
269 278 ``gammalib::plaw_photon_flux`` Compute photon flux under a power law.
270 279 ``gammalib::plaw_energy_flux`` Compute energy flux under a power law.
  280 +``gammalib::elogmean`` Computes geometric mean of energy.
271 281 ``gammalib::file_exists`` Check whether a file exists.
  282 +``gammalib::dir_exists`` Check whether a directory exists.
272 283 ``gammalib::is_infinite`` Check whether a double precision value is infinite.
273 284 ``gammalib::is_notanumber`` Check whether a double precision value is not a number.
274 285 ``gammalib::contains`` Check whether a string contains a sub-string.
275 286 ``gammalib::warning`` Dump warning in console.
  287 +``gammalib::xml2str`` Converts XML to string.
  288 +``gammalib::str2xml`` Converts string to XML.
  289 +``gammalib::xml_has_par`` Checks is XML file has parameter.
  290 +``gammalib::xml_need_par`` Require specific parameter in XML file.
  291 +``gammalib::xml_get_par`` Get parameter from XML file.
  292 +``gammalib::xml_check_par`` Check parameter in XML file.
  293 +``gammalib::recv`` Receive on socket with timeout.
276 294 ============================== ===========
277 295  
278 296  
... ...
doc/source/user_manual/modules/uml_app.png

18.4 KB | W: | H:

18.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_com.png

73.5 KB | W: | H:

73.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_cta.png

222 KB | W: | H:

275 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_fits.png

126 KB | W: | H:

126 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_lat.png

119 KB | W: | H:

119 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_model.png

168 KB | W: | H:

201 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_obs.png

114 KB | W: | H:

119 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/uml_sky.png

68.6 KB | W: | H:

75.8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/user_manual/modules/vo.rst
... ... @@ -6,20 +6,21 @@ Virtual Observatory interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -The VO module provides classes that interface GammaLib to the Virtual
10   -Observatory infrastructure. So far the module contains the :doxy:`GVOClient`
11   -and the :doxy:`GVOHub` classes. :doxy:`GVOClient` implements a
12   -Virtual Observatory client while :doxy:`GVOHub` implement a hub for
13   -inter-client communication.
14   -If a client needs to connect to a Hub and no Hub is currently running
15   -on the system, the client will launch it's own Hub.
16   -
17   -:ref:`fig_uml_vo` presents an overview over the C++ classes of the VO
  9 +The following figure presents an overview over the C++ classes of the VO
18 10 module and their relations.
19 11  
20 12 .. _fig_uml_vo:
21 13  
22 14 .. figure:: uml_vo.png
23 15 :width: 30%
  16 + :align: center
24 17  
25   - VO module
  18 + *VO module*
  19 +
  20 +The VO module provides classes that interface GammaLib to the Virtual
  21 +Observatory infrastructure. So far the module contains the :doxy:`GVOClient`
  22 +and the :doxy:`GVOHub` classes. :doxy:`GVOClient` implements a
  23 +Virtual Observatory client while :doxy:`GVOHub` implements a hub for
  24 +inter-client communication.
  25 +If a client needs to connect to a Hub and no Hub is running on the system,
  26 +the client will launch it's own Hub.
... ...
doc/source/user_manual/modules/xml.rst
... ... @@ -6,15 +6,16 @@ XML file interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -:ref:`fig_uml_xml` present an overview over the C++ classes of the XML
  9 +The followinf figure presents an overview over the C++ classes of the XML
10 10 module and their relations.
11 11  
12 12 .. _fig_uml_xml:
13 13  
14 14 .. figure:: uml_xml.png
15   - :width: 100%
  15 + :width: 80%
  16 + :align: center
16 17  
17   - XML module
  18 + *XML module*
18 19  
19 20 The XML module provides classes that allow creation, writing and reading of
20 21 files in the Extensible Markup Language (XML) format.
... ...
doc/source/user_manual/modules/xspec.rst
... ... @@ -6,19 +6,20 @@ Xspec interface
6 6 Overview
7 7 ~~~~~~~~
8 8  
9   -The Xspec module provides an interface to data in the XSPEC format. Event
10   -data storage is implemented by the :doxy:`GPha` class that provides
11   -the number of events measured per channel. The effective area taking
12   -into account any event selection cuts is implemented by the :doxy:`GArf`
13   -class. And energy redistribution information is implemented by the
14   -:doxy:`GRmf` class.
15   -
16   -:ref:`fig_uml_xspec` present an overview over the C++ classes of the Xspec
  9 +The following figure presents an overview over the C++ classes of the Xspec
17 10 module and their relations.
18 11  
19 12 .. _fig_uml_xspec:
20 13  
21 14 .. figure:: uml_xspec.png
22   - :width: 50%
  15 + :width: 40%
  16 + :align: center
23 17  
24   - Xspec module
  18 + *Xspec module*
  19 +
  20 +The Xspec module provides an interface to data in the XSPEC format. Event
  21 +data storage is implemented by the :doxy:`GPha` class that provides
  22 +the number of events measured per channel. The effective area taking
  23 +into account any event selection cuts is implemented by the :doxy:`GArf`
  24 +class. And energy redistribution information is implemented by the
  25 +:doxy:`GRmf` class.
... ...
doc/source/user_manual/quickstart.rst
... ... @@ -4,12 +4,22 @@ Getting started with GammaLib
4 4 A quick GammaLib tutorial
5 5 -------------------------
6 6  
  7 +To be written ...
  8 +
  9 +
7 10 Using GammaLib from Python
8 11 --------------------------
9 12  
  13 +To be written ...
  14 +
  15 +
10 16 Programming guidelines
11 17 ----------------------
12 18  
  19 +To be written ...
  20 +
  21 +
13 22 Frequently asked questions
14 23 --------------------------
15 24  
  25 +To be written ...
... ...