Commit c4cb81cc2c76f94ab82c8e9abca9e6f56d0ca533

Authored by Jürgen Knödlseder
1 parent 3e1c1652

Update quickstart documentation

doc/source/users/tutorials/quickstart/binning.rst
1 1 .. _sec_binning_cta:
2 2  
3 3 Binning CTA data
4   -~~~~~~~~~~~~~~~~
  4 +----------------
5 5  
6   -As next analysis step you will bin the data into a counts cube using
7   -:ref:`ctbin`.
8   -A counts cube is a 3-dimensional data cube, spanned by
9   -Right Ascension (or Galactic longitude), Declination (or Galactic latitude),
10   -and energy (by default logarithmically spaced, but this is under your control).
  6 + .. admonition:: What you will learn
11 7  
12   -:ref:`ctbin` is executed by typing:
  8 + You will learn how to use the :ref:`ctbin` tool to **bin the selected
  9 + CTA event data into a counts cube**.
  10 +
  11 + A counts cube is a 3-dimensional data cube that is spanned by Right
  12 + Ascension (or Galactic longitude), Declination (or Galactic latitude),
  13 + and energy (by default logarithmically spaced, but this is under your
  14 + control).
  15 +
  16 +Let's now bin the selected event data into a counts cube. You do this
  17 +using the :ref:`ctbin` tool as follows:
13 18  
14 19 .. code-block:: bash
15 20  
16   - $ ctbin
17   - Input event list or observation definition XML file [events.fits]
18   - First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
19   - Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
20   - Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR]
21   - Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
22   - Image scale (in degrees/pixel) [0.02]
23   - Size of the X axis in pixels [200]
24   - Size of the Y axis in pixels [200]
25   - Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
26   - Start value for first energy bin in TeV [0.1]
27   - Stop value for last energy bin in TeV [100.0]
28   - Number of energy bins [20]
29   - Output counts cube file [cntcube.fits]
  21 + $ ctbin
  22 + Input event list or observation definition XML file [events.fits] selected_events.fits
  23 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  24 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  25 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  26 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  27 + Image scale (in degrees/pixel) [0.02]
  28 + Size of the X axis in pixels [200]
  29 + Size of the Y axis in pixels [200]
  30 + Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
  31 + Start value for first energy bin in TeV [0.1]
  32 + Stop value for last energy bin in TeV [100.0]
  33 + Number of energy bins (1-200) [20]
  34 + Output counts cube file [cntcube.fits]
30 35  
31 36 In this example the events from file ``events.fits`` will be binned into
32 37 a counts cube stored into the file ``cntcube.fits``. The counts cube
33   -is centred on the location of the Crab nebula (Right Ascension 83.63°,
34   -Declination 22.01°). A cartesian projection aligned in celestial
  38 +is centred on the location of the Crab nebula (Right Ascension 83.63 deg,
  39 +Declination 22.01 deg). A cartesian projection aligned in celestial
35 40 coordinates is used and the counts cube has
36 41 200 x 200 spatial pixels of 0.02 x 0.02 degrees in size, covering
37   -an area of 4° x 4°, and 20 logarithmically spaced energy bins, covering
  42 +an area of 4 deg x 4 deg, and 20 logarithmically spaced energy bins, covering
38 43 an energy range from 0.1 TeV to 100 TeV.
39 44  
40 45 The ``cntcube.fits`` file produced by :ref:`ctbin` contains four extensions:
... ... @@ -58,7 +63,7 @@ simulated data.
58 63 :width: 600px
59 64 :align: center
60 65  
61   - *Extensions of a counts cube FITS file*
  66 + *Extensions of the counts cube FITS file*
62 67  
63 68  
64 69 An image of the first bin, covering the energy range 100 - 141 GeV, is
... ... @@ -68,23 +73,24 @@ shown below:
68 73 :height: 400px
69 74 :align: center
70 75  
71   - *Image of first energy bin of a counts cube*
  76 + *Image of first energy bin of the counts cube*
72 77  
73 78 For illustration, the last few lines of the log file ``ctbin.log`` are
74 79 reproduced below:
75 80  
76 81 .. code-block:: none
77 82  
78   - 2016-06-29T10:33:23: +=================+
79   - 2016-06-29T10:33:23: | Bin observation |
80   - 2016-06-29T10:33:23: +=================+
81   - 2016-06-29T10:33:23: === CTA observation ===
82   - 2016-06-29T10:33:23: Events in list ............: 23099
83   - 2016-06-29T10:33:23: Events in cube ............: 18532
84   - 2016-06-29T10:33:23: Event bins outside RoI ....: 0
85   - 2016-06-29T10:33:23: Events outside cube area ..: 4567
86   - 2016-06-29T10:33:23: Events outside energy bins : 0
87   -
88   -From the 23099 events that have been simulated and stored in the
89   -``events.fits`` file, 18532 lie within the cube boundaries and are thus put
  83 + 2017-08-08T20:17:06: +=================+
  84 + 2017-08-08T20:17:06: | Bin observation |
  85 + 2017-08-08T20:17:06: +=================+
  86 + 2017-08-08T20:17:06: === CTA observation ===
  87 + 2017-08-08T20:17:06: Events in list ............: 21991
  88 + 2017-08-08T20:17:06: Events in cube ............: 18827
  89 + 2017-08-08T20:17:06: Events outside RoI ........: 0
  90 + 2017-08-08T20:17:06: Events with invalid WCS ...: 0
  91 + 2017-08-08T20:17:06: Events outside cube area ..: 3164
  92 + 2017-08-08T20:17:06: Events outside energy bins : 0
  93 +
  94 +From the 21991 events that have been simulated and stored in the
  95 +``events.fits`` file, 18827 lie within the cube boundaries and are thus put
90 96 into the resulting counts cube.
... ...
doc/source/users/tutorials/quickstart/butterfly.jpg deleted

58.9 KB

doc/source/users/tutorials/quickstart/butterfly.rst deleted
1   -.. _sec_butterfly_cta:
2   -
3   -Calculating and visualising a butterfly diagram
4   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5   -
6   -To visualise the analysis results you can compute a butterfly diagram
7   -which shows the confidence band of the spectral fit using the
8   -:ref:`ctbutterfly` tool.
9   -The butterfly diagram is the envelope of all power law models
10   -that are within a given confidence limit compatible with the data.
11   -By default a confidence level of 68% is used, but the level can be adjusted
12   -using the hidden ``confidence`` parameter.
13   -:ref:`ctbutterfly` computes this envelope by evaluating for each energy the
14   -minimum and maximum intensity of all power law models that fall within the
15   -error ellipse of the prefactor and index parameters.
16   -The error ellipse is derived from the covariance matrix of a maximum
17   -likelihood fit.
18   -
19   -The following example illustrates how you can use the :ref:`ctbutterfly`
20   -tool:
21   -
22   -.. code-block:: bash
23   -
24   - $ ctbutterfly
25   - Input event list, counts cube or observation definition XML file [events.fits]
26   - Calibration database [prod2]
27   - Instrument response function [South_0.5h]
28   - Input model XML file [$CTOOLS/share/models/crab.xml] crab_results.xml
29   - Source of interest [Crab]
30   - Start value for first energy bin in TeV [0.1]
31   - Stop value for last energy bin in TeV [100.0]
32   - Output ASCII file [butterfly.txt]
33   -
34   -Now that you have computed the confidence band of the spectral fit and
35   -that you will have an ASCII file named ``butterfly.txt`` on disk you can
36   -visualise the butterfly using the script ``show_butterfly.py`` that is
37   -in the ctools ``example`` folder. You will need matplotlib on your system
38   -to make this work. To launch the script, type:
39   -
40   -.. code-block:: bash
41   -
42   - $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt
43   -
44   -This will result in a canvas which should look like the following:
45   -
46   -.. figure:: butterfly.jpg
47   - :height: 400px
48   - :align: center
49   -
50   - *Confidence band of the power law fit*
51   -
52 0 \ No newline at end of file
doc/source/users/tutorials/quickstart/dskeys.jpg deleted

99.6 KB

doc/source/users/tutorials/quickstart/energy_dispersion.rst
1 1 .. _sec_edisp_cta:
2 2  
3   -Taking into account energy dispersion
4   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3 +Taking the energy dispersion into account
  4 +-----------------------------------------
5 5  
6   -You may not have recognised it, but the examples you have exercised so far
7   -have neglected the impact of energy dispersion on the analysis. In reality,
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to **take the energy dispersion (or energy redistribution)
  9 + into account**.
  10 +
  11 + Although the effect of the energy dispersion is often neglegible there
  12 + may be cases where you want to consider energy dispersion in an analysis,
  13 + for example if you are analysing the data down to very low energies.
  14 +
  15 + .. warning::
  16 + Energy dispersion is fully implemented in ctools but is computationally
  17 + intensive. So be aware that the **tools and scripts will take a substantial
  18 + amount of computing time**.
  19 +
  20 +You may not have recognised, but the examples you have exercised so far
  21 +have neglected the impact of the energy dispersion on the analysis. In reality,
8 22 however, the reconstructed event energy will differ from the true photon energy,
9 23 and this effect will become particularily important at low energies. There are
10   -therefore cases where you want to take the effects of energy dispersion into
11   -account, and you can do this in all ctools that make use of the instrument
12   -response functions by setting the hidden ``edisp`` parameter to ``yes``.
  24 +therefore cases where you want to take the energy dispersion into account.
13 25  
14   -.. warning::
  26 +To simulate events taking the energy dispersion into account you run the
  27 +:ref:`ctobssim` tool with ``edisp=yes`` parameter:
15 28  
16   - The maximum likelihood computations including energy dispersion are
17   - relatively time consuming, and in many situations the impact of the
18   - energy dispersion on the analysis results will be very small. For this
19   - reason, energy dispersion is by default disabled in ctools.
  29 +.. code-block:: bash
20 30  
21   -To simulate events taking into account the energy dispersion you should
22   -run the :ref:`ctobssim` tool with ``edisp=yes`` parameter:
  31 + $ ctobssim edisp=yes
  32 + RA of pointing (degrees) (0-360) [83.63]
  33 + Dec of pointing (degrees) (-90-90) [22.01]
  34 + Radius of FOV (degrees) (0-180) [5.0]
  35 + Start time (UTC string, JD, MJD or MET in seconds) [2020-01-01T00:00:00]
  36 + Stop time (UTC string, JD, MJD or MET in seconds) [2020-01-01T00:30:00] 2020-01-01T01:00:00
  37 + Lower energy limit (TeV) [0.1] 0.030
  38 + Upper energy limit (TeV) [100.0] 200.0
  39 + Calibration database [prod2]
  40 + Instrument response function [South_0.5h]
  41 + Input model definition XML file [$CTOOLS/share/models/crab.xml]
  42 + Output event data file or observation definition XML file [events.fits]
  43 +
  44 +You then select events from the simulated data as before using the
  45 +:ref:`ctselect` tool:
