Commit 0c62eb0dfb5c4da87de0a105bba9580e734b5965
1 parent
97e3960e
Do some minor corrections.
Showing
1 changed file
with
33 additions
and
99 deletions
doc/source/user_manual/getting_started/quickstart.rst
| @@ -641,6 +641,7 @@ the same events for both analyses. | @@ -641,6 +641,7 @@ the same events for both analyses. | ||
| 641 | 2014-01-09T21:47:54: | 641 | 2014-01-09T21:47:54: |
| 642 | 2014-01-09T21:47:54: Application "ctlike" terminated after 6 wall clock seconds, consuming 0.163384 seconds of CPU time. | 642 | 2014-01-09T21:47:54: Application "ctlike" terminated after 6 wall clock seconds, consuming 0.163384 seconds of CPU time. |
| 643 | 643 | ||
| 644 | + | ||
| 644 | .. _sec_butterfly_cta: | 645 | .. _sec_butterfly_cta: |
| 645 | 646 | ||
| 646 | Calculate and visualise butterfly | 647 | Calculate and visualise butterfly |
| @@ -649,119 +650,52 @@ Calculate and visualise butterfly | @@ -649,119 +650,52 @@ Calculate and visualise butterfly | ||
| 649 | To visualise the analysis results retrieved above, one can calculate the | 650 | To visualise the analysis results retrieved above, one can calculate the |
| 650 | confidence band of the spectral fit. The tool ctbutterfly takes the optimised | 651 | confidence band of the spectral fit. The tool ctbutterfly takes the optimised |
| 651 | source model as input. It takes the covariance matrix from the fit to conduct a | 652 | source model as input. It takes the covariance matrix from the fit to conduct a |
| 652 | -Gaussian error propagation for each energy value. | ||
| 653 | -The following example shows how to compute such a butterfly from the command line | ||
| 654 | -and subsequently shows how to visualise the spectral fit using matplotlib. | 653 | +Gaussian error propagation for each energy value. It will write the |
| 654 | +butterfly information into an ASCII file. | ||
| 655 | +The following example shows how to compute such a butterfly from the command | ||
| 656 | +line. | ||
| 655 | 657 | ||
| 656 | .. code-block:: bash | 658 | .. code-block:: bash |
| 657 | 659 | ||
| 658 | $ ctbutterfly | 660 | $ ctbutterfly |
| 659 | Input event list, cube or observation definition file [$CTOOLS/test/data/crab_events.fits.gz] | 661 | Input event list, cube or observation definition file [$CTOOLS/test/data/crab_events.fits.gz] |
| 660 | - Calibration database [share/caldb/data/cta/dummy//cta_dummy_irf] share/caldb/data/cta/dummy/bcf/ | ||
| 661 | - Instrument response function [cta_dummy_irf] | ||
| 662 | - Source model [$CTOOLS/test/data/crab.xml] | ||
| 663 | - Source of interest [CrabNebula] Crab | ||
| 664 | - Start value for first energy bin in TeV [0.1] | ||
| 665 | - Stop value for last energy bin in TeV [100.] | ||
| 666 | - Output ascii file [butterfly.txt] | 662 | + Calibration database [share/caldb/data/cta/dummy//cta_dummy_irf] share/caldb/data/cta/dummy/bcf/ |
| 663 | + Instrument response function [cta_dummy_irf] | ||
| 664 | + Source model [$CTOOLS/test/data/crab.xml] | ||
| 665 | + Source of interest [CrabNebula] Crab | ||
| 666 | + Start value for first energy bin in TeV [0.1] | ||
| 667 | + Stop value for last energy bin in TeV [100.] | ||
| 668 | + Output ascii file [butterfly.txt] | ||
| 667 | 669 | ||
| 668 | Below some lines of the ``ctbutterfly.log``: | 670 | Below some lines of the ``ctbutterfly.log``: |
| 669 | 671 | ||
| 670 | .. code-block:: xml | 672 | .. code-block:: xml |
| 671 | 673 | ||
| 672 | - 2014-10-30T17:51:24: ******************************************************************************** | ||
| 673 | - 2014-10-30T17:51:24: * ctbutterfly * | ||
| 674 | - 2014-10-30T17:51:24: * ---------------------------------------------------------------------------- * | ||
| 675 | - 2014-10-30T17:51:24: * Version: 00-01-00 * | ||
| 676 | - 2014-10-30T17:51:24: ******************************************************************************** | ||
| 677 | - 2014-10-30T17:51:39: +============+ | ||
| 678 | - 2014-10-30T17:51:39: | Parameters | | ||
| 679 | - 2014-10-30T17:51:39: +============+ | ||
| 680 | - 2014-10-30T17:51:39: infile ....................: $CTOOLS/test/data/crab_events.fits.gz | ||
| 681 | - 2014-10-30T17:51:39: srcmdl ....................: $CTOOLS/test/data/crab.xml | ||
| 682 | - 2014-10-30T17:51:39: srcname ...................: Crab | ||
| 683 | - 2014-10-30T17:51:39: caldb .....................: share/caldb/data/cta/dummy/bcf/ | ||
| 684 | - 2014-10-30T17:51:39: irf .......................: cta_dummy_irf | ||
| 685 | - 2014-10-30T17:51:39: outfile ...................: butterfly.txt | ||
| 686 | - 2014-10-30T17:51:39: matrix ....................: NONE | ||
| 687 | - 2014-10-30T17:51:39: ebinalg ...................: LOG | ||
| 688 | - 2014-10-30T17:51:39: emin ......................: 0.1 | ||
| 689 | - 2014-10-30T17:51:39: emax ......................: 100. | ||
| 690 | - 2014-10-30T17:51:39: enumbins ..................: 100 | ||
| 691 | - 2014-10-30T17:51:39: ebinfile ..................: NONE | ||
| 692 | - 2014-10-30T17:51:39: chatter ...................: 2 | ||
| 693 | - 2014-10-30T17:51:39: clobber ...................: yes | ||
| 694 | - 2014-10-30T17:51:39: debug .....................: no | ||
| 695 | - 2014-10-30T17:51:39: mode ......................: ql | ||
| 696 | - 2014-10-30T17:51:39: logfile ...................: ctbutterfly.log | ||
| 697 | - 2014-10-30T17:51:39: | ||
| 698 | - 2014-10-30T17:51:39: +=============+ | ||
| 699 | - 2014-10-30T17:51:39: | Observation | | ||
| 700 | - 2014-10-30T17:51:39: +=============+ | ||
| 701 | - 2014-10-30T17:51:39: === GObservations === | ||
| 702 | - 2014-10-30T17:51:39: Number of observations ....: 1 | ||
| 703 | - 2014-10-30T17:51:39: Number of predicted events : 0 | ||
| 704 | - 2014-10-30T17:51:39: === GCTAObservation === | ||
| 705 | - 2014-10-30T17:51:39: Name ......................: | ||
| 706 | - 2014-10-30T17:51:39: Identifier ................: | ||
| 707 | - 2014-10-30T17:51:39: Instrument ................: CTA | ||
| 708 | - 2014-10-30T17:51:39: Event file ................: test/data/crab_events.fits.gz | ||
| 709 | - 2014-10-30T17:51:39: Event type ................: EventList | ||
| 710 | - 2014-10-30T17:51:39: Statistics ................: Poisson | ||
| 711 | - 2014-10-30T17:51:39: Ontime ....................: 1800 s | ||
| 712 | - 2014-10-30T17:51:39: Livetime ..................: 1710 s | ||
| 713 | - 2014-10-30T17:51:39: Deadtime correction .......: 0.95 | ||
| 714 | - 2014-10-30T17:51:39: === GCTAPointing === | ||
| 715 | - 2014-10-30T17:51:39: Pointing direction ........: (RA,Dec)=(83.63,22.01) | ||
| 716 | - 2014-10-30T17:51:39: === GCTAResponseIrf === | ||
| 717 | - 2014-10-30T17:51:39: Response name .............: cta_dummy_irf | ||
| 718 | - 2014-10-30T17:51:39: Energy dispersion .........: Not used | ||
| 719 | - 2014-10-30T17:51:39: === GCaldb === | ||
| 720 | - 2014-10-30T17:51:39: Database root .............: share/caldb/data/cta/dummy/bcf/ | ||
| 721 | - 2014-10-30T17:51:39: === GCTAAeffPerfTable === | ||
| 722 | - 2014-10-30T17:51:39: Filename ..................: share/caldb/data/cta/dummy/bcf//cta_dummy_irf.dat | ||
| 723 | - 2014-10-30T17:51:39: Number of energy bins .....: 20 | ||
| 724 | - 2014-10-30T17:51:39: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | ||
| 725 | - 2014-10-30T17:51:39: Offset angle dependence ...: Fixed sigma=3 | ||
| 726 | - 2014-10-30T17:51:39: === GCTAPsfPerfTable === | ||
| 727 | - 2014-10-30T17:51:39: Filename ..................: share/caldb/data/cta/dummy/bcf//cta_dummy_irf.dat | ||
| 728 | - 2014-10-30T17:51:39: Number of energy bins .....: 20 | ||
| 729 | - 2014-10-30T17:51:39: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | ||
| 730 | - 2014-10-30T17:51:39: === GCTAEdispPerfTable === | ||
| 731 | - 2014-10-30T17:51:39: Filename ..................: share/caldb/data/cta/dummy/bcf//cta_dummy_irf.dat | ||
| 732 | - 2014-10-30T17:51:39: Number of energy bins .....: 20 | ||
| 733 | - 2014-10-30T17:51:39: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | ||
| 734 | - 2014-10-30T17:51:39: === GCTABackgroundPerfTable === | ||
| 735 | - 2014-10-30T17:51:39: Filename ..................: share/caldb/data/cta/dummy/bcf//cta_dummy_irf.dat | ||
| 736 | - 2014-10-30T17:51:39: Number of energy bins .....: 20 | ||
| 737 | - 2014-10-30T17:51:39: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | ||
| 738 | - 2014-10-30T17:51:39: Offset angle dependence ...: Fixed sigma=3 | ||
| 739 | - 2014-10-30T17:51:39: === GCTAEventList === | ||
| 740 | - 2014-10-30T17:51:39: Number of events ..........: 6141 | ||
| 741 | - 2014-10-30T17:51:39: Time interval .............: 51544.5 - 51544.5 days | ||
| 742 | - 2014-10-30T17:51:39: | ||
| 743 | - 2014-10-30T17:51:39: +===========================+ | ||
| 744 | - 2014-10-30T17:51:39: | Compute covariance matrix | | ||
| 745 | - 2014-10-30T17:51:39: +===========================+ | ||
| 746 | - 2014-10-30T17:51:39: | ||
| 747 | - 2014-10-30T17:51:39: +====================+ | ||
| 748 | - 2014-10-30T17:51:39: | Generate butterfly | | ||
| 749 | - 2014-10-30T17:51:39: +====================+ | ||
| 750 | - 2014-10-30T17:51:39: | ||
| 751 | - 2014-10-30T17:51:39: +========================+ | ||
| 752 | - 2014-10-30T17:51:39: | Save Butterfly to file | | ||
| 753 | - 2014-10-30T17:51:39: +========================+ | ||
| 754 | - 2014-10-30T17:51:39: | ||
| 755 | - 2014-10-30T17:51:39: Application "ctbutterfly" terminated after 15 wall clock seconds, consuming 0.051253 seconds of CPU time. | ||
| 756 | - | ||
| 757 | -Now that you have computed the confidence band of the spectral fit, you can visualise | ||
| 758 | -file with an example script. The script is located in the "examples" folder. Make sure you | ||
| 759 | -have installed matplotlib on your system. Then run the following script: | 674 | + 2014-10-30T17:51:39: +===========================+ |
| 675 | + 2014-10-30T17:51:39: | Compute covariance matrix | | ||
| 676 | + 2014-10-30T17:51:39: +===========================+ | ||
| 677 | + 2014-10-30T17:51:39: | ||
| 678 | + 2014-10-30T17:51:39: +====================+ | ||
| 679 | + 2014-10-30T17:51:39: | Generate butterfly | | ||
| 680 | + 2014-10-30T17:51:39: +====================+ | ||
| 681 | + 2014-10-30T17:51:39: | ||
| 682 | + 2014-10-30T17:51:39: +========================+ | ||
| 683 | + 2014-10-30T17:51:39: | Save Butterfly to file | | ||
| 684 | + 2014-10-30T17:51:39: +========================+ | ||
| 685 | + 2014-10-30T17:51:39: | ||
| 686 | + 2014-10-30T17:51:39: Application "ctbutterfly" terminated after 15 wall clock seconds, consuming 0.051253 seconds of CPU time. | ||
| 687 | + | ||
| 688 | +Now that you have computed the confidence band of the spectral fit and | ||
| 689 | +that you will have an ASCII file named ``butterfly.txt'' on disk you can | ||
| 690 | +visualise the butterfly using the script ``show_butterfly.py'' that is | ||
| 691 | +in the ctools ``example'' folder. You will need matplotlib on your system | ||
| 692 | +to make this work. To launch the script, type: | ||
| 760 | 693 | ||
| 761 | .. code-block:: bash | 694 | .. code-block:: bash |
| 762 | - python $CTOOLS/examples/show_butterfly.py butterfly.txt | 695 | + python $CTOOLS/examples/python/show_butterfly.py butterfly.txt |
| 763 | 696 | ||
| 764 | This will result in a canvas which should look like the following: | 697 | This will result in a canvas which should look like the following: |
| 698 | + | ||
| 765 | .. figure:: butterfly.jpg | 699 | .. figure:: butterfly.jpg |
| 766 | :width: 60% | 700 | :width: 60% |
| 767 | 701 |