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 42 >>> sim = ctools.ctobssim()
43 43 >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml")
44 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 47 >>> sim["ra"].real(83.63)
48 48 >>> sim["dec"].real(22.01)
49 49 >>> sim["rad"].real(5.0)
... ... @@ -95,13 +95,13 @@ in that observation you may type:
95 95  
96 96 >>> print(sim.obs()[0].events())
97 97 === GCTAEventList ===
98   - Number of events ..........: 12152
  98 + Number of events ..........: 31928
99 99 Time interval .............: 51544.5 - 51544.5 days
100 100 === GEbounds ===
101 101 Number of intervals .......: 1
102 102 Energy range ..............: 100 GeV - 100 TeV
103 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 105 ROI radius ................: 5 deg
106 106  
107 107 The ``obs()[0]`` operator returns the first observation in the observation
... ... @@ -127,9 +127,9 @@ terrestrial times (TT) of all events.
127 127 >>> for event in events:
128 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 135 .. note::
... ... @@ -150,13 +150,13 @@ terrestrial times (TT) of all events.
150 150 >>> sim.run()
151 151 >>> print(sim.obs()[0].events())
152 152 === GCTAEventList ===
153   - Number of events ..........: 6141
  153 + Number of events ..........: 15964
154 154 Time interval .............: 51544.5 - 51544.5 days
155 155 === GEbounds ===
156 156 Number of intervals .......: 1
157 157 Energy range ..............: 100 GeV - 100 TeV
158 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 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 189  
190 190 >>> print(like.opt())
191 191 === GOptimizerLM ===
192   - Optimized function value ..: 44578.761
  192 + Optimized function value ..: 101048.382
193 193 Absolute precision ........: 0.005
194 194 Acceptable value decrease .: 2
195 195 Optimization status .......: converged
196   - Number of parameters ......: 9
  196 + Number of parameters ......: 10
197 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 201 Apparently, the fit converged after fitting 4 parameters in 3 iterations.
202 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 207 >>> print(like.obs().models())
208 208 === GModels ===
209 209 Number of models ..........: 2
210   - Number of parameters ......: 9
  210 + Number of parameters ......: 10
211 211 === GModelSky ===
212 212 Name ......................: Crab
213 213 Instruments ...............: all
... ... @@ -220,24 +220,24 @@ member of the observation container:
220 220 RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
221 221 DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
222 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 225 PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient)
226 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 230 Instruments ...............: CTA
231 231 Instrument scale factors ..: unity
232 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 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 242 Suppose you want to repeat the fit by optimising also the position of the
243 243 point source.
... ... @@ -250,8 +250,8 @@ This is easy from Python:
250 250 >>> like.run()
251 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 256 The ``like.obs().models()`` method provides the model container, using the
257 257 ``["Crab"]`` operator we access the Crab model in that container and using
... ... @@ -293,7 +293,7 @@ the ``fix()`` method.
293 293 >>> print(like.obs())
294 294 === GObservations ===
295 295 Number of observations ....: 1
296   - Number of predicted events : 6141
  296 + Number of predicted events : 15964
297 297  
298 298 is okay as the ``ctools.ctlike(sim.obs())`` constructor will create
299 299 a copy of the observation container that lives within the :ref:`ctlike`
... ...