23 46  
24 47 .. code-block:: bash
25 48  
26   - $ ctobssim edisp=yes
27   - RA of pointing (degrees) (0-360) [83.63]
28   - Dec of pointing (degrees) (-90-90) [22.01]
29   - Radius of FOV (degrees) (0-180) [5.0]
30   - Start time (MET in s) [0.0]
31   - End time (MET in s) [1800.0]
32   - Lower energy limit (TeV) [0.1]
33   - Upper energy limit (TeV) [100.0]
34   - Calibration database [prod2]
35   - Instrument response function [South_0.5h]
36   - Input model XML file [$CTOOLS/share/models/crab.xml]
37   - Output event data file or observation definition XML file [events.fits]
38   -
39   -You may then select events as before using the :ref:`ctselect` tool
40   -(since this tool does not need the instrument response function it has no
41   -hidden ``edisp`` parameter):
  49 + $ ctselect
  50 + Input event list or observation definition XML file [events.fits]
  51 + RA for ROI centre (degrees) (0-360) [83.63]
  52 + Dec for ROI centre (degrees) (-90-90) [22.01]
  53 + Radius of ROI (degrees) (0-180) [3.0]
  54 + Start time (UTC string, JD, MJD or MET in seconds) [NONE] 2020-01-01T00:10:00
  55 + Stop time (UTC string, JD, MJD or MET in seconds) [NONE] 2020-01-01T00:40:00
  56 + Lower energy limit (TeV) [0.1]
  57 + Upper energy limit (TeV) [100.0]
  58 + Output event list or observation definition XML file [selected_events.fits]
  59 +
  60 +Then you bin as before the selected events into a counts cube using the
  61 +:ref:`ctbin` tool:
42 62  
43 63 .. code-block:: bash
44 64  
45   - $ ctselect
46   - Input event list or observation definition XML file [events.fits]
47   - RA for ROI centre (degrees) (0-360) [83.63]
48   - Dec for ROI centre (degrees) (-90-90) [22.01]
49   - Radius of ROI (degrees) (0-180) [3.0]
50   - Start time (CTA MET in seconds) [0.0]
51   - End time (CTA MET in seconds) [0.0]
52   - Lower energy limit (TeV) [0.1]
53   - Upper energy limit (TeV) [100.0]
54   - Output event list or observation definition XML file [selected_events.fits]
55   -
56   -You then perform a maximum likelihood fit using the :ref:`ctlike` tool
57   -with ``edisp=yes`` so that energy dispersion is correctly taken into account
58   -in the likelihood computation:
  65 + $ ctbin
  66 + Input event list or observation definition XML file [events.fits] selected_events.fits
  67 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  68 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  69 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  70 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  71 + Image scale (in degrees/pixel) [0.02]
  72 + Size of the X axis in pixels [200]
  73 + Size of the Y axis in pixels [200]
  74 + Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
  75 + Start value for first energy bin in TeV [0.1]
  76 + Stop value for last energy bin in TeV [100.0]
  77 + Number of energy bins (1-200) [20]
  78 + Output counts cube file [cntcube.fits]
  79 +
  80 +As next step you need to compute the
  81 +:ref:`energy dispersion cube <glossary_edispcube>`
  82 +using the :ref:`ctexpcube` tool. You run the tool as follows:
59 83  
60 84 .. code-block:: bash
61 85  
62   - $ ctlike edisp=yes
63   - Input event list, counts cube or observation definition XML file [selected_events.fits]
64   - Calibration database [prod2]
65   - Instrument response function [South_0.5h]
66   - Input model XML file [$CTOOLS/share/models/crab.xml]
67   - Output model XML file [crab_results.xml]
68   -
69   -Below you see the output from the ``ctlike.log`` file.
70   -
71   -.. code-block:: none
72   -
73   - 2016-06-29T20:33:36: +=================================+
74   - 2016-06-29T20:33:36: | Maximum likelihood optimisation |
75   - 2016-06-29T20:33:36: +=================================+
76   - 2016-06-29T20:33:39: >Iteration 0: -logL=133777.933, Lambda=1.0e-03
77   - 2016-06-29T20:33:42: >Iteration 1: -logL=133772.125, Lambda=1.0e-03, delta=5.808, max(|grad|)=23.221525 [Index:7]
78   - 2016-06-29T20:33:45: >Iteration 2: -logL=133772.111, Lambda=1.0e-04, delta=0.013, max(|grad|)=-0.042654 [Prefactor:6]
79   - 2016-06-29T20:33:48: >Iteration 3: -logL=133772.111, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.000611 [Index:3]
80   - ...
81   - 2016-06-29T20:33:50: +=========================================+
82   - 2016-06-29T20:33:50: | Maximum likelihood optimisation results |
83   - 2016-06-29T20:33:50: +=========================================+
84   - 2016-06-29T20:33:50: === GOptimizerLM ===
85   - 2016-06-29T20:33:50: Optimized function value ..: 133772.111
86   - 2016-06-29T20:33:50: Absolute precision ........: 0.005
87   - 2016-06-29T20:33:50: Acceptable value decrease .: 2
88   - 2016-06-29T20:33:50: Optimization status .......: converged
89   - 2016-06-29T20:33:50: Number of parameters ......: 10
90   - 2016-06-29T20:33:50: Number of free parameters .: 4
91   - 2016-06-29T20:33:50: Number of iterations ......: 3
92   - 2016-06-29T20:33:50: Lambda ....................: 1e-06
93   - 2016-06-29T20:33:50: Maximum log likelihood ....: -133772.111
94   - 2016-06-29T20:33:50: Observed events (Nobs) ...: 20952.000
95   - 2016-06-29T20:33:50: Predicted events (Npred) ..: 20952.000 (Nobs - Npred = 1.01277e-06)
96   - 2016-06-29T20:33:50: === GModels ===
97   - 2016-06-29T20:33:50: Number of models ..........: 2
98   - 2016-06-29T20:33:50: Number of parameters ......: 10
99   - 2016-06-29T20:33:50: === GModelSky ===
100   - 2016-06-29T20:33:50: Name ......................: Crab
101   - 2016-06-29T20:33:50: Instruments ...............: all
102   - 2016-06-29T20:33:50: Instrument scale factors ..: unity
103   - 2016-06-29T20:33:50: Observation identifiers ...: all
104   - 2016-06-29T20:33:50: Model type ................: PointSource
105   - 2016-06-29T20:33:50: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
106   - 2016-06-29T20:33:50: Number of parameters ......: 6
107   - 2016-06-29T20:33:50: Number of spatial par's ...: 2
108   - 2016-06-29T20:33:50: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
109   - 2016-06-29T20:33:50: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
110   - 2016-06-29T20:33:50: Number of spectral par's ..: 3
111   - 2016-06-29T20:33:50: Prefactor ................: 5.74029e-16 +/- 1.04025e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
112   - 2016-06-29T20:33:50: Index ....................: -2.49899 +/- 0.015621 [-0,-5] (free,scale=-1,gradient)
113   - 2016-06-29T20:33:50: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
114   - 2016-06-29T20:33:50: Number of temporal par's ..: 1
115   - 2016-06-29T20:33:50: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
116   - 2016-06-29T20:33:50: === GCTAModelIrfBackground ===
117   - 2016-06-29T20:33:50: Name ......................: CTABackgroundModel
118   - 2016-06-29T20:33:50: Instruments ...............: CTA
119   - 2016-06-29T20:33:50: Instrument scale factors ..: unity
120   - 2016-06-29T20:33:50: Observation identifiers ...: all
121   - 2016-06-29T20:33:50: Model type ................: "PowerLaw" * "Constant"
122   - 2016-06-29T20:33:50: Number of parameters ......: 4
123   - 2016-06-29T20:33:50: Number of spectral par's ..: 3
124   - 2016-06-29T20:33:50: Prefactor ................: 0.959074 +/- 0.0134496 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient)
125   - 2016-06-29T20:33:50: Index ....................: -0.0162199 +/- 0.00850751 [-5,5] (free,scale=1,gradient)
126   - 2016-06-29T20:33:50: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
127   - 2016-06-29T20:33:50: Number of temporal par's ..: 1
128   - 2016-06-29T20:33:50: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  86 + $ ctedispcube
  87 + Input event list or observation definition XML file [NONE] selected_events.fits
  88 + Calibration database [prod2]
  89 + Instrument response function [South_0.5h]
  90 + Input counts cube file to extract energy dispersion cube definition [NONE]
  91 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  92 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  93 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  94 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  95 + Image scale (in degrees/pixel) [1.0]
  96 + Size of the X axis in pixels [10]
  97 + Size of the Y axis in pixels [10]
  98 + Lower energy limit (TeV) [0.1]
  99 + Upper energy limit (TeV) [100.0]
  100 + Number of energy bins [20]
  101 + Output energy dispersion cube file [edispcube.fits]
  102 +
  103 +Now you are ready to perform a binned maximum likelihood analysis taking the
  104 +energy dispersion into account. You do this by running the :ref:`ctlike` tool
  105 +with the ``edisp=yes`` parameter. The :ref:`ctlike` tool will now query for the
  106 +energy dispersion cube:
  107 +
  108 +.. code-block:: bash
  109 +
  110 + $ ctlike edisp=yes
  111 + Input event list, counts cube or observation definition XML file [selected_events.fits] cntcube.fits
  112 + Input exposure cube file [expcube.fits]
  113 + Input PSF cube file [psfcube.fits]
  114 + Input energy dispersion cube file [NONE] edispcube.fits
  115 + Input background cube file [bkgcube.fits]
  116 + Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
  117 + Output model definition XML file [crab_results.xml]
  118 +
  119 +You can also perform an unbinned maximum likelihood analysis taking the energy
  120 +dispersion into account. In that case the energy dispersion information will be
  121 +directly determined from the
  122 +:ref:`instrument response functions <glossary_irf>`
  123 +and no energy dispersion cube is required:
  124 +
  125 +.. code-block:: bash
129 126  
  127 + $ ctlike edisp=yes
  128 + Input event list, counts cube or observation definition XML file [cntcube.fits] selected_events.fits
  129 + Calibration database [prod2]
  130 + Instrument response function [South_0.5h]
  131 + Input model definition XML file [models.xml] $CTOOLS/share/models/crab.xml
  132 + Output model definition XML file [crab_results.xml]
... ...
doc/source/users/tutorials/quickstart/fitting.rst
1 1 .. _sec_fitting_cta:
2 2  
3 3 Fitting CTA data
4   -~~~~~~~~~~~~~~~~
  4 +----------------
5 5  
6   -Now you are ready to fit the simulated data with a model. For simplicity
7   -the same model is used in the example that you used to simulate the data
8   -with :ref:`ctobssim`. Model fitting is done using the :ref:`ctlike` tool,
9   -and you do the fit by typing:
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to **adjust a parametrised model to the counts cube
  9 + by means of a maximum likelihood fit**.
  10 +
  11 +Now you are ready to fit the data with a model. For simplicity the same model
  12 +is used in the example that you used to simulate the data with :ref:`ctobssim`.
  13 +Model fitting is done using the :ref:`ctlike` tool, and you do the fit by
  14 +typing:
10 15  
11 16 .. code-block:: bash
12 17  
13   - $ ctlike
14   - Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits
15   - Input exposure cube file (only needed for stacked analysis) [NONE]
16   - Input PSF cube file (only needed for stacked analysis) [NONE]
17   - Input background cube file (only needed for stacked analysis) [NONE]
18   - Calibration database [prod2]
19   - Instrument response function [South_0.5h]
20   - Input model XML file [$CTOOLS/share/models/crab.xml]
21   - Output model XML file [crab_results.xml]
  18 + $ ctlike
  19 + Input event list, counts cube or observation definition XML file [events.fits] cntcube.fits
  20 + Input exposure cube file [NONE] expcube.fits
  21 + Input PSF cube file [NONE] psfcube.fits
  22 + Input background cube file [NONE] bkgcube.fits
  23 + Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
  24 + Output model definition XML file [crab_results.xml]
