diff --git a/doc/source/user_manual/getting.rst b/doc/source/user_manual/getting.rst index f0561f6..87d8059 100644 --- a/doc/source/user_manual/getting.rst +++ b/doc/source/user_manual/getting.rst @@ -31,7 +31,7 @@ Installing gammalib ctools is built on top of gammalib, hence gammalib needs to be built, installed and configured before ctools can be installed. In case that ctools is already installed on your system you may skip reading this -section and continue with Section TBD that explains how to install ctools. +section and continue with the :ref:`sec_building_ctools` section. You will need the following to build the gammalib: @@ -59,7 +59,7 @@ in an appropriate location (for example ``$HOME/builds``), and type .. code-block:: bash - $ tar xvfz gammalib-1.0.0.tar.gz + $ tar xvfz gammalib-0.10.0.tar.gz (the ``$`` symbol indicates the console prompt and is not part of the command that you should type in). @@ -69,7 +69,7 @@ typing .. code-block:: bash - $ cd gammalib-1.0.0 + $ cd gammalib-0.10.0 $ ./configure $ make $ make check @@ -117,6 +117,8 @@ If you use C shell or a variant then add the following to your source $GAMMALIB/bin/gammalib-init.csh +.. _sec_building_ctools: + Building ctools --------------- @@ -125,7 +127,7 @@ an appropriate location (for example ``$HOME/builds``), and type .. code-block:: bash - $ tar xvfz ctools-1.0.0.tar.gz + $ tar xvfz ctools-0.9.0.tar.gz (the ``$`` symbol indicates the console prompt and is not part of the command that you should type in). @@ -134,7 +136,7 @@ Step in the directory and build the ctools by typing .. code-block:: bash - $ cd ctools-1.0.0 + $ cd ctools-0.9.0 $ ./configure $ make @@ -171,7 +173,7 @@ following output at the end of the unit testing: PASS: test_python.py make[4]: Nothing to be done for `all'. ============================================================================ - Testsuite summary for ctools 1.0.0 + Testsuite summary for ctools 0.9.0 ============================================================================ # TOTAL: 3 # PASS: 3 @@ -189,26 +191,33 @@ For older automake version, you should see *************** * Test ctools * *************** - Test ctobssim: .... ok + Test ctobssim: .. ok Test ctskymap: .. ok Test ctbin: .... ok - Test ctmodel: ...... ok - Test ctselect: .. ok - Test ctlike: ........ ok - Test cttsmap: .. ok Test ctexpcube: .... ok Test ctpsfcube: .... ok Test ctbkgcube: ...... ok + Test ctmodel: ...... ok + Test ctselect: .. ok + Test ctlike: ...... ok + Test cttsmap: .. ok Test ctcubemask: .. ok Test ctbutterfly: .. ok + Test ctulimit: .. ok PASS: test_ctools.sh ***************** * Test cscripts * ***************** + Test csobsdef: .. ok Test cspull: .. ok + Test cssens: .. ok Test cstsdist: .. ok Test csresmap: .. ok + Test csspec (unbinned): .. ok + Test csspec (binned): .. ok + Test cslightcrv (unbinned): .. ok + Test cslightcrv (binned): .. ok PASS: test_cscripts.sh *********************** @@ -227,6 +236,7 @@ For older automake version, you should see Test ctbkgcube functionality: ... ok Test ctcubemask functionality: ... ok Test ctbutterfly functionality: ... ok + Test ctulimit functionality: ... ok Test unbinned pipeline with FITS file saving: .... ok Test unbinned in-memory pipeline: .... ok PASS: test_python.py @@ -307,9 +317,8 @@ GammaLib unit tests fail Some users have reported failure of a large fraction of the GammaLib unit tests after after typing ``make check``. In all cases, this was related to -the absence of the directory where the shared ``libcfitsio`` library -resides in the library load path. To solve the issue, locate the directory -where the shared ``libcfitsio`` library resides and then type +not finding the ``libcfitsio`` library. To solve the issue, locate the +directory where the shared ``libcfitsio`` library resides and then type .. code-block:: bash diff --git a/doc/source/user_manual/getting_started/beyond_combine.rst b/doc/source/user_manual/getting_started/beyond_combine.rst index e2b3fdc..487eea8 100644 --- a/doc/source/user_manual/getting_started/beyond_combine.rst +++ b/doc/source/user_manual/getting_started/beyond_combine.rst @@ -20,12 +20,12 @@ nebula, each offset by 0.5 deg from the nebula in opposite directions: RA of pointing (degrees) (0-360) [83.63] Dec of pointing (degrees) (-90-90) [22.01] 21.51 Radius of FOV (degrees) (0-180) [5.0] - Start time (MET in s) (0) [0.0] - End time (MET in s) (0) [1800.0] - Lower energy limit (TeV) (0) [0.1] - Upper energy limit (TeV) (0) [100.0] - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Start time (MET in s) [0.0] + End time (MET in s) [1800.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] + Calibration database [prod2] + Instrument response function [South_50h] Model [$CTOOLS/share/models/crab.xml] Output event data file or observation definition file [events.fits] events1.fits @@ -35,12 +35,12 @@ nebula, each offset by 0.5 deg from the nebula in opposite directions: RA of pointing (degrees) (0-360) [83.63] Dec of pointing (degrees) (-90-90) [21.51] 22.51 Radius of FOV (degrees) (0-180) [5.0] - Start time (MET in s) (0) [0.0] - End time (MET in s) (0) [1800.0] - Lower energy limit (TeV) (0) [0.1] - Upper energy limit (TeV) (0) [100.0] - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Start time (MET in s) [0.0] + End time (MET in s) [1800.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] + Calibration database [prod2] + Instrument response function [South_50h] Model [$CTOOLS/share/models/crab.xml] Output event data file or observation definition file [events1.fits] events2.fits @@ -92,11 +92,11 @@ Now we are ready to do a joint maximum likelihood analysis using .. code-block:: bash $ ctlike - Event list, counts cube or observation definition file [events.fits] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Event list, counts cube or observation definition file [selected_events.fits] obs.xml + Calibration database [prod2] + Instrument response function [South_50h] Source model [$CTOOLS/share/models/crab.xml] - Source model output file [crab_results.xml] + Source model output file [crab_results.xml] Instead of providing an event list or a counts cube, we now provided the filename of the observation definition XML file (here ``obs.xml``) as input @@ -106,102 +106,96 @@ joint analysis, as indicated in the log file: .. code-block:: xml - 2015-02-04T20:33:26: +==============+ - 2015-02-04T20:33:26: | Observations | - 2015-02-04T20:33:26: +==============+ - 2015-02-04T20:33:26: === GObservations === - 2015-02-04T20:33:26: Number of observations ....: 2 - 2015-02-04T20:33:26: Number of predicted events : 0 - 2015-02-04T20:33:26: === GCTAObservation === - 2015-02-04T20:33:26: Name ......................: Crab - 2015-02-04T20:33:26: Identifier ................: 00001 - 2015-02-04T20:33:26: Instrument ................: CTA - 2015-02-04T20:33:26: Event file ................: events1.fits - 2015-02-04T20:33:26: Event type ................: EventList - 2015-02-04T20:33:26: Statistics ................: Poisson - 2015-02-04T20:33:26: Ontime ....................: 1800 s - 2015-02-04T20:33:26: Livetime ..................: 1710 s - 2015-02-04T20:33:26: Deadtime correction .......: 0.95 - 2015-02-04T20:33:26: User energy range .........: undefined - 2015-02-04T20:33:26: === GCTAPointing === - 2015-02-04T20:33:26: Pointing direction ........: (RA,Dec)=(83.63,21.51) + 2015-05-22T20:17:07: +==============+ + 2015-05-22T20:17:07: | Observations | + 2015-05-22T20:17:07: +==============+ + 2015-05-22T20:17:07: === GObservations === + 2015-05-22T20:17:07: Number of observations ....: 2 + 2015-05-22T20:17:07: Number of predicted events : 0 + 2015-05-22T20:17:07: === GCTAObservation === + 2015-05-22T20:17:07: Name ......................: + 2015-05-22T20:17:07: Identifier ................: 00001 + 2015-05-22T20:17:07: Instrument ................: CTA + 2015-05-22T20:17:07: Event file ................: events1.fits + 2015-05-22T20:17:07: Event type ................: EventList + 2015-05-22T20:17:07: Statistics ................: Poisson + 2015-05-22T20:17:07: Ontime ....................: 1800 s + 2015-05-22T20:17:07: Livetime ..................: 1710 s + 2015-05-22T20:17:07: Deadtime correction .......: 0.95 + 2015-05-22T20:17:07: User energy range .........: undefined + 2015-05-22T20:17:07: === GCTAPointing === + 2015-05-22T20:17:07: Pointing direction ........: (RA,Dec)=(83.63,21.51) ... - 2015-02-04T20:33:26: === GCTAObservation === - 2015-02-04T20:33:26: Name ......................: Crab - 2015-02-04T20:33:26: Identifier ................: 00002 - 2015-02-04T20:33:26: Instrument ................: CTA - 2015-02-04T20:33:26: Event file ................: events2.fits - 2015-02-04T20:33:26: Event type ................: EventList - 2015-02-04T20:33:26: Statistics ................: Poisson - 2015-02-04T20:33:26: Ontime ....................: 1800 s - 2015-02-04T20:33:26: Livetime ..................: 1710 s - 2015-02-04T20:33:26: Deadtime correction .......: 0.95 - 2015-02-04T20:33:26: User energy range .........: undefined - 2015-02-04T20:33:26: === GCTAPointing === - 2015-02-04T20:33:26: Pointing direction ........: (RA,Dec)=(83.63,22.51) + 2015-05-22T20:17:07: === GCTAObservation === + 2015-05-22T20:17:07: Name ......................: + 2015-05-22T20:17:07: Identifier ................: 00002 + 2015-05-22T20:17:07: Instrument ................: CTA + 2015-05-22T20:17:07: Event file ................: events2.fits + 2015-05-22T20:17:07: Event type ................: EventList + 2015-05-22T20:17:07: Statistics ................: Poisson + 2015-05-22T20:17:07: Ontime ....................: 1800 s + 2015-05-22T20:17:07: Livetime ..................: 1710 s + 2015-05-22T20:17:07: Deadtime correction .......: 0.95 + 2015-05-22T20:17:07: User energy range .........: undefined + 2015-05-22T20:17:07: === GCTAPointing === + 2015-05-22T20:17:07: Pointing direction ........: (RA,Dec)=(83.63,22.51) ... - 2015-02-04T20:33:26: +=================================+ - 2015-02-04T20:33:26: | Maximum likelihood optimisation | - 2015-02-04T20:33:26: +=================================+ - 2015-02-04T20:33:26: >Iteration 0: -logL=89099.788, Lambda=1.0e-03 - 2015-02-04T20:33:26: >Iteration 1: -logL=89094.435, Lambda=1.0e-03, delta=5.353, max(|grad|)=-4.388872 [Normalization:7] - 2015-02-04T20:33:26: >Iteration 2: -logL=89094.420, Lambda=1.0e-04, delta=0.015, max(|grad|)=-0.116432 [Index:3] - 2015-02-04T20:33:26: >Iteration 3: -logL=89094.420, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003989 [Index:3] - 2015-02-04T20:33:26: - 2015-02-04T20:33:26: +=========================================+ - 2015-02-04T20:33:26: | Maximum likelihood optimization results | - 2015-02-04T20:33:26: +=========================================+ - 2015-02-04T20:33:26: === GOptimizerLM === - 2015-02-04T20:33:26: Optimized function value ..: 89094.420 - 2015-02-04T20:33:26: Absolute precision ........: 0.005 - 2015-02-04T20:33:26: Acceptable value decrease .: 2 - 2015-02-04T20:33:26: Optimization status .......: converged - 2015-02-04T20:33:26: Number of parameters ......: 9 - 2015-02-04T20:33:26: Number of free parameters .: 4 - 2015-02-04T20:33:26: Number of iterations ......: 3 - 2015-02-04T20:33:26: Lambda ....................: 1e-06 - 2015-02-04T20:33:26: Maximum log likelihood ....: -89094.420 - 2015-02-04T20:33:26: Observed events (Nobs) ...: 12260.000 - 2015-02-04T20:33:26: Predicted events (Npred) ..: 12260.000 (Nobs - Npred = 6.95764e-06) - 2015-02-04T20:33:26: === GModels === - 2015-02-04T20:33:26: Number of models ..........: 2 - 2015-02-04T20:33:26: Number of parameters ......: 9 - 2015-02-04T20:33:26: === GModelSky === - 2015-02-04T20:33:26: Name ......................: Crab - 2015-02-04T20:33:26: Instruments ...............: all - 2015-02-04T20:33:26: Instrument scale factors ..: unity - 2015-02-04T20:33:26: Observation identifiers ...: all - 2015-02-04T20:33:26: Model type ................: PointSource - 2015-02-04T20:33:26: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" - 2015-02-04T20:33:26: Number of parameters ......: 6 - 2015-02-04T20:33:26: Number of spatial par's ...: 2 - 2015-02-04T20:33:26: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) - 2015-02-04T20:33:26: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) - 2015-02-04T20:33:26: Number of spectral par's ..: 3 - 2015-02-04T20:33:26: Prefactor ................: 6.06322e-16 +/- 1.44948e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) - 2015-02-04T20:33:26: Index ....................: -2.49814 +/- 0.0178524 [-0,-5] (free,scale=-1,gradient) - 2015-02-04T20:33:26: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) - 2015-02-04T20:33:26: Number of temporal par's ..: 1 - 2015-02-04T20:33:26: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T20:33:26: === GCTAModelRadialAcceptance === - 2015-02-04T20:33:26: Name ......................: Background - 2015-02-04T20:33:26: Instruments ...............: CTA - 2015-02-04T20:33:26: Instrument scale factors ..: unity - 2015-02-04T20:33:26: Observation identifiers ...: all - 2015-02-04T20:33:26: Model type ................: "Gaussian" * "FileFunction" * "Constant" - 2015-02-04T20:33:26: Number of parameters ......: 3 - 2015-02-04T20:33:26: Number of radial par's ....: 1 - 2015-02-04T20:33:26: Sigma ....................: 3.0356 +/- 0.0215259 [0.01,10] deg2 (free,scale=1,gradient) - 2015-02-04T20:33:26: Number of spectral par's ..: 1 - 2015-02-04T20:33:26: Normalization ............: 0.99936 +/- 0.0122024 [0,1000] (free,scale=1,gradient) - 2015-02-04T20:33:26: Number of temporal par's ..: 1 - 2015-02-04T20:33:26: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T20:33:26: - 2015-02-04T20:33:26: +==============+ - 2015-02-04T20:33:26: | Save results | - 2015-02-04T20:33:26: +==============+ - 2015-02-04T20:33:26: - 2015-02-04T20:33:26: Application "ctlike" terminated after 10 wall clock seconds, consuming 0.385432 seconds of CPU time. + 2015-05-22T20:17:07: +=================================+ + 2015-05-22T20:17:07: | Maximum likelihood optimisation | + 2015-05-22T20:17:07: +=================================+ + 2015-05-22T20:17:07: >Iteration 0: -logL=201836.657, Lambda=1.0e-03 + 2015-05-22T20:17:07: >Iteration 1: -logL=201829.438, Lambda=1.0e-03, delta=7.220, max(|grad|)=22.756507 [Index:7] + 2015-05-22T20:17:07: >Iteration 2: -logL=201829.432, Lambda=1.0e-04, delta=0.005, max(|grad|)=0.086395 [Index:3] + 2015-05-22T20:17:07: >Iteration 3: -logL=201829.432, Lambda=1.0e-05, delta=0.000, max(|grad|)=0.001287 [Index:3] + 2015-05-22T20:17:07: + 2015-05-22T20:17:07: +=========================================+ + 2015-05-22T20:17:07: | Maximum likelihood optimization results | + 2015-05-22T20:17:07: +=========================================+ + 2015-05-22T20:17:07: === GOptimizerLM === + 2015-05-22T20:17:07: Optimized function value ..: 201829.432 + 2015-05-22T20:17:07: Absolute precision ........: 0.005 + 2015-05-22T20:17:07: Acceptable value decrease .: 2 + 2015-05-22T20:17:07: Optimization status .......: converged + 2015-05-22T20:17:07: Number of parameters ......: 10 + 2015-05-22T20:17:07: Number of free parameters .: 4 + 2015-05-22T20:17:07: Number of iterations ......: 3 + 2015-05-22T20:17:07: Lambda ....................: 1e-06 + 2015-05-22T20:17:07: Maximum log likelihood ....: -201829.432 + 2015-05-22T20:17:07: Observed events (Nobs) ...: 31799.000 + 2015-05-22T20:17:07: Predicted events (Npred) ..: 31799.000 (Nobs - Npred = 2.67544e-06) + 2015-05-22T20:17:07: === GModels === + 2015-05-22T20:17:07: Number of models ..........: 2 + 2015-05-22T20:17:07: Number of parameters ......: 10 + 2015-05-22T20:17:07: === GModelSky === + 2015-05-22T20:17:07: Name ......................: Crab + 2015-05-22T20:17:07: Instruments ...............: all + 2015-05-22T20:17:07: Instrument scale factors ..: unity + 2015-05-22T20:17:07: Observation identifiers ...: all + 2015-05-22T20:17:07: Model type ................: PointSource + 2015-05-22T20:17:07: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" + 2015-05-22T20:17:07: Number of parameters ......: 6 + 2015-05-22T20:17:07: Number of spatial par's ...: 2 + 2015-05-22T20:17:07: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) + 2015-05-22T20:17:07: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) + 2015-05-22T20:17:07: Number of spectral par's ..: 3 + 2015-05-22T20:17:07: Prefactor ................: 5.8727e-16 +/- 8.04314e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) + 2015-05-22T20:17:07: Index ....................: -2.49825 +/- 0.0118418 [-0,-5] (free,scale=-1,gradient) + 2015-05-22T20:17:07: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T20:17:07: Number of temporal par's ..: 1 + 2015-05-22T20:17:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2015-05-22T20:17:07: === GCTAModelIrfBackground === + 2015-05-22T20:17:07: Name ......................: CTABackgroundModel + 2015-05-22T20:17:07: Instruments ...............: CTA + 2015-05-22T20:17:07: Instrument scale factors ..: unity + 2015-05-22T20:17:07: Observation identifiers ...: all + 2015-05-22T20:17:07: Model type ................: "PowerLaw" * "Constant" + 2015-05-22T20:17:07: Number of parameters ......: 4 + 2015-05-22T20:17:07: Number of spectral par's ..: 3 + 2015-05-22T20:17:07: Prefactor ................: 1.01608 +/- 0.0152751 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) + 2015-05-22T20:17:07: Index ....................: 0.0226023 +/- 0.0086794 [-5,5] (free,scale=1,gradient) + 2015-05-22T20:17:07: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T20:17:07: Number of temporal par's ..: 1 + 2015-05-22T20:17:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) The log file indicates that the fit converged quickly, the spectral parameters of the Crab nebula have now been constrained using the events diff --git a/doc/source/user_manual/getting_started/beyond_irf.rst b/doc/source/user_manual/getting_started/beyond_irf.rst index 69dd500..2c9d9fa 100644 --- a/doc/source/user_manual/getting_started/beyond_irf.rst +++ b/doc/source/user_manual/getting_started/beyond_irf.rst @@ -3,33 +3,50 @@ Connecting observations to dedicated instrument response functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. note:: - - To execute the following examples on your machine you need to - install a specific calibration database. Download the file - :download:`caldb.tar.gz ` into a local working - directory, decompress and untar the folder, and set the calibration - database to this folder by typing: - - .. code-block:: bash - - $ export CALDB=$PWD/caldb - - Note that the response functions in the calibration database - are all identical to the ``cta_dummy_irf`` response, yet there - a multiple database and response entries so that the usage of - specific response functions can be emulated. - So far the same instrument response function has been used for all observations in our analysis examples. You may have recognised that we always specified the calibration database -``dummy`` and the instrument response function ``cta_dummy_irf`` that -are shipped with the ctools release. +``prod2`` and the instrument response function ``South_50h`` that +are shipped with ctools. When combining multiple observations in a joint analysis we may however need to specify dedicated instrument response functions for the different observations. -This can be done by adding the calibration information to the observation -definition XML file: + +Let's simulate two observations of the Crab nebula, one done with +the northern array and the other with the southern array: + +.. code-block:: bash + + $ ctobssim + RA of pointing (degrees) (0-360) [83.63] + Dec of pointing (degrees) (-90-90) [22.01] 21.51 + Radius of FOV (degrees) (0-180) [5.0] + Start time (MET in s) [0.0] + End time (MET in s) [1800.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] + Calibration database [prod2] + Instrument response function [South_50h] North_50h + Model [$CTOOLS/share/models/crab.xml] + Output event data file or observation definition file [events.fits] events1.fits + +.. code-block:: bash + + $ ctobssim + RA of pointing (degrees) (0-360) [83.63] + Dec of pointing (degrees) (-90-90) [22.01] 22.51 + Radius of FOV (degrees) (0-180) [5.0] + Start time (MET in s) [0.0] + End time (MET in s) [1800.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] + Calibration database [prod2] + Instrument response function [North_50h] South_50h + Model [$CTOOLS/share/models/crab.xml] + Output event data file or observation definition file [events1.fits] events2.fits + +Now we combine the information about these two observations in an +observation definition XML file: .. code-block:: xml @@ -37,11 +54,11 @@ definition XML file: - + - + @@ -55,41 +72,39 @@ option to get the output of the script on the console): $ cscaldb debug=yes Parfile cscaldb.par not found. Create default parfile. - 2015-02-05T14:26:50: +============+ - 2015-02-05T14:26:50: | Parameters | - 2015-02-05T14:26:50: +============+ - 2015-02-05T14:26:50: chatter ...................: 2 - 2015-02-05T14:26:50: clobber ...................: yes - 2015-02-05T14:26:50: debug .....................: yes - 2015-02-05T14:26:50: mode ......................: ql - 2015-02-05T14:26:50: - 2015-02-05T14:26:50: +==============+ - 2015-02-05T14:26:50: | Mission: cta | - 2015-02-05T14:26:50: +==============+ - 2015-02-05T14:26:50: === Response functions in database "dummy" === - 2015-02-05T14:26:50: cta_dummy_irf - 2015-02-05T14:26:50: cta_prod1_irf - 2015-02-05T14:26:50: cta_prod2_irf - 2015-02-05T14:26:50: - 2015-02-05T14:26:50: === Response functions in database "north" === - 2015-02-05T14:26:50: cta_north_irf - 2015-02-05T14:26:50: - 2015-02-05T14:26:50: === Response functions in database "south" === - 2015-02-05T14:26:50: cta_south_irf - -You will see that for the CTA observatory three databases exist. -The ``dummy`` database contains three response functions -(``cta_dummy_irf``, ``cta_prod1_irf``, ``cta_prod2_irf``) while the -``north`` and ``south`` databases contain a single response function. -You may now do a :ref:`ctlike` fit using the XML file with the specific -response definitions: + 2015-05-22T21:35:39: +============+ + 2015-05-22T21:35:39: | Parameters | + 2015-05-22T21:35:39: +============+ + 2015-05-22T21:35:39: chatter ...................: 2 + 2015-05-22T21:35:39: clobber ...................: yes + 2015-05-22T21:35:39: debug .....................: yes + 2015-05-22T21:35:39: mode ......................: ql + 2015-05-22T21:35:39: + 2015-05-22T21:35:39: +==============+ + 2015-05-22T21:35:39: | Mission: cta | + 2015-05-22T21:35:39: +==============+ + 2015-05-22T21:35:40: === Response functions in database "prod2" === + 2015-05-22T21:35:40: North_0.5h + 2015-05-22T21:35:40: North_50h + 2015-05-22T21:35:40: North_5h + 2015-05-22T21:35:40: South_0.5h + 2015-05-22T21:35:40: South_50h + 2015-05-22T21:35:40: South_5h + +You will see that ctools ships with one database for the CTA observatory. +This is the ``prod2`` database. +Within this database there are six response functions: +``North_0.5h``, ``North_5h``, ``North_50h``, +``South_0.5h``, ``South_5h``, and ``South_50h``. + +We now jointly fit both observations using :ref:`ctlike`: .. code-block:: bash $ ctlike - Event list, counts cube or observation definition file [events.fits] obs_irf.xml + Event list, counts cube or observation definition file [obs.xml] obs_irf.xml Source model [$CTOOLS/share/models/crab.xml] - Source model output file [crab_results.xml] + Source model output file [crab_results.xml] To see the usage of the individual response functions you may inspect the log file. You will notice that each observation now has a specific response @@ -98,69 +113,110 @@ both observations. .. code-block:: xml - 2015-02-05T14:48:46: +==============+ - 2015-02-05T14:48:46: | Observations | - 2015-02-05T14:48:46: +==============+ - 2015-02-05T14:48:46: === GObservations === - 2015-02-05T14:48:46: Number of observations ....: 2 - 2015-02-05T14:48:46: Number of predicted events : 0 - 2015-02-05T14:48:46: === GCTAObservation === - 2015-02-05T14:48:46: Name ......................: Crab - 2015-02-05T14:48:46: Identifier ................: 00001 - 2015-02-05T14:48:46: Instrument ................: CTA - 2015-02-05T14:48:46: Event file ................: events1.fits - 2015-02-05T14:48:46: Event type ................: EventList - 2015-02-05T14:48:46: Statistics ................: Poisson - 2015-02-05T14:48:46: Ontime ....................: 1800 s - 2015-02-05T14:48:46: Livetime ..................: 1710 s - 2015-02-05T14:48:46: Deadtime correction .......: 0.95 - 2015-02-05T14:48:46: User energy range .........: undefined - 2015-02-05T14:48:46: === GCTAPointing === - 2015-02-05T14:48:46: Pointing direction ........: (RA,Dec)=(83.63,21.51) - 2015-02-05T14:48:46: === GCTAResponseIrf === - 2015-02-05T14:48:46: Response name .............: cta_north_irf - 2015-02-05T14:48:46: Energy dispersion .........: Not used - 2015-02-05T14:48:46: Save energy range .........: undefined - 2015-02-05T14:48:46: === GCaldb === - 2015-02-05T14:48:46: Database root .............: /Users/jurgen/Desktop/tmp/beyond/caldb - 2015-02-05T14:48:46: Selected Mission ..........: CTA - 2015-02-05T14:48:46: Selected Instrument .......: NORTH - 2015-02-05T14:48:46: Calibration Index File ....: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/north/caldb.indx - 2015-02-05T14:48:46: Number of entries .........: 4 - 2015-02-05T14:48:46: === GCTAAeffPerfTable === - 2015-02-05T14:48:46: Filename ..................: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/north/bcf/cta_north_irf.dat - 2015-02-05T14:48:46: Number of energy bins .....: 20 - 2015-02-05T14:48:46: Log10(Energy) range .......: 0.0199526 - 125.893 TeV - 2015-02-05T14:48:46: Offset angle dependence ...: Fixed sigma=3 - ... - 2015-02-05T14:48:46: === GCTAObservation === - 2015-02-05T14:48:46: Name ......................: Crab - 2015-02-05T14:48:46: Identifier ................: 00002 - 2015-02-05T14:48:46: Instrument ................: CTA - 2015-02-05T14:48:46: Event file ................: events2.fits - 2015-02-05T14:48:46: Event type ................: EventList - 2015-02-05T14:48:46: Statistics ................: Poisson - 2015-02-05T14:48:46: Ontime ....................: 1800 s - 2015-02-05T14:48:46: Livetime ..................: 1710 s - 2015-02-05T14:48:46: Deadtime correction .......: 0.95 - 2015-02-05T14:48:46: User energy range .........: undefined - 2015-02-05T14:48:46: === GCTAPointing === - 2015-02-05T14:48:46: Pointing direction ........: (RA,Dec)=(83.63,22.51) - 2015-02-05T14:48:46: === GCTAResponseIrf === - 2015-02-05T14:48:46: Response name .............: cta_south_irf - 2015-02-05T14:48:46: Energy dispersion .........: Not used - 2015-02-05T14:48:46: Save energy range .........: undefined - 2015-02-05T14:48:46: === GCaldb === - 2015-02-05T14:48:46: Database root .............: /Users/jurgen/Desktop/tmp/beyond/caldb - 2015-02-05T14:48:46: Selected Mission ..........: CTA - 2015-02-05T14:48:46: Selected Instrument .......: SOUTH - 2015-02-05T14:48:46: Calibration Index File ....: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/south/caldb.indx - 2015-02-05T14:48:46: Number of entries .........: 4 - 2015-02-05T14:48:46: === GCTAAeffPerfTable === - 2015-02-05T14:48:46: Filename ..................: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/south/bcf/cta_south_irf.dat - 2015-02-05T14:48:46: Number of energy bins .....: 20 - 2015-02-05T14:48:46: Log10(Energy) range .......: 0.0199526 - 125.893 TeV - 2015-02-05T14:48:46: Offset angle dependence ...: Fixed sigma=3 + 2015-05-22T22:06:43: +==============+ + 2015-05-22T22:06:43: | Observations | + 2015-05-22T22:06:43: +==============+ + 2015-05-22T22:06:43: === GObservations === + 2015-05-22T22:06:43: Number of observations ....: 2 + 2015-05-22T22:06:43: Number of predicted events : 0 + 2015-05-22T22:06:43: === GCTAObservation === + 2015-05-22T22:06:43: Name ......................: + 2015-05-22T22:06:43: Identifier ................: 00001 + 2015-05-22T22:06:43: Instrument ................: CTA + 2015-05-22T22:06:43: Event file ................: events1.fits + 2015-05-22T22:06:43: Event type ................: EventList + 2015-05-22T22:06:43: Statistics ................: Poisson + 2015-05-22T22:06:43: Ontime ....................: 1800 s + 2015-05-22T22:06:43: Livetime ..................: 1710 s + 2015-05-22T22:06:43: Deadtime correction .......: 0.95 + 2015-05-22T22:06:43: User energy range .........: undefined + 2015-05-22T22:06:43: === GCTAPointing === + 2015-05-22T22:06:43: Pointing direction ........: (RA,Dec)=(83.63,21.51) + 2015-05-22T22:06:43: === GCTAResponseIrf === + 2015-05-22T22:06:43: Caldb mission .............: cta + 2015-05-22T22:06:43: Caldb instrument ..........: prod2 + 2015-05-22T22:06:43: Response name .............: North_50h + 2015-05-22T22:06:43: Energy dispersion .........: Not used + 2015-05-22T22:06:43: Save energy range .........: undefined + ... + 2015-05-22T22:06:43: === GCTAObservation === + 2015-05-22T22:06:43: Name ......................: + 2015-05-22T22:06:43: Identifier ................: 00002 + 2015-05-22T22:06:43: Instrument ................: CTA + 2015-05-22T22:06:43: Event file ................: events2.fits + 2015-05-22T22:06:43: Event type ................: EventList + 2015-05-22T22:06:43: Statistics ................: Poisson + 2015-05-22T22:06:43: Ontime ....................: 1800 s + 2015-05-22T22:06:43: Livetime ..................: 1710 s + 2015-05-22T22:06:43: Deadtime correction .......: 0.95 + 2015-05-22T22:06:43: User energy range .........: undefined + 2015-05-22T22:06:43: === GCTAPointing === + 2015-05-22T22:06:43: Pointing direction ........: (RA,Dec)=(83.63,22.51) + 2015-05-22T22:06:43: === GCTAResponseIrf === + 2015-05-22T22:06:43: Caldb mission .............: cta + 2015-05-22T22:06:43: Caldb instrument ..........: prod2 + 2015-05-22T22:06:43: Response name .............: South_50h + 2015-05-22T22:06:43: Energy dispersion .........: Not used + 2015-05-22T22:06:43: Save energy range .........: undefined + ... + 2015-05-22T22:06:43: +=================================+ + 2015-05-22T22:06:43: | Maximum likelihood optimisation | + 2015-05-22T22:06:43: +=================================+ + 2015-05-22T22:06:43: >Iteration 0: -logL=138039.472, Lambda=1.0e-03 + 2015-05-22T22:06:43: >Iteration 1: -logL=138035.501, Lambda=1.0e-03, delta=3.971, max(|grad|)=16.203761 [Index:7] + 2015-05-22T22:06:43: >Iteration 2: -logL=138035.496, Lambda=1.0e-04, delta=0.005, max(|grad|)=-0.053284 [Index:7] + 2015-05-22T22:06:43: >Iteration 3: -logL=138035.496, Lambda=1.0e-05, delta=0.000, max(|grad|)=0.001386 [Index:7] + 2015-05-22T22:06:44: + 2015-05-22T22:06:44: +=========================================+ + 2015-05-22T22:06:44: | Maximum likelihood optimization results | + 2015-05-22T22:06:44: +=========================================+ + 2015-05-22T22:06:44: === GOptimizerLM === + 2015-05-22T22:06:44: Optimized function value ..: 138035.496 + 2015-05-22T22:06:44: Absolute precision ........: 0.005 + 2015-05-22T22:06:44: Acceptable value decrease .: 2 + 2015-05-22T22:06:44: Optimization status .......: converged + 2015-05-22T22:06:44: Number of parameters ......: 10 + 2015-05-22T22:06:44: Number of free parameters .: 4 + 2015-05-22T22:06:44: Number of iterations ......: 3 + 2015-05-22T22:06:44: Lambda ....................: 1e-06 + 2015-05-22T22:06:44: Maximum log likelihood ....: -138035.496 + 2015-05-22T22:06:44: Observed events (Nobs) ...: 20814.000 + 2015-05-22T22:06:44: Predicted events (Npred) ..: 20814.000 (Nobs - Npred = 2.67698e-06) + 2015-05-22T22:06:44: === GModels === + 2015-05-22T22:06:44: Number of models ..........: 2 + 2015-05-22T22:06:44: Number of parameters ......: 10 + 2015-05-22T22:06:44: === GModelSky === + 2015-05-22T22:06:44: Name ......................: Crab + 2015-05-22T22:06:44: Instruments ...............: all + 2015-05-22T22:06:44: Instrument scale factors ..: unity + 2015-05-22T22:06:44: Observation identifiers ...: all + 2015-05-22T22:06:44: Model type ................: PointSource + 2015-05-22T22:06:44: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" + 2015-05-22T22:06:44: Number of parameters ......: 6 + 2015-05-22T22:06:44: Number of spatial par's ...: 2 + 2015-05-22T22:06:44: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) + 2015-05-22T22:06:44: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) + 2015-05-22T22:06:44: Number of spectral par's ..: 3 + 2015-05-22T22:06:44: Prefactor ................: 5.9184e-16 +/- 9.68924e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) + 2015-05-22T22:06:44: Index ....................: -2.49569 +/- 0.0145376 [-0,-5] (free,scale=-1,gradient) + 2015-05-22T22:06:44: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T22:06:44: Number of temporal par's ..: 1 + 2015-05-22T22:06:44: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2015-05-22T22:06:44: === GCTAModelIrfBackground === + 2015-05-22T22:06:44: Name ......................: CTABackgroundModel + 2015-05-22T22:06:44: Instruments ...............: CTA + 2015-05-22T22:06:44: Instrument scale factors ..: unity + 2015-05-22T22:06:44: Observation identifiers ...: all + 2015-05-22T22:06:44: Model type ................: "PowerLaw" * "Constant" + 2015-05-22T22:06:44: Number of parameters ......: 4 + 2015-05-22T22:06:44: Number of spectral par's ..: 3 + 2015-05-22T22:06:44: Prefactor ................: 1.02524 +/- 0.0182054 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) + 2015-05-22T22:06:44: Index ....................: 0.0229728 +/- 0.0104713 [-5,5] (free,scale=1,gradient) + 2015-05-22T22:06:44: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T22:06:44: Number of temporal par's ..: 1 + 2015-05-22T22:06:44: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + + A more fine grained control over the response function can be achieved by specifying individual filenames for the various response components. @@ -173,17 +229,17 @@ This is definitely expert mode, to be used with utmost care. - - - - + + + + - - - - + + + + @@ -199,11 +255,13 @@ file is given below: + + diff --git a/doc/source/user_manual/getting_started/beyond_model.rst b/doc/source/user_manual/getting_started/beyond_model.rst index 69678cd..0621daa 100644 --- a/doc/source/user_manual/getting_started/beyond_model.rst +++ b/doc/source/user_manual/getting_started/beyond_model.rst @@ -56,23 +56,21 @@ event list. - - - + + + + + - - - - - - + + + + + - - - - + Note that both background model components distinguish in their event rate; component ``Background_00002`` has a ten times larger background rate than @@ -112,21 +110,19 @@ This is illustrated in the model definition file below where component - - - + + + + + - - - - - - + + + + + - - - diff --git a/doc/source/user_manual/getting_started/beyond_residual.rst b/doc/source/user_manual/getting_started/beyond_residual.rst index 19deaad..9eb2924 100644 --- a/doc/source/user_manual/getting_started/beyond_residual.rst +++ b/doc/source/user_manual/getting_started/beyond_residual.rst @@ -16,15 +16,27 @@ the model value to obtained the fractional residuals Residual = \frac{Counts-Model}{Model} for all map pixels. -The :ref:`csresmap` script is used as follows: + +Suppose that you have done the following unbinned ``ctlike`` analysis: + +.. code-block:: bash + + $ ctlike + Event list, counts cube or observation definition file [events.fits] obs.xml + Calibration database [prod2] + Instrument response function [South_50h] + Source model [$CTOOLS/share/models/crab.xml] + Source model output file [crab_results.xml] + +The :ref:`csresmap` script is then used as follows: .. code-block:: bash $ csresmap Parfile csresmap.par not found. Create default parfile. Event list, counts cube, or observation definition file [events.fits] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Calibration database [prod2] + Instrument response function [South_50h] Source model [$CTOOLS/share/models/crab.xml] crab_results.xml Output residual map [resmap.fits] First coordinate of image center in degrees (RA or galactic l) [83.63] diff --git a/doc/source/user_manual/getting_started/beyond_stacked.rst b/doc/source/user_manual/getting_started/beyond_stacked.rst index c001e8b..4e7b9a4 100644 --- a/doc/source/user_manual/getting_started/beyond_stacked.rst +++ b/doc/source/user_manual/getting_started/beyond_stacked.rst @@ -15,10 +15,10 @@ into a single counts cube: .. code-block:: bash $ ctbin - Event list or observation definition file [events2.fits] obs.xml - First coordinate of image center in degrees (RA or galactic l) [83.63] - Second coordinate of image center in degrees (DEC or galactic b) [22.01] - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] + Event list or observation definition file [events.fits] obs.xml + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] Image scale (in degrees/pixel) [0.02] Size of the X axis in pixels [200] @@ -27,15 +27,16 @@ into a single counts cube: Start value for first energy bin in TeV [0.1] Stop value for last energy bin in TeV [100.0] Number of energy bins [20] - Output counts cube [cntcube2.fits] cntcube.fits + Output counts cube [cntcube.fits] We now have a stacked counts cube ``cntcube.fits`` on disk. Before we can use that counts cube in a maximum likelihood analysis, we have to compute the instrument response and the background model that are needed to describe the stacked data. + For the former, we have to compute the total exposure for the stacked cube (i.e. the sum of the effective areas for each observation multiplied -by the corresponding lifetimes) and an effective point spread function +by the corresponding livetimes) and an effective point spread function (i.e. the point spread function of the different observations weighted by the corresponding exposures). To get both informations we use the :ref:`ctexpcube` and @@ -45,29 +46,29 @@ To get both informations we use the :ref:`ctexpcube` and $ ctexpcube Event list or observation definition file [NONE] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Calibration database [prod2] + Instrument response function [South_50h] Counts cube for exposure cube definition [NONE] cntcube.fits - Output exposure cube file [expcube.fits] + Output exposure cube file [expcube.fits] .. code-block:: bash $ ctpsfcube Event list or observation definition file [NONE] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Calibration database [prod2] + Instrument response function [South_50h] Counts cube for psf cube definition [NONE] - First coordinate of image center in degrees (RA or galactic l) [83.63] - Second coordinate of image center in degrees (DEC or galactic b) [22.01] - Projection method e.g. AIT|AZP|CAR|MER|MOL|STG|TAN (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] Image scale (in degrees/pixel) [1.0] Size of the X axis in pixels [10] Size of the Y axis in pixels [10] - Start value for first energy bin in TeV [0.1] - Stop value for last energy bin in TeV [100.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] Number of energy bins [20] - Output psf cube file [psfcube.fits] + Output psf cube file [psfcube.fits] We provide the ``obs.xml`` file on input to inform both tools which observations have been combined. @@ -93,17 +94,17 @@ background cube using the :ref:`ctbkgcube` tool: $ ctbkgcube Input event list or observation definition file [NONE] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] - Input (background) model XML file [NONE] $CTOOLS/share/models/crab.xml + Calibration database [prod2] + Instrument response function [South_50h] Counts cube for background cube definition [NONE] cntcube.fits + Input model XML file [NONE] $CTOOLS/share/models/crab.xml Output background cube file [bkgcube.fits] - Output (background) model XML file [NONE] model.xml + Output model XML file [NONE] model.xml The usage of :ref:`ctbkgcube` is very similar to that of :ref:`ctexpcube`, yet it takes the model XML file as an additional input parameter. -We here use the usual ``$CTOOLS/share/models/crab.xml`` Crab plus -background model file that is shipped with the ctools. +We here use the usual ``$CTOOLS/share/models/crab.xml`` model +file that is shipped with the ctools. :ref:`ctbkgcube` provides on output the background cube file ``bkgcube.fits`` and the model XML file ``model.xml`` that can be used for further analysis. @@ -125,25 +126,21 @@ modelling works: - + - - - The Crab source component is the same that is also present in ``$CTOOLS/share/models/crab.xml`` and is not modified. -The background component, however, has been replaced and now is -the ``ctbkgcube default background model``. -This model is of type ``CTACubeBackground`` which is a 3-dimensional -data cube that describes the expected background rate as function -of spatial position and energy. +The background component, however, has been replaced by a model of +type ``CTACubeBackground``. +This model is a 3-dimensional data cube that describes the expected +background rate as function of spatial position and energy. The data cube is multiplied by a power law spectrum that allows to adjust the normalization and slope of the background spectrum in the fit. This power law could be replaced by any spectral model that is found @@ -166,87 +163,82 @@ analysis using the :ref:`ctlike` tool: .. code-block:: bash $ ctlike - Event list, counts cube or observation definition file [events.fits] cntcube.fits - Exposure cube file [NONE] expcube.fits - PSF cube file [NONE] psfcube.fits + Event list, counts cube or observation definition file [obs.xml] cntcube.fits + Exposure cube file (only needed for stacked analysis) [NONE] expcube.fits + PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits + Background cube file (only needed for stacked analysis) [NONE] bkgcube.fits Source model [$CTOOLS/share/models/crab.xml] model.xml - Source model output file [crab_results.xml] + Source model output file [crab_results.xml] :ref:`ctlike` recognises that a counts cube should be analysed and queries -for the exposure cube and PSF cube file names. -We specified the names of the files produced by the :ref:`ctexpcube` and -:ref:`ctpsfcube` tools and furthermore provided the ``model.xml`` file -that is generated by the :ref:`ctbkgcube` tool as source model. +for the exposure cube, the PSF cube, and the background cube file names. +We specified the names of the files produced by the :ref:`ctexpcube`, +the :ref:`ctpsfcube` and the :ref:`ctbkgcube` tools. +Furthermore we provided as model the ``model.xml`` file that has been +generated by the :ref:`ctbkgcube` tool. + The log file of the :ref:`ctlike` run is shown below. Note that the spectral model that is multiplied with the background -cube has a Prefactor of 1.06 +/- 0.02 and an Index of 0.004 +/- 0.009, +cube has a Prefactor of 1.09 +/- 0.02 and an Index of 0.03 +/- 0.01, indicating a very small correction to the actual spectrum of the background cube. Real life situations may of course require larger correction factors. .. code-block:: xml - 2015-02-04T23:00:25: +=================================+ - 2015-02-04T23:00:25: | Maximum likelihood optimisation | - 2015-02-04T23:00:25: +=================================+ - 2015-02-04T23:00:29: >Iteration 0: -logL=36748.112, Lambda=1.0e-03 - 2015-02-04T23:00:33: >Iteration 1: -logL=36734.170, Lambda=1.0e-03, delta=13.942, max(|grad|)=34.291911 [Index:8] - 2015-02-04T23:00:38: >Iteration 2: -logL=36734.127, Lambda=1.0e-04, delta=0.044, max(|grad|)=0.178088 [Index:8] - 2015-02-04T23:00:42: >Iteration 3: -logL=36734.127, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.001993 [Index:8] - 2015-02-04T23:00:46: - 2015-02-04T23:00:46: +=========================================+ - 2015-02-04T23:00:46: | Maximum likelihood optimization results | - 2015-02-04T23:00:46: +=========================================+ - 2015-02-04T23:00:46: === GOptimizerLM === - 2015-02-04T23:00:46: Optimized function value ..: 36734.127 - 2015-02-04T23:00:46: Absolute precision ........: 0.005 - 2015-02-04T23:00:46: Acceptable value decrease .: 2 - 2015-02-04T23:00:46: Optimization status .......: converged - 2015-02-04T23:00:46: Number of parameters ......: 11 - 2015-02-04T23:00:46: Number of free parameters .: 4 - 2015-02-04T23:00:46: Number of iterations ......: 3 - 2015-02-04T23:00:46: Lambda ....................: 1e-06 - 2015-02-04T23:00:46: Maximum log likelihood ....: -36734.127 - 2015-02-04T23:00:46: Observed events (Nobs) ...: 10685.000 - 2015-02-04T23:00:46: Predicted events (Npred) ..: 10685.000 (Nobs - Npred = 2.06522e-06) - 2015-02-04T23:00:46: === GModels === - 2015-02-04T23:00:46: Number of models ..........: 2 - 2015-02-04T23:00:46: Number of parameters ......: 11 - 2015-02-04T23:00:46: === GModelSky === - 2015-02-04T23:00:46: Name ......................: Crab - 2015-02-04T23:00:46: Instruments ...............: all - 2015-02-04T23:00:46: Instrument scale factors ..: unity - 2015-02-04T23:00:46: Observation identifiers ...: all - 2015-02-04T23:00:46: Model type ................: PointSource - 2015-02-04T23:00:46: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" - 2015-02-04T23:00:46: Number of parameters ......: 6 - 2015-02-04T23:00:46: Number of spatial par's ...: 2 - 2015-02-04T23:00:46: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) - 2015-02-04T23:00:46: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) - 2015-02-04T23:00:46: Number of spectral par's ..: 3 - 2015-02-04T23:00:46: Prefactor ................: 6.01471e-16 +/- 1.44183e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) - 2015-02-04T23:00:46: Index ....................: -2.49533 +/- 0.0179769 [-0,-5] (free,scale=-1,gradient) - 2015-02-04T23:00:46: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) - 2015-02-04T23:00:46: Number of temporal par's ..: 1 - 2015-02-04T23:00:46: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T23:00:46: === GCTAModelCubeBackground === - 2015-02-04T23:00:46: Name ......................: ctbkgcube default background model - 2015-02-04T23:00:46: Instruments ...............: all - 2015-02-04T23:00:46: Instrument scale factors ..: unity - 2015-02-04T23:00:46: Observation identifiers ...: all - 2015-02-04T23:00:46: Model type ................: "MapCubeFunction" * "PowerLaw" * "Constant" - 2015-02-04T23:00:46: Number of parameters ......: 5 - 2015-02-04T23:00:46: Number of spatial par's ...: 1 - 2015-02-04T23:00:46: Normalization ............: 1 [0.001,1000] (fixed,scale=1,gradient) - 2015-02-04T23:00:46: Number of spectral par's ..: 3 - 2015-02-04T23:00:46: Prefactor ................: 1.05876 +/- 0.0178132 [0,infty[ ph/cm2/s/MeV (free,scale=1,gradient) - 2015-02-04T23:00:46: Index ....................: 0.00396962 +/- 0.00881842 [-10,10] (free,scale=1,gradient) - 2015-02-04T23:00:46: PivotEnergy ..............: 1e+06 MeV (fixed,scale=1e+06,gradient) - 2015-02-04T23:00:46: Number of temporal par's ..: 1 - 2015-02-04T23:00:46: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T23:00:46: - 2015-02-04T23:00:46: +==============+ - 2015-02-04T23:00:46: | Save results | - 2015-02-04T23:00:46: +==============+ - 2015-02-04T23:00:46: - 2015-02-04T23:00:46: Application "ctlike" terminated after 43 wall clock seconds, consuming 21.5624 seconds of CPU time. + 2015-05-22T21:10:09: +=================================+ + 2015-05-22T21:10:09: | Maximum likelihood optimisation | + 2015-05-22T21:10:09: +=================================+ + 2015-05-22T21:10:10: >Iteration 0: -logL=60663.798, Lambda=1.0e-03 + 2015-05-22T21:10:11: >Iteration 1: -logL=60642.413, Lambda=1.0e-03, delta=21.385, max(|grad|)=120.031102 [Index:7] + 2015-05-22T21:10:13: >Iteration 2: -logL=60642.233, Lambda=1.0e-04, delta=0.180, max(|grad|)=1.139187 [Index:7] + 2015-05-22T21:10:14: >Iteration 3: -logL=60642.233, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.001247 [Index:7] + 2015-05-22T21:10:16: + 2015-05-22T21:10:16: +=========================================+ + 2015-05-22T21:10:16: | Maximum likelihood optimization results | + 2015-05-22T21:10:16: +=========================================+ + 2015-05-22T21:10:16: === GOptimizerLM === + 2015-05-22T21:10:16: Optimized function value ..: 60642.233 + 2015-05-22T21:10:16: Absolute precision ........: 0.005 + 2015-05-22T21:10:16: Acceptable value decrease .: 2 + 2015-05-22T21:10:16: Optimization status .......: converged + 2015-05-22T21:10:16: Number of parameters ......: 10 + 2015-05-22T21:10:16: Number of free parameters .: 4 + 2015-05-22T21:10:16: Number of iterations ......: 3 + 2015-05-22T21:10:16: Lambda ....................: 1e-06 + 2015-05-22T21:10:16: Maximum log likelihood ....: -60642.233 + 2015-05-22T21:10:16: Observed events (Nobs) ...: 25963.000 + 2015-05-22T21:10:16: Predicted events (Npred) ..: 25963.000 (Nobs - Npred = 1.5749e-05) + 2015-05-22T21:10:16: === GModels === + 2015-05-22T21:10:16: Number of models ..........: 2 + 2015-05-22T21:10:16: Number of parameters ......: 10 + 2015-05-22T21:10:16: === GModelSky === + 2015-05-22T21:10:16: Name ......................: Crab + 2015-05-22T21:10:16: Instruments ...............: all + 2015-05-22T21:10:16: Instrument scale factors ..: unity + 2015-05-22T21:10:16: Observation identifiers ...: all + 2015-05-22T21:10:16: Model type ................: PointSource + 2015-05-22T21:10:16: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" + 2015-05-22T21:10:16: Number of parameters ......: 6 + 2015-05-22T21:10:16: Number of spatial par's ...: 2 + 2015-05-22T21:10:16: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) + 2015-05-22T21:10:16: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) + 2015-05-22T21:10:16: Number of spectral par's ..: 3 + 2015-05-22T21:10:16: Prefactor ................: 5.8499e-16 +/- 8.02289e-18 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) + 2015-05-22T21:10:16: Index ....................: -2.49909 +/- 0.0118976 [-0,-5] (free,scale=-1,gradient) + 2015-05-22T21:10:16: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T21:10:16: Number of temporal par's ..: 1 + 2015-05-22T21:10:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2015-05-22T21:10:16: === GCTAModelCubeBackground === + 2015-05-22T21:10:16: Name ......................: BackgroundModel + 2015-05-22T21:10:16: Instruments ...............: CTA, HESS, MAGIC, VERITAS + 2015-05-22T21:10:16: Instrument scale factors ..: unity + 2015-05-22T21:10:16: Observation identifiers ...: all + 2015-05-22T21:10:16: Model type ................: "PowerLaw" * "Constant" + 2015-05-22T21:10:16: Number of parameters ......: 4 + 2015-05-22T21:10:16: Number of spectral par's ..: 3 + 2015-05-22T21:10:16: Prefactor ................: 1.08781 +/- 0.0212678 [0,infty[ ph/cm2/s/MeV (free,scale=1,gradient) + 2015-05-22T21:10:16: Index ....................: 0.0269681 +/- 0.0111532 [-10,10] (free,scale=1,gradient) + 2015-05-22T21:10:16: PivotEnergy ..............: 1e+06 MeV (fixed,scale=1e+06,gradient) + 2015-05-22T21:10:16: Number of temporal par's ..: 1 + 2015-05-22T21:10:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) diff --git a/doc/source/user_manual/getting_started/beyond_tsmap.rst b/doc/source/user_manual/getting_started/beyond_tsmap.rst index 4f9dc71..c34be7e 100644 --- a/doc/source/user_manual/getting_started/beyond_tsmap.rst +++ b/doc/source/user_manual/getting_started/beyond_tsmap.rst @@ -6,7 +6,7 @@ Generating a Test Statistic map In the above examples we were always considering that we knew exactly where the source is located, but in real life situations this may not necessarily be the case. -We thus need a mean to search for significant excess emission in our data. +We thus need a means to search for significant excess emission in our data. One possibility to accomplish this task is to compute the Test Statistic for a specific source at a grid of trial positions. The :ref:`cttsmap` tool will exactly do that job. @@ -32,25 +32,25 @@ nominal position of the Crab nebula with a grid spacing of 0.02 degrees. $ cttsmap Input event list, counts cube or observation definition file [events.fits] obs.xml - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Calibration database [prod2] + Instrument response function [South_50h] Source model [$CTOOLS/share/models/crab.xml] Test source [Crab] - First coordinate of image center in degrees (RA or galactic l) [83.63] - Second coordinate of image center in degrees (DEC or galactic b) [22.01] - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] Image scale (in degrees/pixel) [0.02] Size of the X axis in pixels [200] 10 Size of the Y axis in pixels [200] 10 - Output Test Statistic map [tsmap.fits] + Output Test Statistic map [tsmap.fits] :ref:`cttsmap` writes the Test Statistic map in the ``tsmap.fits`` file that contains one extension for the Test Statistic value and further extensions for the spectral parameters that have been fitted for the source at each position of the grid. The figure below show the Test Statistic map which reaches a maximum -value of 13782 near the centre of the map. +value of 37484 near the centre of the map. .. figure:: tsmap-crab.png :height: 400px diff --git a/doc/source/user_manual/getting_started/quickstart.rst b/doc/source/user_manual/getting_started/quickstart.rst index 8e4d528..65fa257 100644 --- a/doc/source/user_manual/getting_started/quickstart.rst +++ b/doc/source/user_manual/getting_started/quickstart.rst @@ -39,14 +39,14 @@ type :ref:`ctobssim` at the console prompt (which is denoted by ``$``). RA of pointing (degrees) (0-360) [83.63] Dec of pointing (degrees) (-90-90) [22.01] Radius of FOV (degrees) (0-180) [5.0] - Start time (MET in s) (0) [0.0] - End time (MET in s) (0) [1800.0] - Lower energy limit (TeV) (0) [0.1] - Upper energy limit (TeV) (0) [100.0] - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Start time (MET in s) [0.0] + End time (MET in s) [1800.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] + Calibration database [prod2] + Instrument response function [South_50h] Model [$CTOOLS/share/models/crab.xml] - Output event data file or observation definition file [events.fits] + Output event data file or observation definition file [events.fits] Each line represents a query for one parameter value. The line starts with a short description of the parameter, followed by @@ -62,8 +62,18 @@ You may have recognised that the environment variable ``$CTOOLS`` has been used in the path name of the model. ctools will automatically expand the environment variables in parameter inputs. -The CTA instrument properties (effective area, PSF width) are taken for -the moment from a dummy calibration database. +The CTA instrument properties (effective area, PSF width) are taken from +the prod2 database. The response for the southern array using the cuts +optimised for 50 hours of observing time are used. + +.. note:: + + ctools comes bundled with CTA response functions for the northern and + the southern array. The response functions are based on a Prod2 + analysis with cuts optimised for 0.5 hours, 5 hours and 50 hours of + observing time. The following Instrument Response Functions + (IRFs) are available: ``North_0.5h``, ``North_5h``, ``North_50h``, + ``South_0.5h``, ``South_5h``, and ``South_50h``. Events are simulated based on the instrument properties and based on a source and background model. Only events that fall within the specified @@ -90,14 +100,13 @@ The source and background model is defined by the XML file - - - + + + + + - - - - + The model consists of a source library that contains two components: @@ -107,14 +116,15 @@ The Crab nebula is modelled by a factorized sky model that has a spectral and a spatial component (tags ```` and ````, respectively). The spectrum is modelled by a power law, which is defined by three parameters: the ``Prefactor``, the ``Index`` and the ``Scale``. -The spatial model has two parameters: Right Ascension in degrees (RA), and -Declination in degrees (DEC). Each parameter has a value and a scale factor, +The spatial model has two parameters: Right Ascension in degrees (``RA``), and +Declination in degrees (``DEC``). Each parameter has a value and a scale factor, the real value of the parameter being the product ``value * scale``. Typically, -scale is chosen so that value is of the order of 1 (this is relevant for -model fitting). In addition, value is bound by a minimum (min) and -maximum (max) value, and a parameter may be free (``free="1"``) or fixed -(``free="0"``). The min, max, and free attributes are not relevant here for -the simulations, but they will be important for the model fitting later. +``scale`` is chosen so that ``value`` is of the order of 1 (this is relevant for +model fitting). In addition, ``value`` is bound by a minimum (``min``) and +maximum (``max``) value, and a parameter may be free (``free="1"``) or fixed +(``free="0"``). The ``min``, ``max``, and ``free`` attributes are not +relevant here for the simulations, but they will be important for the model +fitting later. The spectral intensity I(E) (in units of photons/cm2/s/MeV) of the power law is given by @@ -128,19 +138,20 @@ where the parameters in the XML definition have the following mappings: * :math:`\gamma` = ``Index`` * :math:`E_0` = ``Scale`` -Note that energies are given in MeV. This is a GammaLib convention that -can not be modified. **So make sure you always use MeV as energy unit in -an XML file.** +.. warning:: + + Energies are given in the XML file in MeV units. This is a GammaLib + convention that can not be modified. **So make sure you always use + MeV as energy unit in an XML file.** -The instrumental background of CTA is modelled by a factorized data model -that has a spectral and a radial component (tags ```` and -````, respectively). The spectral component describes the -on-axis background counting rate of CTA as function of energy in units of -counts/s/sr/MeV. The radial component describes the variation of the -background rate with offset angle squared, (i.e. square of the offset angle -with respect to the pointing direction) which is modelled here by a Gaussian. -The only parameter of the radial component is the width of the Gaussian Sigma, -which is here set to 3 degrees squared. +The instrumental background of CTA is modelled using the background +information provided in the IRF (``CTAIrfBackground``) multipled +by a power law. As it is defined here, the power law represents a +constant of 1, hence the background IRF will be used without any +modification. The power law will become active when fitting the data +later and allows a spectral adjustment of the background model that +may account for uncertainties in the background information provided +in the IRF. :ref:`ctobssim` has a couple of hidden parameters, the most important one being certainly ``seed``. ``seed`` is an integer that specifies the seed value @@ -167,25 +178,25 @@ from this file are shown here: .. code-block:: xml - 2015-02-04T15:04:56: +======================+ - 2015-02-04T15:04:56: | Simulate observation | - 2015-02-04T15:04:56: +======================+ - 2015-02-04T15:04:56: === Observation === - 2015-02-04T15:04:56: Simulation area ...........: 1.9635e+11 cm2 - 2015-02-04T15:04:56: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=5.5 deg - 2015-02-04T15:04:56: Time interval .............: 0 - 1800 s - 2015-02-04T15:04:56: Photon energy range .......: 100 GeV - 100 TeV - 2015-02-04T15:04:56: Event energy range ........: 100 GeV - 100 TeV - 2015-02-04T15:04:56: MC source photons .........: 207547 [Crab] - 2015-02-04T15:04:56: MC source events ..........: 995 [Crab] - 2015-02-04T15:04:56: MC source events ..........: 995 (all source models) - 2015-02-04T15:04:56: MC background events ......: 5146 - 2015-02-04T15:04:56: MC events .................: 6141 (all models) + 2015-05-22T19:24:53: +======================+ + 2015-05-22T19:24:53: | Simulate observation | + 2015-05-22T19:24:53: +======================+ + 2015-05-22T19:24:53: === Observation === + 2015-05-22T19:24:53: Simulation area ...........: 1.9635e+11 cm2 + 2015-05-22T19:24:53: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=5.5 deg + 2015-05-22T19:24:53: Time interval .............: 0 - 1800 s + 2015-05-22T19:24:53: Photon energy range .......: 100 GeV - 100 TeV + 2015-05-22T19:24:53: Event energy range ........: 100 GeV - 100 TeV + 2015-05-22T19:24:53: MC source photons .........: 207547 [Crab] + 2015-05-22T19:24:53: MC source events ..........: 2961 [Crab] + 2015-05-22T19:24:53: MC source events ..........: 2961 (all source models) + 2015-05-22T19:24:55: MC background events ......: 13003 + 2015-05-22T19:24:55: MC events .................: 15964 (all models) Each line starts with the UTC time at which the line has been written. In this run, 207547 Crab photons have been thrown over an area of 19.6 square -kilometres during a time interval of 1800 seconds. 995 of these photons have -been registered by CTA as events. In the same time interval, 5146 background +kilometres during a time interval of 1800 seconds. 2961 of these photons have +been registered by CTA as events. In the same time interval, 13003 background events have been registred by CTA. You may change the name of the log file using the hidden parameter @@ -233,9 +244,9 @@ control). $ ctbin Event list or observation definition file [events.fits] - First coordinate of image center in degrees (RA or galactic l) [83.63] - Second coordinate of image center in degrees (DEC or galactic b) [22.01] - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] Image scale (in degrees/pixel) [0.02] Size of the X axis in pixels [200] @@ -244,7 +255,7 @@ control). Start value for first energy bin in TeV [0.1] Stop value for last energy bin in TeV [100.0] Number of energy bins [20] - Output counts cube [cntcube.fits] + Output counts cube [cntcube.fits] The counts cube will be centred on the location of the Crab (Right Ascension 83.63 degrees, Declination 22.01 degrees) and will be aligned in celestial @@ -285,41 +296,18 @@ reproduced below: .. code-block:: xml - 2015-02-04T15:33:34: +====================+ - 2015-02-04T15:33:34: | Binned observation | - 2015-02-04T15:33:34: +====================+ - 2015-02-04T15:33:34: === GObservations === - 2015-02-04T15:33:34: Number of observations ....: 1 - 2015-02-04T15:33:34: Number of predicted events : 0 - 2015-02-04T15:33:34: === GCTAObservation === - 2015-02-04T15:33:34: Name ......................: - 2015-02-04T15:33:34: Identifier ................: - 2015-02-04T15:33:34: Instrument ................: CTA - 2015-02-04T15:33:34: Event file ................: - 2015-02-04T15:33:34: Event type ................: CountsCube - 2015-02-04T15:33:34: Statistics ................: Poisson - 2015-02-04T15:33:34: Ontime ....................: 1800 s - 2015-02-04T15:33:34: Livetime ..................: 1710 s - 2015-02-04T15:33:34: Deadtime correction .......: 0.95 - 2015-02-04T15:33:34: User energy range .........: undefined - 2015-02-04T15:33:34: === GCTAPointing === - 2015-02-04T15:33:34: Pointing direction ........: (RA,Dec)=(83.63,22.01) - 2015-02-04T15:33:34: Response function .........: undefined - 2015-02-04T15:33:34: === GCTAEventCube === - 2015-02-04T15:33:34: Number of events ..........: 5542 - 2015-02-04T15:33:34: Number of elements ........: 800000 - 2015-02-04T15:33:34: Number of pixels ..........: 40000 - 2015-02-04T15:33:34: Number of energy bins .....: 20 - 2015-02-04T15:33:34: Time interval .............: 0 - 1800 sec - 2015-02-04T15:33:34: - 2015-02-04T15:33:34: +==================+ - 2015-02-04T15:33:34: | Save observation | - 2015-02-04T15:33:34: +==================+ - 2015-02-04T15:33:34: - 2015-02-04T15:33:34: Application "ctbin" terminated after 14 wall clock seconds, consuming 0.332675 seconds of CPU time. - -From the 6141 events that have been simulated and stored in the -``events.fits`` file, 5542 lie within the cube boundaries and are thus put + 2015-05-22T19:40:30: +=================+ + 2015-05-22T19:40:30: | Bin observation | + 2015-05-22T19:40:30: +=================+ + 2015-05-22T19:40:30: === Observation === + 2015-05-22T19:40:30: Events in list ............: 15964 + 2015-05-22T19:40:30: Events in cube ............: 13360 + 2015-05-22T19:40:30: Event bins outside RoI ....: 0 + 2015-05-22T19:40:30: Events outside cube area ..: 2604 + 2015-05-22T19:40:30: Events outside energy bins : 0 + +From the 15964 events that have been simulated and stored in the +``events.fits`` file, 13360 lie within the cube boundaries and are thus put into the resulting counts cube. The counts cube is stored in a cartesian projection in a World Coordinate System (WCS) compliant format. @@ -340,12 +328,13 @@ and we do the fit by typing: Event list, counts cube or observation definition file [events.fits] cntcube.fits Exposure cube file (only needed for stacked analysis) [NONE] PSF cube file (only needed for stacked analysis) [NONE] - Calibration database [dummy] - Instrument response function [cta_dummy_irf] + Background cube file (only needed for stacked analysis) [NONE] + Calibration database [prod2] + Instrument response function [South_50h] Source model [$CTOOLS/share/models/crab.xml] Source model output file [crab_results.xml] -Fitting of the data is done in *binned* mode, which means that the events +The data are fitted in *binned* mode, which means that the events have been binned into a counts cube and the fit computes the log-likelihood function by summing over all 200 x 200 x 20 bins of the counts cube. There is an alternative method, the so called *unbinned* mode, where the events are @@ -356,8 +345,8 @@ One of the parameters of :ref:`ctlike` is a source model output file (we specified ``crab_results.xml`` in the example), and this file will be a copy of the source model input XML file where the parameter values have been replaced by the fit results. In addition, the statistical uncertainties -are added for each fitted parameter using the attribute error. Below we show -the XML result file that has been produced by the run: +are added for each fitted parameter using the attribute ``error``. +Below we show the XML result file that has been produced by the run: .. code-block:: xml @@ -365,8 +354,8 @@ the XML result file that has been produced by the run: - - + + @@ -374,20 +363,31 @@ the XML result file that has been produced by the run: - - - + + + + + - - - In this example, the ``Prefactor`` and ``Index`` of the spectral model for the -Crab as well as the ``Normalization`` and ``Sigma`` parameter of the radial -acceptance model have been fitted (all parameters having the attribute -``free="1"`` are fitted). +Crab as well as the ``Prefactor`` and ``Index`` of the background spectral +model have been fitted (all parameters having the attribute ``free="1"`` are +fitted). Now we see also the effect of having multiplied the background +model with a power law. In that way, the amplitude of the background as +well as it's spectral slope is adjusted by the fit. Obviously, in this +example the adjustment compensates only for the statistical fluctuations +of the background, but with real data, the adjustment may account also for +some of the systematic uncertainties. + +.. warning:: + + As good practice, the amplitude of the background model should always be + left as a free parameter of the fit. Otherwise, any uncertainty in the + background rate will immediately propagate into the flux estimate of the + source. To get more details about the model fitting you can inspect the log file. Below the last lines of the ctlike.log log file that has been produced by @@ -395,70 +395,63 @@ this run: .. code-block:: xml - 2015-02-04T15:50:43: +=================================+ - 2015-02-04T15:50:43: | Maximum likelihood optimisation | - 2015-02-04T15:50:43: +=================================+ - 2015-02-04T15:50:44: >Iteration 0: -logL=22752.553, Lambda=1.0e-03 - 2015-02-04T15:50:46: >Iteration 1: -logL=22750.640, Lambda=1.0e-03, delta=1.913, max(|grad|)=-0.941594 [Index:3] - 2015-02-04T15:50:47: >Iteration 2: -logL=22750.632, Lambda=1.0e-04, delta=0.008, max(|grad|)=-0.079270 [Index:3] - 2015-02-04T15:50:48: >Iteration 3: -logL=22750.632, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003073 [Index:3] - 2015-02-04T15:50:49: - 2015-02-04T15:50:49: +=========================================+ - 2015-02-04T15:50:49: | Maximum likelihood optimization results | - 2015-02-04T15:50:49: +=========================================+ - 2015-02-04T15:50:49: === GOptimizerLM === - 2015-02-04T15:50:49: Optimized function value ..: 22750.632 - 2015-02-04T15:50:49: Absolute precision ........: 0.005 - 2015-02-04T15:50:49: Acceptable value decrease .: 2 - 2015-02-04T15:50:49: Optimization status .......: converged - 2015-02-04T15:50:49: Number of parameters ......: 9 - 2015-02-04T15:50:49: Number of free parameters .: 4 - 2015-02-04T15:50:49: Number of iterations ......: 3 - 2015-02-04T15:50:49: Lambda ....................: 1e-06 - 2015-02-04T15:50:49: Maximum log likelihood ....: -22750.632 - 2015-02-04T15:50:49: Observed events (Nobs) ...: 5542.000 - 2015-02-04T15:50:49: Predicted events (Npred) ..: 5542.000 (Nobs - Npred = 3.3498e-06) - 2015-02-04T15:50:49: === GModels === - 2015-02-04T15:50:49: Number of models ..........: 2 - 2015-02-04T15:50:49: Number of parameters ......: 9 - 2015-02-04T15:50:49: === GModelSky === - 2015-02-04T15:50:49: Name ......................: Crab - 2015-02-04T15:50:49: Instruments ...............: all - 2015-02-04T15:50:49: Instrument scale factors ..: unity - 2015-02-04T15:50:49: Observation identifiers ...: all - 2015-02-04T15:50:49: Model type ................: PointSource - 2015-02-04T15:50:49: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" - 2015-02-04T15:50:49: Number of parameters ......: 6 - 2015-02-04T15:50:49: Number of spatial par's ...: 2 - 2015-02-04T15:50:49: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) - 2015-02-04T15:50:49: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) - 2015-02-04T15:50:49: Number of spectral par's ..: 3 - 2015-02-04T15:50:49: Prefactor ................: 6.07928e-16 +/- 2.04582e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) - 2015-02-04T15:50:49: Index ....................: -2.5009 +/- 0.0252057 [-0,-5] (free,scale=-1,gradient) - 2015-02-04T15:50:49: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) - 2015-02-04T15:50:49: Number of temporal par's ..: 1 - 2015-02-04T15:50:49: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T15:50:49: === GCTAModelRadialAcceptance === - 2015-02-04T15:50:49: Name ......................: Background - 2015-02-04T15:50:49: Instruments ...............: CTA - 2015-02-04T15:50:49: Instrument scale factors ..: unity - 2015-02-04T15:50:49: Observation identifiers ...: all - 2015-02-04T15:50:49: Model type ................: "Gaussian" * "FileFunction" * "Constant" - 2015-02-04T15:50:49: Number of parameters ......: 3 - 2015-02-04T15:50:49: Number of radial par's ....: 1 - 2015-02-04T15:50:49: Sigma ....................: 3.02523 +/- 0.0594117 [0.01,10] deg2 (free,scale=1,gradient) - 2015-02-04T15:50:49: Number of spectral par's ..: 1 - 2015-02-04T15:50:49: Normalization ............: 0.990708 +/- 0.0192887 [0,1000] (free,scale=1,gradient) - 2015-02-04T15:50:49: Number of temporal par's ..: 1 - 2015-02-04T15:50:49: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T15:50:49: - 2015-02-04T15:50:49: +==============+ - 2015-02-04T15:50:49: | Save results | - 2015-02-04T15:50:49: +==============+ - 2015-02-04T15:50:49: - 2015-02-04T15:50:49: Application "ctlike" terminated after 15 wall clock seconds, consuming 5.92686 seconds of CPU time. - -The maximum likelihood optimizer required 3 iterations to converge. This + 2015-05-22T19:45:15: +=================================+ + 2015-05-22T19:45:15: | Maximum likelihood optimisation | + 2015-05-22T19:45:15: +=================================+ + 2015-05-22T19:45:16: >Iteration 0: -logL=39910.748, Lambda=1.0e-03 + 2015-05-22T19:45:18: >Iteration 1: -logL=39908.788, Lambda=1.0e-03, delta=1.960, max(|grad|)=6.701856 [Index:7] + 2015-05-22T19:45:19: >Iteration 2: -logL=39908.787, Lambda=1.0e-04, delta=0.001, max(|grad|)=-0.057041 [Index:3] + 2015-05-22T19:45:21: + 2015-05-22T19:45:21: +=========================================+ + 2015-05-22T19:45:21: | Maximum likelihood optimization results | + 2015-05-22T19:45:21: +=========================================+ + 2015-05-22T19:45:21: === GOptimizerLM === + 2015-05-22T19:45:21: Optimized function value ..: 39908.787 + 2015-05-22T19:45:21: Absolute precision ........: 0.005 + 2015-05-22T19:45:21: Acceptable value decrease .: 2 + 2015-05-22T19:45:21: Optimization status .......: converged + 2015-05-22T19:45:21: Number of parameters ......: 10 + 2015-05-22T19:45:21: Number of free parameters .: 4 + 2015-05-22T19:45:21: Number of iterations ......: 2 + 2015-05-22T19:45:21: Lambda ....................: 1e-05 + 2015-05-22T19:45:21: Maximum log likelihood ....: -39908.787 + 2015-05-22T19:45:21: Observed events (Nobs) ...: 13360.000 + 2015-05-22T19:45:21: Predicted events (Npred) ..: 13359.998 (Nobs - Npred = 0.00180799) + 2015-05-22T19:45:21: === GModels === + 2015-05-22T19:45:21: Number of models ..........: 2 + 2015-05-22T19:45:21: Number of parameters ......: 10 + 2015-05-22T19:45:21: === GModelSky === + 2015-05-22T19:45:21: Name ......................: Crab + 2015-05-22T19:45:21: Instruments ...............: all + 2015-05-22T19:45:21: Instrument scale factors ..: unity + 2015-05-22T19:45:21: Observation identifiers ...: all + 2015-05-22T19:45:21: Model type ................: PointSource + 2015-05-22T19:45:21: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" + 2015-05-22T19:45:21: Number of parameters ......: 6 + 2015-05-22T19:45:21: Number of spatial par's ...: 2 + 2015-05-22T19:45:21: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) + 2015-05-22T19:45:21: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) + 2015-05-22T19:45:21: Number of spectral par's ..: 3 + 2015-05-22T19:45:21: Prefactor ................: 5.78197e-16 +/- 1.10889e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) + 2015-05-22T19:45:21: Index ....................: -2.49174 +/- 0.0164369 [-0,-5] (free,scale=-1,gradient) + 2015-05-22T19:45:21: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T19:45:21: Number of temporal par's ..: 1 + 2015-05-22T19:45:21: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2015-05-22T19:45:21: === GCTAModelIrfBackground === + 2015-05-22T19:45:21: Name ......................: CTABackgroundModel + 2015-05-22T19:45:21: Instruments ...............: CTA + 2015-05-22T19:45:21: Instrument scale factors ..: unity + 2015-05-22T19:45:21: Observation identifiers ...: all + 2015-05-22T19:45:21: Model type ................: "PowerLaw" * "Constant" + 2015-05-22T19:45:21: Number of parameters ......: 4 + 2015-05-22T19:45:21: Number of spectral par's ..: 3 + 2015-05-22T19:45:21: Prefactor ................: 1.02048 +/- 0.0280684 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) + 2015-05-22T19:45:21: Index ....................: 0.0197856 +/- 0.0156686 [-5,5] (free,scale=1,gradient) + 2015-05-22T19:45:21: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T19:45:21: Number of temporal par's ..: 1 + 2015-05-22T19:45:21: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + +The maximum likelihood optimizer required 2 iterations to converge. This is pretty fast, but recall that we used the same model file for the simulation and for fitting, hence the initial parameter values were already very close to the best fitting values. To see the impact of the initial parameters on @@ -466,7 +459,7 @@ the fit result, you may re-run :ref:`ctlike` using another copy of the model XML file where you change the value attributes of the parameters that should be fitted. You will see that the optimizer requires a couple of more iterations, but it should converge to the same solution (provided that the initial values -are not too far of the best fitting values). +are not too far from the best fitting values). .. note:: @@ -502,17 +495,17 @@ are not too far of the best fitting values). .. code-block:: xml - 2015-02-05T08:29:07: === GModelSky === - 2015-02-05T08:29:07: Name ......................: Crab - 2015-02-05T08:29:07: Instruments ...............: all - 2015-02-05T08:29:07: Test Statistic ............: 6875.35 + 2015-05-22T19:58:43: === GModelSky === + 2015-05-22T19:58:43: Name ......................: Crab + 2015-05-22T19:58:43: Instruments ...............: all + 2015-05-22T19:58:43: Test Statistic ............: 18662.6 The Test Statistic value will also be added as new attribute ``ts`` to the XML result file: .. code-block:: xml - + .. _sec_unbinned_cta: @@ -521,8 +514,8 @@ Doing an unbinned analysis ~~~~~~~~~~~~~~~~~~~~~~~~~~ As gamma-ray events are rare, the counts cubes generated by :ref:`ctbin` -will in general be sparse, having many empty pixels, in particular at -high energies. +will in general be sparsly populated, having many empty pixels, in +particular at high energies. An alternative analysis technique consists of working directly on the event list without binning the events in a counts cube. We will see the benefit of such an analysis later once you re-run :ref:`ctlike` in unbinned mode. @@ -553,10 +546,10 @@ following example shows how to run ctselect: RA for ROI centre (degrees) (0-360) [83.63] Dec for ROI centre (degrees) (-90-90) [22.01] Radius of ROI (degrees) (0-180) [3.0] - Start time (CTA MET in seconds) (0) [0.0] - End time (CTA MET in seconds) (0) [0.0] - Lower energy limit (TeV) (0) [0.1] - Upper energy limit (TeV) (0) [100.0] + Start time (CTA MET in seconds) [0.0] + End time (CTA MET in seconds) [0.0] + Lower energy limit (TeV) [0.1] + Upper energy limit (TeV) [100.0] Output event list or observation definition file [selected_events.fits] :ref:`ctselect` takes the input event list ``events.fits``, performs an @@ -585,16 +578,16 @@ part: .. code-block:: xml - 2015-02-04T17:21:41: +=================+ - 2015-02-04T17:21:41: | Event selection | - 2015-02-04T17:21:41: +=================+ - 2015-02-04T17:21:41: === Observation === - 2015-02-04T17:21:41: Selected energy range .....: 0.1 - 100 TeV - 2015-02-04T17:21:41: Requested ROI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg - 2015-02-04T17:21:41: ROI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg - 2015-02-04T17:21:41: Selected ROI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg - 2015-02-04T17:21:41: cfitsio selection .........: ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000 - 2015-02-04T17:21:41: FITS filename .............: /var/tmp/tmp.0.pTIaTL[EVENTS][ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000] + 2015-05-22T20:01:46: +=================+ + 2015-05-22T20:01:46: | Event selection | + 2015-05-22T20:01:46: +=================+ + 2015-05-22T20:01:46: === Observation === + 2015-05-22T20:01:47: Selected energy range .....: 0.1 - 100 TeV + 2015-05-22T20:01:47: Requested ROI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg + 2015-05-22T20:01:47: ROI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg + 2015-05-22T20:01:47: Selected ROI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg + 2015-05-22T20:01:47: cfitsio selection .........: ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000 + 2015-05-22T20:01:47: FITS filename .............: /var/tmp/tmp.0.rRgLpO[EVENTS][ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000] .. note:: @@ -608,10 +601,10 @@ part: :ref:`ctselect` will automatically adjust the selection parameters to guarantee full enclosure. To keep track of this adjustment, the :ref:`ctselect` log file quotes the requested - selection, and existing selections, and the selection that was finally + selection, any existing selections, and the selection that was finally applied. -.. note:: +.. warning:: :ref:`ctselect` may of course also be used for event selection prior to binned analysis, for example to select events for a given period in @@ -627,24 +620,25 @@ instead of the counts cube: .. code-block:: bash - $ ctlike - Event list, counts cube or observation definition file [cntmap.fits] selected_events.fits - Calibration database [dummy] - Instrument response function [cta_dummy_irf] - Source model [$CTOOLS/share/models/crab.xml] - Source model output file [crab_results.xml] + $ ctlike + Event list, counts cube or observation definition file [cntcube.fits] selected_events.fits + Calibration database [prod2] + Instrument response function [South_50h] + Source model [$CTOOLS/share/models/crab.xml] + Source model output file [crab_results.xml] You will recognise that :ref:`ctlike` runs much faster in unbinned mode compared to binned mode. This is understandable as the selected event list contains -only 6127 events, while the binned counts cube we used before had +only 15312 events, while the binned counts cube we used before had 200 x 200 x 20 = 800000 pixels. As unbinned maximum likelihood fitting loops over the events (while binned maximum likelihood loops over the pixels), there are much less operations to perform in unbinned than in binned mode (there is some additional overhead in unbinned mode that comes from integrating the models over the region of interest, yet this is negligible -compared to the operations needed when looping over the pixels). So as long -as you work with short event lists, unbinned mode is faster. +compared to the operations needed when looping over all pixels). So as long +as you work with small event lists, unbinned mode is faster (this +typically holds up to 100 hours of observing time). Unbinned :ref:`ctlike` should also be more precise as no binning is performed, hence there is no loss of information due to histogramming. @@ -658,68 +652,62 @@ the same events for both analyses. .. code-block:: xml - 2015-02-04T17:31:58: +=================================+ - 2015-02-04T17:31:58: | Maximum likelihood optimisation | - 2015-02-04T17:31:58: +=================================+ - 2015-02-04T17:31:58: >Iteration 0: -logL=44395.244, Lambda=1.0e-03 - 2015-02-04T17:31:58: Iteration 1: -logL=44396.223, Lambda=1.0e-03, delta=-0.979, max(|grad|)=9.644743 [Sigma:6] (stalled) - 2015-02-04T17:31:58: >Iteration 2: -logL=44396.162, Lambda=1.0e-02, delta=0.061, max(|grad|)=-0.309683 [Normalization:7] - 2015-02-04T17:31:59: >Iteration 3: -logL=44396.162, Lambda=1.0e-03, delta=0.000, max(|grad|)=-0.008931 [Index:3] - 2015-02-04T17:31:59: - 2015-02-04T17:31:59: +=========================================+ - 2015-02-04T17:31:59: | Maximum likelihood optimization results | - 2015-02-04T17:31:59: +=========================================+ - 2015-02-04T17:31:59: === GOptimizerLM === - 2015-02-04T17:31:59: Optimized function value ..: 44396.162 - 2015-02-04T17:31:59: Absolute precision ........: 0.005 - 2015-02-04T17:31:59: Acceptable value decrease .: 2 - 2015-02-04T17:31:59: Optimization status .......: converged - 2015-02-04T17:31:59: Number of parameters ......: 9 - 2015-02-04T17:31:59: Number of free parameters .: 4 - 2015-02-04T17:31:59: Number of iterations ......: 3 - 2015-02-04T17:31:59: Lambda ....................: 0.0001 - 2015-02-04T17:31:59: Maximum log likelihood ....: -44396.162 - 2015-02-04T17:31:59: Observed events (Nobs) ...: 6127.000 - 2015-02-04T17:31:59: Predicted events (Npred) ..: 6127.000 (Nobs - Npred = 0.000303534) - 2015-02-04T17:31:59: === GModels === - 2015-02-04T17:31:59: Number of models ..........: 2 - 2015-02-04T17:31:59: Number of parameters ......: 9 - 2015-02-04T17:31:59: === GModelSky === - 2015-02-04T17:31:59: Name ......................: Crab - 2015-02-04T17:31:59: Instruments ...............: all - 2015-02-04T17:31:59: Instrument scale factors ..: unity - 2015-02-04T17:31:59: Observation identifiers ...: all - 2015-02-04T17:31:59: Model type ................: PointSource - 2015-02-04T17:31:59: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" - 2015-02-04T17:31:59: Number of parameters ......: 6 - 2015-02-04T17:31:59: Number of spatial par's ...: 2 - 2015-02-04T17:31:59: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) - 2015-02-04T17:31:59: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) - 2015-02-04T17:31:59: Number of spectral par's ..: 3 - 2015-02-04T17:31:59: Prefactor ................: 6.13325e-16 +/- 2.05738e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) - 2015-02-04T17:31:59: Index ....................: -2.5057 +/- 0.0250818 [-0,-5] (free,scale=-1,gradient) - 2015-02-04T17:31:59: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) - 2015-02-04T17:31:59: Number of temporal par's ..: 1 - 2015-02-04T17:31:59: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T17:31:59: === GCTAModelRadialAcceptance === - 2015-02-04T17:31:59: Name ......................: Background - 2015-02-04T17:31:59: Instruments ...............: CTA - 2015-02-04T17:31:59: Instrument scale factors ..: unity - 2015-02-04T17:31:59: Observation identifiers ...: all - 2015-02-04T17:31:59: Model type ................: "Gaussian" * "FileFunction" * "Constant" - 2015-02-04T17:31:59: Number of parameters ......: 3 - 2015-02-04T17:31:59: Number of radial par's ....: 1 - 2015-02-04T17:31:59: Sigma ....................: 3.04429 +/- 0.0330227 [0.01,10] deg2 (free,scale=1,gradient) - 2015-02-04T17:31:59: Number of spectral par's ..: 1 - 2015-02-04T17:31:59: Normalization ............: 0.996767 +/- 0.0175227 [0,1000] (free,scale=1,gradient) - 2015-02-04T17:31:59: Number of temporal par's ..: 1 - 2015-02-04T17:31:59: Constant .................: 1 (relative value) (fixed,scale=1,gradient) - 2015-02-04T17:31:59: - 2015-02-04T17:31:59: +==============+ - 2015-02-04T17:31:59: | Save results | - 2015-02-04T17:31:59: +==============+ - 2015-02-04T17:31:59: - 2015-02-04T17:31:59: Application "ctlike" terminated after 8 wall clock seconds, consuming 0.21275 seconds of CPU time. + 2015-05-22T20:05:54: +=================================+ + 2015-05-22T20:05:54: | Maximum likelihood optimisation | + 2015-05-22T20:05:54: +=================================+ + 2015-05-22T20:05:54: >Iteration 0: -logL=93854.543, Lambda=1.0e-03 + 2015-05-22T20:05:54: >Iteration 1: -logL=93848.595, Lambda=1.0e-03, delta=5.948, max(|grad|)=22.480581 [Index:7] + 2015-05-22T20:05:54: >Iteration 2: -logL=93848.587, Lambda=1.0e-04, delta=0.008, max(|grad|)=-0.081846 [Index:3] + 2015-05-22T20:05:54: >Iteration 3: -logL=93848.587, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003485 [Index:3] + 2015-05-22T20:05:54: + 2015-05-22T20:05:54: +=========================================+ + 2015-05-22T20:05:54: | Maximum likelihood optimization results | + 2015-05-22T20:05:54: +=========================================+ + 2015-05-22T20:05:54: === GOptimizerLM === + 2015-05-22T20:05:54: Optimized function value ..: 93848.587 + 2015-05-22T20:05:54: Absolute precision ........: 0.005 + 2015-05-22T20:05:54: Acceptable value decrease .: 2 + 2015-05-22T20:05:54: Optimization status .......: converged + 2015-05-22T20:05:54: Number of parameters ......: 10 + 2015-05-22T20:05:54: Number of free parameters .: 4 + 2015-05-22T20:05:54: Number of iterations ......: 3 + 2015-05-22T20:05:54: Lambda ....................: 1e-06 + 2015-05-22T20:05:54: Maximum log likelihood ....: -93848.587 + 2015-05-22T20:05:54: Observed events (Nobs) ...: 15312.000 + 2015-05-22T20:05:54: Predicted events (Npred) ..: 15312.000 (Nobs - Npred = 3.03823e-06) + 2015-05-22T20:05:54: === GModels === + 2015-05-22T20:05:54: Number of models ..........: 2 + 2015-05-22T20:05:54: Number of parameters ......: 10 + 2015-05-22T20:05:54: === GModelSky === + 2015-05-22T20:05:54: Name ......................: Crab + 2015-05-22T20:05:54: Instruments ...............: all + 2015-05-22T20:05:54: Instrument scale factors ..: unity + 2015-05-22T20:05:54: Observation identifiers ...: all + 2015-05-22T20:05:54: Model type ................: PointSource + 2015-05-22T20:05:54: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" + 2015-05-22T20:05:54: Number of parameters ......: 6 + 2015-05-22T20:05:54: Number of spatial par's ...: 2 + 2015-05-22T20:05:54: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) + 2015-05-22T20:05:54: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) + 2015-05-22T20:05:54: Number of spectral par's ..: 3 + 2015-05-22T20:05:54: Prefactor ................: 5.80619e-16 +/- 1.11149e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) + 2015-05-22T20:05:54: Index ....................: -2.49282 +/- 0.0163467 [-0,-5] (free,scale=-1,gradient) + 2015-05-22T20:05:54: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T20:05:54: Number of temporal par's ..: 1 + 2015-05-22T20:05:54: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) + 2015-05-22T20:05:54: === GCTAModelIrfBackground === + 2015-05-22T20:05:54: Name ......................: CTABackgroundModel + 2015-05-22T20:05:54: Instruments ...............: CTA + 2015-05-22T20:05:54: Instrument scale factors ..: unity + 2015-05-22T20:05:54: Observation identifiers ...: all + 2015-05-22T20:05:54: Model type ................: "PowerLaw" * "Constant" + 2015-05-22T20:05:54: Number of parameters ......: 4 + 2015-05-22T20:05:54: Number of spectral par's ..: 3 + 2015-05-22T20:05:54: Prefactor ................: 1.03511 +/- 0.024311 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) + 2015-05-22T20:05:54: Index ....................: 0.0333176 +/- 0.0134386 [-5,5] (free,scale=1,gradient) + 2015-05-22T20:05:54: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) + 2015-05-22T20:05:54: Number of temporal par's ..: 1 + 2015-05-22T20:05:54: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) .. _sec_butterfly_cta: @@ -739,14 +727,14 @@ line. .. code-block:: bash $ ctbutterfly - Input event list, cube or observation definition file [events.fits] - Calibration database [dummy] - Instrument response function [cta_dummy_irf] - Source model [$CTOOLS/share/models/crab.xml] crab_results.xml + Input event list, counts cube or observation definition file [events.fits] + Calibration database [prod2] + Instrument response function [South_50h] + Source model [$CTOOLS/share/models/crab.xml] Source of interest [Crab] Start value for first energy bin in TeV [0.1] Stop value for last energy bin in TeV [100.0] - Output ascii file [butterfly.txt] + Output ascii file [butterfly.txt] Now that you have computed the confidence band of the spectral fit and that you will have an ASCII file named ``butterfly.txt`` on disk you can diff --git a/doc/source/user_manual/getting_started/tsmap-crab.png b/doc/source/user_manual/getting_started/tsmap-crab.png index 1fa28b8..f1ef431 100644 --- a/doc/source/user_manual/getting_started/tsmap-crab.png +++ b/doc/source/user_manual/getting_started/tsmap-crab.png