Commit 34d6c7fd22a6a7e6dd96b3ebfcb2730f14d86db8
1 parent
f2a352d5
Simplify GApplication parameter setting from Python in user manual
Showing
1 changed file
with
15 additions
and
20 deletions
doc/source/user_manual/getting_started/python.rst
| ... | ... | @@ -29,29 +29,26 @@ To illustrate how to use ctools from Python, below is a working example |
| 29 | 29 | of an event list simulation using the :ref:`ctobssim` class. |
| 30 | 30 | An instance ``sim`` of the :ref:`ctobssim` class is generated and user |
| 31 | 31 | parameters are set for this instance using the ``[ ]`` operator. |
| 32 | -Note that specific methods exist for [file], [string], [real], [integer], | |
| 33 | -and [boolean] parameter types (see the :ref:`reference` for a list of | |
| 34 | -parameters and their types). | |
| 32 | +See the :ref:`reference` for a list of parameters and their types). | |
| 35 | 33 | The ``execute()`` method executes the :ref:`ctobssim` class in the same |
| 36 | 34 | way as if it were executed from the command line. |
| 37 | 35 | |
| 38 | 36 | .. code-block:: python |
| 39 | 37 | |
| 40 | - >>> import gammalib | |
| 41 | - >>> import ctools | |
| 42 | - >>> sim = ctools.ctobssim() | |
| 43 | - >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml") | |
| 44 | - >>> sim["outevents"].filename("events.fits") | |
| 45 | - >>> sim["caldb"].string("prod2") | |
| 46 | - >>> sim["irf"].string("South_50h") | |
| 47 | - >>> sim["ra"].real(83.63) | |
| 48 | - >>> sim["dec"].real(22.01) | |
| 49 | - >>> sim["rad"].real(5.0) | |
| 50 | - >>> sim["tmin"].real(0.0) | |
| 51 | - >>> sim["tmax"].real(1800.0) | |
| 52 | - >>> sim["emin"].real(0.1) | |
| 53 | - >>> sim["emax"].real(100.0) | |
| 54 | - >>> sim.execute() | |
| 38 | + import ctools | |
| 39 | + sim = ctools.ctobssim() | |
| 40 | + sim["inmodel"] = "${CTOOLS}/share/models/crab.xml" | |
| 41 | + sim["outevents"] = "events.fits" | |
| 42 | + sim["caldb"] = "prod2" | |
| 43 | + sim["irf"] = "South_50h" | |
| 44 | + sim["ra"] = 83.63 | |
| 45 | + sim["dec"] = 22.01 | |
| 46 | + sim["rad"] = 5.0 | |
| 47 | + sim["tmin"] = 0 | |
| 48 | + sim["tmax"] = 1800 | |
| 49 | + sim["emin"] = 0.1 | |
| 50 | + sim["emax"] = 100 | |
| 51 | + sim.execute() | |
| 55 | 52 | |
| 56 | 53 | Alternatively, you may "run" the :ref:`ctobssim` tool using |
| 57 | 54 | |
| ... | ... | @@ -371,5 +368,3 @@ You now have learned the basics of using ctools and GammaLib within Python. |
| 371 | 368 | To go beyond these initial steps you may check the Python scripts in the |
| 372 | 369 | ``examples`` folder that provide useful analysis examples. |
| 373 | 370 | Check the ``README`` file in that folder for an explanation of the scripts. |
| 374 | - | |
| 375 | - | ... | ... |