22 25  
23 26 The data are fitted in *binned* mode, which means that the events
24 27 have been binned into a counts cube and the fit computes the log-likelihood
25 28 function by summing over all 200 x 200 x 20 bins of the counts cube. There is
26 29 an alternative method, the so called *unbinned* mode, where the events are
27 30 not binned into a counts cube and the log-likelihood is computed directly by
28   -summing over all events. We will explore the *unbinned* mode later.
29   -
30   -One of the parameters of :ref:`ctlike` is a source model output file
31   -(we specified ``crab_results.xml`` in the example), and this file will be
32   -a copy of the source model input XML file where the parameter values have
33   -been replaced by the fit results. In addition, the statistical uncertainties
34   -are added for each fitted parameter using the attribute ``error``.
35   -Below we show the XML result file that has been produced by the run:
  31 +summing over all events. We will explore the *unbinned* mode later (see
  32 +:ref:`here <sec_unbinned_cta>`).
  33 +
  34 +The :ref:`ctlike` tool produced a
  35 +:ref:`model definition XML output file <glossary_moddef>`
  36 +``crab_results.xml`` that contains the fit results.
  37 +The file is a copy of the
  38 +:ref:`model definition XML input file <glossary_moddef>`
  39 +``models.xml`` where the parameter values were replaced by the fit results.
  40 +In addition, the statistical uncertainties were added for each fitted parameter
  41 +using the attribute ``error``.
  42 +Below the
  43 +:ref:`model definition XML output file <glossary_moddef>`
  44 +that was produced by the run:
36 45  
37 46 .. code-block:: xml
38 47  
39   - <?xml version="1.0" encoding="UTF-8" standalone="no"?>
40   - <source_library title="source library">
41   - <source name="Crab" type="PointSource">
42   - <spectrum type="PowerLaw">
43   - <parameter name="Prefactor" value="5.79064" error="0.101828" scale="1e-16" min="1e-07" max="1000" free="1" />
44   - <parameter name="Index" value="2.47177" error="0.0154935" scale="-1" min="0" max="5" free="1" />
45   - <parameter name="PivotEnergy" value="0.3" scale="1e+06" min="0.01" max="1000" free="0" />
46   - </spectrum>
47   - <spatialModel type="SkyDirFunction">
48   - <parameter name="RA" value="83.6331" scale="1" min="-360" max="360" free="0" />
49   - <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" />
50   - </spatialModel>
51   - </source>
52   - <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA">
53   - <spectrum type="PowerLaw">
54   - <parameter name="Prefactor" value="1.01642" error="0.0162226" scale="1" min="0.001" max="1000" free="1" />
55   - <parameter name="Index" value="0.00462945" error="0.00964737" scale="1" min="-5" max="5" free="1" />
56   - <parameter name="PivotEnergy" value="1" scale="1e+06" min="0.01" max="1000" free="0" />
57   - </spectrum>
58   - </source>
  48 + <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  49 + <source_library title="source library">
  50 + <source name="Crab" type="PointSource">
  51 + <spectrum type="PowerLaw">
  52 + <parameter name="Prefactor" value="5.61368377731832" error="0.0982975197293023" scale="1e-16" min="1e-07" max="1000" free="1" />
  53 + <parameter name="Index" value="2.45569249143075" error="0.0145471260625612" scale="-1" min="0" max="5" free="1" />
  54 + <parameter name="PivotEnergy" value="0.3" scale="1000000" min="0.01" max="1000" free="0" />
  55 + </spectrum>
  56 + <spatialModel type="PointSource">
  57 + <parameter name="RA" value="83.6331" scale="1" min="-360" max="360" free="0" />
  58 + <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" />
  59 + </spatialModel>
  60 + </source>
  61 + <source name="BackgroundModel" type="CTACubeBackground" instrument="CTA,HESS,MAGIC,VERITAS">
  62 + <spectrum type="PowerLaw">
  63 + <parameter name="Prefactor" value="0.945994938701748" error="0.0148673466828289" scale="1" min="0.01" max="100" free="1" />
  64 + <parameter name="Index" value="0.0198073832868029" error="0.00948925246912034" scale="1" min="-5" max="5" free="1" />
  65 + <parameter name="PivotEnergy" value="1" scale="1000000" free="0" />
  66 + </spectrum>
  67 + </source>
59 68 </source_library>
60 69  
61 70 In this example, the ``Prefactor`` and ``Index`` of the spectral model for the
62 71 Crab nebula as well as the ``Prefactor`` and ``Index`` of the background spectral
63   -model have been fitted (all parameters having the attribute ``free="1"`` are
64   -fitted). Now you see also the effect of having multiplied the background
65   -model with a power law. In that way, the amplitude of the background as
66   -well as it's spectral slope is adjusted by the fit. Obviously, in this
67   -example the adjustment compensates only for the statistical fluctuations
68   -of the background, but with real data, the adjustment may account also for
69   -some of the systematic uncertainties.
70   -
71   -.. warning::
72   -
73   - As good practice, the amplitude of the background model should always be
74   - left as a free parameter of the fit. Otherwise, any uncertainty in the
75   - background rate will immediately propagate into the flux estimate of the
76   - source.
  72 +model were fitted (these parameters had the attribute ``free="1"``). Now you
  73 +see also the effect of having multiplied the background model with a power law.
  74 +In that way, the amplitude of the background as well as it's spectral slope is
  75 +adjusted by the fit. Obviously, in this example the adjustment compensates only
  76 +for the statistical fluctuations of the background, but with real data, the
  77 +adjustment may account also for some of the systematic uncertainties.
  78 +
  79 + .. warning::
  80 +
  81 + As good practice, the amplitude of the background model should always be
  82 + left as a free parameter of the fit. Otherwise, any uncertainty in the
  83 + background rate will immediately propagate into the flux estimate of the
  84 + source.
  85 +
  86 + .. warning::
  87 +
  88 + You may have recognized the ``scale`` and ``value`` attributes in the
  89 + :ref:`model definition XML file <glossary_moddef>`. The value of each
  90 + parameter is obtained by multiplying ``value`` with ``scale``. This allows
  91 + for a pre-scaling of the parameters, and **you should make use of this
  92 + capability to have the value attributes of all parameters that are fitted
  93 + of about the same order, typically 1**. This is necessary to assure a
  94 + proper convergence of the fitting algorithm.
77 95  
78 96 To get more details about the model fitting you can inspect the log file.
79   -Below the last lines of the ctlike.log log file that has been produced by
80   -this run:
  97 +Below the last lines of the log file that was produced by this run:
81 98  
82 99 .. code-block:: none
83 100  
84   - 2016-06-29T16:11:05: +=================================+
85   - 2016-06-29T16:11:05: | Maximum likelihood optimisation |
86   - 2016-06-29T16:11:05: +=================================+
87   - 2016-06-29T16:11:06: >Iteration 0: -logL=55574.937, Lambda=1.0e-03
88   - 2016-06-29T16:11:06: >Iteration 1: -logL=55573.383, Lambda=1.0e-03, delta=1.555, max(|grad|)=3.170837 [Index:7]
89   - 2016-06-29T16:11:07: >Iteration 2: -logL=55573.382, Lambda=1.0e-04, delta=0.001, max(|grad|)=0.056280 [Index:3]
90   - ...
91   - 2016-06-29T16:11:08: +=========================================+
92   - 2016-06-29T16:11:08: | Maximum likelihood optimisation results |
93   - 2016-06-29T16:11:08: +=========================================+
94   - 2016-06-29T16:11:08: === GOptimizerLM ===
95   - 2016-06-29T16:11:08: Optimized function value ..: 55573.382
96   - 2016-06-29T16:11:08: Absolute precision ........: 0.005
97   - 2016-06-29T16:11:08: Acceptable value decrease .: 2
98   - 2016-06-29T16:11:08: Optimization status .......: converged
99   - 2016-06-29T16:11:08: Number of parameters ......: 10
100   - 2016-06-29T16:11:08: Number of free parameters .: 4
101   - 2016-06-29T16:11:08: Number of iterations ......: 2
102   - 2016-06-29T16:11:08: Lambda ....................: 1e-05
103   - 2016-06-29T16:11:08: Maximum log likelihood ....: -55573.382
104   - 2016-06-29T16:11:08: Observed events (Nobs) ...: 18532.000
105   - 2016-06-29T16:11:08: Predicted events (Npred) ..: 18531.998 (Nobs - Npred = 0.00243959)
106   - 2016-06-29T16:11:08: === GModels ===
107   - 2016-06-29T16:11:08: Number of models ..........: 2
108   - 2016-06-29T16:11:08: Number of parameters ......: 10
109   - 2016-06-29T16:11:08: === GModelSky ===
110   - 2016-06-29T16:11:08: Name ......................: Crab
111   - 2016-06-29T16:11:08: Instruments ...............: all
112   - 2016-06-29T16:11:08: Instrument scale factors ..: unity
113   - 2016-06-29T16:11:08: Observation identifiers ...: all
114   - 2016-06-29T16:11:08: Model type ................: PointSource
115   - 2016-06-29T16:11:08: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
116   - 2016-06-29T16:11:08: Number of parameters ......: 6
117   - 2016-06-29T16:11:08: Number of spatial par's ...: 2
118   - 2016-06-29T16:11:08: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
119   - 2016-06-29T16:11:08: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
120   - 2016-06-29T16:11:08: Number of spectral par's ..: 3
121   - 2016-06-29T16:11:08: Prefactor ................: 5.79064e-16 +/- 1.01828e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
122   - 2016-06-29T16:11:08: Index ....................: -2.47177 +/- 0.0154935 [-0,-5] (free,scale=-1,gradient)
123   - 2016-06-29T16:11:08: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
124   - 2016-06-29T16:11:08: Number of temporal par's ..: 1
125   - 2016-06-29T16:11:08: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
126   - 2016-06-29T16:11:08: === GCTAModelIrfBackground ===
127   - 2016-06-29T16:11:08: Name ......................: CTABackgroundModel
128   - 2016-06-29T16:11:08: Instruments ...............: CTA
129   - 2016-06-29T16:11:08: Instrument scale factors ..: unity
130   - 2016-06-29T16:11:08: Observation identifiers ...: all
131   - 2016-06-29T16:11:08: Model type ................: "PowerLaw" * "Constant"
132   - 2016-06-29T16:11:08: Number of parameters ......: 4
133   - 2016-06-29T16:11:08: Number of spectral par's ..: 3
134   - 2016-06-29T16:11:08: Prefactor ................: 1.01642 +/- 0.0162226 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient)
135   - 2016-06-29T16:11:08: Index ....................: 0.00462945 +/- 0.00964737 [-5,5] (free,scale=1,gradient)
136   - 2016-06-29T16:11:08: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
137   - 2016-06-29T16:11:08: Number of temporal par's ..: 1
138   - 2016-06-29T16:11:08: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
139   -
140   -The maximum likelihood optimizer required 2 iterations to converge. This
  101 + 2017-08-08T20:24:06: +=================================+
  102 + 2017-08-08T20:24:06: | Maximum likelihood optimisation |
  103 + 2017-08-08T20:24:06: +=================================+
  104 + 2017-08-08T20:24:07: >Iteration 0: -logL=56488.484, Lambda=1.0e-03
  105 + 2017-08-08T20:24:07: >Iteration 1: -logL=56431.025, Lambda=1.0e-03, delta=57.459, step=1.0e+00, max(|grad|)=128.772103 [Index:7]
  106 + 2017-08-08T20:24:08: >Iteration 2: -logL=56430.794, Lambda=1.0e-04, delta=0.232, step=1.0e+00, max(|grad|)=0.505741 [Index:7]
  107 + 2017-08-08T20:24:09: >Iteration 3: -logL=56430.794, Lambda=1.0e-05, delta=0.000, step=1.0e+00, max(|grad|)=0.017423 [Index:3]
  108 + 2017-08-08T20:24:09:
  109 + 2017-08-08T20:24:09: +=========================================+
  110 + 2017-08-08T20:24:09: | Maximum likelihood optimisation results |
  111 + 2017-08-08T20:24:09: +=========================================+
  112 + 2017-08-08T20:24:09: === GOptimizerLM ===
  113 + 2017-08-08T20:24:09: Optimized function value ..: 56430.794
  114 + 2017-08-08T20:24:09: Absolute precision ........: 0.005
  115 + 2017-08-08T20:24:09: Acceptable value decrease .: 2
  116 + 2017-08-08T20:24:09: Optimization status .......: converged
  117 + 2017-08-08T20:24:09: Number of parameters ......: 10
  118 + 2017-08-08T20:24:09: Number of free parameters .: 4
  119 + 2017-08-08T20:24:09: Number of iterations ......: 3
  120 + 2017-08-08T20:24:09: Lambda ....................: 1e-06
  121 + 2017-08-08T20:24:09: Maximum log likelihood ....: -56430.794
  122 + 2017-08-08T20:24:09: Observed events (Nobs) ...: 18827.000
  123 + 2017-08-08T20:24:09: Predicted events (Npred) ..: 18827.000 (Nobs - Npred = 1.92705083463807e-05)
  124 + 2017-08-08T20:24:09: === GModels ===
  125 + 2017-08-08T20:24:09: Number of models ..........: 2
  126 + 2017-08-08T20:24:09: Number of parameters ......: 10
  127 + 2017-08-08T20:24:09: === GModelSky ===
  128 + 2017-08-08T20:24:09: Name ......................: Crab
  129 + 2017-08-08T20:24:09: Instruments ...............: all
  130 + 2017-08-08T20:24:09: Instrument scale factors ..: unity
  131 + 2017-08-08T20:24:09: Observation identifiers ...: all
  132 + 2017-08-08T20:24:09: Model type ................: PointSource
  133 + 2017-08-08T20:24:09: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
  134 + 2017-08-08T20:24:09: Number of parameters ......: 6
  135 + 2017-08-08T20:24:09: Number of spatial par's ...: 2
  136 + 2017-08-08T20:24:09: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
  137 + 2017-08-08T20:24:09: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
  138 + 2017-08-08T20:24:09: Number of spectral par's ..: 3
  139 + 2017-08-08T20:24:09: Prefactor ................: 5.61368377731832e-16 +/- 9.82975197293023e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
  140 + 2017-08-08T20:24:09: Index ....................: -2.45569249143075 +/- 0.0145471260625612 [-0,-5] (free,scale=-1,gradient)
  141 + 2017-08-08T20:24:09: PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
  142 + 2017-08-08T20:24:09: Number of temporal par's ..: 1
  143 + 2017-08-08T20:24:09: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  144 + 2017-08-08T20:24:09: === GCTAModelCubeBackground ===
  145 + 2017-08-08T20:24:09: Name ......................: BackgroundModel
  146 + 2017-08-08T20:24:09: Instruments ...............: CTA, HESS, MAGIC, VERITAS
  147 + 2017-08-08T20:24:09: Instrument scale factors ..: unity
  148 + 2017-08-08T20:24:09: Observation identifiers ...: all
  149 + 2017-08-08T20:24:09: Model type ................: "PowerLaw" * "Constant"
  150 + 2017-08-08T20:24:09: Number of parameters ......: 4
  151 + 2017-08-08T20:24:09: Number of spectral par's ..: 3
  152 + 2017-08-08T20:24:09: Prefactor ................: 0.945994938701748 +/- 0.0148673466828289 [0.01,100] ph/cm2/s/MeV (free,scale=1,gradient)
  153 + 2017-08-08T20:24:09: Index ....................: 0.0198073832868029 +/- 0.00948925246912034 [-5,5] (free,scale=1,gradient)
  154 + 2017-08-08T20:24:09: PivotEnergy ..............: 1000000 MeV (fixed,scale=1000000,gradient)
  155 + 2017-08-08T20:24:09: Number of temporal par's ..: 1
  156 + 2017-08-08T20:24:09: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  157 +
  158 +The maximum likelihood optimizer required 3 iterations to converge. This
