Commit 3e80f4637d56996b08fdcc83a3370e177a779a8c

Authored by Jürgen Knödlseder
1 parent 2e97e659

Update Fermi-LAT How-tos

doc/source/users/tutorials/howto/fermi/howto_fermi_errors.rst
@@ -31,56 +31,82 @@ that was created by :ref:`cterror`. As you will see, the parameter errors @@ -31,56 +31,82 @@ that was created by :ref:`cterror`. As you will see, the parameter errors
31 are essentially symmetric and very close to the values determined using the 31 are essentially symmetric and very close to the values determined using the
32 covariance matrix. 32 covariance matrix.
33 33
34 -.. code-block:: bash 34 +.. code-block:: none
35 35
36 - 2017-08-26T14:16:00: +=======================================================+  
37 - 2017-08-26T14:16:00: | Compute error for source "Vela" parameter "Prefactor" |  
38 - 2017-08-26T14:16:00: +=======================================================+  
39 - 2017-08-26T14:16:00: Confidence level ..........: 68 %  
40 - 2017-08-26T14:16:00: Log-likelihood difference .: 0.494473  
41 - 2017-08-26T14:16:00: Initial factor range ......: [1e-07, 9.10916268820218]  
42 - 2017-08-26T14:16:20: Lower parameter factor ....: 3.93549  
43 - 2017-08-26T14:16:20: Upper parameter factor ....: 4.89285  
44 - 2017-08-26T14:16:20: Error from curvature ......: 4.75365104151534e-10 ph/cm2/s/MeV  
45 - 2017-08-26T14:16:20: Error from profile ........: 4.78682555317737e-10 ph/cm2/s/MeV  
46 - 2017-08-26T14:16:20: Negative profile error ....: 4.20026137925122e-10 ph/cm2/s/MeV  
47 - 2017-08-26T14:16:20: Positive profile error ....: 5.37338972710351e-10 ph/cm2/s/MeV  
48 - 2017-08-26T14:16:20:  
49 - 2017-08-26T14:16:20: +====================================================+  
50 - 2017-08-26T14:16:20: | Compute error for source "Vela" parameter "Index1" |  
51 - 2017-08-26T14:16:20: +====================================================+  
52 - 2017-08-26T14:16:20: Confidence level ..........: 68 %  
53 - 2017-08-26T14:16:20: Log-likelihood difference .: 0.494473  
54 - 2017-08-26T14:16:20: Initial factor range ......: [1.03221907174349, 1.65479046234989]  
55 - 2017-08-26T14:16:42: Lower parameter factor ....: 1.31121  
56 - 2017-08-26T14:16:42: Upper parameter factor ....: 1.37307  
57 - 2017-08-26T14:16:42: Error from curvature ......: 0.03112856953032  
58 - 2017-08-26T14:16:42: Error from profile ........: 0.0309309760713872  
59 - 2017-08-26T14:16:42: Negative profile error ....: 0.0322989307870749  
60 - 2017-08-26T14:16:42: Positive profile error ....: 0.0295630213556994  
61 - 2017-08-26T14:16:42:  
62 - 2017-08-26T14:16:42: +==========================================================+  
63 - 2017-08-26T14:16:42: | Compute error for source "Vela" parameter "CutoffEnergy" |  
64 - 2017-08-26T14:16:42: +==========================================================+  
65 - 2017-08-26T14:16:42: Confidence level ..........: 68 %  
66 - 2017-08-26T14:16:42: Log-likelihood difference .: 0.494473  
67 - 2017-08-26T14:16:42: Initial factor range ......: [0.001, 2.8071605417966]  
68 - 2017-08-26T14:17:02: Lower parameter factor ....: 0.813181  
69 - 2017-08-26T14:17:02: Upper parameter factor ....: 1.17404  
70 - 2017-08-26T14:17:02: Error from curvature ......: 181.871842544747 MeV  
71 - 2017-08-26T14:17:02: Error from profile ........: 180.431484426618 MeV  
72 - 2017-08-26T14:17:02: Negative profile error ....: 175.261332662553 MeV  
73 - 2017-08-26T14:17:02: Positive profile error ....: 185.601636190684 MeV  
74 - 2017-08-26T14:17:02:  
75 - 2017-08-26T14:17:02: +====================================================+  
76 - 2017-08-26T14:17:02: | Compute error for source "Vela" parameter "Index2" |  
77 - 2017-08-26T14:17:02: +====================================================+  
78 - 2017-08-26T14:17:02: Confidence level ..........: 68 %  
79 - 2017-08-26T14:17:02: Log-likelihood difference .: 0.494473  
80 - 2017-08-26T14:17:02: Initial factor range ......: [0.307804018748382, 0.866425033775455]  
81 - 2017-08-26T14:17:24: Lower parameter factor ....: 0.559156  
82 - 2017-08-26T14:17:24: Upper parameter factor ....: 0.615141  
83 - 2017-08-26T14:17:24: Error from curvature ......: 0.0279310507513537  
84 - 2017-08-26T14:17:24: Error from profile ........: 0.0279924226890397  
85 - 2017-08-26T14:17:24: Negative profile error ....: 0.027958327168103  
86 - 2017-08-26T14:17:24: Positive profile error ....: 0.0280265182099764 36 + 2018-01-25T20:45:22: +================================================+
  37 + 2018-01-25T20:45:22: | Compute error for source "Vela" parameter "RA" |
  38 + 2018-01-25T20:45:22: +================================================+
  39 + 2018-01-25T20:45:22: Confidence level ..........: 68 %
  40 + 2018-01-25T20:45:22: Log-likelihood difference .: 0.494473
  41 + 2018-01-25T20:45:22: Initial factor range ......: [128.819554251926, 128.851989886434]
  42 + 2018-01-25T20:45:41: Lower parameter factor ....: 128.834
  43 + 2018-01-25T20:45:41: Upper parameter factor ....: 128.837
  44 + 2018-01-25T20:45:41: Error from curvature ......: 0.00162178172537938 deg
  45 + 2018-01-25T20:45:41: Error from profile ........: 0.00169067577327553 deg
  46 + 2018-01-25T20:45:41: Negative profile error ....: 0.00165900034895117 deg
  47 + 2018-01-25T20:45:41: Positive profile error ....: 0.00172235119759989 deg
  48 + 2018-01-25T20:45:41:
  49 + 2018-01-25T20:45:41: +=================================================+
  50 + 2018-01-25T20:45:41: | Compute error for source "Vela" parameter "DEC" |
  51 + 2018-01-25T20:45:41: +=================================================+
  52 + 2018-01-25T20:45:41: Confidence level ..........: 68 %
  53 + 2018-01-25T20:45:41: Log-likelihood difference .: 0.494473
  54 + 2018-01-25T20:45:41: Initial factor range ......: [-45.1949881923928, -45.1721741961801]
  55 + 2018-01-25T20:46:01: Lower parameter factor ....: -45.1847
  56 + 2018-01-25T20:46:01: Upper parameter factor ....: -45.1824
  57 + 2018-01-25T20:46:01: Error from curvature ......: 0.00114069981063169 deg
  58 + 2018-01-25T20:46:01: Error from profile ........: 0.00116548552428952 deg
  59 + 2018-01-25T20:46:01: Negative profile error ....: 0.00115852324517363 deg
  60 + 2018-01-25T20:46:01: Positive profile error ....: 0.00117244780340542 deg
  61 + 2018-01-25T20:46:01:
  62 + 2018-01-25T20:46:01: +=======================================================+
  63 + 2018-01-25T20:46:01: | Compute error for source "Vela" parameter "Prefactor" |
  64 + 2018-01-25T20:46:01: +=======================================================+
  65 + 2018-01-25T20:46:01: Confidence level ..........: 68 %
  66 + 2018-01-25T20:46:01: Log-likelihood difference .: 0.494473
  67 + 2018-01-25T20:46:01: Initial factor range ......: [1e-07, 9.09784331905335]
  68 + 2018-01-25T20:46:45: Lower parameter factor ....: 3.93674
  69 + 2018-01-25T20:46:45: Upper parameter factor ....: 4.89558
  70 + 2018-01-25T20:46:45: Error from curvature ......: 4.74564602380296e-10 ph/cm2/s/MeV
  71 + 2018-01-25T20:46:45: Error from profile ........: 4.79421031311828e-10 ph/cm2/s/MeV
  72 + 2018-01-25T20:46:45: Negative profile error ....: 4.15456324058327e-10 ph/cm2/s/MeV
  73 + 2018-01-25T20:46:45: Positive profile error ....: 5.4338573856533e-10 ph/cm2/s/MeV
  74 + 2018-01-25T20:46:45:
  75 + 2018-01-25T20:46:45: +====================================================+
  76 + 2018-01-25T20:46:45: | Compute error for source "Vela" parameter "Index1" |
  77 + 2018-01-25T20:46:45: +====================================================+
  78 + 2018-01-25T20:46:45: Confidence level ..........: 68 %
  79 + 2018-01-25T20:46:45: Log-likelihood difference .: 0.494473
  80 + 2018-01-25T20:46:45: Initial factor range ......: [1.0323933217421, 1.65461803910864]
  81 + 2018-01-25T20:47:31: Lower parameter factor ....: 1.31084
  82 + 2018-01-25T20:47:31: Upper parameter factor ....: 1.37275
  83 + 2018-01-25T20:47:31: Error from curvature ......: 0.0311112358683271
  84 + 2018-01-25T20:47:31: Error from profile ........: 0.0309517300203693
  85 + 2018-01-25T20:47:31: Negative profile error ....: 0.032660721248488
  86 + 2018-01-25T20:47:31: Positive profile error ....: 0.0292427387922507
  87 + 2018-01-25T20:47:31:
  88 + 2018-01-25T20:47:31: +==========================================================+
  89 + 2018-01-25T20:47:31: | Compute error for source "Vela" parameter "CutoffEnergy" |
  90 + 2018-01-25T20:47:31: +==========================================================+
  91 + 2018-01-25T20:47:31: Confidence level ..........: 68 %
  92 + 2018-01-25T20:47:31: Log-likelihood difference .: 0.494473
  93 + 2018-01-25T20:47:31: Initial factor range ......: [0.001, 2.80853448949703]
  94 + 2018-01-25T20:48:14: Lower parameter factor ....: 0.81239
  95 + 2018-01-25T20:48:14: Upper parameter factor ....: 1.17294
  96 + 2018-01-25T20:48:14: Error from curvature ......: 181.899981380157 MeV
  97 + 2018-01-25T20:48:14: Error from profile ........: 180.277267463442 MeV
  98 + 2018-01-25T20:48:14: Negative profile error ....: 177.144641591912 MeV
  99 + 2018-01-25T20:48:14: Positive profile error ....: 183.409893334972 MeV
  100 + 2018-01-25T20:48:14:
  101 + 2018-01-25T20:48:14: +====================================================+
  102 + 2018-01-25T20:48:14: | Compute error for source "Vela" parameter "Index2" |
  103 + 2018-01-25T20:48:14: +====================================================+
  104 + 2018-01-25T20:48:14: Confidence level ..........: 68 %
  105 + 2018-01-25T20:48:14: Log-likelihood difference .: 0.494473
  106 + 2018-01-25T20:48:14: Initial factor range ......: [0.308028525758507, 0.866644263529458]
  107 + 2018-01-25T20:49:01: Lower parameter factor ....: 0.559037
  108 + 2018-01-25T20:49:01: Upper parameter factor ....: 0.615056
  109 + 2018-01-25T20:49:01: Error from curvature ......: 0.0279307868885475
  110 + 2018-01-25T20:49:01: Error from profile ........: 0.0280092058458762
  111 + 2018-01-25T20:49:01: Negative profile error ....: 0.028299015036004
  112 + 2018-01-25T20:49:01: Positive profile error ....: 0.0277193966557485
