Commit f356e83ed9a86242173cdb15186d43806b775300

Authored by Jürgen Knödlseder
1 parent 7f2f1e64

Update the Python description

doc/source/user_manual/getting_started/python.rst
@@ -20,7 +20,7 @@ generally not very useful. @@ -20,7 +20,7 @@ generally not very useful.
20 20
21 .. warning:: 21 .. warning::
22 22
23 - The GammaLib module needs to be imported before the ctools 23 + The GammaLib module needs to be imported **before** the ctools
24 module so that GammaLib class types are handled correctly. 24 module so that GammaLib class types are handled correctly.
25 So make sure that you **always import the GammaLib module before the ctools 25 So make sure that you **always import the GammaLib module before the ctools
26 module.** 26 module.**
@@ -114,11 +114,12 @@ To see what kind of object you actually got, use: @@ -114,11 +114,12 @@ To see what kind of object you actually got, use:
114 >>> type(sim.obs()[0].events()) 114 >>> type(sim.obs()[0].events())
115 <class 'gammalib.cta.GCTAEventList'> 115 <class 'gammalib.cta.GCTAEventList'>
116 116
117 -The CTA event list is implement as the ``GCTAEventList`` class in the 117 +The CTA event list is implement by the ``GCTAEventList`` class in the
118 ``cta`` module of GammaLib. 118 ``cta`` module of GammaLib.
119 To visualise the individual events you can iterate over the events using a 119 To visualise the individual events you can iterate over the events using a
120 for loop. 120 for loop.
121 -This will show the simulated celestial coordinates (RA, DEC), energies and 121 +This will show the simulated celestial coordinates (RA, DEC), the
  122 +coordinate in the camera system [DETX, DETY], energies and
122 terrestrial times (TT) of all events. 123 terrestrial times (TT) of all events.
123 124
124 .. code-block:: python 125 .. code-block:: python
@@ -178,11 +179,11 @@ Where are the user parameters? @@ -178,11 +179,11 @@ Where are the user parameters?
178 :ref:`ctlike` doesn't in fact need any as all the relevant information is 179 :ref:`ctlike` doesn't in fact need any as all the relevant information is
179 already contained in the observation container produced by the 180 already contained in the observation container produced by the
180 :ref:`ctobssim` class. 181 :ref:`ctobssim` class.
181 -And you make have recognised that we constructed the :ref:`ctlike` 182 +And you may have recognised that we constructed the :ref:`ctlike`
182 instance by using the :ref:`ctobssim` observation container as 183 instance by using the :ref:`ctobssim` observation container as
183 constructor argument. 184 constructor argument.
184 185
185 -To check how the fit went you may inspect the optimiser class used by 186 +To check how the fit went you can inspect the optimiser used by
186 :ref:`ctlike`: 187 :ref:`ctlike`:
187 188
188 .. code-block:: python 189 .. code-block:: python
@@ -198,8 +199,10 @@ To check how the fit went you may inspect the optimiser class used by @@ -198,8 +199,10 @@ To check how the fit went you may inspect the optimiser class used by
198 Number of iterations ......: 2 199 Number of iterations ......: 2
199 Lambda ....................: 1e-05 200 Lambda ....................: 1e-05
200 201
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 +Apparently, the fit converged after 2 iterations.
  203 +Out of 10 parameters in the model 4 have been fitted (the others were kept
  204 +fixed).
  205 +To inspect the fit results you can print the model container that is a
203 member of the observation container: 206 member of the observation container:
204 207
205 .. code-block:: python 208 .. code-block:: python
@@ -298,7 +301,7 @@ the ``fix()`` method. @@ -298,7 +301,7 @@ the ``fix()`` method.
298 is okay as the ``ctools.ctlike(sim.obs())`` constructor will create 301 is okay as the ``ctools.ctlike(sim.obs())`` constructor will create
299 a copy of the observation container that lives within the :ref:`ctlike` 302 a copy of the observation container that lives within the :ref:`ctlike`
300 instance. 303 instance.
301 - To preserve an observation container after a ctools object went out 304 + To preserve an observation container after a ctools object goes out
302 of scope you have to create a local copy of the container using the 305 of scope you have to create a local copy of the container using the
303 ``copy()`` method: 306 ``copy()`` method:
304 307
@@ -327,8 +330,8 @@ Here an example of how to use ``obsutils``: @@ -327,8 +330,8 @@ Here an example of how to use ``obsutils``:
327 >>> import ctools 330 >>> import ctools
328 >>> from ctools import obsutils 331 >>> from ctools import obsutils
329 >>> pattern = obsutils.set_obs_patterns("four", ra=83.63, dec=22.01, offset=1.0) 332 >>> pattern = obsutils.set_obs_patterns("four", ra=83.63, dec=22.01, offset=1.0)
330 - >>> obs = obsutils.set_obs_list(pattern, duration=1800, emin=0.1, emax=100.0, rad=5.0, caldb="dummy", irf="cta_dummy_irf")  
331 - >>> print(like.obs()) 333 + >>> obs = obsutils.set_obs_list(pattern, duration=1800, emin=0.1, emax=100.0, rad=5.0, caldb="prod2", irf="South_50h")
  334 + >>> print(obs)
332 === GObservations === 335 === GObservations ===
333 Number of observations ....: 4 336 Number of observations ....: 4
334 Number of predicted events : 0 337 Number of predicted events : 0
@@ -339,7 +342,7 @@ Here an example of how to use ``obsutils``: @@ -339,7 +342,7 @@ Here an example of how to use ``obsutils``:
339 >>> print(like.obs().models()) 342 >>> print(like.obs().models())
340 === GModels === 343 === GModels ===
341 Number of models ..........: 2 344 Number of models ..........: 2
342 - Number of parameters ......: 9 345 + Number of parameters ......: 10
343 ... 346 ...
344 347
345 The module is imported using the ``from ctools import obsutils`` directive. 348 The module is imported using the ``from ctools import obsutils`` directive.