141 159 is pretty fast, but recall that you used the same model file for the simulation
142 160 and for fitting, hence the initial parameter values were already very close
143 161 to the best fitting values. To see the impact of the initial parameters on
144   -the fit result, you may re-run :ref:`ctlike` using another copy of the model
145   -XML file where you change the value attributes of the parameters that should be
  162 +the fit result, you may re-run :ref:`ctlike` using another copy of the
  163 +:ref:`model definition XML input file <glossary_moddef>`
  164 +where you change the value attributes of the parameters that should be
146 165 fitted. You will see that the optimizer requires a couple of more iterations,
147 166 but it should converge to the same solution (provided that the initial values
148 167 are not too far from the best fitting values).
149 168  
150   -.. note::
  169 + .. note::
151 170  
152   - As sanity check you should verify that the predicted number of events
153   - (Npred) is equal to the observed number of events (Nobs). To facilitate
154   - this comparison, :ref:`ctlike` provides the difference Nobs - Npred in
155   - the log file. In real life situations, this difference may not always be
156   - small, in particular if the source model is too constrained. You may
157   - then free some of the model parameters so that the fit can correctly
158   - describe the data.
  171 + As sanity check you should verify that the predicted number of events
  172 + (Npred) is equal to the observed number of events (Nobs). To facilitate
  173 + this comparison, :ref:`ctlike` provides the difference Nobs - Npred in
  174 + the log file. In real life situations, this difference may not always be
  175 + small, in particular if the source model is too constrained. You may
  176 + then free some of the model parameters so that the fit can correctly
  177 + describe the data.
159 178  
160   -.. note::
  179 + .. note::
161 180  
162   - The :ref:`ctlike` tool has the ability to estimate the detection
163   - significance for sources in the XML model. This is done by computing
164   - the Test Statistic value which is defined as twice the log-likelihood
165   - difference between fitting a source at a given position on top of a
166   - (background) model or fitting no source. Roughly speaken, the square
167   - root of the Test Statistic value gives the source detection significance
168   - in Gaussian sigmas, although the exact relation depends somewhat on
169   - the formulation of the statistical problem.
  181 + The :ref:`ctlike` tool has the ability to estimate the detection
  182 + significance for sources in the XML model. This is done by computing
  183 + the Test Statistic value which is defined as twice the log-likelihood
  184 + difference between fitting a source at a given position on top of a
  185 + (background) model or fitting no source. Roughly speaken, the square
  186 + root of the Test Statistic value gives the source detection significance
  187 + in Gaussian sigmas, although the exact relation depends somewhat on
  188 + the formulation of the statistical problem.
170 189  
171   - To instruct :ref:`ctlike` to compute the Test Statistic value for a
172   - given source you need to add the attribute ``tscalc="1"`` to the XML
173   - file:
  190 + To instruct :ref:`ctlike` to compute the Test Statistic value for a
  191 + given source you need to add the attribute ``tscalc="1"`` to the XML
  192 + file:
174 193  
175   - .. code-block:: xml
  194 + .. code-block:: xml
176 195  
177   - <source name="Crab" type="PointSource" tscalc="1">
  196 + <source name="Crab" type="PointSource" tscalc="1">
178 197  
179   - :ref:`ctlike` will then compute the Test Statistic value for that
180   - source and dump the result in the log file:
  198 + :ref:`ctlike` will then compute the Test Statistic value for that
  199 + source and dump the result in the log file:
181 200  
182   - .. code-block:: none
  201 + .. code-block:: none
183 202  
184   - 2016-06-29T16:17:38: === GModelSky ===
185   - 2016-06-29T16:17:38: Name ......................: Crab
186   - 2016-06-29T16:17:38: Instruments ...............: all
187   - 2016-06-29T16:17:38: Test Statistic ............: 21778.8
  203 + 2017-08-08T20:34:29: === GModelSky ===
  204 + 2017-08-08T20:34:29: Name ......................: Crab
  205 + 2017-08-08T20:34:29: Instruments ...............: all
  206 + 2017-08-08T20:34:29: Test Statistic ............: 21873.9558591403
188 207  
189   - The Test Statistic value will also be added as new attribute
190   - ``ts`` to the XML result file:
  208 + The Test Statistic value will also be added as new attribute
  209 + ``ts`` to the XML result file:
191 210  
192   - .. code-block:: xml
  211 + .. code-block:: xml
193 212  
194   - <source name="Crab" type="PointSource" ts="21778.780" tscalc="1">
  213 + <source name="Crab" type="PointSource" ts="21873.956" tscalc="1">
... ...
doc/source/users/tutorials/quickstart/index.rst
... ... @@ -3,23 +3,17 @@
3 3 First steps with ctools
4 4 -----------------------
5 5  
6   -This section provides a step-by-step description of a simple CTA data
7   -analysis example using the ctools. In this example we will simulate a
8   -half an hour long CTA observation of the Crab nebula as the single
9   -point source within the CTA field of view. You will learn how to bin the
10   -event data into a counts cube and how to fit a spatial and spectral model
11   -to the data. You will also learn how to analyse directly event lists
12   -without binning the events into a counts cube. We will show how you can
13   -create a butterfly diagram that shows the confidence band of the
14   -fitted spectral model. And you will learn how to take energy dispersion
15   -into account.
  6 +This section provides a step-by-step description of a simple CTA data simulation
  7 +and analysis example using the ctools.
16 8  
17 9 .. toctree::
18 10 :maxdepth: 1
19 11  
20 12 simulating
  13 + selecting
  14 + skymap
21 15 binning
  16 + response