doc/source/users/tutorials/howto/fermi/howto_fermi_fitting.rst
@@ -47,8 +47,8 @@ extragalactic isotropic source component. @@ -47,8 +47,8 @@ extragalactic isotropic source component.
47 <parameter name="Index2" scale="1.0" value="0.5" min="0.1" max="5.0" free="1"/> 47 <parameter name="Index2" scale="1.0" value="0.5" min="0.1" max="5.0" free="1"/>
48 </spectrum> 48 </spectrum>
49 <spatialModel type="PointSource"> 49 <spatialModel type="PointSource">
50 - <parameter name="RA" scale="1.0" value="128.84" min="-360" max="360" free="0"/>  
51 - <parameter name="DEC" scale="1.0" value="-45.18" min="-90" max="90" free="0"/> 50 + <parameter name="RA" scale="1.0" value="128.84" min="-360" max="360" free="1"/>
  51 + <parameter name="DEC" scale="1.0" value="-45.18" min="-90" max="90" free="1"/>
52 </spatialModel> 52 </spatialModel>
53 </source> 53 </source>
54 <source type="DiffuseSource" name="Galactic_diffuse"> 54 <source type="DiffuseSource" name="Galactic_diffuse">
@@ -92,96 +92,95 @@ log file ``ctlike.log`` that was also created by :ref:`ctlike`: @@ -92,96 +92,95 @@ log file ``ctlike.log`` that was also created by :ref:`ctlike`:
92 92
93 .. code-block:: none 93 .. code-block:: none
94 94
95 - 2017-08-26T10:35:10: +=================================+  
96 - 2017-08-26T10:35:10: | Maximum likelihood optimisation |  
97 - 2017-08-26T10:35:10: +=================================+  
98 - 2017-08-26T10:35:12: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03  
99 - 2017-08-26T10:35:12: >Iteration 1: -logL=-198931.081, Lambda=1.0e-03, delta=21698.754, step=1.0e+00, max(|grad|)=-22713.401202 [CutoffEnergy:4]  
100 - 2017-08-26T10:35:12: >Iteration 2: -logL=-200263.519, Lambda=1.0e-04, delta=1332.438, step=1.0e+00, max(|grad|)=-67648.133552 [CutoffEnergy:4]  
101 - 2017-08-26T10:35:12: >Iteration 3: -logL=-212350.035, Lambda=1.0e-05, delta=12086.515, step=1.0e+00, max(|grad|)=23036.151920 [Index2:6]  
102 - 2017-08-26T10:35:12: >Iteration 4: -logL=-213951.781, Lambda=1.0e-06, delta=1601.746, step=1.0e+00, max(|grad|)=-8297.648633 [CutoffEnergy:4]  
103 - 2017-08-26T10:35:13: >Iteration 5: -logL=-215341.362, Lambda=1.0e-07, delta=1389.581, step=1.0e+00, max(|grad|)=2747.034517 [Index2:6]  
104 - 2017-08-26T10:35:13: >Iteration 6: -logL=-215490.429, Lambda=1.0e-08, delta=149.067, step=1.0e+00, max(|grad|)=697.301361 [Index2:6]  
105 - 2017-08-26T10:35:13: Iteration 7: -logL=-215490.429, Lambda=1.0e-09, delta=-14.065, step=1.0e+00, max(|grad|)=-1205.683279 [Index1:3] (stalled)  
106 - 2017-08-26T10:35:13: Iteration 8: -logL=-215490.429, Lambda=1.0e-08, delta=-14.064, step=1.0e+00, max(|grad|)=-1205.659884 [Index1:3] (stalled)  
107 - 2017-08-26T10:35:14: Iteration 9: -logL=-215490.429, Lambda=1.0e-07, delta=-14.055, step=1.0e+00, max(|grad|)=-1205.425967 [Index1:3] (stalled)  
108 - 2017-08-26T10:35:14: Iteration 10: -logL=-215490.429, Lambda=1.0e-06, delta=-13.963, step=1.0e+00, max(|grad|)=-1203.090620 [Index1:3] (stalled)  
109 - 2017-08-26T10:35:14: Iteration 11: -logL=-215490.429, Lambda=1.0e-05, delta=-13.066, step=1.0e+00, max(|grad|)=-1180.113526 [Index1:3] (stalled)  
110 - 2017-08-26T10:35:14: Iteration 12: -logL=-215490.429, Lambda=1.0e-04, delta=-6.263, step=1.0e+00, max(|grad|)=-983.079153 [Index1:3] (stalled)  
111 - 2017-08-26T10:35:14: >Iteration 13: -logL=-215496.367, Lambda=1.0e-03, delta=5.937, step=1.0e+00, max(|grad|)=-285.734284 [Index1:3]  
112 - 2017-08-26T10:35:15: Iteration 14: -logL=-215496.367, Lambda=1.0e-04, delta=-8.812, step=1.0e+00, max(|grad|)=-731.894749 [Index1:3] (stalled)  
113 - 2017-08-26T10:35:15: >Iteration 15: -logL=-215497.536, Lambda=1.0e-03, delta=1.169, step=1.0e+00, max(|grad|)=-153.668138 [Index1:3]  
114 - 2017-08-26T10:35:15: Iteration 16: -logL=-215496.136, Lambda=1.0e-04, delta=-1.400, step=1.0e+00, max(|grad|)=-328.522942 [Index1:3] (stalled)  
115 - 2017-08-26T10:35:15: >Iteration 17: -logL=-215498.376, Lambda=1.0e-03, delta=2.240, step=1.0e+00, max(|grad|)=3.257091 [Index2:6]  
116 - 2017-08-26T10:35:16: >Iteration 18: -logL=-215498.383, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.270351 [CutoffEnergy:4]  
117 - 2017-08-26T10:35:16: >Iteration 19: -logL=-215498.384, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.637485 [Index2:6]  
118 - 2017-08-26T10:35:16:  
119 - 2017-08-26T10:35:16: +=========================================+  
120 - 2017-08-26T10:35:16: | Maximum likelihood optimisation results |  
121 - 2017-08-26T10:35:16: +=========================================+  
122 - 2017-08-26T10:35:16: === GOptimizerLM ===  
123 - 2017-08-26T10:35:16: Optimized function value ..: -215498.384  
124 - 2017-08-26T10:35:16: Absolute precision ........: 0.005  
125 - 2017-08-26T10:35:16: Acceptable value decrease .: 2  
126 - 2017-08-26T10:35:16: Optimization status .......: converged  
127 - 2017-08-26T10:35:16: Number of parameters ......: 14  
128 - 2017-08-26T10:35:16: Number of free parameters .: 5  
129 - 2017-08-26T10:35:16: Number of iterations ......: 19  
130 - 2017-08-26T10:35:16: Lambda ....................: 1e-06  
131 - 2017-08-26T10:35:16: Maximum log likelihood ....: 215498.384  
132 - 2017-08-26T10:35:16: Observed events (Nobs) ...: 202330.000  
133 - 2017-08-26T10:35:16: Predicted events (Npred) ..: 202318.082 (Nobs - Npred = 11.9178772509331)  
134 - 2017-08-26T10:35:16: === GModels ===  
135 - 2017-08-26T10:35:16: Number of models ..........: 3  
136 - 2017-08-26T10:35:16: Number of parameters ......: 14  
137 - 2017-08-26T10:35:16: === GModelSky ===  
138 - 2017-08-26T10:35:16: Name ......................: Vela  
139 - 2017-08-26T10:35:16: Instruments ...............: all  
140 - 2017-08-26T10:35:16: Instrument scale factors ..: unity  
141 - 2017-08-26T10:35:16: Observation identifiers ...: all  
142 - 2017-08-26T10:35:16: Model type ................: PointSource  
143 - 2017-08-26T10:35:16: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant"  
144 - 2017-08-26T10:35:16: Number of parameters ......: 8  
145 - 2017-08-26T10:35:16: Number of spatial par's ...: 2  
146 - 2017-08-26T10:35:16: RA .......................: 128.84 [-360,360] deg (fixed,scale=1)  
147 - 2017-08-26T10:35:16: DEC ......................: -45.18 [-90,90] deg (fixed,scale=1)  
148 - 2017-08-26T10:35:16: Number of spectral par's ..: 5  
149 - 2017-08-26T10:35:16: Prefactor ................: 4.3553344038324e-09 +/- 4.75309654008435e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient)  
150 - 2017-08-26T10:35:16: Index1 ...................: -1.3435116067011 +/- 0.0311270092486095 [-0,-5] (free,scale=-1,gradient)  
151 - 2017-08-26T10:35:16: CutoffEnergy .............: 988.499237722443 +/- 181.86709257978 [1,1000000] MeV (free,scale=1000,gradient)  
152 - 2017-08-26T10:35:16: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient)  
153 - 2017-08-26T10:35:16: Index2 ...................: 0.587129723482927 +/- 0.0279303486200403 [0.1,5] (free,scale=1,gradient)  
154 - 2017-08-26T10:35:16: Number of temporal par's ..: 1  
155 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)  
156 - 2017-08-26T10:35:16: === GModelSky ===  
157 - 2017-08-26T10:35:16: Name ......................: Galactic_diffuse  
158 - 2017-08-26T10:35:16: Instruments ...............: all  
159 - 2017-08-26T10:35:16: Instrument scale factors ..: unity  
160 - 2017-08-26T10:35:16: Observation identifiers ...: all  
161 - 2017-08-26T10:35:16: Model type ................: DiffuseSource  
162 - 2017-08-26T10:35:16: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant"  
163 - 2017-08-26T10:35:16: Number of parameters ......: 3  
164 - 2017-08-26T10:35:16: Number of spatial par's ...: 1  
165 - 2017-08-26T10:35:16: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient)  
166 - 2017-08-26T10:35:16: Number of spectral par's ..: 1  
167 - 2017-08-26T10:35:16: Normalization ............: 1.10915296009432 +/- 0.00503367301009883 [0.1,1000] (free,scale=1,gradient)  
168 - 2017-08-26T10:35:16: Number of temporal par's ..: 1  
169 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)  
170 - 2017-08-26T10:35:16: === GModelSky ===  
171 - 2017-08-26T10:35:16: Name ......................: Extragalactic_diffuse  
172 - 2017-08-26T10:35:16: Instruments ...............: all  
173 - 2017-08-26T10:35:16: Instrument scale factors ..: unity  
174 - 2017-08-26T10:35:16: Observation identifiers ...: all  
175 - 2017-08-26T10:35:16: Model type ................: DiffuseSource  
176 - 2017-08-26T10:35:16: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant"  
177 - 2017-08-26T10:35:16: Number of parameters ......: 3  
178 - 2017-08-26T10:35:16: Number of spatial par's ...: 1  
179 - 2017-08-26T10:35:16: Value ....................: 1 [0,10] (fixed,scale=1,gradient)  
180 - 2017-08-26T10:35:16: Number of spectral par's ..: 1  
181 - 2017-08-26T10:35:16: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient)  
182 - 2017-08-26T10:35:16: Number of temporal par's ..: 1  
183 - 2017-08-26T10:35:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)  
184 - 95 + 2018-01-25T20:07:55: +=================================+
  96 + 2018-01-25T20:07:55: | Maximum likelihood optimisation |
  97 + 2018-01-25T20:07:55: +=================================+
  98 + 2018-01-25T20:07:57: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03
  99 + 2018-01-25T20:07:58: >Iteration 1: -logL=-198931.136, Lambda=1.0e-03, delta=21698.809, step=1.0e+00, max(|grad|)=-22717.063466 [CutoffEnergy:4]
  100 + 2018-01-25T20:07:58: >Iteration 2: -logL=-200269.888, Lambda=1.0e-04, delta=1338.753, step=1.0e+00, max(|grad|)=-67629.683771 [CutoffEnergy:4]
  101 + 2018-01-25T20:07:59: >Iteration 3: -logL=-212351.965, Lambda=1.0e-05, delta=12082.076, step=1.0e+00, max(|grad|)=23026.802421 [Index2:6]
  102 + 2018-01-25T20:07:59: >Iteration 4: -logL=-213954.259, Lambda=1.0e-06, delta=1602.294, step=1.0e+00, max(|grad|)=-8297.380912 [CutoffEnergy:4]
  103 + 2018-01-25T20:07:59: >Iteration 5: -logL=-215347.973, Lambda=1.0e-07, delta=1393.714, step=1.0e+00, max(|grad|)=2746.754042 [Index2:6]
  104 + 2018-01-25T20:08:00: >Iteration 6: -logL=-215497.807, Lambda=1.0e-08, delta=149.834, step=1.0e+00, max(|grad|)=699.848484 [Index2:6]
  105 + 2018-01-25T20:08:00: Iteration 7: -logL=-215497.807, Lambda=1.0e-09, delta=-13.845, step=1.0e+00, max(|grad|)=-1201.982875 [Index1:3] (stalled)
  106 + 2018-01-25T20:08:01: Iteration 8: -logL=-215497.807, Lambda=1.0e-08, delta=-13.844, step=1.0e+00, max(|grad|)=-1201.959647 [Index1:3] (stalled)
  107 + 2018-01-25T20:08:01: Iteration 9: -logL=-215497.807, Lambda=1.0e-07, delta=-13.835, step=1.0e+00, max(|grad|)=-1201.727401 [Index1:3] (stalled)
  108 + 2018-01-25T20:08:02: Iteration 10: -logL=-215497.807, Lambda=1.0e-06, delta=-13.744, step=1.0e+00, max(|grad|)=-1199.408717 [Index1:3] (stalled)
  109 + 2018-01-25T20:08:02: Iteration 11: -logL=-215497.807, Lambda=1.0e-05, delta=-12.858, step=1.0e+00, max(|grad|)=-1176.594021 [Index1:3] (stalled)
  110 + 2018-01-25T20:08:03: Iteration 12: -logL=-215497.807, Lambda=1.0e-04, delta=-6.126, step=1.0e+00, max(|grad|)=-980.833963 [Index1:3] (stalled)
  111 + 2018-01-25T20:08:04: >Iteration 13: -logL=-215503.803, Lambda=1.0e-03, delta=5.995, step=1.0e+00, max(|grad|)=-285.964915 [Index1:3]
  112 + 2018-01-25T20:08:04: Iteration 14: -logL=-215503.803, Lambda=1.0e-04, delta=-8.762, step=1.0e+00, max(|grad|)=-730.461326 [Index1:3] (stalled)
  113 + 2018-01-25T20:08:05: >Iteration 15: -logL=-215504.976, Lambda=1.0e-03, delta=1.173, step=1.0e+00, max(|grad|)=-153.941336 [Index1:3]
  114 + 2018-01-25T20:08:05: Iteration 16: -logL=-215503.593, Lambda=1.0e-04, delta=-1.383, step=1.0e+00, max(|grad|)=-327.368445 [Index1:3] (stalled)
  115 + 2018-01-25T20:08:06: >Iteration 17: -logL=-215505.817, Lambda=1.0e-03, delta=2.225, step=1.0e+00, max(|grad|)=3.256216 [Index2:6]
  116 + 2018-01-25T20:08:06: >Iteration 18: -logL=-215505.824, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.190316 [CutoffEnergy:4]
  117 + 2018-01-25T20:08:06: >Iteration 19: -logL=-215505.826, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.635263 [Index2:6]
  118 + 2018-01-25T20:08:07:
  119 + 2018-01-25T20:08:07: +=========================================+
  120 + 2018-01-25T20:08:07: | Maximum likelihood optimisation results |
  121 + 2018-01-25T20:08:07: +=========================================+
  122 + 2018-01-25T20:08:07: === GOptimizerLM ===
  123 + 2018-01-25T20:08:07: Optimized function value ..: -215505.826
  124 + 2018-01-25T20:08:07: Absolute precision ........: 0.005
  125 + 2018-01-25T20:08:07: Acceptable value decrease .: 2
  126 + 2018-01-25T20:08:07: Optimization status .......: converged
  127 + 2018-01-25T20:08:07: Number of parameters ......: 14
  128 + 2018-01-25T20:08:07: Number of free parameters .: 7
  129 + 2018-01-25T20:08:07: Number of iterations ......: 19
  130 + 2018-01-25T20:08:07: Lambda ....................: 1e-06
  131 + 2018-01-25T20:08:07: Maximum log likelihood ....: 215505.826
  132 + 2018-01-25T20:08:07: Observed events (Nobs) ...: 202330.000
  133 + 2018-01-25T20:08:07: Predicted events (Npred) ..: 202318.925 (Nobs - Npred = 11.0749561789562)
  134 + 2018-01-25T20:08:07: === GModels ===
  135 + 2018-01-25T20:08:07: Number of models ..........: 3
  136 + 2018-01-25T20:08:07: Number of parameters ......: 14
  137 + 2018-01-25T20:08:07: === GModelSky ===
  138 + 2018-01-25T20:08:07: Name ......................: Vela
  139 + 2018-01-25T20:08:07: Instruments ...............: all
  140 + 2018-01-25T20:08:07: Instrument scale factors ..: unity
  141 + 2018-01-25T20:08:07: Observation identifiers ...: all
  142 + 2018-01-25T20:08:07: Model type ................: PointSource
  143 + 2018-01-25T20:08:07: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant"
  144 + 2018-01-25T20:08:07: Number of parameters ......: 8
  145 + 2018-01-25T20:08:07: Number of spatial par's ...: 2
  146 + 2018-01-25T20:08:07: RA .......................: 128.835772118429 +/- 0.00162177813558897 [-360,360] deg (free,scale=1)
  147 + 2018-01-25T20:08:07: DEC ......................: -45.1835812138884 +/- 0.00114069728792873 [-90,90] deg (free,scale=1)
  148 + 2018-01-25T20:08:07: Number of spectral par's ..: 5
  149 + 2018-01-25T20:08:07: Prefactor ................: 4.35032346821964e-09 +/- 4.73845090178596e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient)
  150 + 2018-01-25T20:08:07: Index1 ...................: -1.34367731366247 +/- 0.031088811599731 [-0,-5] (free,scale=-1,gradient)
  151 + 2018-01-25T20:08:07: CutoffEnergy .............: 990.275379109663 +/- 181.814299583364 [1,1000000] MeV (free,scale=1000,gradient)
  152 + 2018-01-25T20:08:07: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient)
  153 + 2018-01-25T20:08:07: Index2 ...................: 0.587550117179991 +/- 0.0279192539614008 [0.1,5] (free,scale=1,gradient)
  154 + 2018-01-25T20:08:07: Number of temporal par's ..: 1
  155 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  156 + 2018-01-25T20:08:07: === GModelSky ===
  157 + 2018-01-25T20:08:07: Name ......................: Galactic_diffuse
  158 + 2018-01-25T20:08:07: Instruments ...............: all
  159 + 2018-01-25T20:08:07: Instrument scale factors ..: unity
  160 + 2018-01-25T20:08:07: Observation identifiers ...: all
  161 + 2018-01-25T20:08:07: Model type ................: DiffuseSource
  162 + 2018-01-25T20:08:07: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant"
  163 + 2018-01-25T20:08:07: Number of parameters ......: 3
  164 + 2018-01-25T20:08:07: Number of spatial par's ...: 1
  165 + 2018-01-25T20:08:07: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient)
  166 + 2018-01-25T20:08:07: Number of spectral par's ..: 1
  167 + 2018-01-25T20:08:07: Normalization ............: 1.10941973066973 +/- 0.00503412002598653 [0.1,1000] (free,scale=1,gradient)
  168 + 2018-01-25T20:08:07: Number of temporal par's ..: 1
  169 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  170 + 2018-01-25T20:08:07: === GModelSky ===
  171 + 2018-01-25T20:08:07: Name ......................: Extragalactic_diffuse
  172 + 2018-01-25T20:08:07: Instruments ...............: all
  173 + 2018-01-25T20:08:07: Instrument scale factors ..: unity
  174 + 2018-01-25T20:08:07: Observation identifiers ...: all
  175 + 2018-01-25T20:08:07: Model type ................: DiffuseSource
  176 + 2018-01-25T20:08:07: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant"
  177 + 2018-01-25T20:08:07: Number of parameters ......: 3
  178 + 2018-01-25T20:08:07: Number of spatial par's ...: 1
  179 + 2018-01-25T20:08:07: Value ....................: 1 [0,10] (fixed,scale=1,gradient)
  180 + 2018-01-25T20:08:07: Number of spectral par's ..: 1
  181 + 2018-01-25T20:08:07: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient)
  182 + 2018-01-25T20:08:07: Number of temporal par's ..: 1
  183 + 2018-01-25T20:08:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
