Commit 17fc888cf3c27b8095591fb46d8a7e40f5c752f1

Authored by Christoph Deil
1 parent a9c1de33

Minor cleanup of Python docs

doc/source/user_manual/getting_started/python.rst
... ... @@ -365,8 +365,7 @@ assumed that you have a ctlike object called 'like' which is setup and runs:
365 365 import ctools
366 366 like = ctools.ctlike(sim.obs())
367 367 like.run()
368   - ...
369   -
  368 +
370 369 * Best-fit parameters:
371 370  
372 371 The following command shows how to access the fit parameters and errors:
... ... @@ -376,31 +375,27 @@ assumed that you have a ctlike object called 'like' which is setup and runs:
376 375 obs = like.obs() # Get observations object
377 376 obs.models()["Crab"]["Prefactor"].value() # This returns the actual fit value
378 377 obs.models()["Crab"]["Prefactor"].error() # This returns the actual fit error
379   - ...
380 378  
381 379 * Open XML model file from python and print models on screen:
382 380  
383 381 .. code-block:: python
384 382  
385 383 models = gammalib.GModels("$CTOOLS/share/models/crab.xml")
386   - print models
387   - ...
388   -
  384 + print(models)
  385 +
389 386 * Likelihood value
390 387  
391 388 .. code-block:: python
392 389  
393 390 like.opt().value() # Returns likelihood value
394   - ...
395   -
  391 +
396 392 * Covariance Matrix
397 393  
398 394 .. code-block:: python
399 395  
400 396 covariance = like.opt().curvature().invert() # Return GMatrix object
401   - print covariance
402   - ...
403   -
  397 + print(covariance)
  398 +
404 399 Modify and work on XML models
405 400 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406 401  
... ... @@ -409,52 +404,45 @@ Modify and work on XML models
409 404 .. code-block:: python
410 405  
411 406 models["Crab"]["Prefactor"].fix()
412   - ...
413   -
  407 +
414 408 * Release a certain parameter
415 409  
416 410 .. code-block:: python
417 411  
418 412 models["Crab"]["Prefactor"].free()
419   - ...
420   -
  413 +
421 414 * Check if parameter is free
422 415  
423 416 .. code-block:: python
424 417  
425 418 models["Crab"]["Prefactor"].is_free()
426   - ...
427   -
  419 +
428 420 * Set parameter value
429 421  
430 422 .. code-block:: python
431 423  
432 424 models["Crab"]["Index"].value(-2.5)
433   - ...
434   -
  425 +
435 426 * Set parameter boundaries
436 427  
437 428 .. code-block:: python
438 429  
439 430 models["Crab"]["Index"].min(-5.0)
440 431 models["Crab"]["Index"].max(-1.0)
441   - ...
442   -
  432 +
443 433 * Loop over models and parameters (e.g. fix all parameters)
444 434  
445   - .. code-block:: python
446   -
447   - for model in models: # Loop over models
448   - for par in model: # Loop over parameters
449   - par.fix() # fix parameter
450   - ...
451   -
  435 + .. code-block:: python
  436 +
  437 + for model in models: # Loop over models
  438 + for par in model: # Loop over parameters
  439 + par.fix() # fix parameter
  440 +
452 441 * Save modified XML model
453 442  
454 443 .. code-block:: python
455 444  
456   - models.save("myXMLmodel.xml")
457   - ...
  445 + models.save("my_model.xml")
458 446  
459 447  
460 448 Beyond the first steps
... ...