22 17 fitting
23 18 unbinned
24   - butterfly
25 19 energy_dispersion
... ...
doc/source/users/tutorials/quickstart/response.rst 0 → 100644
  1 +.. _sec_stacked_reponse:
  2 +
  3 +Pre-computing the response
  4 +--------------------------
  5 +
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to **compute the instrument response for a counts
  9 + cube**. Pre-computing the instrument response will speed-up
  10 + the model fitting later.
  11 +
  12 +To speed-up the model fitting it is recommended to pre-compute the instrument
  13 +response for the counts cube. Specifically, you should compute an exposure
  14 +cube, a point spread function cube and a background cube.
  15 +
  16 +The
  17 +:ref:`exposure cube <glossary_expcube>`
  18 +is computed using the :ref:`ctexpcube` tool and provides the effective area
  19 +multiplied by the livetime of the observation.
  20 +You run :ref:`ctexpcube` as follows:
  21 +
  22 +.. code-block:: bash
  23 +
  24 + $ ctexpcube
  25 + Input event list or observation definition XML file [NONE] selected_events.fits
  26 + Calibration database [prod2]
  27 + Instrument response function [South_0.5h]
  28 + Input counts cube file to extract exposure cube definition [NONE] cntcube.fits
  29 + Output exposure cube file [expcube.fits]
  30 +
  31 +This produces the FITS file ``expcube.fits`` that contains the exposure as
  32 +function of sky position and energy. In the example above you extracted the
  33 +binning of the exposure cube from the counts cube, which considerably reduces
  34 +the number of parameters that are queried by the tool.
  35 +
  36 + .. note::
  37 +
  38 + The binning of the exposure cube does not need to correspond to the
  39 + binning of the counts cube. In any case, exposure values will be
  40 + determined by interpolation from the values stored in the exposure cube
  41 + file. The same is true for the point spread function and background cubes
  42 + that are described below.
  43 +
  44 +Next, we use the :ref:`ctpsfcube` tool to compute the
  45 +:ref:`point spread function (PSF) cube <glossary_psfcube>` for the counts
  46 +cube.
  47 +You run :ref:`ctpsfcube` as follows:
  48 +
  49 +.. code-block:: bash
  50 +
  51 + $ ctpsfcube
  52 + Input event list or observation definition XML file [NONE] selected_events.fits
  53 + Calibration database [prod2]
  54 + Instrument response function [South_0.5h]
  55 + Input counts cube file to extract PSF cube definition [NONE]
  56 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  57 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  58 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  59 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  60 + Image scale (in degrees/pixel) [1.0]
  61 + Size of the X axis in pixels [10]
  62 + Size of the Y axis in pixels [10]
  63 + Lower energy limit (TeV) [0.1]
  64 + Upper energy limit (TeV) [100.0]
  65 + Number of energy bins [20]
  66 + Output PSF cube file [psfcube.fits]
  67 +
  68 +This produces the FITS file ``psfcube.fits`` that contains the point spread
  69 +function as function of sky position and energy. You may have noted in the
  70 +example that the definiton of the
  71 +:ref:`point spread function cube <glossary_psfcube>`
  72 +has not been extracted from the counts cube, since this would lead to a
  73 +large FITS file on output.
  74 +The point spread function varies in fact only slowly over the field of view
  75 +of the camera, and consequently it is sufficient to sample that variation
  76 +at a large spatial scale of typically one degree.
  77 +
  78 +Finally, we use the :ref:`ctbkgcube` tool to compute the
  79 +:ref:`background cube <glossary_bkgcube>`.
  80 +You run :ref:`ctbkgcube` as follows:
  81 +
  82 +.. code-block:: bash
  83 +
  84 + $ ctbkgcube
  85 + Input event list or observation definition XML file [NONE] selected_events.fits
  86 + Calibration database [prod2]
  87 + Instrument response function [South_0.5h]
  88 + Input counts cube file to extract background cube definition [NONE] cntcube.fits
  89 + Input model definition XML file [NONE] $CTOOLS/share/models/crab.xml
  90 + Output background cube file [bkgcube.fits]
  91 + Output model definition XML file [NONE] models.xml
  92 +
  93 +This produces the FITS file ``bkgcube.fits`` that contains the predicted
  94 +background rate as function of sky position and energy.
  95 +The tool also produces the
  96 +:ref:`model definition file <glossary_moddef>`
  97 +``models.xml``
  98 +on output that will serve as input for the maximum likelihood analysis that
  99 +will follow.
  100 +The file is a copy of the input
  101 +:ref:`model definition file <glossary_moddef>`
  102 +``$CTOOLS/share/models/crab.xml``
  103 +where the input background model has been replaced by a background model of
  104 +type ``CTACubeBackground``. Below is the content of the ``models.xml`` file:
  105 +
  106 +.. code-block:: xml
  107 +
  108 + <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  109 + <source_library title="source library">
  110 + <source name="Crab" type="PointSource">
  111 + <spectrum type="PowerLaw">
  112 + <parameter name="Prefactor" value="5.7" error="0" scale="1e-16" min="1e-07" max="1000" free="1" />
  113 + <parameter name="Index" value="2.48" error="0" scale="-1" min="0" max="5" free="1" />
  114 + <parameter name="PivotEnergy" value="0.3" scale="1000000" min="0.01" max="1000" free="0" />
  115 + </spectrum>
  116 + <spatialModel type="PointSource">
  117 + <parameter name="RA" value="83.6331" scale="1" min="-360" max="360" free="0" />
  118 + <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" />
  119 + </spatialModel>
  120 + </source>
  121 + <source name="BackgroundModel" type="CTACubeBackground" instrument="CTA,HESS,MAGIC,VERITAS">
  122 + <spectrum type="PowerLaw">
  123 + <parameter name="Prefactor" value="1" error="0" scale="1" min="0.01" max="100" free="1" />
  124 + <parameter name="Index" value="0" error="0" scale="1" min="-5" max="5" free="1" />
  125 + <parameter name="PivotEnergy" value="1" scale="1000000" free="0" />
  126 + </spectrum>
  127 + </source>
  128 + </source_library>
... ...
doc/source/users/tutorials/quickstart/selecting.rst 0 → 100644
  1 +.. _sec_selecting_cta:
  2 +
  3 +Selecting CTA data
  4 +------------------
  5 +
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to use the :ref:`ctselect` tool to **select relevant
  9 + events from the simulated CTA event data**.
  10 +
  11 +As next step you may want to select some events from the simulated CTA data.
  12 +You may want to restrict the events to a region of interest (ROI) of 3 degrees
  13 +around the Crab nebula, you may want to extract a 30 minutes time slice
  14 +from the data, and you may want to limit the energy range of the events
  15 +to 0.1 - 100 TeV.
  16 +You do this event selection using the :ref:`ctselect` tool as follows:
  17 +
  18 +.. code-block:: bash
  19 +
  20 + $ ctselect
  21 + Input event list or observation definition XML file [events.fits]
  22 + RA for ROI centre (degrees) (0-360) [83.63]
  23 + Dec for ROI centre (degrees) (-90-90) [22.01]
  24 + Radius of ROI (degrees) (0-180) [3.0]
  25 + Start time (UTC string, JD, MJD or MET in seconds) [NONE] 2020-01-01T00:10:00
  26 + Stop time (UTC string, JD, MJD or MET in seconds) [NONE] 2020-01-01T00:40:00
  27 + Lower energy limit (TeV) [0.1]
  28 + Upper energy limit (TeV) [100.0]
  29 + Output event list or observation definition XML file [selected_events.fits]
  30 +
  31 +This created a new CTA event list FITS file ``selected_events.fits``
  32 +that contains the selected data.
  33 +Below an excerpt of the ``ctselect.log`` log file that illustrates the
  34 +event selection:
  35 +
  36 +.. code-block:: none
  37 +
  38 + 2017-08-08T19:48:43: +===================+
  39 + 2017-08-08T19:48:43: | Input observation |
  40 + 2017-08-08T19:48:43: +===================+
  41 + 2017-08-08T19:48:43: === GObservations ===
  42 + 2017-08-08T19:48:43: Number of observations ....: 1
  43 + 2017-08-08T19:48:43: Number of models ..........: 0
  44 + 2017-08-08T19:48:43: Number of observed events .: 202766
  45 + 2017-08-08T19:48:43: Number of predicted events : 0
  46 + 2017-08-08T19:48:43:
  47 + 2017-08-08T19:48:43: +=================+
  48 + 2017-08-08T19:48:43: | Event selection |
  49 + 2017-08-08T19:48:43: +=================+
  50 + 2017-08-08T19:48:43: === CTA observation ===
  51 + 2017-08-08T19:48:43: Input filename ............: events.fits
  52 + 2017-08-08T19:48:43: Event extension name ......: EVENTS
  53 + 2017-08-08T19:48:43: GTI extension name ........: GTI
  54 + 2017-08-08T19:48:43: === Event selection ===
  55 + 2017-08-08T19:48:43: Time range (MJD) ..........: 58849.0077451852 - 58849.0285785185 days
  56 + 2017-08-08T19:48:43: Time range (UTC) ..........: 2020-01-01T00:10:00 - 2020-01-01T00:40:00
  57 + 2017-08-08T19:48:43: Time range (MET) ..........: 631109469.184 - 631111269.184 seconds
  58 + 2017-08-08T19:48:43: Selected energy range .....: 0.1 - 100 TeV
  59 + 2017-08-08T19:48:43: Requested RoI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg
  60 + 2017-08-08T19:48:43: RoI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg
  61 + 2017-08-08T19:48:43: Selected RoI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg
  62 + 2017-08-08T19:48:43: cfitsio selection .........: TIME >= 631109469.18399978 && TIME <= 631111269.18400002 && ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000
  63 + 2017-08-08T19:48:43: FITS filename .............: /var/tmp/tmp.0.FLddl1[EVENTS][TIME >= 631109469.18399978 && TIME <= 631111269.18400002 && ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000]
  64 + 2017-08-08T19:48:43:
  65 + 2017-08-08T19:48:43: +====================+
  66 + 2017-08-08T19:48:43: | Output observation |
  67 + 2017-08-08T19:48:43: +====================+
  68 + 2017-08-08T19:48:43: === GObservations ===
  69 + 2017-08-08T19:48:43: Number of observations ....: 1
  70 + 2017-08-08T19:48:43: Number of models ..........: 0
  71 + 2017-08-08T19:48:43: Number of observed events .: 21991
  72 + 2017-08-08T19:48:43: Number of predicted events : 0
  73 +
  74 +From the 202766 events in the input event list 21991 events were selected.
  75 +
  76 + .. note::
  77 +
  78 + Event selection by :ref:`ctselect` in a given dimension can be avoided
  79 + by specifying ``NONE`` (or ``INDEF``, ``UNDEF`` or ``UNDEFINED``) for
  80 + one of the selection parameters. The following run for example only
  81 + performs a selection by time but no selection by ROI or energy:
  82 +
  83 + .. code-block:: bash
  84 +
  85 + $ ctselect
  86 + Input event list or observation definition XML file [events.fits]
  87 + RA for ROI centre (degrees) (0-360) [83.63] NONE
  88 + Start time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:10:00]
  89 + Stop time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:40:00]
  90 + Lower energy limit (TeV) [0.1] NONE
  91 + Output event list or observation definition XML file [selected_events.fits]
... ...
doc/source/users/tutorials/quickstart/simulating.rst
1 1 .. _sec_simulating_cta:
2 2  
3 3 Simulating CTA data
4   -~~~~~~~~~~~~~~~~~~~
  4 +-------------------
5 5  
6   -You can simulate a CTA observation with the :ref:`ctobssim` tool.
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to use the :ref:`ctobssim` tool from the command
  9 + line to **simulate CTA event data**.
  10 +
  11 + :ref:`ctobssim` draws random events using a model of the celestial
  12 + gamma-ray intensity distribution that was convolved with the
  13 + :ref:`instrument response function <glossary_irf>`.
  14 + The tool adds random events from the expected distribution of the
  15 + residual background to the data.
  16 +
  17 +Let's assume that you want to generate a simulated CTA event list. You
  18 +do this by using the :ref:`ctobssim` tool from the command line.
7 19  
8 20 To invoke the tool, type :ref:`ctobssim` at the console prompt
9 21 (which is denoted by ``$``).
10   -:ref:`ctobssim` will query for a number of parameters:
  22 +:ref:`ctobssim` will then query for several parameters that define the
  23 +characteristics of the simulation:
11 24  
12 25 .. code-block:: bash
13 26  
... ... @@ -15,10 +28,10 @@ To invoke the tool, type :ref:`ctobssim` at the console prompt
15 28 RA of pointing (degrees) (0-360) [83.63]
16 29 Dec of pointing (degrees) (-90-90) [22.01]
17 30 Radius of FOV (degrees) (0-180) [5.0]
18   - Start time (MET in s) [0.0]
19   - End time (MET in s) [1800.0]
20   - Lower energy limit (TeV) [0.1]
21   - Upper energy limit (TeV) [100.0]
  31 + Start time (UTC string, JD, MJD or MET in seconds) [2020-01-01T00:00:00]
  32 + Stop time (UTC string, JD, MJD or MET in seconds) [2020-01-01T00:30:00] 2020-01-01T01:00:00
  33 + Lower energy limit (TeV) [0.03]
  34 + Upper energy limit (TeV) [200.0]