185 184
186 The fit converged after 19 iterations with spectral parameters that are 185 The fit converged after 19 iterations with spectral parameters that are
187 reasonably close to those found in 186 reasonably close to those found in
@@ -242,13 +241,16 @@ using the Fermi-LAT Science Tools. @@ -242,13 +241,16 @@ using the Fermi-LAT Science Tools.
242 241
243 .. code-block:: none 242 .. code-block:: none
244 243
245 - 2017-08-26T13:05:12: === GModelSky ===  
246 - 2017-08-26T13:05:12: Name ......................: Vela  
247 - 2017-08-26T13:05:12: Instruments ...............: all  
248 - 2017-08-26T13:05:12: Test Statistic ............: 326326.556902542 244 + 2018-01-25T20:05:57: Name ......................: Vela
  245 + 2018-01-25T20:05:57: Instruments ...............: all
  246 + 2018-01-25T20:05:57: Test Statistic ............: 326341.439917148
249 247
250 which is also close to the value determined by gtlike. 248 which is also close to the value determined by gtlike.
251 249
  250 +.. note::
  251 + Unlike gtlike, :ref:`ctlike` can also fit the source location. This has been
  252 + done in the example above by setting the parameter attributes to ``free="1"``.
  253 +
252 .. warning:: 254 .. warning::
253 ctools supports for the moment only the fitting of point sources for 255 ctools supports for the moment only the fitting of point sources for
254 Fermi-LAT data. Other spatial shapes need to be preconvolved with the 256 Fermi-LAT data. Other spatial shapes need to be preconvolved with the
doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.png

