Commit 7f2f1e64fb48fa8f7051778305ca2471d71fcd70

Authored by Jürgen Knödlseder
1 parent 06ad3937

Update the Python description

doc/source/user_manual/getting_started/python.rst
@@ -42,8 +42,8 @@ way as if it were executed from the command line. @@ -42,8 +42,8 @@ way as if it were executed from the command line.
42 >>> sim = ctools.ctobssim() 42 >>> sim = ctools.ctobssim()
43 >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml") 43 >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml")
44 >>> sim["outevents"].filename("events.fits") 44 >>> sim["outevents"].filename("events.fits")
45 - >>> sim["caldb"].string("dummy")  
46 - >>> sim["irf"].string("cta_dummy_irf") 45 + >>> sim["caldb"].string("prod2")
  46 + >>> sim["irf"].string("South_50h")
47 >>> sim["ra"].real(83.63) 47 >>> sim["ra"].real(83.63)
48 >>> sim["dec"].real(22.01) 48 >>> sim["dec"].real(22.01)
49 >>> sim["rad"].real(5.0) 49 >>> sim["rad"].real(5.0)
@@ -95,13 +95,13 @@ in that observation you may type: @@ -95,13 +95,13 @@ in that observation you may type:
95 95
96 >>> print(sim.obs()[0].events()) 96 >>> print(sim.obs()[0].events())
97 === GCTAEventList === 97 === GCTAEventList ===
98 - Number of events ..........: 12152 98 + Number of events ..........: 31928
99 Time interval .............: 51544.5 - 51544.5 days 99 Time interval .............: 51544.5 - 51544.5 days
100 === GEbounds === 100 === GEbounds ===
101 Number of intervals .......: 1 101 Number of intervals .......: 1
102 Energy range ..............: 100 GeV - 100 TeV 102 Energy range ..............: 100 GeV - 100 TeV
103 === GCTARoi === 103 === GCTARoi ===
104 - ROI centre ................: RA=83.63, DEC=22.01 [0, 0] 104 + ROI centre ................: RA=83.63, DEC=22.01 [0,0]
105 ROI radius ................: 5 deg 105 ROI radius ................: 5 deg
106 106
107 The ``obs()[0]`` operator returns the first observation in the observation 107 The ``obs()[0]`` operator returns the first observation in the observation
@@ -127,9 +127,9 @@ terrestrial times (TT) of all events. @@ -127,9 +127,9 @@ terrestrial times (TT) of all events.
127 >>> for event in events: 127 >>> for event in events:
128 ... print(event) 128 ... print(event)
129 ... 129 ...
130 - Dir=RA=83.6477, DEC=22.0202 [0.000178879, 0.000286637] Energy=3.235 TeV Time=-3.15576e+08 s (TT)  
131 - Dir=RA=83.482, DEC=22.0189 [0.000155643, -0.00239471] Energy=141.949 GeV Time=-3.15576e+08 s (TT)  
132 - Dir=RA=83.6058, DEC=22.1586 [0.00259306, -0.000391919] Energy=316.376 GeV Time=-3.15576e+08 s (TT) 130 + Dir=RA=83.5759, DEC=21.9757 [-0.000597839,-0.000875483] Energy=328.153 GeV Time=-3.15576e+08 s (TT)
  131 + Dir=RA=83.5775, DEC=22.0128 [4.88943e-05,-0.000849504] Energy=353.264 GeV Time=-3.15576e+08 s (TT)
  132 + Dir=RA=83.4302, DEC=21.931 [-0.00137616,-0.0032343] Energy=117.999 GeV Time=-3.15576e+08 s (TT)
133 ... 133 ...
134 134
135 .. note:: 135 .. note::
@@ -150,13 +150,13 @@ terrestrial times (TT) of all events. @@ -150,13 +150,13 @@ terrestrial times (TT) of all events.
150 >>> sim.run() 150 >>> sim.run()
151 >>> print(sim.obs()[0].events()) 151 >>> print(sim.obs()[0].events())
152 === GCTAEventList === 152 === GCTAEventList ===
153 - Number of events ..........: 6141 153 + Number of events ..........: 15964
154 Time interval .............: 51544.5 - 51544.5 days 154 Time interval .............: 51544.5 - 51544.5 days
155 === GEbounds === 155 === GEbounds ===
156 Number of intervals .......: 1 156 Number of intervals .......: 1
157 Energy range ..............: 100 GeV - 100 TeV 157 Energy range ..............: 100 GeV - 100 TeV
158 === GCTARoi === 158 === GCTARoi ===
159 - ROI centre ................: RA=83.63, DEC=22.01 [0, 0] 159 + ROI centre ................: RA=83.63, DEC=22.01 [0,0]
160 ROI radius ................: 5 deg 160 ROI radius ................: 5 deg
161 161
162 162
@@ -189,14 +189,14 @@ To check how the fit went you may inspect the optimiser class used by @@ -189,14 +189,14 @@ To check how the fit went you may inspect the optimiser class used by
189 189
190 >>> print(like.opt()) 190 >>> print(like.opt())
191 === GOptimizerLM === 191 === GOptimizerLM ===
192 - Optimized function value ..: 44578.761 192 + Optimized function value ..: 101048.382
193 Absolute precision ........: 0.005 193 Absolute precision ........: 0.005
194 Acceptable value decrease .: 2 194 Acceptable value decrease .: 2
195 Optimization status .......: converged 195 Optimization status .......: converged
196 - Number of parameters ......: 9 196 + Number of parameters ......: 10
197 Number of free parameters .: 4 197 Number of free parameters .: 4
198 - Number of iterations ......: 3  
199 - Lambda ....................: 1e-06 198 + Number of iterations ......: 2
  199 + Lambda ....................: 1e-05