22 35 Calibration database [prod2]
23 36 Instrument response function [South_0.5h]
24 37 Input model XML file [$CTOOLS/share/models/crab.xml]
... ... @@ -28,38 +41,61 @@ Each line represents a query for one parameter value.
28 41 The line starts with a short description of the parameter, followed by
29 42 the default value proposed by ctobssim in squared brackets ``[ ]``.
30 43  
31   -**If no parameter is entered the default value will be used**
32   -(which is the case for all parameters shown here).
  44 +**If no parameter value is entered the default value will be used**.
33 45 Otherwise, the specified value will overwrite the default value.
34 46 The round brackets ``( )`` indicate the range of possible parameter
35 47 values (if applicable).
36 48  
  49 + .. note::
37 50  
38   -You may have recognised that the environment variable ``$CTOOLS`` has
39   -been used in the path name of the model. ctools will automatically expand
40   -the environment variables in parameter inputs.
41   -
42   -The CTA instrument properties (effective area, PSF width) are taken from
43   -the prod2 database. The response for the southern array using the cuts
44   -optimised for 50 hours of observing time are used.
  51 + Times can be entered in various formats in ctools. Times can be provided
  52 + as
45 53  
46   -.. note::
  54 + * UTC date strings (e.g. ``"2020-01-01T00:00:00"``)
  55 + * Modified Julian days (e.g. ``"MJD 58849.0"``)
  56 + * Julian days (e.g. ``"JD 2458849.5"``)
  57 + * Mission elapsed time in seconds, counted from ``2000-01-01T12:00:00``
  58 + (e.g. ``"631108869.18"``)
47 59  
48   - ctools comes bundled with CTA response functions for the northern and
49   - the southern array. The response functions are based on a Prod2
50   - analysis with cuts optimised for 0.5 hours, 5 hours and 50 hours of
51   - observing time. The following Instrument Response Functions
52   - (IRFs) are available: ``North_0.5h``, ``North_5h``, ``North_50h``,
53   - ``South_0.5h``, ``South_5h``, and ``South_50h``.
  60 + Usually times are given in Terrestial Time (``TT``) but may also be
  61 + specified as ``TAI`` or ``UTC`` (e.g. ``"MJD 58849.0 (TAI)"`` or
  62 + ``"MJD 58849.0 (UTC)"``).
54 63  
55   -Events are simulated based on the instrument properties and based on a
56   -source and background model. Only events that fall within the specified
57   -region of interest (ROI), defined as a circle around a sky position in
  64 +You may have recognised that the environment variable ``$CTOOLS`` has
  65 +been used in the path name of the model. ctools will automatically expand
  66 +the environment variables in parameter values.
  67 +
  68 +The CTA
  69 +:ref:`instrument response function <glossary_irf>` (IRF)
  70 +is taken from the ``prod2`` database. The response for the southern array
  71 +using the cuts optimised for 0.5 hours of observing time is used.
  72 +
  73 + .. note::
  74 +
  75 + ctools comes bundled with CTA
  76 + :ref:`instrument response functions <glossary_irf>` for the northern and
  77 + the southern array. The IRFs are based on a ``prod2``
  78 + analysis with cuts optimised for 0.5 hours, 5 hours and 50 hours of
  79 + observing time. **Be aware that these times do not need to correspond
  80 + to the actual observing time that is simulated.** IRFs optimised for
  81 + short observation times correspond to ``loose`` cuts that keep more
  82 + photons but also more background events, while IRFs optimised for
  83 + long observation times correspond to ``hard`` cuts that limit the
  84 + number of background events at the expense of loosing some photons.
  85 + The following IRFs are available:
  86 + ``North_0.5h``, ``North_5h``, ``North_50h``,
  87 + ``South_0.5h``, ``South_5h``, and ``South_50h``.
  88 +
  89 +Events are simulated based on the
  90 +:ref:`instrument response function <glossary_irf>`
  91 +and based on a source and background model. Only events that fall within the
  92 +specified region of interest (ROI), defined as a circle around a sky position in
58 93 Right Ascension and Declination (in degrees), will be stored in the output
59   -event data file. The duration of the simulation is taken here to 30 minutes
60   -(or 1800 seconds). Events are simulated for energies between 0.1 and 100 TeV.
  94 +event data file. The duration of the simulation is taken here to one hour.
  95 +Events are simulated for energies between 30 GeV and 200 TeV.
61 96  
62   -The source and background model is defined by the XML file
  97 +The source and background model is defined by the
  98 +:ref:`model definition XML file <glossary_moddef>`
63 99 ``$CTOOLS/share/models/crab.xml``:
64 100  
65 101 .. code-block:: xml
... ... @@ -72,7 +108,7 @@ The source and background model is defined by the XML file
72 108 <parameter name="Index" scale="-1" value="2.48" min="0.0" max="+5.0" free="1"/>
73 109 <parameter name="PivotEnergy" scale="1e6" value="0.3" min="0.01" max="1000.0" free="0"/>
74 110 </spectrum>
75   - <spatialModel type="SkyDirFunction">
  111 + <spatialModel type="PointSource">
76 112 <parameter name="RA" scale="1.0" value="83.6331" min="-360" max="360" free="0"/>
77 113 <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="0"/>
78 114 </spatialModel>
... ... @@ -103,8 +139,10 @@ maximum (``max``) value, and a parameter may be free (``free=&quot;1&quot;``) or fixed
103 139 relevant here for the simulations, but they will be important for the model
104 140 fitting later.
105 141  
106   -The spectral intensity I(E) (in units of photons/cm2/s/MeV) of the power law is
107   -given by
  142 +The spectral intensity I(E) (in units of
  143 +:math:`{\rm photons} \, {\rm cm}^{-2} \, {\rm s}^{-1} \, {\rm MeV}^{-1}`)
  144 +of the power law is given by
  145 +
108 146  
109 147 .. math::
110 148 \frac{dN}{dE} = N_0 \left( \frac{E}{E_0} \right)^{\gamma}
... ... @@ -115,16 +153,19 @@ where the parameters in the XML definition have the following mappings:
115 153 * :math:`\gamma` = ``Index``
116 154 * :math:`E_0` = ``PivotEnergy``
117 155  
118   -.. warning::
  156 +..
119 157  
120   - Energies are given in the XML file in MeV units. This is a GammaLib
121   - convention that can not be modified. **So make sure you always use
122   - MeV as energy unit in an XML file.**
  158 + .. warning::
  159 + **Energies are given in the XML file in MeV units.** This is a GammaLib
  160 + convention that can not be modified. So make sure you always use
  161 + MeV as energy unit in an XML file.
123 162  
124 163 The instrumental background of CTA is modelled using the background
125   -information provided in the IRF (``CTAIrfBackground``) multipled
126   -by a power law. As it is defined here, the power law represents a
127   -constant of 1, hence the background IRF will be used without any
  164 +information provided in the
  165 +:ref:`instrument response function <glossary_irf>`
  166 +(``CTAIrfBackground``), where the energy dependence of the background
  167 +model is multipled by a power law. As it is defined here, the power law
  168 +represents a constant of 1, hence the background IRF will be used without any
128 169 modification. The power law will become active when fitting the data
129 170 later and allows a spectral adjustment of the background model that
130 171 may account for uncertainties in the background information provided
... ... @@ -155,46 +196,45 @@ from this file are shown here:
155 196  
156 197 .. code-block:: none
157 198  
158   - 2016-06-29T10:21:57: +======================+
159   - 2016-06-29T10:21:57: | Simulate observation |
160   - 2016-06-29T10:21:57: +======================+
161   - 2016-06-29T10:21:57: === CTA observation ===
162   - 2016-06-29T10:21:57: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, radius=5.5 deg
163   - 2016-06-29T10:21:57: Time interval .............: 0 - 1800 s
164   - 2016-06-29T10:21:57: Photon energy range .......: 100 GeV - 199.526 GeV
165   - 2016-06-29T10:21:57: Event energy range ........: 100 GeV - 199.526 GeV
166   - 2016-06-29T10:21:57: Simulation area ..........: 5.75561e+09 cm2
167   - 2016-06-29T10:21:57: Use model ................: Crab
168   - 2016-06-29T10:21:57: Normalization ............: 1 [Crab]
169   - 2016-06-29T10:21:57: Flux .....................: 3.76031e-10 [Crab] photons/cm2/s
170   - 2016-06-29T10:21:57: Normalized flux ..........: 3.76031e-10 [Crab] photons/cm2/s
171   - 2016-06-29T10:21:57: Photon rate ..............: 2.16429 photons/s [Crab]
172   - 2016-06-29T10:21:57: MC source photons ........: 3889 [Crab]
173   - 2016-06-29T10:21:57: MC source events .........: 1226 [Crab]
174   - 2016-06-29T10:21:57: MC source events .........: 1226 (all source models)
175   - 2016-06-29T10:21:57: Photon energy range .......: 199.526 GeV - 398.107 GeV
176   - ...
177   - 2016-06-29T10:21:57: MC source photons .........: 10759 [Crab]
178   - 2016-06-29T10:21:57: MC source events ..........: 3686 [Crab]
179   - 2016-06-29T10:21:57: MC events outside ROI .....: 0
180   - 2016-06-29T10:21:57: MC background events ......: 19413
181   - 2016-06-29T10:21:57: MC events .................: 23099 (all models)
  199 + 2017-08-08T19:28:54: === CTA observation ===
  200 + 2017-08-08T19:28:54: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, radius=5.5 deg
  201 + 2017-08-08T19:28:54: Time interval .............: 6.31109e+08 - 6.31112e+08 s
  202 + 2017-08-08T19:28:54: Photon energy range .......: 30 GeV - 72.3622611060088 GeV
  203 + 2017-08-08T19:28:54: Event energy range ........: 30 GeV - 72.3622611060088 GeV
  204 + 2017-08-08T19:28:54: Simulation area ..........: 1.97769e+09 cm2
  205 + 2017-08-08T19:28:54: Use model ................: Crab
  206 + 2017-08-08T19:28:54: Normalization ............: 1 [Crab]
  207 + 2017-08-08T19:28:54: Flux .....................: 2.5413e-09 [Crab] photons/cm2/s
  208 + 2017-08-08T19:28:54: Normalized flux ..........: 2.5413e-09 [Crab] photons/cm2/s
  209 + 2017-08-08T19:28:54: Photon rate ..............: 5.0259 photons/s [Crab]
  210 + 2017-08-08T19:28:54: MC source photons ........: 18186 [Crab]
  211 + 2017-08-08T19:28:54: MC source events .........: 4175 [Crab]
  212 + 2017-08-08T19:28:54: MC source events .........: 4175 (all source models)
  213 + 2017-08-08T19:28:54: Photon energy range .......: 72.3622611060088 GeV - 174.543227745807 GeV
  214 + ...
  215 + 2017-08-08T19:28:54: MC source photons .........: 47371 [Crab]
  216 + 2017-08-08T19:28:54: MC source events ..........: 13227 [Crab]
  217 + 2017-08-08T19:29:02: MC events outside ROI .....: 0
  218 + 2017-08-08T19:29:02: MC background events ......: 189539
  219 + 2017-08-08T19:29:02: MC identifier 1 ...........: Crab
  220 + 2017-08-08T19:29:02: MC identifier 2 ...........: CTABackgroundModel
  221 + 2017-08-08T19:29:02: MC events .................: 202766 (all models)
182 222  
183 223 Each line starts with the UTC time at which the line has been written. In
184   -this run, 10759 Crab photons have been thrown during a time interval of 1800
185   -seconds. 3686 of these photons have been registered by CTA as events. In the
186   -same time interval, 19413 background events have been registred by CTA.
  224 +this run, 47371 Crab photons have been thrown. 13227 of these photons have been
  225 +registered by CTA as events. In the same time interval, 189539 background
  226 +events have been registred by CTA.