26.5 KB | W: | H:

22 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
doc/source/users/tutorials/howto/fermi/howto_fermi_spectrum.rst
@@ -5,77 +5,44 @@ Generate a spectral energy distribution for a source @@ -5,77 +5,44 @@ Generate a spectral energy distribution for a source
5 5
6 .. admonition:: What you will learn 6 .. admonition:: What you will learn
7 7
8 - You will learn how to use :ref:`ctlike` to derive the spectral energy 8 + You will learn how to use :ref:`csspec` to derive the spectral energy
9 density of a source from Fermi-LAT data. 9 density of a source from Fermi-LAT data.
10 10
11 -So far the :ref:`csspec` script does not work for Fermi-LAT data, but you  
12 -will learn here a method that you can use to derive the spectrum of any  
13 -source using Fermi-LAT data. For this you first need a little Python code  
14 -to transform the spectral component of the Vela source in the  
15 -:ref:`model definition file <glossary_moddef>`  
16 -from a super exponentially cut-off power law into a node function.  
17 -You do this as follows:  
18 -  
19 -.. code-block:: python  
20 -  
21 - >>> import gammalib  
22 - >>> models = gammalib.GModels('vela_results.xml')  
23 - >>> energies = gammalib.GEnergies(10, gammalib.GEnergy(100.0, 'MeV'), gammalib.GEnergy(100.0, 'GeV'))  
24 - >>> nodes = gammalib.GModelSpectralNodes()  
25 - >>> for energy in energies:  
26 - >>> nodes.append(energy, models['Vela'].spectral().eval(energy))  
27 - >>> for par in nodes:  
28 - >>> if 'Energy' in par.name():  
29 - >>> par.fix()  
30 - >>> if 'Intensity' in par.name():  
31 - >>> par.min(1.0e-30)  
32 - >>> models['Vela'].spectral(nodes)  
33 - >>> models.save('model_nodes.xml')  
34 -  
35 -This will create a  
36 -:ref:`model definition file <glossary_moddef>`  
37 -with the following structure:  
38 -  
39 -.. code-block:: xml  
40 -  
41 - <?xml version="1.0" encoding="UTF-8" standalone="no"?>  
42 - <source_library title="source library">  
43 - <source name="Vela" type="PointSource">  
44 - <spectrum type="NodeFunction">  
45 - <node>  
46 - <parameter name="Energy" value="100" scale="1" free="0" />  
47 - <parameter name="Intensity" value="7.40280399439422e-08" error="0" scale="1" min="1e-30" free="1" />  
48 - </node>  
49 - <node>  
50 - <parameter name="Energy" value="215.443469003188" scale="1" free="0" />  
51 - <parameter name="Intensity" value="2.27587615163047e-08" error="0" scale="1" min="1e-30" free="1" />  
52 - </node>  
53 - ...  
54 - </source_library>  
55 -  
56 -Instead of the super exponentially cut-off power law the model now contains  
57 -a node function with ten intensity nodes between 100 MeV and 100 GeV, and the  
58 -:ref:`ctlike` tool will now adjust the intensities of each of the nodes which  
59 -will result in a spectrum. To do this type now: 11 +To determine a spectral of the Vela pulsar you can use the :ref:`csspec`
  12 +script. To do this, type
