Commit 06ad3937a5c8575f8c6e032e6ff190d48e30d7a6

Authored by Jürgen Knödlseder
1 parent 42448a69

Update the response description

doc/source/user_manual/getting_started/caldb.tar.gz deleted
No preview for this file type
doc/source/user_manual/getting_started/irf-aeff.png 0 → 100644

3.24 KB

doc/source/user_manual/getting_started/irf-file.png 0 → 100644

7.1 KB

doc/source/user_manual/getting_started/response.rst
... ... @@ -3,20 +3,6 @@
3 3 CTA Instrument Response Functions
4 4 ---------------------------------
5 5  
6   -.. note ::
7   -
8   - Instrument response functions are formally not part of ctools as they
9   - should be provided by the instrument teams. The GammaLib framework on
10   - which ctools are built comes with a set of basic response functions, but
11   - for getting the latest instrument response functions you should contact
12   - the relevant instrument teams. CTA consortium members should
13   - `download
14   - <https://portal.cta-observatory.org/WG/DM/DM_wiki/DATA_Access/Pages/Science%20Tools.aspx>`_
15   - the latest calibration database containing Prod1 and Prod2 instrument
16   - response functions from the consortium Sharepoint site (requires
17   - password).
18   -
19   -
20 6 What are instrument response functions?
21 7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 8  
... ... @@ -47,98 +33,64 @@ atmospheric conditions, etc.). All these quantities and hence the
47 33 instrument response function may depend on time.
48 34  
49 35  
50   -Data formats
51   -~~~~~~~~~~~~
52   -
53   -So far the data format of the CTA instrument response functions has not
54   -yet been settled, and information about instrument response functions is
55   -provided in various ways. Three types of data formats are supported:
56   -
57   -- :ref:`sec_cta_rsp_perftable`
58   -
59   -- :ref:`sec_cta_rsp_xspec`
60   -
61   -- :ref:`sec_cta_rsp_rsptable`
62   -
63   -All formats provide the instrument response as function of true (and
64   -sometimes also measured) photon energy, typically from about 20 GeV to
65   -about 125 TeV.
66   -Performance tables provide the instrument response for on-axis sources.
67   -ARF, RMF and PSF files provide the instrument response for a specific
68   -source position (and region) within the field of view.
69   -Response tables provide the instrument response as function of position in
70   -the field of view. Response tables are thus the most universal form of
71   -instrument response functions available, and we recommend using this form
72   -for any analysis.
73   -
74   -.. note ::
75   -
76   - Instrument response functions are so far only provided for a fixed
77   - zenith angle of 20 deg. Therefore, no zenith or azimuth angle dependence has
78   - been implemented so far.
79   -
80   -
81   -Installing the CTA calibration database
82   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83   -
84   -After `downloading
85   -<https://portal.cta-observatory.org/WG/DM/DM_wiki/DATA_Access/Pages/Science%20Tools.aspx>`_
86   -the latest calibration database (only possible for CTA consortium members),
87   -the database is installed using
88   -
89   -.. code-block:: bash
90   -
91   - $ [sudo] tar -C $CALDB -zxvf cta-caldb-20150220.tar.gz
92   -
93   -or
94   -
95   -.. code-block:: bash
96   -
97   - $ [sudo] tar -C $CALDB -xvf cta-caldb-20150220.tar
98   -
99   -depending on whether the database has been retrieved as a gzipped file or
100   -not. Depending on your access rights to the ``$CALDB`` directory,
101   -installation of the calibration database may require root privileges
102   -(type ``sudo`` in this case, otherwise omit this part of the command).
103   -
104   -The calibration database must be installed into the directory to which you
105   -``CALDB`` environment variable points. By default, ctools sets this
106   -enviroment variable to
107   -
108   -.. code-block:: bash
109   -
110   - $CTOOLS/share/caldb
111   -
112   -but it may be that due to some other analysis software on your system the
113   -``CALDB`` environment variable points to another directory. If in doubt, type
114   -
115   -.. code-block:: bash
116   -
117   - echo $CALDB
118   -
119   -to find out to which directory your ``CALDB`` environment variable points.
120   -You may always overwrite this setting using
121   -
122   -.. code-block:: bash
123   -
124   - export CALDB=/my/preferred/caldb/directory
125   -
126   -which you can add to your ``.bashrc`` file to set the directory
127   -permanently.
128   -ctools will use the ``CALDB`` environment variable to find out where the
129   -calibration database is located. If needed, this mechanism can be
130   -circumvented (see :ref:`sec_cta_rsp_abspath`).
131   -
132   -
133   -Specifying the CTA Instrument Response Functions
134   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36 +CTA response functions
  37 +~~~~~~~~~~~~~~~~~~~~~~
  38 +
  39 +The instrument response functions for CTA are factorised into
  40 +the effective area :math:`A_{\rm eff}(d, p, E, t)` (units :math:`cm^2`),
  41 +the point spread function :math:`PSF(p' | d, p, E, t)`,
  42 +and the energy dispersion :math:`E_{\rm disp}(E' | d, p, E, t)`
  43 +following:
  44 +
  45 +.. math::
  46 + R(p', E', t' | d, p, E, t) =
  47 + A_{\rm eff}(d, p, E, t) \times
  48 + PSF(p' | d, p, E, t) \times
  49 + E_{\rm disp}(E' | d, p, E, t)
  50 +
  51 +ctools are shipped with response functions for the northern and southern
  52 +arrays, and variants are available that have been optimised for exposure
  53 +times of 0.5 hours, 5 hours and 50 hours.
  54 +In total, the following six instrument response functions are available:
  55 +``North_0.5h``, ``North_5h``, ``North_50h``, ``South_0.5h``,
  56 +``South_5h``, and ``South_50h``.
  57 +
  58 +Each response is stored in a single FITS file, and each component of
  59 +the response factorisation is stored in a binary table of that FITS
  60 +file.
  61 +In addition, the response files contain an additional table that
  62 +describes the background rate as function of energy and position in
  63 +the field of view.
  64 +An example of a CTA response file is shown below:
  65 +
  66 +.. figure:: irf-file.png
  67 + :width: 100%
  68 +
  69 +Each table in the response file is in a standardised format that is
  70 +the one that is also used for the Fermi/LAT telescope.
  71 +As an example, the effective area component of the response file
  72 +is shown below.
  73 +Response information is stored in a n-dimensional cube, and each axis
  74 +of this cube is described by the lower and upper edges of the axis bins.
  75 +In this example the effective area is stored as a 2D matrix with the
  76 +first axis being energy and the second axis being offaxis angle.
  77 +Effective area information is stored for true (``EFFAREA``) and
  78 +reconstructed (``EFFAREA_RECO``) energy.
  79 +Vector columns are used to store all information.
  80 +
  81 +.. figure:: irf-aeff.png
  82 + :width: 100%
  83 +
  84 +
  85 +Specifying CTA response functions
  86 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 87  
136 88 The specification of the CTA Instrument Response Functions depends on the
137 89 way how ctools are used. Common to all methods is that the IRFs are
138 90 defined by a response name and a calibration database name.
139   -
140   -There are different means to specify the CTA Instrument Response Functions
141   -when using ctools, and the following section describe the
  91 +ctools makes use of HEASARC's CALDB format to index and store
  92 +IRFs, and specification of the database and response names is
  93 +sufficient to access the response.
142 94  
143 95  
144 96 Specifying the response function as input parameters
... ... @@ -146,23 +98,22 @@ Specifying the response function as input parameters
146 98  
147 99 ctools that require instrument response functions have two parameters
148 100 to specify the calibration database name and the response function name.
149   -The following example shows a ``ctobssim`` run using the ``dummy``
150   -calibration database and the ``cta_dummy_irf`` response function:
  101 +The following example shows a ``ctobssim`` run using the ``prod2``
  102 +calibration database and the ``South_50h`` response function:
151 103  
152 104 .. code-block:: bash
153 105  
154 106 $ ctobssim
155   - Model [$CTOOLS/share/models/crab.xml]
156   - Calibration database [dummy]
157   - Instrument response function [cta_dummy_irf]
158 107 RA of pointing (degrees) (0-360) [83.63]
159   - Dec of pointing (degrees) (-90-90) [22.01]
  108 + Dec of pointing (degrees) (-90-90) [22.51]
160 109 Radius of FOV (degrees) (0-180) [5.0]
161   - Start time (MET in s) (0) [0.0]
162   - End time (MET in s) (0) [1800.0]
163   - Lower energy limit (TeV) (0) [0.1]
164   - Upper energy limit (TeV) (0) [100.0]
165   - Output event data file or observation definition file [events.fits]
  110 + Start time (MET in s) [0.0]
  111 + End time (MET in s) [1800.0]
  112 + Lower energy limit (TeV) [0.1]
  113 + Upper energy limit (TeV) [100.0]
  114 + Calibration database [prod2]
  115 + Instrument response function [South_50h]
  116 + Model [$CTOOLS/share/models/crab.xml]
166 117  
167 118 Running the other tools is equivalent.
168 119  
... ... @@ -180,7 +131,7 @@ definition file:
180 131 <observation_list title="observation library">
181 132 <observation name="Crab" id="00001" instrument="CTA">
182 133 <parameter name="EventList" file="events.fits"/>
183   - <parameter name="Calibration" database="dummy" response="cta_dummy_irf"/>
  134 + <parameter name="Calibration" database="prod2" response="South_50h"/>
184 135 </observation>
185 136 </observation_list>
186 137  
... ... @@ -190,9 +141,9 @@ response name. You can then pass this file directly to, e.g., ``ctlike``:
190 141 .. code-block:: bash
191 142  
192 143 $ ctlike
193   - Event list, counts map or observation definition file [events.fits] obs_rsp.xml
  144 + Event list, counts cube or observation definition file [events.fits] obs_irf.xml
194 145 Source model [$CTOOLS/share/models/crab.xml]
195   - Source model output file [crab_results.xml]
  146 + Source model output file [crab_results.xml]
196 147  
197 148 Note that ``ctlike`` does not ask for the calibration database and
198 149 response name as it found the relevant information in the XML file.
... ... @@ -211,10 +162,10 @@ specify them individually in the XML observation file as follows:
211 162 <observation_list title="observation library">
212 163 <observation name="Crab" id="00001" instrument="CTA">
213 164 <parameter name="EventList" file="events.fits"/>
214   - <parameter name="EffectiveArea" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/>
215   - <parameter name="PointSpreadFunction" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/>
216   - <parameter name="EnergyDispersion" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/>
217   - <parameter name="Background" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/>
  165 + <parameter name="EffectiveArea" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/>
  166 + <parameter name="PointSpreadFunction" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/>
  167 + <parameter name="EnergyDispersion" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/>
  168 + <parameter name="Background" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/>
218 169 </observation>
219 170 </observation_list>
220 171  
... ... @@ -229,169 +180,12 @@ and response name from within Python:
229 180  
230 181 import gammalib
231 182 obs = gammalib.GCTAObservation()
232   - caldb = gammalib.GCaldb("cta", "dummy")
233   - irf = "cta_dummy_irf"
  183 + caldb = gammalib.GCaldb("cta", "prod2")
  184 + irf = "South_50h"
234 185 obs.response(irf, caldb)
235 186  
236 187 The calibration database is set by creating a ``GCaldb`` object. The
237 188 constructor takes as argument the mission (always ``cta``) and the
238   -database name, in our case ``dummy``. The response function is then set
239   -by passing the response name (here ``cta_dummy_irf``) and the calibration
  189 +database name, in our case ``prod2``. The response function is then set
  190 +by passing the response name (here ``South_50h``) and the calibration
240 191 database object to the ``response`` method.
241   -
242   -Alternatively, you can specify a specific response file by using
243   -
244   -.. code-block:: python
245   -
246   - import gammalib
247   - obs = gammalib.GCTAObservation()
248   - caldb = gammalib.GCaldb("$CALDB/data/cta/dummy/bcf")
249   - irf = "cta_dummy_irf.dat"
250   - obs.response(irf, caldb)
251   -
252   -Here, the directory in which the calibration file resides is specified
253   -as argument to the ``GCaldb`` constructor, and the filename is passed
254   -as response function name to the ``response`` method.
255   -
256   -
257   -What response functions are available?
258   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259   -
260   -To see what response functions are available on your system, type
261   -
262   -.. code-block:: bash
263   -
264   - $ cscaldb
265   -
266   -This creates the file ``cscaldb.log`` in your current working directory
267   -that contains information about the available response functions. The
268   -format of the file is:
269   -
270   -.. code-block:: bash
271   -
272   - 2014-02-20T17:15:21: +==============+
273   - 2014-02-20T17:15:21: | Mission: cta |
274   - 2014-02-20T17:15:21: +==============+
275   - 2014-02-20T17:15:21: === Calibration: aar ===
276   - 2014-02-20T17:15:21: DESY20140105_50h
277   - 2014-02-20T17:15:21: DESY20140105_50h_0deg
278   - 2014-02-20T17:15:21: DESY20140105_50h_180deg
279   - 2014-02-20T17:15:21:
280   - 2014-02-20T17:15:21: === Calibration: aar500 ===
281   - 2014-02-20T17:15:21: DESY20140105_50h
282   - 2014-02-20T17:15:21: DESY20140105_50h_0deg
283   - 2014-02-20T17:15:21: DESY20140105_50h_180deg
284   -
285   -The name after ``Calibration`` is what we called earlier the calibration
286   -database, and the names that are following each
287   -``=== Calibration: xxx ===`` header are the response file names.
288   -
289   -To get the same information also onto the console, type
290   -
291   -.. code-block:: bash
292   -
293   - $ cscaldb debug=yes
294   -
295   -
296   -Data format details
297   -~~~~~~~~~~~~~~~~~~~
298   -
299   -.. _sec_cta_rsp_perftable:
300   -
301   -Performance tables
302   -^^^^^^^^^^^^^^^^^^
303   -
304   -In the early days, the instrument performances derived from Monte-Carlo
305   -simulations have been summarised in what we call here Performance
306   -Tables, which are ASCII files that contain as function of energy the
307   -on-axis performance parameters of CTA, such as effective area, point spread
308   -function containment radius, energy resolution, background count rate and
309   -differential sensitivity.
310   -
311   -Below an example of a CTA performance table::
312   -
313   - log(E) Area r68 r80 ERes. BG Rate Diff Sens
314   - -1.7 261.6 0.3621 0.4908 0.5134 0.0189924 6.88237e-11
315   - -1.5 5458.2 0.2712 0.3685 0.4129 0.1009715 1.72717e-11
316   - -1.3 15590.0 0.1662 0.2103 0.2721 0.0575623 6.16963e-12
317   - -1.1 26554.1 0.1253 0.1567 0.2611 0.0213008 2.89932e-12
318   - -0.9 52100.5 0.1048 0.1305 0.1987 0.0088729 1.39764e-12
319   - -0.7 66132.1 0.0827 0.1024 0.1698 0.0010976 6.03531e-13
320   - -0.5 108656.8 0.0703 0.0867 0.1506 0.0004843 3.98147e-13
321   - -0.3 129833.0 0.0585 0.0722 0.1338 0.0001575 3.23090e-13
322   - -0.1 284604.3 0.0531 0.0656 0.1008 0.0001367 2.20178e-13
323   - 0.1 263175.3 0.0410 0.0506 0.0831 0.0000210 1.87452e-13
324   - 0.3 778048.6 0.0470 0.0591 0.0842 0.0000692 1.53976e-13
325   - 0.5 929818.8 0.0391 0.0492 0.0650 0.0000146 1.18947e-13
326   - 0.7 1078450.0 0.0335 0.0415 0.0541 0.0000116 1.51927e-13
327   - 0.9 1448579.1 0.0317 0.0397 0.0516 0.0000047 1.42439e-13
328   - 1.1 1899905.0 0.0290 0.0372 0.0501 0.0000081 1.96670e-13
329   - 1.3 2476403.8 0.0285 0.0367 0.0538 0.0000059 2.20695e-13
330   - 1.5 2832570.6 0.0284 0.0372 0.0636 0.0000073 3.22523e-13
331   - 1.7 3534065.3 0.0290 0.0386 0.0731 0.0000135 4.84153e-13
332   - 1.9 3250103.4 0.0238 0.0308 0.0729 0.0000044 6.26265e-13
333   - 2.1 3916071.6 0.0260 0.0354 0.0908 0.0000023 7.69921e-13
334   - ---------------------------------------------
335   - 1) log(E) = log10(E/TeV) - bin centre
336   - 2) Eff Area - in square metres after background cut (no theta cut)
337   - 3) Ang. Res - 68% containment radius of gamma-ray PSF post cuts - in degrees
338   - 4) Ang. Res - 80% containment radius of gamma-ray PSF post cuts - in degrees
339   - 5) Fractional Energy Resolution (rms)
340   - 6) BG Rate - inside point-source selection region - post call cuts - in Hz
341   - 7) Diff Sens - differential sensitivity for this bin expressed as E^2 dN/dE
342   - - in erg cm^-2 s^-1 - for a 50 hours exposure - 5 sigma significance including
343   - systematics and statistics and at least 10 photons.
344   -
345   -
346   -.. _sec_cta_rsp_xspec:
347   -
348   -ARF, RMF and PSF files
349   -^^^^^^^^^^^^^^^^^^^^^^
350   -
351   -Instrument response information for the first CTA Data Challenge (1DC) has been
352   -provided in a format that was heavily inspired by the
353   -`RMF and ARF file formats
354   -<http://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/docs/memos/cal_gen_92_002/cal_gen_92_002.html>`_
355   -that have been introduced by
356   -`HEASARC <http://heasarc.gsfc.nasa.gov/>`_
357   -for spectral analysis of X-ray data.
358   -
359   -The Redistribution Matrix File (RMF) describes how an incoming photon with
360   -a given true energy is redistributed in measured energy. In other words, it
361   -describes the energy dispersion of the instrument. The RMF is organised as
362   -a two-dimensional matrix, with the first axis being in true energies while
363   -the second axis represents the measured energies.
364   -
365   -The Ancillary Response File (ARF) describes the sensitivity of the
366   -instrument to photons of a given true energy. The ARF gives the effective
367   -area of the detector system after applying an event selection cut
368   -(theta cut). For computing the ARF, some knowledge of the Point Spread
369   -Function (PSF) is needed, so that the fraction of photons that falls into
370   -the event selection region for a given source can be properly estimated.
371   -Once this is done, no further PSF information is needed for the analysis.
372   -
373   -ctools however relies on the full modelling of the instrument, including
374   -the Point Spread Function, and hence, PSF information has also been
375   -provided for 1DC. Two data formats have been used for this: a first that
376   -is based on a simple one-dimensional vector, providing the width of a
377   -2-dimensional Gaussian as function of energy; and a second that is based
378   -on a three-component 2D Gaussian as function of energy and offset angle
379   -in the camera system. While the former was implement by a simply FITS
380   -table with two columns, the latter was implemented by
381   -:ref:`sec_cta_rsp_rsptable`.
382   -
383   -
384   -.. _sec_cta_rsp_rsptable:
385   -
386   -Response tables
387   -^^^^^^^^^^^^^^^
388   -
389   -The CTA response table class ``GCTAResponseTable`` provides a generic
390   -handle for multi-dimensional response information. It is based on the
391   -response format used for storing response information for the
392   -*Fermi*/LAT telescope. In this format, all information is stored in
393   -a single row of a FITS binary table. Each element of the row contains
394   -a vector column, that describes the axes of the multi-dimensional response
395   -cube and the response information. Note that this class may in the future
396   -be promoted to the GammaLib core, as a similar class has been implemented
397   -in the *Fermi*/LAT interface.
... ...