200 200
201 Apparently, the fit converged after fitting 4 parameters in 3 iterations. 201 Apparently, the fit converged after fitting 4 parameters in 3 iterations.
202 To inspect the fit results you may print the model container that is a 202 To inspect the fit results you may print the model container that is a
@@ -207,7 +207,7 @@ member of the observation container: @@ -207,7 +207,7 @@ member of the observation container:
207 >>> print(like.obs().models()) 207 >>> print(like.obs().models())
208 === GModels === 208 === GModels ===
209 Number of models ..........: 2 209 Number of models ..........: 2
210 - Number of parameters ......: 9 210 + Number of parameters ......: 10
211 === GModelSky === 211 === GModelSky ===
212 Name ......................: Crab 212 Name ......................: Crab
213 Instruments ...............: all 213 Instruments ...............: all
@@ -220,24 +220,24 @@ member of the observation container: @@ -220,24 +220,24 @@ member of the observation container:
220 RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) 220 RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
221 DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) 221 DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
222 Number of spectral par's ..: 3 222 Number of spectral par's ..: 3
223 - Prefactor ................: 6.13265e-16 +/- 2.05734e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)  
224 - Index ....................: -2.50565 +/- 0.0250831 [-0,-5] (free,scale=-1,gradient) 223 + Prefactor ................: 5.80565e-16 +/- 1.11147e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient)
  224 + Index ....................: -2.49266 +/- 0.0163476 [-0,-5] (free,scale=-1,gradient)
225 PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) 225 PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
226 Number of temporal par's ..: 1 226 Number of temporal par's ..: 1
227 - Constant .................: 1 (relative value) (fixed,scale=1,gradient)  
228 - === GCTAModelRadialAcceptance ===  
229 - Name ......................: Background 227 + Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
  228 + === GCTAModelIrfBackground ===
  229 + Name ......................: CTABackgroundModel
230 Instruments ...............: CTA 230 Instruments ...............: CTA
231 Instrument scale factors ..: unity 231 Instrument scale factors ..: unity
232 Observation identifiers ...: all 232 Observation identifiers ...: all
233 - Model type ................: "Gaussian" * "FileFunction" * "Constant"  
234 - Number of parameters ......: 3  
235 - Number of radial par's ....: 1  
236 - Sigma ....................: 3.03693 +/- 0.0304896 [0.01,10] deg2 (free,scale=1,gradient)  
237 - Number of spectral par's ..: 1  
238 - Normalization ............: 0.998667 +/- 0.0172585 [0,1000] (free,scale=1,gradient) 233 + Model type ................: "PowerLaw" * "Constant"
  234 + Number of parameters ......: 4
  235 + Number of spectral par's ..: 3
  236 + Prefactor ................: 1.01701 +/- 0.0216563 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient)
  237 + Index ....................: 0.0230864 +/- 0.0123006 [-5,5] (free,scale=1,gradient)
  238 + PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
239 Number of temporal par's ..: 1 239 Number of temporal par's ..: 1
240 - Constant .................: 1 (relative value) (fixed,scale=1,gradient) 240 + Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
241 241
242 Suppose you want to repeat the fit by optimising also the position of the 242 Suppose you want to repeat the fit by optimising also the position of the
243 point source. 243 point source.
@@ -250,8 +250,8 @@ This is easy from Python: @@ -250,8 +250,8 @@ This is easy from Python:
250 >>> like.run() 250 >>> like.run()
251 >>> print(like.obs().models()) 251 >>> print(like.obs().models())
252 ... 252 ...
253 - RA .......................: 83.633 +/- 0.00137216 [-360,360] deg (free,scale=1)  
254 - DEC ......................: 22.0144 +/- 0.00127247 [-90,90] deg (free,scale=1) 253 + RA .......................: 83.6341 +/- 0.000958947 [-360,360] deg (free,scale=1)
  254 + DEC ......................: 22.0139 +/- 0.000870912 [-90,90] deg (free,scale=1)
255 255
256 The ``like.obs().models()`` method provides the model container, using the 256 The ``like.obs().models()`` method provides the model container, using the
257 ``["Crab"]`` operator we access the Crab model in that container and using 257 ``["Crab"]`` operator we access the Crab model in that container and using
@@ -293,7 +293,7 @@ the ``fix()`` method. @@ -293,7 +293,7 @@ the ``fix()`` method.
293 >>> print(like.obs()) 293 >>> print(like.obs())
294 === GObservations === 294 === GObservations ===
295 Number of observations ....: 1 295 Number of observations ....: 1
296 - Number of predicted events : 6141 296 + Number of predicted events : 15964
297 297
298 is okay as the ``ctools.ctlike(sim.obs())`` constructor will create 298 is okay as the ``ctools.ctlike(sim.obs())`` constructor will create
299 a copy of the observation container that lives within the :ref:`ctlike` 299 a copy of the observation container that lives within the :ref:`ctlike`