60 13
61 .. code-block:: bash 14 .. code-block:: bash
62 15
63 - $ ctlike  
64 - Input event list, counts cube or observation definition XML file [obs.xml]  
65 - Input model definition XML file [models.xml] model_nodes.xml  
66 - Output model definition XML file [vela_results.xml] vela_nodes_results.xml  
67 -  
68 -This will produce the  
69 -:ref:`model definition file <glossary_moddef>`  
70 -``vela_nodes_results.xml`` with the intensities of the fitted source at  
71 -each energy. The results are displayed graphically below. 16 + $ csspec
  17 + Input event list, counts cube, or observation definition XML file [events.fits] obs.xml
  18 + Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
  19 + Source name [Crab] Vela
  20 + Spectrum generation method (SLICE|NODES|AUTO) [AUTO]
  21 + Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
  22 + Start value for first energy bin in TeV [0.1] 0.0001
  23 + Stop value for last energy bin in TeV [100.0] 0.1
  24 + Number of energy bins (1-200) [20] 10
  25 + Output spectrum file [spectrum.fits]
  26 +
  27 +This will generate a logarithmically spaced spectrum composed of 10 energy bins
  28 +comprised within 100 MeV and 100 GeV. The :ref:`csspec` tool is run in the ``AUTO``
  29 +mode, which for Fermi-LAT data corresponds to the ``NODES`` method. :ref:`csspec`
  30 +will convert the Vela spectrum in the input model into a node function and fit
  31 +all intensity nodes using :ref:`ctlike`. The resulting node intensities are
  32 +then interpreted as the spectral point, and are displayed graphically below:
72 33
73 .. figure:: howto_fermi_spectrum.png 34 .. figure:: howto_fermi_spectrum.png
74 :width: 600px 35 :width: 600px
75 :align: center 36 :align: center
76 37
77 - *Spectrum of the Vela pulsar derived using a node function* 38 + *Spectrum of the Vela pulsar derived using csspec*
78 39
79 .. note:: 40 .. note::
80 - The ``NodeFunction`` spectral models implements a piece-wise power law  
81 - that is defined by the intensity values at each node. 41 + The figure was created using the ``show_spectrum.py`` script that is
  42 + located in the ctools example folder. The example script requires the
  43 + `matplotlib <http://matplotlib.org>`_ Python module for display.
  44 + You may reproduce the plot by typing
  45 +
  46 + .. code-block:: bash
  47 +
  48 + $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits
doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.png 0 → 100644

24 KB

doc/source/users/tutorials/howto/fermi/howto_fermi_tsmap.rst 0 → 100644
  1 +.. _howto_fermi_tsmap:
  2 +
  3 +Generate a Test Statistic map
  4 +-----------------------------
  5 +
  6 + .. admonition:: What you will learn
  7 +
  8 + You will learn how to use :ref:`cttsmap` to generate a Test Staristic
  9 + map from Fermi-LAT data.
  10 +
  11 +The Test Statistic (or maximum likelihood ratio) is a measure of the detection
  12 +significance of a gamma-ray source. By displacing the location of a test source
  13 +on a grid of positions you can generate a Test Statistic map that helps in
  14 +finding significant source and assessing the position uncertainty of a
  15 +source. You do this by using the :ref:`cttsmap` tool as follows:
  16 +
  17 +.. code-block:: bash
  18 +
  19 + $ cttsmap
  20 + Input event list, counts cube or observation definition XML file [events.fits] obs.xml
  21 + Test source name [Crab] Vela
  22 + Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
  23 + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 128.84
  24 + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] -45.18
  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] 0.3
  28 + Size of the X axis in pixels [200] 10
  29 + Size of the Y axis in pixels [200] 10
  30 + Output Test Statistic map file [tsmap.fits]
  31 +
  32 +:ref:`cttsmap` created a 10 x 10 pixels map with a pixel size of 0.3 degrees
  33 +around the location of the Vela pulsar and saved the result in the FITS file
  34 +``tsmap.fits``. The file also contains the values of all fitted parameters
  35 +at each grid position. The Test Statistics map is displayed using
  36 +`ds9 <http://ds9.si.edu>`_ in the figure below:
  37 +
  38 +.. figure:: howto_fermi_tsmap.png
  39 + :width: 400px
  40 + :align: center
  41 +
  42 + *Test Statistic map for Fermi-LAT of the Vela pulsar*