187 227  
188   -.. note::
  228 + .. note::
189 229  
190   - :ref:`ctobssim` will split the simulated energy range into a number of
191   - slices, controlled via the hidden ``eslices`` parameter (ten energy slices
192   - are used by default). For each energy slice, the simulation area
193   - will be adapted to the effective area of the array in that energy slice,
194   - which helps to keep the computing time low. The log file will provide
195   - information about the simulation in each slice. In the example above, the
196   - simulation results for the first energy slice are shown, followed by a
197   - summary of the results for all slices.
  230 + :ref:`ctobssim` will split the simulated energy range into a number of
  231 + slices, controlled via the hidden ``eslices`` parameter (ten energy slices
  232 + are used by default). For each energy slice, the simulation area
  233 + will be adapted to the effective area of the array in that energy slice,
  234 + which helps to keep the computing time low. The log file will provide
  235 + information about the simulation in each slice. In the example above, the
  236 + simulation results for the first energy slice are shown, followed by a
  237 + summary of the results for all slices.
198 238  
199 239 You may change the name of the log file using the hidden parameter
200 240 ``logfile``:
... ... @@ -222,3 +262,15 @@ the hidden ``debug`` parameter to yes:
222 262 .. code-block:: bash
223 263  
224 264 $ ctobssim debug=yes
  265 +
  266 +..
  267 +
  268 + .. note::
  269 +
  270 + All tools have the hidden parameters ``logfile``, ``chatter``, and
  271 + ``debug`` and you can use these parameters to control the log file
  272 + output. In addition, all tools have the hidden parameter ``clobber``
  273 + that allows to overwrite existing files (set to ``yes`` by default)
  274 + and ``mode`` that defines the mode of automatic tool parameters (set to
  275 + ``ql`` by default).
  276 +
... ...
doc/source/users/tutorials/quickstart/skymap.jpg 0 → 100644

184 KB

doc/source/users/tutorials/quickstart/skymap.rst 0 → 100644
  1 +.. _sec_skymap:
  2 +
  3 +Generating a sky map
  4 +--------------------
  5 +
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to use the :ref:`ctskymap` tool to **generate a sky
  9 + map from the selected CTA event data**.
  10 +
  11 +Now let's have a look into the selected data by generating a sky map. You do
  12 +this with the :ref:`ctskymap` tool as follows:
  13 +
  14 +.. code-block:: bash
  15 +
  16 + $ ctskymap
  17 + Input event list or observation definition XML file [events.fits] selected_events.fits
  18 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  19 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  20 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  21 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  22 + Image scale (in degrees/pixel) [0.02]
  23 + Size of the X axis in pixels [200]
  24 + Size of the Y axis in pixels [200]
  25 + Lower energy limit (TeV) [0.1]
  26 + Upper energy limit (TeV) [100.0]
  27 + Background subtraction method (NONE|IRF) [NONE]
  28 + Output skymap file [skymap.fits]
  29 +
  30 +The tool produces the file ``skymap.fits`` which contains a sky map of the
  31 +events in FITS format. The sky map is centred on the location of the Crab
  32 +nebula (Right Ascension 83.63 deg, Declination 22.01 deg) and consists of
  33 +200 x 200 spatial pixels of 0.02 x 0.02 degrees in size, covering
  34 +an area of 4 deg x 4 deg.
  35 +
  36 +Below an image of the sky map, displayed using
  37 +`ds9 <http://ds9.si.edu>`_ in logarithmic color scale with a small Gaussian
  38 +kernel smoothing applied:
  39 +
  40 +.. figure:: skymap.jpg
  41 + :width: 400px
  42 + :align: center
  43 +
  44 + *Sky map of the selected events*
  45 +
  46 +The sky map shows the Crab nebula on top of a wide-spread distribution of
  47 +events that originates from the instrumental background.
  48 +The
  49 +:ref:`instrument response functions <glossary_irf>`
  50 +contain templates that describe the spatial and spectral distribution of
  51 +the background, and :ref:`ctskymap` can make use of these templates
  52 +to subtract the background contribution from the sky map.
  53 +You enable the background subtraction by running the :ref:`ctskymap` tool with
  54 +the background subtraction method set to ``IRF``, as shown in the following
  55 +example:
  56 +
  57 +.. code-block:: bash
  58 +
  59 + $ ctskymap
  60 + Input event list or observation definition XML file [events.fits] selected_events.fits
  61 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
  62 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
  63 + Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
  64 + Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
  65 + Image scale (in degrees/pixel) [0.02]
  66 + Size of the X axis in pixels [200]
  67 + Size of the Y axis in pixels [200]
  68 + Lower energy limit (TeV) [0.1]
  69 + Upper energy limit (TeV) [100.0]
  70 + Background subtraction method (NONE|IRF) [NONE] IRF
  71 + Output skymap file [skymap.fits] skymap_subtracted.fits
  72 +
  73 +The resulting sky map, displayed using
  74 +`ds9 <http://ds9.si.edu>`_ in logarithmic color scale with a small Gaussian
  75 +kernel smoothing applied is shown below:
  76 +
  77 +.. figure:: skymap_subtracted.jpg
  78 + :width: 400px
  79 + :align: center
  80 +
  81 + *Background subtracted sky map of the selected events*
  82 +
... ...
doc/source/users/tutorials/quickstart/skymap_subtracted.jpg 0 → 100644

128 KB

doc/source/users/tutorials/quickstart/unbinned.rst
1 1 .. _sec_unbinned_cta:
2 2  
3 3 Doing an unbinned analysis
4   -~~~~~~~~~~~~~~~~~~~~~~~~~~
  4 +--------------------------
5 5  
6   -As gamma-ray events are rare, the counts cubes generated by :ref:`ctbin`
7   -will in general be sparsly populated, having many empty pixels, in
8   -particular at high energies.
9   -An alternative analysis technique consists of working directly on the event
10   -list without binning the events in a counts cube. You will see the benefit of
11   -such an analysis later once you re-run :ref:`ctlike` in unbinned mode.
12   -
13   -For unbinned analysis you first have to define the data space region over
14   -which the analysis is done. This is similiar to the :ref:`ctbin` step for
15   -a binned analysis where you defined the size of the counts cube, the energy
16   -range, and the time interval. For unbinned analysis you have no such thing
17   -as a counts cube, but you have to define over which region of the data space
18   -the selected events are spread (because the ctools have to integrate over
19   -this region to compute the total number of predicted events in the data space
20   -that you analyse). Furthermore, you have to define what energy range is
21   -covered, and what time interval is spanned by the data. All this is done
22   -by the :ref:`ctselect` tool, which replaces the :ref:`ctbin` step in an
23   -unbinned analysis.
24   -
25   -:ref:`ctselect` performs an event selection by choosing only events within
26   -a given region-of-interest (ROI), within a given energy band, and within a
27   -given time interval from the input event list. The ROI is a circular region on
28   -the sky, for which you define the centre (in celestial coordinates) and the
29   -radius. Such a circular ROI is sometimes also called an acceptance cone. The
30   -following example shows how to run ctselect:
31   -
32   -.. code-block:: bash
33   -
34   - $ ctselect
35   - Input event list or observation definition XML file [events.fits]
36   - RA for ROI centre (degrees) (0-360) [83.63]
37   - Dec for ROI centre (degrees) (-90-90) [22.01]
38   - Radius of ROI (degrees) (0-180) [3.0]
39   - Start time (CTA MET in seconds) [0.0]
40   - End time (CTA MET in seconds) [0.0]
41   - Lower energy limit (TeV) [0.1]
42   - Upper energy limit (TeV) [100.0]
43   - Output event list or observation definition XML file [selected_events.fits]
44   -
45   -:ref:`ctselect` takes the input event list ``events.fits``, performs an
46   -event selection, and writes the selected event into the file
47   -``selected_events.fits``. The parameters it will query for are the centre
48   -of the ROI, the radius of the ROI, the start and stop time (in seconds),
49   -and the energy lower and upper limits (in TeV). The event selection information
50   -is also written as a set of data selection keywords to the output events
51   -file ``selected_events.fits``, by respecting the same syntax that has been
52   -implemented for Fermi/LAT. The following image is a screen dump of the data
53   -selection keywords that have been written to the ``EVENTS`` header in the
54   -file ``selected_events.fits``:
55   -
56   -.. figure:: dskeys.jpg
57   - :width: 400px
58   - :align: center
  6 + .. admonition:: What you will learn
59 7  
60   - *Data selection keywords*
  8 + You will learn how to **adjust a parametrised model to the events without
  9 + binning the data**.
61 10  
62   -**It is mandatory for an unbinned analysis that these data selection keywords
63   -exist in the FITS file.**
64   -If they don't exist, :ref:`ctlike` will not execute in unbinned mode.
  11 + Gamma-ray events are rare, hence the counts cubes generated by
  12 + :ref:`ctbin` may be sparsly populated, having many empty pixels, in
  13 + particular at high energies. In that case it may be worth to
  14 + analyse the events directly with an unbinned maximum likelihood
  15 + analysis.
65 16  
66   -Below some lines of the ``ctselect.log`` file that show the data selection
67   -part:
  17 + An unbinned analysis is generally preferred over a binned analysis for
  18 + short observation times (a few tens of hours) or if you want to assure
  19 + that the analysis results are not biased by the selected binning. Also
  20 + the fitting of a light or phase curve is only be possible with an
  21 + unbinned maximum likelihood analysis
  22 + (see :ref:`light curve <1dc_howto_ligthcurve>` and
  23 + :ref:`phase curve <1dc_howto_phasecurve>` fitting).
68 24  
69   -.. code-block:: none
70   -
71   - 2016-06-29T16:20:10: +=================+
72   - 2016-06-29T16:20:10: | Event selection |
73   - 2016-06-29T16:20:10: +=================+
74   - 2016-06-29T16:20:10: === CTA observation ===
75   - 2016-06-29T16:20:10: Input filename ............: events.fits
76   - 2016-06-29T16:20:10: Event extension name ......: EVENTS
77   - 2016-06-29T16:20:10: GTI extension name ........: GTI
78   - 2016-06-29T16:20:10: Selected energy range .....: 0.1 - 100 TeV
79   - 2016-06-29T16:20:10: Requested ROI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg
80   - 2016-06-29T16:20:10: ROI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg
81   - 2016-06-29T16:20:10: Selected ROI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg
82   - 2016-06-29T16:20:10: cfitsio selection .........: ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000
83   - 2016-06-29T16:20:10: FITS filename .............: /var/tmp/tmp.0.3aUIXn[EVENTS][ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000]
84   -
85   -.. note::
86   -
87   - :ref:`ctobssim` will also write data selection keywords in the event
88   - list FITS file, hence you can run :ref:`ctlike` directly on a FITS file
89   - produced by :ref:`ctobssim`. Any selection performed by :ref:`ctselect`
90   - needs to be fully enclosed within any previous selection, e.g. the ROI
91   - needs to be fully enclosed in the acceptance cone used for event
92   - simulation, the energy selection must be fully comprised in the
93   - range of simulated energies, the same applies for the temporal selection.
94   - :ref:`ctselect` will automatically adjust
95   - the selection parameters to guarantee full enclosure. To keep track of
96   - this adjustment, the :ref:`ctselect` log file quotes the requested
97   - selection, any existing selections, and the selection that was finally
98   - applied.
99   -
100   -.. note::
101   -
102   - :ref:`ctselect` may of course also be used for event selection prior to
103   - binned analysis, for example to select events for a given period in
104   - time. The ``WEIGHT`` extension of the counts cube will track the overlap
105   - between the ROI applied by :ref:`ctselect` and the counts cube, and this
106   - information will be transparently used in any further analysis to restrict
107   - the analysis on counts cube bins that contain data.
108   -
109   -Now that you have selected the events of interest, you can run ctlike in
110   -unbinned mode. To do this you have to specify the selected event list
111   -instead of the counts cube:
  25 +An alternative analysis technique consists of working directly on the event
  26 +list without binning the events in a counts cube.
  27 +You do this with the :ref:`ctlike` tool as follows:
112 28  
113 29 .. code-block:: bash
114 30  
115   - $ ctlike
116   - Input event list, counts cube or observation definition XML file [cntcube.fits] selected_events.fits
117   - Calibration database [prod2]
118   - Instrument response function [South_0.5h]
119   - Input model XML file [$CTOOLS/share/models/crab.xml]
120   - Output model XML file [crab_results.xml]
  31 + $ ctlike
  32 + Input event list, counts cube or observation definition XML file [selected_events.fits]
  33 + Calibration database [prod2]
  34 + Instrument response function [South_0.5h]
  35 + Input model definition XML file [models.xml] $CTOOLS/share/models/crab.xml
  36 + Output model definition XML file [crab_results.xml]
121 37  
122 38 You will recognise that :ref:`ctlike` runs much faster in unbinned mode
123 39 compared to binned mode.
124 40 This is understandable as the selected event list contains
125   -only 21604 events, while the binned counts cube you used before had
  41 +only 21991 events, while the binned counts cube you used before had
126 42 200 x 200 x 20 = 800000 bins. As unbinned maximum likelihood fitting loops
127 43 over the events (while binned maximum likelihood loops over the bins),
128 44 there are much less operations to perform in unbinned than in binned mode
... ... @@ -130,7 +46,7 @@ there are much less operations to perform in unbinned than in binned mode
130 46 integrating the models over the region of interest, yet this is negligible
131 47 compared to the operations needed when looping over all pixels). So as long
132 48 as you work with small event lists, unbinned mode is faster (this
133   -typically holds up to 50 hours of observing time for point sources).
  49 +typically holds up to few tens of hours of observing time).
134 50 Unbinned :ref:`ctlike` should also be more precise as no binning is performed,
135 51 hence there is no loss of information due to histogramming.
136 52  
... ... @@ -144,58 +60,58 @@ the same events for both analyses.
144 60  
145 61 .. code-block:: none
146 62  
147   - 2016-06-29T16:24:44: +=================================+
148   - 2016-06-29T16:24:44: | Maximum likelihood optimisation |
149   - 2016-06-29T16:24:44: +=================================+
150   - 2016-06-29T16:24:45: >Iteration 0: -logL=137562.094, Lambda=1.0e-03
151   - 2016-06-29T16:24:45: >Iteration 1: -logL=137560.613, Lambda=1.0e-03, delta=1.481, max(|grad|)=2.548241 [Index:7]
152   - 2016-06-29T16:24:45: >Iteration 2: -logL=137560.613, Lambda=1.0e-04, delta=0.001, max(|grad|)=0.027191 [Index:3]
153   - ...
154   - 2016-06-29T16:24:45: +=========================================+
155   - 2016-06-29T16:24:45: | Maximum likelihood optimisation results |
156   - 2016-06-29T16:24:45: +=========================================+
157   - 2016-06-29T16:24:45: === GOptimizerLM ===
158   - 2016-06-29T16:24:45: Optimized function value ..: 137560.613
159   - 2016-06-29T16:24:45: Absolute precision ........: 0.005
160   - 2016-06-29T16:24:45: Acceptable value decrease .: 2
161   - 2016-06-29T16:24:45: Optimization status .......: converged
162   - 2016-06-29T16:24:45: Number of parameters ......: 10
163   - 2016-06-29T16:24:45: Number of free parameters .: 4
164   - 2016-06-29T16:24:45: Number of iterations ......: 2
165   - 2016-06-29T16:24:45: Lambda ....................: 1e-05
166   - 2016-06-29T16:24:45: Maximum log likelihood ....: -137560.613
167   - 2016-06-29T16:24:45: Observed events (Nobs) ...: 21604.000
168   - 2016-06-29T16:24:45: Predicted events (Npred) ..: 21603.998 (Nobs - Npred = 0.00202556)
169   - 2016-06-29T16:24:45: === GModels ===
170   - 2016-06-29T16:24:45: Number of models ..........: 2
171   - 2016-06-29T16:24:45: Number of parameters ......: 10
172   - 2016-06-29T16:24:45: === GModelSky ===
173   - 2016-06-29T16:24:45: Name ......................: Crab
174   - 2016-06-29T16:24:45: Instruments ...............: all
175   - 2016-06-29T16:24:45: Instrument scale factors ..: unity
176   - 2016-06-29T16:24:45: Observation identifiers ...: all
177   - 2016-06-29T16:24:45: Model type ................: PointSource
178   - 2016-06-29T16:24:45: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
179   - 2016-06-29T16:24:45: Number of parameters ......: 6
180   - 2016-06-29T16:24:45: Number of spatial par's ...: 2
181   - 2016-06-29T16:24:45: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
182   - 2016-06-29T16:24:45: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
183   - 2016-06-29T16:24:45: Number of spectral par's ..: 3
184   - 2016-06-29T16:24:45: Prefactor ................: 5.828e-16 +/- 1.0219e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
185   - 2016-06-29T16:24:45: Index ....................: -2.47546 +/- 0.0154751 [-0,-5] (free,scale=-1,gradient)
186   - 2016-06-29T16:24:45: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
187   - 2016-06-29T16:24:45: Number of temporal par's ..: 1
188   - 2016-06-29T16:24:45: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
189   - 2016-06-29T16:24:45: === GCTAModelIrfBackground ===
190   - 2016-06-29T16:24:45: Name ......................: CTABackgroundModel
191   - 2016-06-29T16:24:45: Instruments ...............: CTA
192   - 2016-06-29T16:24:45: Instrument scale factors ..: unity
193   - 2016-06-29T16:24:45: Observation identifiers ...: all
194   - 2016-06-29T16:24:45: Model type ................: "PowerLaw" * "Constant"
195   - 2016-06-29T16:24:45: Number of parameters ......: 4
196   - 2016-06-29T16:24:45: Number of spectral par's ..: 3
197   - 2016-06-29T16:24:45: Prefactor ................: 1.0132 +/- 0.0138017 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient)
198   - 2016-06-29T16:24:45: Index ....................: 0.00653002 +/- 0.00831374 [-5,5] (free,scale=1,gradient)
199   - 2016-06-29T16:24:45: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
200   - 2016-06-29T16:24:45: Number of temporal par's ..: 1
201   - 2016-06-29T16:24:45: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  63 + 2017-08-08T20:56:27: +=================================+
  64 + 2017-08-08T20:56:27: | Maximum likelihood optimisation |
  65 + 2017-08-08T20:56:27: +=================================+
  66 + 2017-08-08T20:56:27: >Iteration 0: -logL=140091.731, Lambda=1.0e-03
  67 + 2017-08-08T20:56:28: >Iteration 1: -logL=140089.754, Lambda=1.0e-03, delta=1.977, step=1.0e+00, max(|grad|)=5.681267 [Index:3]
  68 + 2017-08-08T20:56:28: >Iteration 2: -logL=140089.751, Lambda=1.0e-04, delta=0.003, step=1.0e+00, max(|grad|)=0.255879 [Index:3]
  69 + 2017-08-08T20:56:28:
  70 + 2017-08-08T20:56:28: +=========================================+
  71 + 2017-08-08T20:56:28: | Maximum likelihood optimisation results |
  72 + 2017-08-08T20:56:28: +=========================================+
  73 + 2017-08-08T20:56:28: === GOptimizerLM ===
  74 + 2017-08-08T20:56:28: Optimized function value ..: 140089.751
  75 + 2017-08-08T20:56:28: Absolute precision ........: 0.005
  76 + 2017-08-08T20:56:28: Acceptable value decrease .: 2
  77 + 2017-08-08T20:56:28: Optimization status .......: converged
  78 + 2017-08-08T20:56:28: Number of parameters ......: 10
  79 + 2017-08-08T20:56:28: Number of free parameters .: 4
  80 + 2017-08-08T20:56:28: Number of iterations ......: 2
  81 + 2017-08-08T20:56:28: Lambda ....................: 1e-05
  82 + 2017-08-08T20:56:28: Maximum log likelihood ....: -140089.751
  83 + 2017-08-08T20:56:28: Observed events (Nobs) ...: 21991.000
  84 + 2017-08-08T20:56:28: Predicted events (Npred) ..: 21990.996 (Nobs - Npred = 0.00358908515045187)
  85 + 2017-08-08T20:56:28: === GModels ===
  86 + 2017-08-08T20:56:28: Number of models ..........: 2
  87 + 2017-08-08T20:56:28: Number of parameters ......: 10
  88 + 2017-08-08T20:56:28: === GModelSky ===
  89 + 2017-08-08T20:56:28: Name ......................: Crab
  90 + 2017-08-08T20:56:28: Instruments ...............: all
  91 + 2017-08-08T20:56:28: Instrument scale factors ..: unity
  92 + 2017-08-08T20:56:28: Observation identifiers ...: all
  93 + 2017-08-08T20:56:28: Model type ................: PointSource
  94 + 2017-08-08T20:56:28: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
  95 + 2017-08-08T20:56:28: Number of parameters ......: 6
  96 + 2017-08-08T20:56:28: Number of spatial par's ...: 2
  97 + 2017-08-08T20:56:28: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
  98 + 2017-08-08T20:56:28: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
  99 + 2017-08-08T20:56:28: Number of spectral par's ..: 3
  100 + 2017-08-08T20:56:28: Prefactor ................: 5.69800719463692e-16 +/- 9.95311294944208e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
  101 + 2017-08-08T20:56:28: Index ....................: -2.46101639180337 +/- 0.0145278326558106 [-0,-5] (free,scale=-1,gradient)
  102 + 2017-08-08T20:56:28: PivotEnergy ..............: 300000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
  103 + 2017-08-08T20:56:28: Number of temporal par's ..: 1
  104 + 2017-08-08T20:56:28: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  105 + 2017-08-08T20:56:28: === GCTAModelIrfBackground ===
  106 + 2017-08-08T20:56:28: Name ......................: CTABackgroundModel
  107 + 2017-08-08T20:56:28: Instruments ...............: CTA
  108 + 2017-08-08T20:56:28: Instrument scale factors ..: unity
  109 + 2017-08-08T20:56:28: Observation identifiers ...: all
  110 + 2017-08-08T20:56:28: Model type ................: "PowerLaw" * "Constant"
  111 + 2017-08-08T20:56:28: Number of parameters ......: 4
  112 + 2017-08-08T20:56:28: Number of spectral par's ..: 3
  113 + 2017-08-08T20:56:28: Prefactor ................: 1.00310957843794 +/- 0.0134585839142799 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient)
  114 + 2017-08-08T20:56:28: Index ....................: 0.00814622034405194 +/- 0.00817635016295375 [-5,5] (free,scale=1,gradient)
  115 + 2017-08-08T20:56:28: PivotEnergy ..............: 1000000 [10000,1000000000] MeV (fixed,scale=1000000,gradient)
  116 + 2017-08-08T20:56:28: Number of temporal par's ..: 1
  117 + 2017-08-08T20:56:28: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
... ...