doc/source/users/tutorials/howto/fermi/howto_fermi_ulimit.rst
@@ -44,18 +44,18 @@ specifying ``emin=0.0001 emax=0.1`` (all values are given in TeV): @@ -44,18 +44,18 @@ specifying ``emin=0.0001 emax=0.1`` (all values are given in TeV):
44 .. code-block:: bash 44 .. code-block:: bash
45 45
46 $ ctulimit eref=0.001 emin=0.0001 emax=0.1 46 $ ctulimit eref=0.001 emin=0.0001 emax=0.1
47 - Input event list, counts cube or observation definition XML file [obs.xml]  
48 - Source of interest [Test]  
49 - Input model definition XML file [model_lat_ulimit.xml] 47 + Input event list, counts cube or observation definition XML file [events.fits] obs.xml
  48 + Source of interest [Crab] Test
  49 + Input model definition XML file [$CTOOLS/share/models/crab.xml] models_ulimit.xml
50 50
51 The results of the upper limit computation can then be extracted from the 51 The results of the upper limit computation can then be extracted from the
52 ``ctulimit.log`` file that is created by :ref:`ctulimit`: 52 ``ctulimit.log`` file that is created by :ref:`ctulimit`:
53 53
54 .. code-block:: bash 54 .. code-block:: bash
55 55
56 - 2017-08-26T14:37:48: +=====================+  
57 - 2017-08-26T14:37:48: | Upper limit results |  
58 - 2017-08-26T14:37:48: +=====================+  
59 - 2017-08-26T14:37:48: Differential flux limit ...: 1.00100099727198e-13 ph/cm2/s/MeV at 0.001 TeV  
60 - 2017-08-26T14:37:48: Integral flux limit .......: 9.9999999627471e-10 ph/cm2/s within [0.0001-0.1] TeV  
61 - 2017-08-26T14:37:48: Energy flux limit .........: 1.10785216561628e-12 erg/cm2/s within [0.0001-0.1] TeV 56 + 2018-01-25T20:43:02: +=====================+
  57 + 2018-01-25T20:43:02: | Upper limit results |
  58 + 2018-01-25T20:43:02: +=====================+
  59 + 2018-01-25T20:43:02: Differential flux limit ...: 1.00100099727198e-13 ph/cm2/s/MeV at 0.001 TeV
  60 + 2018-01-25T20:43:02: Integral flux limit .......: 9.9999999627471e-10 ph/cm2/s within [0.0001-0.1] TeV
  61 + 2018-01-25T20:43:02: Energy flux limit .........: 1.10785216561628e-12 erg/cm2/s within [0.0001-0.1] TeV
doc/source/users/tutorials/howto/fermi/index.rst
@@ -33,5 +33,6 @@ tutorial that is based on a simple analysis of the Vela pulsar. @@ -33,5 +33,6 @@ tutorial that is based on a simple analysis of the Vela pulsar.
33 howto_fermi_fitting 33 howto_fermi_fitting
34 howto_fermi_butterfly 34 howto_fermi_butterfly
35 howto_fermi_spectrum 35 howto_fermi_spectrum
  36 + howto_fermi_tsmap
36 howto_fermi_ulimit 37 howto_fermi_ulimit
37 howto_fermi_errors 38 howto_fermi_errors