Commit ab8f5bbce11af35fd73beb2062746fc5b772247b
Merge branch 'devel' into ctools-cterror
Showing
96 changed files
with
2783 additions
and
1623 deletions
ChangeLog
| 1 | -2015-03-28 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 1 | +2015-06-09 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 2 | 2 | |
| 3 | - * Version 1.0.0 released | |
| 3 | + * Version 0.10.0 released | |
| 4 | + ========================= | |
| 5 | + | |
| 6 | + Check existence of ROI in ctbin (#1476) | |
| 7 | + Allocate optimizer in ctlike upon construction (#1471) | |
| 8 | + Move cscripts into the ctools Python module (#1470) | |
| 9 | + | |
| 10 | + | |
| 11 | +2015-05-22 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 12 | + | |
| 13 | + * Version 0.9.0 released | |
| 4 | 14 | ======================== |
| 5 | 15 | |
| 6 | - Adapt to GammaLib 1.0.0 interface | |
| 16 | + Adapt to GammaLib 0.10.0 interface | |
| 7 | 17 | Do not import automatically Python scripts |
| 8 | 18 | Support INDEF/NONE/UNDEF/UNDEFINED parameters in ctselect |
| 9 | 19 | Modify cssens parameter interface (#1426) |
| ... | ... | @@ -12,6 +22,9 @@ |
| 12 | 22 | Allow ctmodel usage for stacked analysis from command line |
| 13 | 23 | Correct rate check in ctobssim for map cubes (#1452) |
| 14 | 24 | Handle background cubes for stacked analysis (#1371) |
| 25 | + Add csspec script (#1364) | |
| 26 | + Add cslightcrv script (#1365) | |
| 27 | + Correct sensitivity computation in cssens | |
| 15 | 28 | |
| 16 | 29 | |
| 17 | 30 | 2015-01-08 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | ... | ... |
NEWS
| 1 | -New Features and Important Changes in ctools 1.0.0 | |
| 1 | +New Features and Important Changes in ctools 0.10.0 | |
| 2 | 2 | |
| 3 | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | |
| 5 | -28 March 2015 | |
| 5 | +9 June 2015 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | 1. Introduction |
| 9 | 9 | --------------- |
| 10 | 10 | This document briefly summarizes executable by executable the most important |
| 11 | 11 | changes made since the last release of ctools. The code complies to GammaLib |
| 12 | -version 1.0.0 or above. | |
| 12 | +version 0.11.0 or above. | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | 2. Configuration |
| ... | ... | @@ -19,11 +19,8 @@ None |
| 19 | 19 | |
| 20 | 20 | 3. Python interface |
| 21 | 21 | ------------------- |
| 22 | -The ctools module does no longer import automatically Python scripts. This | |
| 23 | -prevents to break the ctools interface in case that some dependencies in | |
| 24 | -the scripts are broken. Scripts (such as obsutils, analysisutils or plotutils) | |
| 25 | -are support scripts that may not be fully supported throughout the | |
| 26 | -development. They may be moved into a special contributions area in the future. | |
| 22 | +The cscripts have been moved to the ctools module. Now everything is comprised | |
| 23 | +in that module. | |
| 27 | 24 | |
| 28 | 25 | |
| 29 | 26 | 4. Support model |
| ... | ... | @@ -33,31 +30,29 @@ None |
| 33 | 30 | |
| 34 | 31 | 5. ctobssim - CTA observation simulation |
| 35 | 32 | ---------------------------------------- |
| 36 | -The rate check is now also correctly done for map cubes. Before, the rate check | |
| 37 | -made simulations with a diffuse map cube fail (#1452). | |
| 33 | +None | |
| 38 | 34 | |
| 39 | 35 | |
| 40 | 36 | 6. ctselect - CTA event selection |
| 41 | 37 | --------------------------------- |
| 42 | -If INDEF, UNDEF, NONE or UNDEFINED are passed for the selection parameters, no | |
| 43 | -selection will be performed. | |
| 38 | +None | |
| 44 | 39 | |
| 45 | 40 | |
| 46 | 41 | 7. ctbin - CTA event binning |
| 47 | 42 | ---------------------------- |
| 48 | -None | |
| 43 | +ctbin now verifies if an ROI has been set properly, and throws an exception in | |
| 44 | +case that no ROI information could be found. | |
| 49 | 45 | |
| 50 | 46 | |
| 51 | 47 | 8. ctlike - Maximum likelihood fitting |
| 52 | 48 | -------------------------------------- |
| 53 | -The bkgcube parameter has been added to allow specification of a background | |
| 54 | -cube for stacked analysis. | |
| 49 | +The optimizer is now allocated upon construction so that ctlike always returns a | |
| 50 | +meaningful object using the opt() method. | |
| 55 | 51 | |
| 56 | 52 | |
| 57 | 53 | 9. cttsmap - Generation of Test Statistics map |
| 58 | 54 | ---------------------------------------------- |
| 59 | -The bkgcube parameter has been added to allow specification of a background | |
| 60 | -cube for stacked analysis. | |
| 55 | +None | |
| 61 | 56 | |
| 62 | 57 | |
| 63 | 58 | 10. ctskymap - CTA sky mapping |
| ... | ... | @@ -67,14 +62,7 @@ None |
| 67 | 62 | |
| 68 | 63 | 11. ctmodel - CTA counts cube modelling |
| 69 | 64 | --------------------------------------- |
| 70 | -The ctmodel tool can now be used for stacked analysis from the command line. | |
| 71 | -It directly makes use of the cube response to compute the model without using | |
| 72 | -the original IRF information. This makes generation of model cubes substantially | |
| 73 | -faster. The old method of accessing the IRF response for model computation is | |
| 74 | -still possible. | |
| 75 | - | |
| 76 | -The bkgcube parameter has been added to allow specification of a background | |
| 77 | -cube for stacked analysis. | |
| 65 | +None | |
| 78 | 66 | |
| 79 | 67 | |
| 80 | 68 | 12. ctexpcube - CTA exposure cube generation |
| ... | ... | @@ -99,16 +87,12 @@ None |
| 99 | 87 | |
| 100 | 88 | 16. ctbutterfly - Generate butterfly diagrams |
| 101 | 89 | --------------------------------------------- |
| 102 | -The bkgcube parameter has been added to allow specification of a background | |
| 103 | -cube for stacked analysis. | |
| 90 | +None | |
| 104 | 91 | |
| 105 | 92 | |
| 106 | 93 | 17. ctulimit - Compute upper limit |
| 107 | 94 | ---------------------------------- |
| 108 | -Added an initial version of the upper limit computation tool. | |
| 109 | - | |
| 110 | -The bkgcube parameter has been added to allow specification of a background | |
| 111 | -cube for stacked analysis. | |
| 95 | +None | |
| 112 | 96 | |
| 113 | 97 | |
| 114 | 98 | 18. Examples |
| ... | ... | @@ -118,16 +102,7 @@ None |
| 118 | 102 | |
| 119 | 103 | 19. Scripts |
| 120 | 104 | ----------- |
| 121 | -The user parameter interface of cssens has been modified. The script | |
| 122 | -now reads a source model that is used for sensitivity estimation. | |
| 123 | -This provides more flexibility in the choice of the model for | |
| 124 | -sensitivity estimation. | |
| 125 | - | |
| 126 | -The csobsdef script has been added that allows creation of observation | |
| 127 | -definition XML files from colon separated value ASCII files. The | |
| 128 | -observation definition files from csobsdef can be fed to ctobssim for | |
| 129 | -simulation of multiple pointings in one shot. This enables for example | |
| 130 | -survey observations to be simulated in a single ctobssim run. | |
| 105 | +None | |
| 131 | 106 | |
| 132 | 107 | |
| 133 | 108 | 20. caldb | ... | ... |
README
| 1 | 1 | ctools information |
| 2 | 2 | ================== |
| 3 | -Version: 00-08-01 (8 January 2015) | |
| 3 | +Version: 0.9.0 (20 May 2015) | |
| 4 | 4 | Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) |
| 5 | -GammaLib dependency: 00-09-00 | |
| 5 | +GammaLib dependency: 0.10.0 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | License information |
| ... | ... | @@ -34,20 +34,27 @@ for the high-level analysis of astronomical gamma-ray data. |
| 34 | 34 | |
| 35 | 35 | The following tools are available: |
| 36 | 36 | |
| 37 | - ctbin - event binning | |
| 38 | - ctlike - maximum likelihood model fitting | |
| 39 | - ctmodel - generation of model counts map | |
| 40 | - ctobssim - simulation of CTA observations | |
| 41 | - ctselect - event selection | |
| 42 | - ctskymap - CTA sky mapping tool | |
| 37 | + ctbin - event binning | |
| 38 | + ctbkgcube - generate a background cube | |
| 39 | + ctbutterfly - create a butterfly | |
| 40 | + ctcubemask - mask bins in binned analysis | |
| 41 | + ctexpcube - generate an exposure cube | |
| 42 | + ctlike - maximum likelihood model fitting | |
| 43 | + ctmodel - generation of model counts map | |
| 44 | + ctobssim - simulation of CTA observations | |
| 45 | + ctpsfcube - generate a PSF cube | |
| 46 | + ctselect - event selection | |
| 47 | + ctskymap - CTA sky mapping tool | |
| 48 | + cttsmap - generate a TS map | |
| 49 | + ctulimit - compute upper limits | |
| 43 | 50 | |
| 44 | 51 | |
| 45 | 52 | Web sites |
| 46 | 53 | ========= |
| 47 | -http://cta.irap.omp.eu/ctools - ctools documentation | |
| 48 | -https://cta-redmine.irap.omp.eu/projects/ctools - for ctools development | |
| 49 | -http://gammalib.sourceforge.net - for GammaLib documentation | |
| 50 | -https://sourceforge.net/projects/gammalib/ - for GammaLib downloads | |
| 54 | +http://cta.irap.omp.eu/ctools - ctools documentation | |
| 55 | +https://cta-redmine.irap.omp.eu/projects/ctools - for ctools development | |
| 56 | +https://cta-redmine.irap.omp.eu/projects/gammalib - for GammaLib documentation | |
| 57 | +https://sourceforge.net/projects/gammalib/ - for GammaLib downloads | |
| 51 | 58 | |
| 52 | 59 | |
| 53 | 60 | Prerequisites | ... | ... |
caldb/Makefile.am
| 1 | 1 | ## Process this file with automake to produce Makefile.in |
| 2 | 2 | |
| 3 | 3 | # Calibration files to distribute |
| 4 | -caldb_indx = caldb.indx | |
| 5 | -caldb_irf = cta_dummy_irf.dat | |
| 6 | - | |
| 7 | -# Distribute calibration database files | |
| 8 | -EXTRA_DIST = $(caldb_indx) $(caldb_irf) | |
| 9 | -caldbindxdir = $(datadir)/caldb/data/cta/dummy | |
| 10 | -caldbindx_DATA = $(caldb_indx) | |
| 11 | -caldbirfdir = $(datadir)/caldb/data/cta/dummy/bcf | |
| 12 | -caldbirf_DATA = $(caldb_irf) | |
| 4 | +caldb_prod2_indxdir = $(datadir)/caldb/data/cta/prod2 | |
| 5 | +caldb_prod2_indx_DATA = data/cta/prod2/caldb.indx | |
| 6 | +caldb_prod2_north1dir = $(datadir)/caldb/data/cta/prod2/bcf/North_0.5h | |
| 7 | +caldb_prod2_north1_DATA = data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz | |
| 8 | +caldb_prod2_north2dir = $(datadir)/caldb/data/cta/prod2/bcf/North_5h | |
| 9 | +caldb_prod2_north2_DATA = data/cta/prod2/bcf/North_5h/irf_file.fits.gz | |
| 10 | +caldb_prod2_north3dir = $(datadir)/caldb/data/cta/prod2/bcf/North_50h | |
| 11 | +caldb_prod2_north3_DATA = data/cta/prod2/bcf/North_50h/irf_file.fits.gz | |
| 12 | +# | |
| 13 | +caldb_prod2_south1dir = $(datadir)/caldb/data/cta/prod2/bcf/South_0.5h | |
| 14 | +caldb_prod2_south1_DATA = data/cta/prod2/bcf/South_0.5h/irf_file.fits.gz | |
| 15 | +caldb_prod2_south2dir = $(datadir)/caldb/data/cta/prod2/bcf/South_5h | |
| 16 | +caldb_prod2_south2_DATA = data/cta/prod2/bcf/South_5h/irf_file.fits.gz | |
| 17 | +caldb_prod2_south3dir = $(datadir)/caldb/data/cta/prod2/bcf/South_50h | |
| 18 | +caldb_prod2_south3_DATA = data/cta/prod2/bcf/South_50h/irf_file.fits.gz | ... | ... |
caldb/caldb.indx deleted
No preview for this file type
caldb/cta_dummy_irf.dat deleted
| 1 | -log(E) Area r68 r80 ERes. BG Rate Diff Sens | |
| 2 | --1.7 261.6 0.3621 0.4908 0.5134 1.89924e-02 6.88237e-11 | |
| 3 | --1.5 5458.2 0.2712 0.3685 0.4129 1.00972e-01 1.72717e-11 | |
| 4 | --1.3 15590.0 0.1662 0.2103 0.2721 5.75623e-02 6.16963e-12 | |
| 5 | --1.1 26554.1 0.1253 0.1567 0.2611 2.13008e-02 2.89932e-12 | |
| 6 | --0.9 52100.5 0.1048 0.1305 0.1987 8.87292e-03 1.39764e-12 | |
| 7 | --0.7 66132.1 0.0827 0.1024 0.1698 1.09756e-03 6.03531e-13 | |
| 8 | --0.5 108656.8 0.0703 0.0867 0.1506 4.84287e-04 3.98147e-13 | |
| 9 | --0.3 129833.0 0.0585 0.0722 0.1338 1.57546e-04 3.23090e-13 | |
| 10 | --0.1 284604.3 0.0531 0.0656 0.1008 1.36703e-04 2.20178e-13 | |
| 11 | -0.1 263175.3 0.0410 0.0506 0.0831 2.09694e-05 1.87452e-13 | |
| 12 | -0.3 778048.6 0.0470 0.0591 0.0842 6.92374e-05 1.53976e-13 | |
| 13 | -0.5 929818.8 0.0391 0.0492 0.0650 1.45844e-05 1.18947e-13 | |
| 14 | -0.7 1078450.0 0.0335 0.0415 0.0541 1.15959e-05 1.51927e-13 | |
| 15 | -0.9 1448579.1 0.0317 0.0397 0.0516 4.71231e-06 1.42439e-13 | |
| 16 | -1.1 1899905.0 0.0290 0.0372 0.0501 8.14997e-06 1.96670e-13 | |
| 17 | -1.3 2476403.8 0.0285 0.0367 0.0538 5.91940e-06 2.20695e-13 | |
| 18 | -1.5 2832570.6 0.0284 0.0372 0.0636 7.33847e-06 3.22523e-13 | |
| 19 | -1.7 3534065.3 0.0290 0.0386 0.0731 1.34549e-05 4.84153e-13 | |
| 20 | -1.9 3250103.4 0.0238 0.0308 0.0729 4.42228e-06 6.26265e-13 | |
| 21 | -2.1 3916071.6 0.0260 0.0354 0.0908 2.26648e-06 7.69921e-13 | |
| 22 | ---------------------------------------------- | |
| 23 | -Notes | |
| 24 | - 1) log(E) = log10(E/TeV) - bin centre | |
| 25 | - 2) Eff Area - in square metres after background cut (no theta cut) | |
| 26 | - 3) Ang. Res - 68% containment radius of gamma-ray PSF post cuts - in degrees | |
| 27 | - 4) Ang. Res - 80% containment radius of gamma-ray PSF post cuts - in degrees | |
| 28 | - 5) Fractional Energy Resolution (rms) | |
| 29 | - 6) BG Rate - inside point-source selection region - post call cuts - in Hz | |
| 30 | - 7) Diff Sens - differential sensitivity for this bin expressed as E^2 dN/dE | |
| 31 | - - in erg cm^-2 s^-1 - for a 50 hours exposure - 5 sigma significance including | |
| 32 | - systematics and statistics and at least 10 photons. |
caldb/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/bcf/North_50h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/bcf/North_5h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/bcf/South_0.5h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/bcf/South_50h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/bcf/South_5h/irf_file.fits.gz
0 → 100644
No preview for this file type
caldb/data/cta/prod2/caldb.indx
0 → 100644
No preview for this file type
configure.ac
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | ############################################################################# |
| 30 | 30 | # Initialisation # |
| 31 | 31 | ############################################################################# |
| 32 | -AC_INIT([ctools], [1.0.0], [jurgen.knodlseder@irap.omp.eu], [ctools]) | |
| 32 | +AC_INIT([ctools], [0.9.0], [jurgen.knodlseder@irap.omp.eu], [ctools]) | |
| 33 | 33 | AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) |
| 34 | 34 | AC_CONFIG_MACRO_DIR([m4]) |
| 35 | 35 | #AM_INIT_AUTOMAKE([gnu no-dependencies]) |
| ... | ... | @@ -749,8 +749,8 @@ darwin_kluge=no |
| 749 | 749 | # Detect if GammaLib has been compiled with OpenMP |
| 750 | 750 | AC_MSG_CHECKING(whether GammaLib has been compiled with OpenMP) |
| 751 | 751 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <GObservations.hpp>]],,)], |
| 752 | - [gammalib_with_openmp=no;AC_MSG_RESULT(no)], | |
| 753 | - [gammalib_with_openmp=yes;AC_MSG_RESULT(yes)]) | |
| 752 | + [gammalib_with_openmp=no;AC_MSG_RESULT(no)], | |
| 753 | + [gammalib_with_openmp=yes;AC_MSG_RESULT(yes)]) | |
| 754 | 754 | |
| 755 | 755 | # Check if openMP is available |
| 756 | 756 | m4_ifdef([AC_OPENMP],[AC_OPENMP], [AX_OPENMP([openmp_ok=yes],[openmp_ok=no])]) | ... | ... |
ctools.pc.in
| ... | ... | @@ -6,9 +6,9 @@ includedir=${prefix}/include |
| 6 | 6 | Name: ctools |
| 7 | 7 | Description: CTA science analysis tools |
| 8 | 8 | URL: http://cta.irap.omp.eu/ctools |
| 9 | -Version: 1.0.0 | |
| 9 | +Version: 0.9.0 | |
| 10 | 10 | Requires: |
| 11 | -Requires.private: gammalib >= 1.0.0 | |
| 11 | +Requires.private: gammalib >= 0.10.0 | |
| 12 | 12 | Conflicts: |
| 13 | 13 | Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ |
| 14 | 14 | Libs: -L${libdir} -lctools | ... | ... |
doc/Doxyfile
| ... | ... | @@ -32,7 +32,7 @@ PROJECT_NAME = ctools |
| 32 | 32 | # This could be handy for archiving the generated documentation or |
| 33 | 33 | # if some version control system is used. |
| 34 | 34 | |
| 35 | -PROJECT_NUMBER = 1.0.0 | |
| 35 | +PROJECT_NUMBER = 0.9.0 | |
| 36 | 36 | |
| 37 | 37 | # Using the PROJECT_BRIEF tag one can provide an optional one line description |
| 38 | 38 | # for a project that appears at the top of each page and should give viewer | ... | ... |
doc/source/_templates/index.html
| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | body %} |
| 3 | 3 | <h1>{{ _('ctools') }}</h1> |
| 4 | 4 | |
| 5 | -<h2 style="margin-bottom: 0">{%trans%}About{%endtrans%}</h2> | |
| 6 | - | |
| 7 | 5 | <p>{%trans%} ctools is a software package developed for the scientific |
| 8 | 6 | analysis of Cherenkov Telescope Array (CTA) data. Analysis of data from |
| 9 | 7 | existing Imaging Air Cherenkov Telescopes (such as H.E.S.S., MAGIC or | ... | ... |
doc/source/_themes/sphinx13/layout.html
| ... | ... | @@ -67,6 +67,7 @@ |
| 67 | 67 | {% block header %} |
| 68 | 68 | <div class="pageheader"> |
| 69 | 69 | <ul> |
| 70 | + <li><a href="{{ pathto('about') }}">About</a></li> | |
| 70 | 71 | <li><a href="{{ pathto('index') }}">Home</a></li> |
| 71 | 72 | <li><a href="{{ pathto('download') }}">Download</a></li> |
| 72 | 73 | <li><a href="{{ pathto('contents') }}">Documentation</a></li> | ... | ... |
doc/source/about.rst
0 → 100644
| 1 | +.. _about: | |
| 2 | + | |
| 3 | +About | |
| 4 | +===== | |
| 5 | + | |
| 6 | +ctools is a software package developed for the scientific analysis of | |
| 7 | +Cherenkov Telescope Array (CTA) data. | |
| 8 | +Analysis of data from existing Imaging Air Cherenkov Telescopes (such as | |
| 9 | +H.E.S.S., MAGIC or VERITAS) is also supported, provided that the data and | |
| 10 | +response functions are available in the format defined for CTA. | |
| 11 | + | |
| 12 | +ctools comprises a set of ftools-like binary executables with a | |
| 13 | +command-line interface allowing for interactive step-wise data analysis. | |
| 14 | +ctools includes also a Python module allowing to control all executables. | |
| 15 | +Creation of shell or Python scripts and pipelines is supported. | |
| 16 | +ctools provides cscripts, which are Python scripts complementing the | |
| 17 | +binary executables. | |
| 18 | +Extensions of the ctools package by user defined binary executables or | |
| 19 | +Python scripts is supported. | |
| 20 | + | |
| 21 | +ctools are based on GammaLib, a versatile toolbox for the high-level | |
| 22 | +analysis of astronomical gamma-ray data. | |
| 23 | +Besides CTA, GammaLib supports also the analysis of Fermi/LAT and COMPTEL | |
| 24 | +data, and extensions to support further gamma-ray instruments are planned. | |
| 25 | +An interface to virtual observatory ressources is also in preparation. | |
| 26 | +By making use of the GammaLib multi-instrument capabilities, ctools | |
| 27 | +supports the joint analysis of CTA (or any IACT providing data in the | |
| 28 | +CTA format), Fermi/LAT and COMPTEL data. | |
| 29 | + | |
| 30 | + | |
| 31 | +Acknowledging or citing ctools | |
| 32 | +------------------------------ | |
| 33 | + | |
| 34 | +If you use ctools for work/research presented in a publication we ask you | |
| 35 | +that you include the following standard acknowledgment: | |
| 36 | + | |
| 37 | + *This research made use of ctools, a community-developed analysis package | |
| 38 | + for Imaging Air Cherenkov Telescope data. ctools is based on GammaLib, | |
| 39 | + a community-developed toolbox for the high-level analysis of astronomical | |
| 40 | + gamma-ray data.* | |
| 41 | + | |
| 42 | + | |
| 43 | +If you wish, you can also include a link to http://cta.irap.omp.eu/ctools/ | |
| 44 | +(if the journal allows this) in addition to the above text. | |
| 45 | + | |
| 46 | +If you are giving a presentation or talk featuring work/research that makes | |
| 47 | +use of ctools, we suggest using this logo on your title slide: | |
| 48 | + | |
| 49 | +.. figure:: ctools-logo.jpg | |
| 50 | + :width: 150px | |
| 51 | + :align: center | |
| 52 | + | |
| 53 | + | |
| 54 | +License | |
| 55 | +------- | |
| 56 | + | |
| 57 | +ctools is free software distributed under the GNU GPL license version 3. | ... | ... |
doc/source/conf.py
| ... | ... | @@ -66,10 +66,10 @@ copyright = u'2014-2015, ctools developers' |
| 66 | 66 | # built documents. |
| 67 | 67 | # |
| 68 | 68 | # The short X.Y version. |
| 69 | -version = '1.0' | |
| 69 | +version = '0.9' | |
| 70 | 70 | |
| 71 | 71 | # The full version, including alpha/beta/rc tags. |
| 72 | -release = '1.0.0' | |
| 72 | +release = '0.9.0' | |
| 73 | 73 | |
| 74 | 74 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 75 | 75 | # for a list of supported languages. | ... | ... |
doc/source/ctools-logo.jpg
0 → 100644
37 KB
doc/source/download.rst
| ... | ... | @@ -13,7 +13,7 @@ bugs. |
| 13 | 13 | Releases |
| 14 | 14 | -------- |
| 15 | 15 | |
| 16 | -The latest ctools release is ``ctools-00-08-01`` (8 January 2015). | |
| 16 | +The latest ctools release is ``ctools-0.9.0`` (22 May 2015). | |
| 17 | 17 | |
| 18 | 18 | Below a table of ctools releases. Please note that at this stage of the |
| 19 | 19 | project there is a strict link between the ctools and gammalib versions. |
| ... | ... | @@ -28,6 +28,9 @@ gammalib. |
| 28 | 28 | * - `ctools <http://cta.irap.omp.eu/ctools/releases/ctools/ChangeLog>`_ |
| 29 | 29 | - `gammalib <http://cta.irap.omp.eu/ctools/releases/gammalib/ChangeLog>`_ |
| 30 | 30 | - Mac OS X package |
| 31 | + * - `0.9.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.0.tar.gz>`_ | |
| 32 | + - `0.10.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.10.0.tar.gz>`_ | |
| 33 | + - `ctools-0.9.0-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-0.9.0-macosx10.3.dmg>`_ | |
| 31 | 34 | * - `0.8.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01.tar.gz>`_ |
| 32 | 35 | - `0.9.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-01.tar.gz>`_ |
| 33 | 36 | - `ctools-00-08-01-macosx10.3.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-00-08-01-macosx10.3.dmg>`_ | ... | ... |
doc/source/reference_manual/cslightcrv.rst
0 → 100644
| 1 | +.. _cslightcrv: | |
| 2 | + | |
| 3 | +cslightcrv | |
| 4 | +========== | |
| 5 | + | |
| 6 | +Computes a lightcurve for a given source. | |
| 7 | + | |
| 8 | + | |
| 9 | +Synopsis | |
| 10 | +-------- | |
| 11 | + | |
| 12 | +Computes a lightcurve for a given source. | |
| 13 | + | |
| 14 | + | |
| 15 | +General parameters | |
| 16 | +------------------ | |
| 17 | + | |
| 18 | +``(inobs = NONE) [file]`` | |
| 19 | + Input event list, counts cube or observation definition XML file. | |
| 20 | + | |
| 21 | +``inmodel [file]`` | |
| 22 | + Input source model XML file. | |
| 23 | + | |
| 24 | +``srcname [string]`` | |
| 25 | + Name of the source in the source model XML file which should be used | |
| 26 | + for sensitivity computation. | |
| 27 | + | |
| 28 | +``outfile [file]`` | |
| 29 | + Name of the source spectrum output file. | |
| 30 | + | |
| 31 | +``expcube [file]`` | |
| 32 | + Exposure cube file (only needed for stacked analysis). | |
| 33 | + | |
| 34 | +``psfcube [file]`` | |
| 35 | + PSF cube file (only needed for stacked analysis). | |
| 36 | + | |
| 37 | +``bkgcube [file]`` | |
| 38 | + Background cube file (only needed for stacked analysis). | |
| 39 | + | |
| 40 | +``caldb [string]`` | |
| 41 | + Calibration database. | |
| 42 | + | |
| 43 | +``irf [string]`` | |
| 44 | + Instrumental response function. | |
| 45 | + | |
| 46 | +``tmin [real]`` | |
| 47 | + Lightcurve start time (in MJD). | |
| 48 | + | |
| 49 | +``tmax [real]`` | |
| 50 | + Lightcurve stop time (in MJD). | |
| 51 | + | |
| 52 | +``tbins [integer]`` | |
| 53 | + Number of time bins. | |
| 54 | + | |
| 55 | +``(tbinalg = GTI) <FILE|LIN|GTI> [string]`` | |
| 56 | + Algorithm for defining time bins. | |
| 57 | + | |
| 58 | +``tbinfile [file]`` | |
| 59 | + File defining the time binning. | |
| 60 | + | |
| 61 | +``binned [boolean]`` | |
| 62 | + Use binned analysis in each time bin. | |
| 63 | + | |
| 64 | +``enumbins [integer]`` | |
| 65 | + Number of energy bins per light curve bin (0=unbinned). | |
| 66 | + | |
| 67 | +``emin [real]`` | |
| 68 | + Lower energy limit of events (in TeV). | |
| 69 | + | |
| 70 | +``emax [real]`` | |
| 71 | + Upper energy limit of events (in TeV). | |
| 72 | + | |
| 73 | +``coordsys <CEL|GAL> [string]`` | |
| 74 | + Coordinate system (CEL - celestial, GAL - galactic). | |
| 75 | + | |
| 76 | +``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | |
| 77 | + Projection method. | |
| 78 | + | |
| 79 | +``xref [real]`` | |
| 80 | + Right Ascension / Galactic longitude of image centre (J2000, in degrees). | |
| 81 | + | |
| 82 | +``yref [real]`` | |
| 83 | + Declination / Galactic latitude of image centre (J2000, in degrees). | |
| 84 | + | |
| 85 | +``nxpix [integer]`` | |
| 86 | + Size of the Right Ascension / Galactic longitude axis (in pixels). | |
| 87 | + | |
| 88 | +``nypix [integer]`` | |
| 89 | + Size of the Declination / Galactic latitude axis (in pixels). | |
| 90 | + | |
| 91 | +``binsz [real]`` | |
| 92 | + Pixel size (in degrees/pixel). | |
| 93 | + | |
| 94 | +``(calc_ts = yes) [boolean]`` | |
| 95 | + Compute TS value for each time bin? | |
| 96 | + | |
| 97 | +``(calc_ulim = yes) [boolean]`` | |
| 98 | + Compute upper limit for each time bin? | |
| 99 | + | |
| 100 | +``(fix_srcs = yes) [boolean]`` | |
| 101 | + Fix other sky model parameters? | |
| 102 | + | |
| 103 | +``(fix_bkg = no) [boolean]`` | |
| 104 | + Fix background model parameters? | |
| 105 | + | |
| 106 | + | |
| 107 | +Standard parameters | |
| 108 | +------------------- | |
| 109 | + | |
| 110 | +``(chatter = 2) [integer]`` | |
| 111 | + Verbosity of the executable: | |
| 112 | + chatter = 0: no information will be logged | |
| 113 | + | |
| 114 | + chatter = 1: only errors will be logged | |
| 115 | + | |
| 116 | + chatter = 2: errors and actions will be logged | |
| 117 | + | |
| 118 | + chatter = 3: report about the task execution | |
| 119 | + | |
| 120 | + chatter = 4: detailed report about the task execution | |
| 121 | + | |
| 122 | +``(clobber = yes) [boolean]`` | |
| 123 | + Specifies whether an existing output counts cube should be overwritten. | |
| 124 | + | |
| 125 | +``(debug = no) [boolean]`` | |
| 126 | + Enables debug mode. In debug mode the executable will dump any log file output to the console. | |
| 127 | + | |
| 128 | +``(mode = ql) [string]`` | |
| 129 | + Mode of automatic parameters (default is "ql", i.e. "query and learn"). | |
| 130 | + | |
| 131 | +``(logfile = cslightcrv.log) [filename]`` | |
| 132 | + Log filename. | |
| 133 | + | |
| 134 | + | |
| 135 | +Related tools | |
| 136 | +------------- | |
| 137 | + | |
| 138 | +None | ... | ... |
doc/source/reference_manual/csobsdef.rst
| ... | ... | @@ -45,9 +45,9 @@ Here some usage examples: |
| 45 | 45 | ``csobsdef rad=5`` |
| 46 | 46 | Creates observation definition file with a ROI radius of 5 deg. |
| 47 | 47 | |
| 48 | -``csobsdef caldb=dummy irf=cta_dummy_irf`` | |
| 49 | - Creates observation definition file using the "cta_dummy_irf" IRF in the | |
| 50 | - "dummy" calibration database. | |
| 48 | +``csobsdef caldb=prod2 irf=South_50h`` | |
| 49 | + Creates observation definition file using the "South_50h" IRF in the | |
| 50 | + "prod2" calibration database. | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | General parameters | ... | ... |
doc/source/reference_manual/cspull.rst
| ... | ... | @@ -41,6 +41,9 @@ General parameters |
| 41 | 41 | ``irf [string]`` |
| 42 | 42 | Instrumental response function. |
| 43 | 43 | |
| 44 | +``(deadc = 0.95) [real]`` | |
| 45 | + Average deadtime correction factor. | |
| 46 | + | |
| 44 | 47 | ``(edisp = no) [boolean]`` |
| 45 | 48 | Apply energy dispersion to response computation. |
| 46 | 49 | |
| ... | ... | @@ -62,12 +65,18 @@ General parameters |
| 62 | 65 | ``enumbins [integer]`` |
| 63 | 66 | Number of energy bins (0=unbinned). |
| 64 | 67 | |
| 65 | -``duration [real]`` | |
| 66 | - Duration of observation (in seconds). | |
| 68 | +``(tmin = 0.0) [real]`` | |
| 69 | + Start time (in seconds). | |
| 67 | 70 | |
| 68 | -``(deadc = 0.95) [real]`` | |
| 69 | - Average deadtime correction factor. | |
| 71 | +``tmax [real]`` | |
| 72 | + Stop time (in seconds). | |
| 73 | + | |
| 74 | +``npix [integer]`` | |
| 75 | + Number of pixels for binned analysis. | |
| 70 | 76 | |
| 77 | +``binsz [real]`` | |
| 78 | + Pixel size for binned analysis. | |
| 79 | + | |
| 71 | 80 | ``(rad = 5.0) [real]`` |
| 72 | 81 | ROI radius (in degrees). |
| 73 | 82 | |
| ... | ... | @@ -77,12 +86,6 @@ General parameters |
| 77 | 86 | ``(offset = 1.5) [real]`` |
| 78 | 87 | Observation pattern offset (in degrees). |
| 79 | 88 | |
| 80 | -``(npix = 200) [integer]`` | |
| 81 | - Number of pixels for binned analysis. | |
| 82 | - | |
| 83 | -``(binsz = 0.05) [real]`` | |
| 84 | - Pixel size for binned analysis. | |
| 85 | - | |
| 86 | 89 | |
| 87 | 90 | Standard parameters |
| 88 | 91 | ------------------- |
| ... | ... | @@ -108,6 +111,9 @@ Standard parameters |
| 108 | 111 | ``(mode = ql) [string]`` |
| 109 | 112 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 110 | 113 | |
| 114 | +``(logfile = cspull.log) [string]`` | |
| 115 | + Log filename. | |
| 116 | + | |
| 111 | 117 | |
| 112 | 118 | Related tools |
| 113 | 119 | ------------- | ... | ... |
doc/source/reference_manual/csspec.rst
0 → 100644
| 1 | +.. _csspec: | |
| 2 | + | |
| 3 | +csspec | |
| 4 | +====== | |
| 5 | + | |
| 6 | +Computes spectrum for a given source. | |
| 7 | + | |
| 8 | + | |
| 9 | +Synopsis | |
| 10 | +-------- | |
| 11 | + | |
| 12 | +Computes spectral points for a given source. | |
| 13 | + | |
| 14 | + | |
| 15 | +General parameters | |
| 16 | +------------------ | |
| 17 | + | |
| 18 | +``(inobs = NONE) [file]`` | |
| 19 | + Input event list, counts cube or observation definition XML file. | |
| 20 | + | |
| 21 | +``inmodel [file]`` | |
| 22 | + Input source model XML file. | |
| 23 | + | |
| 24 | +``srcname [string]`` | |
| 25 | + Name of the source in the source model XML file which should be used | |
| 26 | + for sensitivity computation. | |
| 27 | + | |
| 28 | +``outfile [file]`` | |
| 29 | + Name of the source spectrum output file. | |
| 30 | + | |
| 31 | +``expcube [file]`` | |
| 32 | + Exposure cube file (only needed for stacked analysis). | |
| 33 | + | |
| 34 | +``psfcube [file]`` | |
| 35 | + PSF cube file (only needed for stacked analysis). | |
| 36 | + | |
| 37 | +``bkgcube [file]`` | |
| 38 | + Background cube file (only needed for stacked analysis). | |
| 39 | + | |
| 40 | +``caldb [string]`` | |
| 41 | + Calibration database. | |
| 42 | + | |
| 43 | +``irf [string]`` | |
| 44 | + Instrumental response function. | |
| 45 | + | |
| 46 | +``emin [real]`` | |
| 47 | + Lower energy limit of events (in TeV). | |
| 48 | + | |
| 49 | +``emax [real]`` | |
| 50 | + Upper energy limit of events (in TeV). | |
| 51 | + | |
| 52 | +``enumbins [integer]`` | |
| 53 | + Number of energy bins (0=unbinned). | |
| 54 | + | |
| 55 | +``(ebinalg = LOG) <FILE|LIN|LOG> [string]`` | |
| 56 | + Algorithm for defining energy bins. | |
| 57 | + | |
| 58 | +``binned [boolean]`` | |
| 59 | + Specifies whether a binned computation should be used. | |
| 60 | + | |
| 61 | +``(nebins = 5) [integer]`` | |
| 62 | + Number of bins per spectral point for binned analysis. | |
| 63 | + | |
| 64 | +``coordsys <CEL|GAL> [string]`` | |
| 65 | + Coordinate system (CEL - celestial, GAL - galactic). | |
| 66 | + | |
| 67 | +``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` | |
| 68 | + Projection method. | |
| 69 | + | |
| 70 | +``xref [real]`` | |
| 71 | + Right Ascension / Galactic longitude of image centre (J2000, in degrees). | |
| 72 | + | |
| 73 | +``yref [real]`` | |
| 74 | + Declination / Galactic latitude of image centre (J2000, in degrees). | |
| 75 | + | |
| 76 | +``nxpix [integer]`` | |
| 77 | + Size of the Right Ascension / Galactic longitude axis (in pixels). | |
| 78 | + | |
| 79 | +``nypix [integer]`` | |
| 80 | + Size of the Declination / Galactic latitude axis (in pixels). | |
| 81 | + | |
| 82 | +``binsz [real]`` | |
| 83 | + Pixel size (in degrees/pixel). | |
| 84 | + | |
| 85 | +``(calc_ts = yes) [boolean]`` | |
| 86 | + Compute TS for each spectral point? | |
| 87 | + | |
| 88 | +``(calc_ulim = yes) [boolean]`` | |
| 89 | + Compute upper limit for each spectral point? | |
| 90 | + | |
| 91 | +``(fix_srcs = yes) [boolean]`` | |
| 92 | + Fix other sky model parameters? | |
| 93 | + | |
| 94 | +``(fix_bkg = no) [boolean]`` | |
| 95 | + Fix background model parameters? | |
| 96 | + | |
| 97 | + | |
| 98 | +Standard parameters | |
| 99 | +------------------- | |
| 100 | + | |
| 101 | +``(chatter = 2) [integer]`` | |
| 102 | + Verbosity of the executable: | |
| 103 | + chatter = 0: no information will be logged | |
| 104 | + | |
| 105 | + chatter = 1: only errors will be logged | |
| 106 | + | |
| 107 | + chatter = 2: errors and actions will be logged | |
| 108 | + | |
| 109 | + chatter = 3: report about the task execution | |
| 110 | + | |
| 111 | + chatter = 4: detailed report about the task execution | |
| 112 | + | |
| 113 | +``(clobber = yes) [boolean]`` | |
| 114 | + Specifies whether an existing output counts cube should be overwritten. | |
| 115 | + | |
| 116 | +``(debug = no) [boolean]`` | |
| 117 | + Enables debug mode. In debug mode the executable will dump any log file output to the console. | |
| 118 | + | |
| 119 | +``(mode = ql) [string]`` | |
| 120 | + Mode of automatic parameters (default is "ql", i.e. "query and learn"). | |
| 121 | + | |
| 122 | +``(logfile = csspec.log) [filename]`` | |
| 123 | + Log filename. | |
| 124 | + | |
| 125 | + | |
| 126 | +Related tools | |
| 127 | +------------- | |
| 128 | + | |
| 129 | +None | ... | ... |
doc/source/reference_manual/cstsdist.rst
| ... | ... | @@ -16,30 +16,49 @@ Monte-Carlo simulations. |
| 16 | 16 | General parameters |
| 17 | 17 | ------------------ |
| 18 | 18 | |
| 19 | -``(outfile = ts.dat) [file]`` | |
| 19 | +``(inobs = NONE) [file]`` | |
| 20 | + Input event list, counts cube or observation definition XML file. | |
| 21 | + | |
| 22 | +``inmodel [file]`` | |
| 23 | + Input source model XML file. | |
| 24 | + | |
| 25 | +``srcname [string]`` | |
| 26 | + Name of the source in the source model XML file which should be used | |
| 27 | + for sensitivity computation. | |
| 28 | + | |
| 29 | +``outfile [file]`` | |
| 20 | 30 | ASCII file containing the TS distribution values. |
| 21 | - | |
| 22 | -``ntrials [integer]`` | |
| 23 | - Number of Monte Carlo samples. | |
| 24 | - | |
| 31 | + | |
| 32 | +``expcube [file]`` | |
| 33 | + Exposure cube file (only needed for stacked analysis). | |
| 34 | + | |
| 35 | +``psfcube [file]`` | |
| 36 | + PSF cube file (only needed for stacked analysis). | |
| 37 | + | |
| 38 | +``bkgcube [file]`` | |
| 39 | + Background cube file (only needed for stacked analysis). | |
| 40 | + | |
| 25 | 41 | ``caldb [string]`` |
| 26 | 42 | Calibration database. |
| 27 | 43 | |
| 28 | 44 | ``irf [string]`` |
| 29 | 45 | Instrumental response function. |
| 30 | 46 | |
| 31 | -``type <point|gauss|shell|disk> [string]`` | |
| 32 | - Source model type. | |
| 33 | - | |
| 34 | -``(index = -2.48) [real]`` | |
| 35 | - Spectral index for source model. | |
| 36 | - | |
| 37 | -``offset [real]`` | |
| 38 | - Source offset angle (in degrees). | |
| 39 | - | |
| 40 | -``bkg [string]`` | |
| 41 | - Background model file function (none=power law for subarray E). | |
| 47 | +``(deadc = 0.95) [real]`` | |
| 48 | + Average deadtime correction factor. | |
| 49 | + | |
| 50 | +``(edisp = no) [boolean]`` | |
| 51 | + Apply energy dispersion to response computation. | |
| 52 | + | |
| 53 | +``ntrials [integer]`` | |
| 54 | + Number of Monte Carlo samples. | |
| 55 | + | |
| 56 | +``ra [real]`` | |
| 57 | + Right Ascension of CTA pointing (J2000, in degrees). | |
| 42 | 58 | |
| 59 | +``dec [real]`` | |
| 60 | + Declination of CTA pointing (J2000, in degrees). | |
| 61 | + | |
| 43 | 62 | ``emin [real]`` |
| 44 | 63 | Lower energy limit (in TeV). |
| 45 | 64 | |
| ... | ... | @@ -49,18 +68,27 @@ General parameters |
| 49 | 68 | ``enumbins [integer]`` |
| 50 | 69 | Number of energy bins (0=unbinned). |
| 51 | 70 | |
| 52 | -``duration [real]`` | |
| 53 | - Effective exposure time (in seconds). | |
| 71 | +``(tmin = 0.0) [real]`` | |
| 72 | + Start time (in seconds). | |
| 54 | 73 | |
| 55 | -``(rad = 5.0) [real]`` | |
| 56 | - Radius of ROI (in degrees). | |
| 74 | +``tmax [real]`` | |
| 75 | + Stop time (in seconds). | |
| 57 | 76 | |
| 58 | -``(npix = 200) [integer]`` | |
| 77 | +``npix [integer]`` | |
| 59 | 78 | Number of pixels for binned analysis. |
| 60 | 79 | |
| 61 | -``(binsz = 0.05) [real]`` | |
| 80 | +``binsz [real]`` | |
| 62 | 81 | Pixel size for binned analysis. |
| 63 | 82 | |
| 83 | +``(rad = 5.0) [real]`` | |
| 84 | + Radius of ROI (in degrees). | |
| 85 | + | |
| 86 | +``(pattern = single) [string]`` | |
| 87 | + Pattern for pointing simulation (single/four). | |
| 88 | + | |
| 89 | +``(offset = 1.5) [real]`` | |
| 90 | + Observation pattern offset (in degrees). | |
| 91 | + | |
| 64 | 92 | |
| 65 | 93 | Standard parameters |
| 66 | 94 | ------------------- |
| ... | ... | @@ -86,6 +114,9 @@ Standard parameters |
| 86 | 114 | ``(mode = ql) [string]`` |
| 87 | 115 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 88 | 116 | |
| 117 | +``(logfile = cstsdist.log) [string]`` | |
| 118 | + Log filename. | |
| 119 | + | |
| 89 | 120 | |
| 90 | 121 | Related tools |
| 91 | 122 | ------------- | ... | ... |
doc/source/reference_manual/index.rst
| ... | ... | @@ -38,7 +38,9 @@ cscripts |
| 38 | 38 | |
| 39 | 39 | cscaldb --- Lists available instrument response functions <cscaldb> |
| 40 | 40 | csobsdef --- Generates observation definition file <csobsdef> |
| 41 | + cslightcrv --- Computes lightcurve <cslightcrv> | |
| 41 | 42 | cspull --- Generates pull distribution <cspull> |
| 42 | 43 | cssens --- Computes CTA sensitivity <cssens> |
| 44 | + csspec --- Computes spectral points <csspec> | |
| 43 | 45 | csresmap --- Generates residual map <csresmap> |
| 44 | 46 | cstsdist --- Generates TS distribution <cstsdist> | ... | ... |
doc/source/reference_manual/usage.rst
| ... | ... | @@ -26,7 +26,7 @@ Examples |
| 26 | 26 | ``infile [file]`` |
| 27 | 27 | Describes an automatic (queried) file-type parameter with no default value. |
| 28 | 28 | |
| 29 | -``irf = kb_E_50h_v3 <kb_E_50h_v3|kb_H_50h_v3> [string]`` | |
| 29 | +``irf = South_50h <North_50h|South_50h> [string]`` | |
| 30 | 30 | Describes an automatic (queried) string-type parameter with two value |
| 31 | 31 | options. |
| 32 | 32 | |
| ... | ... | @@ -39,4 +39,4 @@ Examples |
| 39 | 39 | To set hidden parameters at runtime, specify them explicitly at |
| 40 | 40 | the command line; for example: |
| 41 | 41 | |
| 42 | - ``gtobssim start_time=900`` | |
| 42 | + ``ctobssim start_time=900`` | ... | ... |
doc/source/user_manual/enhancing.rst
doc/source/user_manual/expert.rst
| ... | ... | @@ -4,8 +4,16 @@ Behind the scenes |
| 4 | 4 | CTA data structure |
| 5 | 5 | ------------------ |
| 6 | 6 | |
| 7 | +To be written ... | |
| 8 | + | |
| 9 | + | |
| 7 | 10 | Instrument response functions |
| 8 | 11 | ----------------------------- |
| 9 | 12 | |
| 13 | +To be written ... | |
| 14 | + | |
| 15 | + | |
| 10 | 16 | Maximum likelihood fitting |
| 11 | --------------------------- | |
| 12 | 17 | \ No newline at end of file |
| 18 | +-------------------------- | |
| 19 | + | |
| 20 | +To be written ... | ... | ... |
doc/source/user_manual/getting.rst
| ... | ... | @@ -31,7 +31,7 @@ Installing gammalib |
| 31 | 31 | ctools is built on top of gammalib, hence gammalib needs to be built, |
| 32 | 32 | installed and configured before ctools can be installed. In case that |
| 33 | 33 | ctools is already installed on your system you may skip reading this |
| 34 | -section and continue with Section TBD that explains how to install ctools. | |
| 34 | +section and continue with the :ref:`sec_building_ctools` section. | |
| 35 | 35 | |
| 36 | 36 | You will need the following to build the gammalib: |
| 37 | 37 | |
| ... | ... | @@ -59,7 +59,7 @@ in an appropriate location (for example ``$HOME/builds``), and type |
| 59 | 59 | |
| 60 | 60 | .. code-block:: bash |
| 61 | 61 | |
| 62 | - $ tar xvfz gammalib-1.0.0.tar.gz | |
| 62 | + $ tar xvfz gammalib-0.10.0.tar.gz | |
| 63 | 63 | |
| 64 | 64 | (the ``$`` symbol indicates the console prompt and is not part of the |
| 65 | 65 | command that you should type in). |
| ... | ... | @@ -69,7 +69,7 @@ typing |
| 69 | 69 | |
| 70 | 70 | .. code-block:: bash |
| 71 | 71 | |
| 72 | - $ cd gammalib-1.0.0 | |
| 72 | + $ cd gammalib-0.10.0 | |
| 73 | 73 | $ ./configure |
| 74 | 74 | $ make |
| 75 | 75 | $ make check |
| ... | ... | @@ -117,6 +117,8 @@ If you use C shell or a variant then add the following to your |
| 117 | 117 | source $GAMMALIB/bin/gammalib-init.csh |
| 118 | 118 | |
| 119 | 119 | |
| 120 | +.. _sec_building_ctools: | |
| 121 | + | |
| 120 | 122 | Building ctools |
| 121 | 123 | --------------- |
| 122 | 124 | |
| ... | ... | @@ -125,7 +127,7 @@ an appropriate location (for example ``$HOME/builds``), and type |
| 125 | 127 | |
| 126 | 128 | .. code-block:: bash |
| 127 | 129 | |
| 128 | - $ tar xvfz ctools-1.0.0.tar.gz | |
| 130 | + $ tar xvfz ctools-0.9.0.tar.gz | |
| 129 | 131 | |
| 130 | 132 | (the ``$`` symbol indicates the console prompt and is not part of the |
| 131 | 133 | command that you should type in). |
| ... | ... | @@ -134,7 +136,7 @@ Step in the directory and build the ctools by typing |
| 134 | 136 | |
| 135 | 137 | .. code-block:: bash |
| 136 | 138 | |
| 137 | - $ cd ctools-1.0.0 | |
| 139 | + $ cd ctools-0.9.0 | |
| 138 | 140 | $ ./configure |
| 139 | 141 | $ make |
| 140 | 142 | |
| ... | ... | @@ -171,7 +173,7 @@ following output at the end of the unit testing: |
| 171 | 173 | PASS: test_python.py |
| 172 | 174 | make[4]: Nothing to be done for `all'. |
| 173 | 175 | ============================================================================ |
| 174 | - Testsuite summary for ctools 1.0.0 | |
| 176 | + Testsuite summary for ctools 0.9.0 | |
| 175 | 177 | ============================================================================ |
| 176 | 178 | # TOTAL: 3 |
| 177 | 179 | # PASS: 3 |
| ... | ... | @@ -189,26 +191,33 @@ For older automake version, you should see |
| 189 | 191 | *************** |
| 190 | 192 | * Test ctools * |
| 191 | 193 | *************** |
| 192 | - Test ctobssim: .... ok | |
| 194 | + Test ctobssim: .. ok | |
| 193 | 195 | Test ctskymap: .. ok |
| 194 | 196 | Test ctbin: .... ok |
| 195 | - Test ctmodel: ...... ok | |
| 196 | - Test ctselect: .. ok | |
| 197 | - Test ctlike: ........ ok | |
| 198 | - Test cttsmap: .. ok | |
| 199 | 197 | Test ctexpcube: .... ok |
| 200 | 198 | Test ctpsfcube: .... ok |
| 201 | 199 | Test ctbkgcube: ...... ok |
| 200 | + Test ctmodel: ...... ok | |
| 201 | + Test ctselect: .. ok | |
| 202 | + Test ctlike: ...... ok | |
| 203 | + Test cttsmap: .. ok | |
| 202 | 204 | Test ctcubemask: .. ok |
| 203 | 205 | Test ctbutterfly: .. ok |
| 206 | + Test ctulimit: .. ok | |
| 204 | 207 | PASS: test_ctools.sh |
| 205 | 208 | |
| 206 | 209 | ***************** |
| 207 | 210 | * Test cscripts * |
| 208 | 211 | ***************** |
| 212 | + Test csobsdef: .. ok | |
| 209 | 213 | Test cspull: .. ok |
| 214 | + Test cssens: .. ok | |
| 210 | 215 | Test cstsdist: .. ok |
| 211 | 216 | Test csresmap: .. ok |
| 217 | + Test csspec (unbinned): .. ok | |
| 218 | + Test csspec (binned): .. ok | |
| 219 | + Test cslightcrv (unbinned): .. ok | |
| 220 | + Test cslightcrv (binned): .. ok | |
| 212 | 221 | PASS: test_cscripts.sh |
| 213 | 222 | |
| 214 | 223 | *********************** |
| ... | ... | @@ -227,6 +236,7 @@ For older automake version, you should see |
| 227 | 236 | Test ctbkgcube functionality: ... ok |
| 228 | 237 | Test ctcubemask functionality: ... ok |
| 229 | 238 | Test ctbutterfly functionality: ... ok |
| 239 | + Test ctulimit functionality: ... ok | |
| 230 | 240 | Test unbinned pipeline with FITS file saving: .... ok |
| 231 | 241 | Test unbinned in-memory pipeline: .... ok |
| 232 | 242 | PASS: test_python.py |
| ... | ... | @@ -307,9 +317,8 @@ GammaLib unit tests fail |
| 307 | 317 | |
| 308 | 318 | Some users have reported failure of a large fraction of the GammaLib unit |
| 309 | 319 | tests after after typing ``make check``. In all cases, this was related to |
| 310 | -the absence of the directory where the shared ``libcfitsio`` library | |
| 311 | -resides in the library load path. To solve the issue, locate the directory | |
| 312 | -where the shared ``libcfitsio`` library resides and then type | |
| 320 | +not finding the ``libcfitsio`` library. To solve the issue, locate the | |
| 321 | +directory where the shared ``libcfitsio`` library resides and then type | |
| 313 | 322 | |
| 314 | 323 | .. code-block:: bash |
| 315 | 324 | ... | ... |
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: |
| 20 | 20 | RA of pointing (degrees) (0-360) [83.63] |
| 21 | 21 | Dec of pointing (degrees) (-90-90) [22.01] 21.51 |
| 22 | 22 | Radius of FOV (degrees) (0-180) [5.0] |
| 23 | - Start time (MET in s) (0) [0.0] | |
| 24 | - End time (MET in s) (0) [1800.0] | |
| 25 | - Lower energy limit (TeV) (0) [0.1] | |
| 26 | - Upper energy limit (TeV) (0) [100.0] | |
| 27 | - Calibration database [dummy] | |
| 28 | - Instrument response function [cta_dummy_irf] | |
| 23 | + Start time (MET in s) [0.0] | |
| 24 | + End time (MET in s) [1800.0] | |
| 25 | + Lower energy limit (TeV) [0.1] | |
| 26 | + Upper energy limit (TeV) [100.0] | |
| 27 | + Calibration database [prod2] | |
| 28 | + Instrument response function [South_50h] | |
| 29 | 29 | Model [$CTOOLS/share/models/crab.xml] |
| 30 | 30 | Output event data file or observation definition file [events.fits] events1.fits |
| 31 | 31 | |
| ... | ... | @@ -35,12 +35,12 @@ nebula, each offset by 0.5 deg from the nebula in opposite directions: |
| 35 | 35 | RA of pointing (degrees) (0-360) [83.63] |
| 36 | 36 | Dec of pointing (degrees) (-90-90) [21.51] 22.51 |
| 37 | 37 | Radius of FOV (degrees) (0-180) [5.0] |
| 38 | - Start time (MET in s) (0) [0.0] | |
| 39 | - End time (MET in s) (0) [1800.0] | |
| 40 | - Lower energy limit (TeV) (0) [0.1] | |
| 41 | - Upper energy limit (TeV) (0) [100.0] | |
| 42 | - Calibration database [dummy] | |
| 43 | - Instrument response function [cta_dummy_irf] | |
| 38 | + Start time (MET in s) [0.0] | |
| 39 | + End time (MET in s) [1800.0] | |
| 40 | + Lower energy limit (TeV) [0.1] | |
| 41 | + Upper energy limit (TeV) [100.0] | |
| 42 | + Calibration database [prod2] | |
| 43 | + Instrument response function [South_50h] | |
| 44 | 44 | Model [$CTOOLS/share/models/crab.xml] |
| 45 | 45 | Output event data file or observation definition file [events1.fits] events2.fits |
| 46 | 46 | |
| ... | ... | @@ -92,11 +92,11 @@ Now we are ready to do a joint maximum likelihood analysis using |
| 92 | 92 | .. code-block:: bash |
| 93 | 93 | |
| 94 | 94 | $ ctlike |
| 95 | - Event list, counts cube or observation definition file [events.fits] obs.xml | |
| 96 | - Calibration database [dummy] | |
| 97 | - Instrument response function [cta_dummy_irf] | |
| 95 | + Event list, counts cube or observation definition file [selected_events.fits] obs.xml | |
| 96 | + Calibration database [prod2] | |
| 97 | + Instrument response function [South_50h] | |
| 98 | 98 | Source model [$CTOOLS/share/models/crab.xml] |
| 99 | - Source model output file [crab_results.xml] | |
| 99 | + Source model output file [crab_results.xml] | |
| 100 | 100 | |
| 101 | 101 | Instead of providing an event list or a counts cube, we now provided the |
| 102 | 102 | filename of the observation definition XML file (here ``obs.xml``) as input |
| ... | ... | @@ -106,102 +106,96 @@ joint analysis, as indicated in the log file: |
| 106 | 106 | |
| 107 | 107 | .. code-block:: xml |
| 108 | 108 | |
| 109 | - 2015-02-04T20:33:26: +==============+ | |
| 110 | - 2015-02-04T20:33:26: | Observations | | |
| 111 | - 2015-02-04T20:33:26: +==============+ | |
| 112 | - 2015-02-04T20:33:26: === GObservations === | |
| 113 | - 2015-02-04T20:33:26: Number of observations ....: 2 | |
| 114 | - 2015-02-04T20:33:26: Number of predicted events : 0 | |
| 115 | - 2015-02-04T20:33:26: === GCTAObservation === | |
| 116 | - 2015-02-04T20:33:26: Name ......................: Crab | |
| 117 | - 2015-02-04T20:33:26: Identifier ................: 00001 | |
| 118 | - 2015-02-04T20:33:26: Instrument ................: CTA | |
| 119 | - 2015-02-04T20:33:26: Event file ................: events1.fits | |
| 120 | - 2015-02-04T20:33:26: Event type ................: EventList | |
| 121 | - 2015-02-04T20:33:26: Statistics ................: Poisson | |
| 122 | - 2015-02-04T20:33:26: Ontime ....................: 1800 s | |
| 123 | - 2015-02-04T20:33:26: Livetime ..................: 1710 s | |
| 124 | - 2015-02-04T20:33:26: Deadtime correction .......: 0.95 | |
| 125 | - 2015-02-04T20:33:26: User energy range .........: undefined | |
| 126 | - 2015-02-04T20:33:26: === GCTAPointing === | |
| 127 | - 2015-02-04T20:33:26: Pointing direction ........: (RA,Dec)=(83.63,21.51) | |
| 109 | + 2015-05-22T20:17:07: +==============+ | |
| 110 | + 2015-05-22T20:17:07: | Observations | | |
| 111 | + 2015-05-22T20:17:07: +==============+ | |
| 112 | + 2015-05-22T20:17:07: === GObservations === | |
| 113 | + 2015-05-22T20:17:07: Number of observations ....: 2 | |
| 114 | + 2015-05-22T20:17:07: Number of predicted events : 0 | |
| 115 | + 2015-05-22T20:17:07: === GCTAObservation === | |
| 116 | + 2015-05-22T20:17:07: Name ......................: | |
| 117 | + 2015-05-22T20:17:07: Identifier ................: 00001 | |
| 118 | + 2015-05-22T20:17:07: Instrument ................: CTA | |
| 119 | + 2015-05-22T20:17:07: Event file ................: events1.fits | |
| 120 | + 2015-05-22T20:17:07: Event type ................: EventList | |
| 121 | + 2015-05-22T20:17:07: Statistics ................: Poisson | |
| 122 | + 2015-05-22T20:17:07: Ontime ....................: 1800 s | |
| 123 | + 2015-05-22T20:17:07: Livetime ..................: 1710 s | |
| 124 | + 2015-05-22T20:17:07: Deadtime correction .......: 0.95 | |
| 125 | + 2015-05-22T20:17:07: User energy range .........: undefined | |
| 126 | + 2015-05-22T20:17:07: === GCTAPointing === | |
| 127 | + 2015-05-22T20:17:07: Pointing direction ........: (RA,Dec)=(83.63,21.51) | |
| 128 | 128 | ... |
| 129 | - 2015-02-04T20:33:26: === GCTAObservation === | |
| 130 | - 2015-02-04T20:33:26: Name ......................: Crab | |
| 131 | - 2015-02-04T20:33:26: Identifier ................: 00002 | |
| 132 | - 2015-02-04T20:33:26: Instrument ................: CTA | |
| 133 | - 2015-02-04T20:33:26: Event file ................: events2.fits | |
| 134 | - 2015-02-04T20:33:26: Event type ................: EventList | |
| 135 | - 2015-02-04T20:33:26: Statistics ................: Poisson | |
| 136 | - 2015-02-04T20:33:26: Ontime ....................: 1800 s | |
| 137 | - 2015-02-04T20:33:26: Livetime ..................: 1710 s | |
| 138 | - 2015-02-04T20:33:26: Deadtime correction .......: 0.95 | |
| 139 | - 2015-02-04T20:33:26: User energy range .........: undefined | |
| 140 | - 2015-02-04T20:33:26: === GCTAPointing === | |
| 141 | - 2015-02-04T20:33:26: Pointing direction ........: (RA,Dec)=(83.63,22.51) | |
| 129 | + 2015-05-22T20:17:07: === GCTAObservation === | |
| 130 | + 2015-05-22T20:17:07: Name ......................: | |
| 131 | + 2015-05-22T20:17:07: Identifier ................: 00002 | |
| 132 | + 2015-05-22T20:17:07: Instrument ................: CTA | |
| 133 | + 2015-05-22T20:17:07: Event file ................: events2.fits | |
| 134 | + 2015-05-22T20:17:07: Event type ................: EventList | |
| 135 | + 2015-05-22T20:17:07: Statistics ................: Poisson | |
| 136 | + 2015-05-22T20:17:07: Ontime ....................: 1800 s | |
| 137 | + 2015-05-22T20:17:07: Livetime ..................: 1710 s | |
| 138 | + 2015-05-22T20:17:07: Deadtime correction .......: 0.95 | |
| 139 | + 2015-05-22T20:17:07: User energy range .........: undefined | |
| 140 | + 2015-05-22T20:17:07: === GCTAPointing === | |
| 141 | + 2015-05-22T20:17:07: Pointing direction ........: (RA,Dec)=(83.63,22.51) | |
| 142 | 142 | ... |
| 143 | - 2015-02-04T20:33:26: +=================================+ | |
| 144 | - 2015-02-04T20:33:26: | Maximum likelihood optimisation | | |
| 145 | - 2015-02-04T20:33:26: +=================================+ | |
| 146 | - 2015-02-04T20:33:26: >Iteration 0: -logL=89099.788, Lambda=1.0e-03 | |
| 147 | - 2015-02-04T20:33:26: >Iteration 1: -logL=89094.435, Lambda=1.0e-03, delta=5.353, max(|grad|)=-4.388872 [Normalization:7] | |
| 148 | - 2015-02-04T20:33:26: >Iteration 2: -logL=89094.420, Lambda=1.0e-04, delta=0.015, max(|grad|)=-0.116432 [Index:3] | |
| 149 | - 2015-02-04T20:33:26: >Iteration 3: -logL=89094.420, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003989 [Index:3] | |
| 150 | - 2015-02-04T20:33:26: | |
| 151 | - 2015-02-04T20:33:26: +=========================================+ | |
| 152 | - 2015-02-04T20:33:26: | Maximum likelihood optimization results | | |
| 153 | - 2015-02-04T20:33:26: +=========================================+ | |
| 154 | - 2015-02-04T20:33:26: === GOptimizerLM === | |
| 155 | - 2015-02-04T20:33:26: Optimized function value ..: 89094.420 | |
| 156 | - 2015-02-04T20:33:26: Absolute precision ........: 0.005 | |
| 157 | - 2015-02-04T20:33:26: Acceptable value decrease .: 2 | |
| 158 | - 2015-02-04T20:33:26: Optimization status .......: converged | |
| 159 | - 2015-02-04T20:33:26: Number of parameters ......: 9 | |
| 160 | - 2015-02-04T20:33:26: Number of free parameters .: 4 | |
| 161 | - 2015-02-04T20:33:26: Number of iterations ......: 3 | |
| 162 | - 2015-02-04T20:33:26: Lambda ....................: 1e-06 | |
| 163 | - 2015-02-04T20:33:26: Maximum log likelihood ....: -89094.420 | |
| 164 | - 2015-02-04T20:33:26: Observed events (Nobs) ...: 12260.000 | |
| 165 | - 2015-02-04T20:33:26: Predicted events (Npred) ..: 12260.000 (Nobs - Npred = 6.95764e-06) | |
| 166 | - 2015-02-04T20:33:26: === GModels === | |
| 167 | - 2015-02-04T20:33:26: Number of models ..........: 2 | |
| 168 | - 2015-02-04T20:33:26: Number of parameters ......: 9 | |
| 169 | - 2015-02-04T20:33:26: === GModelSky === | |
| 170 | - 2015-02-04T20:33:26: Name ......................: Crab | |
| 171 | - 2015-02-04T20:33:26: Instruments ...............: all | |
| 172 | - 2015-02-04T20:33:26: Instrument scale factors ..: unity | |
| 173 | - 2015-02-04T20:33:26: Observation identifiers ...: all | |
| 174 | - 2015-02-04T20:33:26: Model type ................: PointSource | |
| 175 | - 2015-02-04T20:33:26: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 176 | - 2015-02-04T20:33:26: Number of parameters ......: 6 | |
| 177 | - 2015-02-04T20:33:26: Number of spatial par's ...: 2 | |
| 178 | - 2015-02-04T20:33:26: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 179 | - 2015-02-04T20:33:26: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 180 | - 2015-02-04T20:33:26: Number of spectral par's ..: 3 | |
| 181 | - 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) | |
| 182 | - 2015-02-04T20:33:26: Index ....................: -2.49814 +/- 0.0178524 [-0,-5] (free,scale=-1,gradient) | |
| 183 | - 2015-02-04T20:33:26: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 184 | - 2015-02-04T20:33:26: Number of temporal par's ..: 1 | |
| 185 | - 2015-02-04T20:33:26: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 186 | - 2015-02-04T20:33:26: === GCTAModelRadialAcceptance === | |
| 187 | - 2015-02-04T20:33:26: Name ......................: Background | |
| 188 | - 2015-02-04T20:33:26: Instruments ...............: CTA | |
| 189 | - 2015-02-04T20:33:26: Instrument scale factors ..: unity | |
| 190 | - 2015-02-04T20:33:26: Observation identifiers ...: all | |
| 191 | - 2015-02-04T20:33:26: Model type ................: "Gaussian" * "FileFunction" * "Constant" | |
| 192 | - 2015-02-04T20:33:26: Number of parameters ......: 3 | |
| 193 | - 2015-02-04T20:33:26: Number of radial par's ....: 1 | |
| 194 | - 2015-02-04T20:33:26: Sigma ....................: 3.0356 +/- 0.0215259 [0.01,10] deg2 (free,scale=1,gradient) | |
| 195 | - 2015-02-04T20:33:26: Number of spectral par's ..: 1 | |
| 196 | - 2015-02-04T20:33:26: Normalization ............: 0.99936 +/- 0.0122024 [0,1000] (free,scale=1,gradient) | |
| 197 | - 2015-02-04T20:33:26: Number of temporal par's ..: 1 | |
| 198 | - 2015-02-04T20:33:26: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 199 | - 2015-02-04T20:33:26: | |
| 200 | - 2015-02-04T20:33:26: +==============+ | |
| 201 | - 2015-02-04T20:33:26: | Save results | | |
| 202 | - 2015-02-04T20:33:26: +==============+ | |
| 203 | - 2015-02-04T20:33:26: | |
| 204 | - 2015-02-04T20:33:26: Application "ctlike" terminated after 10 wall clock seconds, consuming 0.385432 seconds of CPU time. | |
| 143 | + 2015-05-22T20:17:07: +=================================+ | |
| 144 | + 2015-05-22T20:17:07: | Maximum likelihood optimisation | | |
| 145 | + 2015-05-22T20:17:07: +=================================+ | |
| 146 | + 2015-05-22T20:17:07: >Iteration 0: -logL=201836.657, Lambda=1.0e-03 | |
| 147 | + 2015-05-22T20:17:07: >Iteration 1: -logL=201829.438, Lambda=1.0e-03, delta=7.220, max(|grad|)=22.756507 [Index:7] | |
| 148 | + 2015-05-22T20:17:07: >Iteration 2: -logL=201829.432, Lambda=1.0e-04, delta=0.005, max(|grad|)=0.086395 [Index:3] | |
| 149 | + 2015-05-22T20:17:07: >Iteration 3: -logL=201829.432, Lambda=1.0e-05, delta=0.000, max(|grad|)=0.001287 [Index:3] | |
| 150 | + 2015-05-22T20:17:07: | |
| 151 | + 2015-05-22T20:17:07: +=========================================+ | |
| 152 | + 2015-05-22T20:17:07: | Maximum likelihood optimization results | | |
| 153 | + 2015-05-22T20:17:07: +=========================================+ | |
| 154 | + 2015-05-22T20:17:07: === GOptimizerLM === | |
| 155 | + 2015-05-22T20:17:07: Optimized function value ..: 201829.432 | |
| 156 | + 2015-05-22T20:17:07: Absolute precision ........: 0.005 | |
| 157 | + 2015-05-22T20:17:07: Acceptable value decrease .: 2 | |
| 158 | + 2015-05-22T20:17:07: Optimization status .......: converged | |
| 159 | + 2015-05-22T20:17:07: Number of parameters ......: 10 | |
| 160 | + 2015-05-22T20:17:07: Number of free parameters .: 4 | |
| 161 | + 2015-05-22T20:17:07: Number of iterations ......: 3 | |
| 162 | + 2015-05-22T20:17:07: Lambda ....................: 1e-06 | |
| 163 | + 2015-05-22T20:17:07: Maximum log likelihood ....: -201829.432 | |
| 164 | + 2015-05-22T20:17:07: Observed events (Nobs) ...: 31799.000 | |
| 165 | + 2015-05-22T20:17:07: Predicted events (Npred) ..: 31799.000 (Nobs - Npred = 2.67544e-06) | |
| 166 | + 2015-05-22T20:17:07: === GModels === | |
| 167 | + 2015-05-22T20:17:07: Number of models ..........: 2 | |
| 168 | + 2015-05-22T20:17:07: Number of parameters ......: 10 | |
| 169 | + 2015-05-22T20:17:07: === GModelSky === | |
| 170 | + 2015-05-22T20:17:07: Name ......................: Crab | |
| 171 | + 2015-05-22T20:17:07: Instruments ...............: all | |
| 172 | + 2015-05-22T20:17:07: Instrument scale factors ..: unity | |
| 173 | + 2015-05-22T20:17:07: Observation identifiers ...: all | |
| 174 | + 2015-05-22T20:17:07: Model type ................: PointSource | |
| 175 | + 2015-05-22T20:17:07: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 176 | + 2015-05-22T20:17:07: Number of parameters ......: 6 | |
| 177 | + 2015-05-22T20:17:07: Number of spatial par's ...: 2 | |
| 178 | + 2015-05-22T20:17:07: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 179 | + 2015-05-22T20:17:07: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 180 | + 2015-05-22T20:17:07: Number of spectral par's ..: 3 | |
| 181 | + 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) | |
| 182 | + 2015-05-22T20:17:07: Index ....................: -2.49825 +/- 0.0118418 [-0,-5] (free,scale=-1,gradient) | |
| 183 | + 2015-05-22T20:17:07: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 184 | + 2015-05-22T20:17:07: Number of temporal par's ..: 1 | |
| 185 | + 2015-05-22T20:17:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 186 | + 2015-05-22T20:17:07: === GCTAModelIrfBackground === | |
| 187 | + 2015-05-22T20:17:07: Name ......................: CTABackgroundModel | |
| 188 | + 2015-05-22T20:17:07: Instruments ...............: CTA | |
| 189 | + 2015-05-22T20:17:07: Instrument scale factors ..: unity | |
| 190 | + 2015-05-22T20:17:07: Observation identifiers ...: all | |
| 191 | + 2015-05-22T20:17:07: Model type ................: "PowerLaw" * "Constant" | |
| 192 | + 2015-05-22T20:17:07: Number of parameters ......: 4 | |
| 193 | + 2015-05-22T20:17:07: Number of spectral par's ..: 3 | |
| 194 | + 2015-05-22T20:17:07: Prefactor ................: 1.01608 +/- 0.0152751 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) | |
| 195 | + 2015-05-22T20:17:07: Index ....................: 0.0226023 +/- 0.0086794 [-5,5] (free,scale=1,gradient) | |
| 196 | + 2015-05-22T20:17:07: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 197 | + 2015-05-22T20:17:07: Number of temporal par's ..: 1 | |
| 198 | + 2015-05-22T20:17:07: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 205 | 199 | |
| 206 | 200 | The log file indicates that the fit converged quickly, the spectral |
| 207 | 201 | parameters of the Crab nebula have now been constrained using the events | ... | ... |
doc/source/user_manual/getting_started/beyond_irf.rst
| ... | ... | @@ -3,33 +3,50 @@ |
| 3 | 3 | Connecting observations to dedicated instrument response functions |
| 4 | 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 5 | 5 | |
| 6 | -.. note:: | |
| 7 | - | |
| 8 | - To execute the following examples on your machine you need to | |
| 9 | - install a specific calibration database. Download the file | |
| 10 | - :download:`caldb.tar.gz <caldb.tar.gz>` into a local working | |
| 11 | - directory, decompress and untar the folder, and set the calibration | |
| 12 | - database to this folder by typing: | |
| 13 | - | |
| 14 | - .. code-block:: bash | |
| 15 | - | |
| 16 | - $ export CALDB=$PWD/caldb | |
| 17 | - | |
| 18 | - Note that the response functions in the calibration database | |
| 19 | - are all identical to the ``cta_dummy_irf`` response, yet there | |
| 20 | - a multiple database and response entries so that the usage of | |
| 21 | - specific response functions can be emulated. | |
| 22 | - | |
| 23 | 6 | So far the same instrument response function has been used for all |
| 24 | 7 | observations in our analysis examples. |
| 25 | 8 | You may have recognised that we always specified the calibration database |
| 26 | -``dummy`` and the instrument response function ``cta_dummy_irf`` that | |
| 27 | -are shipped with the ctools release. | |
| 9 | +``prod2`` and the instrument response function ``South_50h`` that | |
| 10 | +are shipped with ctools. | |
| 28 | 11 | When combining multiple observations in a joint analysis we may however |
| 29 | 12 | need to specify dedicated instrument response functions for the |
| 30 | 13 | different observations. |
| 31 | -This can be done by adding the calibration information to the observation | |
| 32 | -definition XML file: | |
| 14 | + | |
| 15 | +Let's simulate two observations of the Crab nebula, one done with | |
| 16 | +the northern array and the other with the southern array: | |
| 17 | + | |
| 18 | +.. code-block:: bash | |
| 19 | + | |
| 20 | + $ ctobssim | |
| 21 | + RA of pointing (degrees) (0-360) [83.63] | |
| 22 | + Dec of pointing (degrees) (-90-90) [22.01] 21.51 | |
| 23 | + Radius of FOV (degrees) (0-180) [5.0] | |
| 24 | + Start time (MET in s) [0.0] | |
| 25 | + End time (MET in s) [1800.0] | |
| 26 | + Lower energy limit (TeV) [0.1] | |
| 27 | + Upper energy limit (TeV) [100.0] | |
| 28 | + Calibration database [prod2] | |
| 29 | + Instrument response function [South_50h] North_50h | |
| 30 | + Model [$CTOOLS/share/models/crab.xml] | |
| 31 | + Output event data file or observation definition file [events.fits] events1.fits | |
| 32 | + | |
| 33 | +.. code-block:: bash | |
| 34 | + | |
| 35 | + $ ctobssim | |
| 36 | + RA of pointing (degrees) (0-360) [83.63] | |
| 37 | + Dec of pointing (degrees) (-90-90) [22.01] 22.51 | |
| 38 | + Radius of FOV (degrees) (0-180) [5.0] | |
| 39 | + Start time (MET in s) [0.0] | |
| 40 | + End time (MET in s) [1800.0] | |
| 41 | + Lower energy limit (TeV) [0.1] | |
| 42 | + Upper energy limit (TeV) [100.0] | |
| 43 | + Calibration database [prod2] | |
| 44 | + Instrument response function [North_50h] South_50h | |
| 45 | + Model [$CTOOLS/share/models/crab.xml] | |
| 46 | + Output event data file or observation definition file [events1.fits] events2.fits | |
| 47 | + | |
| 48 | +Now we combine the information about these two observations in an | |
| 49 | +observation definition XML file: | |
| 33 | 50 | |
| 34 | 51 | .. code-block:: xml |
| 35 | 52 | |
| ... | ... | @@ -37,11 +54,11 @@ definition XML file: |
| 37 | 54 | <observation_list title="observation library"> |
| 38 | 55 | <observation name="Crab" id="00001" instrument="CTA"> |
| 39 | 56 | <parameter name="EventList" file="events1.fits"/> |
| 40 | - <parameter name="Calibration" database="north" response="cta_north_irf"/> | |
| 57 | + <parameter name="Calibration" database="prod2" response="North_50h"/> | |
| 41 | 58 | </observation> |
| 42 | 59 | <observation name="Crab" id="00002" instrument="CTA"> |
| 43 | 60 | <parameter name="EventList" file="events2.fits"/> |
| 44 | - <parameter name="Calibration" database="south" response="cta_south_irf"/> | |
| 61 | + <parameter name="Calibration" database="prod2" response="South_50h"/> | |
| 45 | 62 | </observation> |
| 46 | 63 | </observation_list> |
| 47 | 64 | |
| ... | ... | @@ -55,41 +72,39 @@ option to get the output of the script on the console): |
| 55 | 72 | |
| 56 | 73 | $ cscaldb debug=yes |
| 57 | 74 | Parfile cscaldb.par not found. Create default parfile. |
| 58 | - 2015-02-05T14:26:50: +============+ | |
| 59 | - 2015-02-05T14:26:50: | Parameters | | |
| 60 | - 2015-02-05T14:26:50: +============+ | |
| 61 | - 2015-02-05T14:26:50: chatter ...................: 2 | |
| 62 | - 2015-02-05T14:26:50: clobber ...................: yes | |
| 63 | - 2015-02-05T14:26:50: debug .....................: yes | |
| 64 | - 2015-02-05T14:26:50: mode ......................: ql | |
| 65 | - 2015-02-05T14:26:50: | |
| 66 | - 2015-02-05T14:26:50: +==============+ | |
| 67 | - 2015-02-05T14:26:50: | Mission: cta | | |
| 68 | - 2015-02-05T14:26:50: +==============+ | |
| 69 | - 2015-02-05T14:26:50: === Response functions in database "dummy" === | |
| 70 | - 2015-02-05T14:26:50: cta_dummy_irf | |
| 71 | - 2015-02-05T14:26:50: cta_prod1_irf | |
| 72 | - 2015-02-05T14:26:50: cta_prod2_irf | |
| 73 | - 2015-02-05T14:26:50: | |
| 74 | - 2015-02-05T14:26:50: === Response functions in database "north" === | |
| 75 | - 2015-02-05T14:26:50: cta_north_irf | |
| 76 | - 2015-02-05T14:26:50: | |
| 77 | - 2015-02-05T14:26:50: === Response functions in database "south" === | |
| 78 | - 2015-02-05T14:26:50: cta_south_irf | |
| 79 | - | |
| 80 | -You will see that for the CTA observatory three databases exist. | |
| 81 | -The ``dummy`` database contains three response functions | |
| 82 | -(``cta_dummy_irf``, ``cta_prod1_irf``, ``cta_prod2_irf``) while the | |
| 83 | -``north`` and ``south`` databases contain a single response function. | |
| 84 | -You may now do a :ref:`ctlike` fit using the XML file with the specific | |
| 85 | -response definitions: | |
| 75 | + 2015-05-22T21:35:39: +============+ | |
| 76 | + 2015-05-22T21:35:39: | Parameters | | |
| 77 | + 2015-05-22T21:35:39: +============+ | |
| 78 | + 2015-05-22T21:35:39: chatter ...................: 2 | |
| 79 | + 2015-05-22T21:35:39: clobber ...................: yes | |
| 80 | + 2015-05-22T21:35:39: debug .....................: yes | |
| 81 | + 2015-05-22T21:35:39: mode ......................: ql | |
| 82 | + 2015-05-22T21:35:39: | |
| 83 | + 2015-05-22T21:35:39: +==============+ | |
| 84 | + 2015-05-22T21:35:39: | Mission: cta | | |
| 85 | + 2015-05-22T21:35:39: +==============+ | |
| 86 | + 2015-05-22T21:35:40: === Response functions in database "prod2" === | |
| 87 | + 2015-05-22T21:35:40: North_0.5h | |
| 88 | + 2015-05-22T21:35:40: North_50h | |
| 89 | + 2015-05-22T21:35:40: North_5h | |
| 90 | + 2015-05-22T21:35:40: South_0.5h | |
| 91 | + 2015-05-22T21:35:40: South_50h | |
| 92 | + 2015-05-22T21:35:40: South_5h | |
| 93 | + | |
| 94 | +You will see that ctools ships with one database for the CTA observatory. | |
| 95 | +This is the ``prod2`` database. | |
| 96 | +Within this database there are six response functions: | |
| 97 | +``North_0.5h``, ``North_5h``, ``North_50h``, | |
| 98 | +``South_0.5h``, ``South_5h``, and ``South_50h``. | |
| 99 | + | |
| 100 | +We now jointly fit both observations using :ref:`ctlike`: | |
| 86 | 101 | |
| 87 | 102 | .. code-block:: bash |
| 88 | 103 | |
| 89 | 104 | $ ctlike |
| 90 | - Event list, counts cube or observation definition file [events.fits] obs_irf.xml | |
| 105 | + Event list, counts cube or observation definition file [obs.xml] obs_irf.xml | |
| 91 | 106 | Source model [$CTOOLS/share/models/crab.xml] |
| 92 | - Source model output file [crab_results.xml] | |
| 107 | + Source model output file [crab_results.xml] | |
| 93 | 108 | |
| 94 | 109 | To see the usage of the individual response functions you may inspect the |
| 95 | 110 | log file. You will notice that each observation now has a specific response |
| ... | ... | @@ -98,69 +113,110 @@ both observations. |
| 98 | 113 | |
| 99 | 114 | .. code-block:: xml |
| 100 | 115 | |
| 101 | - 2015-02-05T14:48:46: +==============+ | |
| 102 | - 2015-02-05T14:48:46: | Observations | | |
| 103 | - 2015-02-05T14:48:46: +==============+ | |
| 104 | - 2015-02-05T14:48:46: === GObservations === | |
| 105 | - 2015-02-05T14:48:46: Number of observations ....: 2 | |
| 106 | - 2015-02-05T14:48:46: Number of predicted events : 0 | |
| 107 | - 2015-02-05T14:48:46: === GCTAObservation === | |
| 108 | - 2015-02-05T14:48:46: Name ......................: Crab | |
| 109 | - 2015-02-05T14:48:46: Identifier ................: 00001 | |
| 110 | - 2015-02-05T14:48:46: Instrument ................: CTA | |
| 111 | - 2015-02-05T14:48:46: Event file ................: events1.fits | |
| 112 | - 2015-02-05T14:48:46: Event type ................: EventList | |
| 113 | - 2015-02-05T14:48:46: Statistics ................: Poisson | |
| 114 | - 2015-02-05T14:48:46: Ontime ....................: 1800 s | |
| 115 | - 2015-02-05T14:48:46: Livetime ..................: 1710 s | |
| 116 | - 2015-02-05T14:48:46: Deadtime correction .......: 0.95 | |
| 117 | - 2015-02-05T14:48:46: User energy range .........: undefined | |
| 118 | - 2015-02-05T14:48:46: === GCTAPointing === | |
| 119 | - 2015-02-05T14:48:46: Pointing direction ........: (RA,Dec)=(83.63,21.51) | |
| 120 | - 2015-02-05T14:48:46: === GCTAResponseIrf === | |
| 121 | - 2015-02-05T14:48:46: Response name .............: cta_north_irf | |
| 122 | - 2015-02-05T14:48:46: Energy dispersion .........: Not used | |
| 123 | - 2015-02-05T14:48:46: Save energy range .........: undefined | |
| 124 | - 2015-02-05T14:48:46: === GCaldb === | |
| 125 | - 2015-02-05T14:48:46: Database root .............: /Users/jurgen/Desktop/tmp/beyond/caldb | |
| 126 | - 2015-02-05T14:48:46: Selected Mission ..........: CTA | |
| 127 | - 2015-02-05T14:48:46: Selected Instrument .......: NORTH | |
| 128 | - 2015-02-05T14:48:46: Calibration Index File ....: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/north/caldb.indx | |
| 129 | - 2015-02-05T14:48:46: Number of entries .........: 4 | |
| 130 | - 2015-02-05T14:48:46: === GCTAAeffPerfTable === | |
| 131 | - 2015-02-05T14:48:46: Filename ..................: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/north/bcf/cta_north_irf.dat | |
| 132 | - 2015-02-05T14:48:46: Number of energy bins .....: 20 | |
| 133 | - 2015-02-05T14:48:46: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | |
| 134 | - 2015-02-05T14:48:46: Offset angle dependence ...: Fixed sigma=3 | |
| 135 | - ... | |
| 136 | - 2015-02-05T14:48:46: === GCTAObservation === | |
| 137 | - 2015-02-05T14:48:46: Name ......................: Crab | |
| 138 | - 2015-02-05T14:48:46: Identifier ................: 00002 | |
| 139 | - 2015-02-05T14:48:46: Instrument ................: CTA | |
| 140 | - 2015-02-05T14:48:46: Event file ................: events2.fits | |
| 141 | - 2015-02-05T14:48:46: Event type ................: EventList | |
| 142 | - 2015-02-05T14:48:46: Statistics ................: Poisson | |
| 143 | - 2015-02-05T14:48:46: Ontime ....................: 1800 s | |
| 144 | - 2015-02-05T14:48:46: Livetime ..................: 1710 s | |
| 145 | - 2015-02-05T14:48:46: Deadtime correction .......: 0.95 | |
| 146 | - 2015-02-05T14:48:46: User energy range .........: undefined | |
| 147 | - 2015-02-05T14:48:46: === GCTAPointing === | |
| 148 | - 2015-02-05T14:48:46: Pointing direction ........: (RA,Dec)=(83.63,22.51) | |
| 149 | - 2015-02-05T14:48:46: === GCTAResponseIrf === | |
| 150 | - 2015-02-05T14:48:46: Response name .............: cta_south_irf | |
| 151 | - 2015-02-05T14:48:46: Energy dispersion .........: Not used | |
| 152 | - 2015-02-05T14:48:46: Save energy range .........: undefined | |
| 153 | - 2015-02-05T14:48:46: === GCaldb === | |
| 154 | - 2015-02-05T14:48:46: Database root .............: /Users/jurgen/Desktop/tmp/beyond/caldb | |
| 155 | - 2015-02-05T14:48:46: Selected Mission ..........: CTA | |
| 156 | - 2015-02-05T14:48:46: Selected Instrument .......: SOUTH | |
| 157 | - 2015-02-05T14:48:46: Calibration Index File ....: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/south/caldb.indx | |
| 158 | - 2015-02-05T14:48:46: Number of entries .........: 4 | |
| 159 | - 2015-02-05T14:48:46: === GCTAAeffPerfTable === | |
| 160 | - 2015-02-05T14:48:46: Filename ..................: /Users/jurgen/Desktop/tmp/beyond/caldb/data/cta/south/bcf/cta_south_irf.dat | |
| 161 | - 2015-02-05T14:48:46: Number of energy bins .....: 20 | |
| 162 | - 2015-02-05T14:48:46: Log10(Energy) range .......: 0.0199526 - 125.893 TeV | |
| 163 | - 2015-02-05T14:48:46: Offset angle dependence ...: Fixed sigma=3 | |
| 116 | + 2015-05-22T22:06:43: +==============+ | |
| 117 | + 2015-05-22T22:06:43: | Observations | | |
| 118 | + 2015-05-22T22:06:43: +==============+ | |
| 119 | + 2015-05-22T22:06:43: === GObservations === | |
| 120 | + 2015-05-22T22:06:43: Number of observations ....: 2 | |
| 121 | + 2015-05-22T22:06:43: Number of predicted events : 0 | |
| 122 | + 2015-05-22T22:06:43: === GCTAObservation === | |
| 123 | + 2015-05-22T22:06:43: Name ......................: | |
| 124 | + 2015-05-22T22:06:43: Identifier ................: 00001 | |
| 125 | + 2015-05-22T22:06:43: Instrument ................: CTA | |
| 126 | + 2015-05-22T22:06:43: Event file ................: events1.fits | |
| 127 | + 2015-05-22T22:06:43: Event type ................: EventList | |
| 128 | + 2015-05-22T22:06:43: Statistics ................: Poisson | |
| 129 | + 2015-05-22T22:06:43: Ontime ....................: 1800 s | |
| 130 | + 2015-05-22T22:06:43: Livetime ..................: 1710 s | |
| 131 | + 2015-05-22T22:06:43: Deadtime correction .......: 0.95 | |
| 132 | + 2015-05-22T22:06:43: User energy range .........: undefined | |
| 133 | + 2015-05-22T22:06:43: === GCTAPointing === | |
| 134 | + 2015-05-22T22:06:43: Pointing direction ........: (RA,Dec)=(83.63,21.51) | |
| 135 | + 2015-05-22T22:06:43: === GCTAResponseIrf === | |
| 136 | + 2015-05-22T22:06:43: Caldb mission .............: cta | |
| 137 | + 2015-05-22T22:06:43: Caldb instrument ..........: prod2 | |
| 138 | + 2015-05-22T22:06:43: Response name .............: North_50h | |
| 139 | + 2015-05-22T22:06:43: Energy dispersion .........: Not used | |
| 140 | + 2015-05-22T22:06:43: Save energy range .........: undefined | |
| 141 | + ... | |
| 142 | + 2015-05-22T22:06:43: === GCTAObservation === | |
| 143 | + 2015-05-22T22:06:43: Name ......................: | |
| 144 | + 2015-05-22T22:06:43: Identifier ................: 00002 | |
| 145 | + 2015-05-22T22:06:43: Instrument ................: CTA | |
| 146 | + 2015-05-22T22:06:43: Event file ................: events2.fits | |
| 147 | + 2015-05-22T22:06:43: Event type ................: EventList | |
| 148 | + 2015-05-22T22:06:43: Statistics ................: Poisson | |
| 149 | + 2015-05-22T22:06:43: Ontime ....................: 1800 s | |
| 150 | + 2015-05-22T22:06:43: Livetime ..................: 1710 s | |
| 151 | + 2015-05-22T22:06:43: Deadtime correction .......: 0.95 | |
| 152 | + 2015-05-22T22:06:43: User energy range .........: undefined | |
| 153 | + 2015-05-22T22:06:43: === GCTAPointing === | |
| 154 | + 2015-05-22T22:06:43: Pointing direction ........: (RA,Dec)=(83.63,22.51) | |
| 155 | + 2015-05-22T22:06:43: === GCTAResponseIrf === | |
| 156 | + 2015-05-22T22:06:43: Caldb mission .............: cta | |
| 157 | + 2015-05-22T22:06:43: Caldb instrument ..........: prod2 | |
| 158 | + 2015-05-22T22:06:43: Response name .............: South_50h | |
| 159 | + 2015-05-22T22:06:43: Energy dispersion .........: Not used | |
| 160 | + 2015-05-22T22:06:43: Save energy range .........: undefined | |
| 161 | + ... | |
| 162 | + 2015-05-22T22:06:43: +=================================+ | |
| 163 | + 2015-05-22T22:06:43: | Maximum likelihood optimisation | | |
| 164 | + 2015-05-22T22:06:43: +=================================+ | |
| 165 | + 2015-05-22T22:06:43: >Iteration 0: -logL=138039.472, Lambda=1.0e-03 | |
| 166 | + 2015-05-22T22:06:43: >Iteration 1: -logL=138035.501, Lambda=1.0e-03, delta=3.971, max(|grad|)=16.203761 [Index:7] | |
| 167 | + 2015-05-22T22:06:43: >Iteration 2: -logL=138035.496, Lambda=1.0e-04, delta=0.005, max(|grad|)=-0.053284 [Index:7] | |
| 168 | + 2015-05-22T22:06:43: >Iteration 3: -logL=138035.496, Lambda=1.0e-05, delta=0.000, max(|grad|)=0.001386 [Index:7] | |
| 169 | + 2015-05-22T22:06:44: | |
| 170 | + 2015-05-22T22:06:44: +=========================================+ | |
| 171 | + 2015-05-22T22:06:44: | Maximum likelihood optimization results | | |
| 172 | + 2015-05-22T22:06:44: +=========================================+ | |
| 173 | + 2015-05-22T22:06:44: === GOptimizerLM === | |
| 174 | + 2015-05-22T22:06:44: Optimized function value ..: 138035.496 | |
| 175 | + 2015-05-22T22:06:44: Absolute precision ........: 0.005 | |
| 176 | + 2015-05-22T22:06:44: Acceptable value decrease .: 2 | |
| 177 | + 2015-05-22T22:06:44: Optimization status .......: converged | |
| 178 | + 2015-05-22T22:06:44: Number of parameters ......: 10 | |
| 179 | + 2015-05-22T22:06:44: Number of free parameters .: 4 | |
| 180 | + 2015-05-22T22:06:44: Number of iterations ......: 3 | |
| 181 | + 2015-05-22T22:06:44: Lambda ....................: 1e-06 | |
| 182 | + 2015-05-22T22:06:44: Maximum log likelihood ....: -138035.496 | |
| 183 | + 2015-05-22T22:06:44: Observed events (Nobs) ...: 20814.000 | |
| 184 | + 2015-05-22T22:06:44: Predicted events (Npred) ..: 20814.000 (Nobs - Npred = 2.67698e-06) | |
| 185 | + 2015-05-22T22:06:44: === GModels === | |
| 186 | + 2015-05-22T22:06:44: Number of models ..........: 2 | |
| 187 | + 2015-05-22T22:06:44: Number of parameters ......: 10 | |
| 188 | + 2015-05-22T22:06:44: === GModelSky === | |
| 189 | + 2015-05-22T22:06:44: Name ......................: Crab | |
| 190 | + 2015-05-22T22:06:44: Instruments ...............: all | |
| 191 | + 2015-05-22T22:06:44: Instrument scale factors ..: unity | |
| 192 | + 2015-05-22T22:06:44: Observation identifiers ...: all | |
| 193 | + 2015-05-22T22:06:44: Model type ................: PointSource | |
| 194 | + 2015-05-22T22:06:44: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 195 | + 2015-05-22T22:06:44: Number of parameters ......: 6 | |
| 196 | + 2015-05-22T22:06:44: Number of spatial par's ...: 2 | |
| 197 | + 2015-05-22T22:06:44: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 198 | + 2015-05-22T22:06:44: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 199 | + 2015-05-22T22:06:44: Number of spectral par's ..: 3 | |
| 200 | + 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) | |
| 201 | + 2015-05-22T22:06:44: Index ....................: -2.49569 +/- 0.0145376 [-0,-5] (free,scale=-1,gradient) | |
| 202 | + 2015-05-22T22:06:44: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 203 | + 2015-05-22T22:06:44: Number of temporal par's ..: 1 | |
| 204 | + 2015-05-22T22:06:44: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 205 | + 2015-05-22T22:06:44: === GCTAModelIrfBackground === | |
| 206 | + 2015-05-22T22:06:44: Name ......................: CTABackgroundModel | |
| 207 | + 2015-05-22T22:06:44: Instruments ...............: CTA | |
| 208 | + 2015-05-22T22:06:44: Instrument scale factors ..: unity | |
| 209 | + 2015-05-22T22:06:44: Observation identifiers ...: all | |
| 210 | + 2015-05-22T22:06:44: Model type ................: "PowerLaw" * "Constant" | |
| 211 | + 2015-05-22T22:06:44: Number of parameters ......: 4 | |
| 212 | + 2015-05-22T22:06:44: Number of spectral par's ..: 3 | |
| 213 | + 2015-05-22T22:06:44: Prefactor ................: 1.02524 +/- 0.0182054 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) | |
| 214 | + 2015-05-22T22:06:44: Index ....................: 0.0229728 +/- 0.0104713 [-5,5] (free,scale=1,gradient) | |
| 215 | + 2015-05-22T22:06:44: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 216 | + 2015-05-22T22:06:44: Number of temporal par's ..: 1 | |
| 217 | + 2015-05-22T22:06:44: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 218 | + | |
| 219 | + | |
| 164 | 220 | |
| 165 | 221 | A more fine grained control over the response function can be achieved by |
| 166 | 222 | specifying individual filenames for the various response components. |
| ... | ... | @@ -173,17 +229,17 @@ This is definitely expert mode, to be used with utmost care. |
| 173 | 229 | <observation_list title="observation library"> |
| 174 | 230 | <observation name="Crab" id="00001" instrument="CTA"> |
| 175 | 231 | <parameter name="EventList" file="events1.fits"/> |
| 176 | - <parameter name="EffectiveArea" file="$(CALDB)/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 177 | - <parameter name="PointSpreadFunction" file="$(CALDB)/data/cta/dummy/bcf/cta_prod1_irf.dat"/> | |
| 178 | - <parameter name="EnergyDispersion" file="$(CALDB)/data/cta/dummy/bcf/cta_prod2_irf.dat"/> | |
| 179 | - <parameter name="Background" file="$(CALDB)/data/cta/north/bcf/cta_north_irf.dat"/> | |
| 232 | + <parameter name="EffectiveArea" file="$(CALDB)/data/cta/prod2/bcf/North_50h/irf_file.fits.gz"/> | |
| 233 | + <parameter name="PointSpreadFunction" file="$(CALDB)/data/cta/prod2/bcf/North_50h/irf_file.fits.gz"/> | |
| 234 | + <parameter name="EnergyDispersion" file="$(CALDB)/data/cta/prod2/bcf/North_50h/irf_file.fits.gz"/> | |
| 235 | + <parameter name="Background" file="$(CALDB)/data/cta/prod2/bcf/North_50h/irf_file.fits.gz"/> | |
| 180 | 236 | </observation> |
| 181 | 237 | <observation name="Crab" id="00002" instrument="CTA"> |
| 182 | 238 | <parameter name="EventList" file="events2.fits"/> |
| 183 | - <parameter name="EffectiveArea" file="$(CALDB)/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 184 | - <parameter name="PointSpreadFunction" file="$(CALDB)/data/cta/dummy/bcf/cta_prod1_irf.dat"/> | |
| 185 | - <parameter name="EnergyDispersion" file="$(CALDB)/data/cta/dummy/bcf/cta_prod2_irf.dat"/> | |
| 186 | - <parameter name="Background" file="$(CALDB)/data/cta/south/bcf/cta_south_irf.dat"/> | |
| 239 | + <parameter name="EffectiveArea" file="$(CALDB)/data/cta/prod2/bcf/South_50h/irf_file.fits.gz"/> | |
| 240 | + <parameter name="PointSpreadFunction" file="$(CALDB)/data/cta/prod2/bcf/South_50h/irf_file.fits.gz"/> | |
| 241 | + <parameter name="EnergyDispersion" file="$(CALDB)/data/cta/prod2/bcf/South_50h/irf_file.fits.gz"/> | |
| 242 | + <parameter name="Background" file="$(CALDB)/data/cta/prod2/bcf/South_50h/irf_file.fits.gz"/> | |
| 187 | 243 | </observation> |
| 188 | 244 | </observation_list> |
| 189 | 245 | |
| ... | ... | @@ -199,11 +255,13 @@ file is given below: |
| 199 | 255 | <parameter name="CountsCube" file="cntcube1.fits"/> |
| 200 | 256 | <parameter name="ExposureCube" file="expcube1.fits"/> |
| 201 | 257 | <parameter name="PsfCube" file="psfcube1.fits"/> |
| 258 | + <parameter name="BkgCube" file="bkgcube1.fits"/> | |
| 202 | 259 | </observation> |
| 203 | 260 | <observation name="Crab" id="00002" instrument="CTA"> |
| 204 | 261 | <parameter name="CountsCube" file="cntcube2.fits"/> |
| 205 | 262 | <parameter name="ExposureCube" file="expcube2.fits"/> |
| 206 | 263 | <parameter name="PsfCube" file="psfcube2.fits"/> |
| 264 | + <parameter name="BkgCube" file="bkgcube2.fits"/> | |
| 207 | 265 | </observation> |
| 208 | 266 | </observation_list> |
| 209 | 267 | ... | ... |
doc/source/user_manual/getting_started/beyond_model.rst
| ... | ... | @@ -56,23 +56,21 @@ event list. |
| 56 | 56 | <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="0"/> |
| 57 | 57 | </spatialModel> |
| 58 | 58 | </source> |
| 59 | - <source name="Background_00001" type="RadialAcceptance" instrument="CTA" id="00001"> | |
| 60 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 61 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 59 | + <source name="Background_00001" type="CTAIrfBackground" instrument="CTA" id="00001"> | |
| 60 | + <spectrum type="PowerLaw"> | |
| 61 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 62 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 63 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 62 | 64 | </spectrum> |
| 63 | - <radialModel type="Gaussian"> | |
| 64 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 65 | - </radialModel> | |
| 66 | 65 | </source> |
| 67 | - <source name="Background_00002" type="RadialAcceptance" instrument="CTA" id="00002"> | |
| 68 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 69 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="10.0" free="1"/> | |
| 66 | + <source name="Background_00002" type="CTAIrfBackground" instrument="CTA" id="00002"> | |
| 67 | + <spectrum type="PowerLaw"> | |
| 68 | + <parameter name="Prefactor" scale="1.0" value="10.0" min="1e-3" max="1e+3" free="1"/> | |
| 69 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 70 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 70 | 71 | </spectrum> |
| 71 | - <radialModel type="Gaussian"> | |
| 72 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 73 | - </radialModel> | |
| 74 | 72 | </source> |
| 75 | - </source_library> | |
| 73 | + </source_library> | |
| 76 | 74 | |
| 77 | 75 | Note that both background model components distinguish in their event rate; |
| 78 | 76 | 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 |
| 112 | 110 | <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="0"/> |
| 113 | 111 | </spatialModel> |
| 114 | 112 | </source> |
| 115 | - <source name="Background_00001" type="RadialAcceptance" instrument="CTA" id="00001,00003,00004"> | |
| 116 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 117 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 113 | + <source name="Background_00001" type="CTAIrfBackground" instrument="CTA" id="00001,00003,00004"> | |
| 114 | + <spectrum type="PowerLaw"> | |
| 115 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 116 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 117 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 118 | 118 | </spectrum> |
| 119 | - <radialModel type="Gaussian"> | |
| 120 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 121 | - </radialModel> | |
| 122 | 119 | </source> |
| 123 | - <source name="Background_00002" type="RadialAcceptance" instrument="CTA" id="00002"> | |
| 124 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 125 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="10.0" free="1"/> | |
| 120 | + <source name="Background_00002" type="CTAIrfBackground" instrument="CTA" id="00002"> | |
| 121 | + <spectrum type="PowerLaw"> | |
| 122 | + <parameter name="Prefactor" scale="1.0" value="10.0" min="1e-3" max="1e+3" free="1"/> | |
| 123 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 124 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 126 | 125 | </spectrum> |
| 127 | - <radialModel type="Gaussian"> | |
| 128 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 129 | - </radialModel> | |
| 130 | 126 | </source> |
| 131 | 127 | </source_library> |
| 132 | 128 | ... | ... |
doc/source/user_manual/getting_started/beyond_residual.rst
| ... | ... | @@ -16,15 +16,27 @@ the model value to obtained the fractional residuals |
| 16 | 16 | Residual = \frac{Counts-Model}{Model} |
| 17 | 17 | |
| 18 | 18 | for all map pixels. |
| 19 | -The :ref:`csresmap` script is used as follows: | |
| 19 | + | |
| 20 | +Suppose that you have done the following unbinned ``ctlike`` analysis: | |
| 21 | + | |
| 22 | +.. code-block:: bash | |
| 23 | + | |
| 24 | + $ ctlike | |
| 25 | + Event list, counts cube or observation definition file [events.fits] obs.xml | |
| 26 | + Calibration database [prod2] | |
| 27 | + Instrument response function [South_50h] | |
| 28 | + Source model [$CTOOLS/share/models/crab.xml] | |
| 29 | + Source model output file [crab_results.xml] | |
| 30 | + | |
| 31 | +The :ref:`csresmap` script is then used as follows: | |
| 20 | 32 | |
| 21 | 33 | .. code-block:: bash |
| 22 | 34 | |
| 23 | 35 | $ csresmap |
| 24 | 36 | Parfile csresmap.par not found. Create default parfile. |
| 25 | 37 | Event list, counts cube, or observation definition file [events.fits] obs.xml |
| 26 | - Calibration database [dummy] | |
| 27 | - Instrument response function [cta_dummy_irf] | |
| 38 | + Calibration database [prod2] | |
| 39 | + Instrument response function [South_50h] | |
| 28 | 40 | Source model [$CTOOLS/share/models/crab.xml] crab_results.xml |
| 29 | 41 | Output residual map [resmap.fits] |
| 30 | 42 | First coordinate of image center in degrees (RA or galactic l) [83.63] | ... | ... |
doc/source/user_manual/getting_started/beyond_stacked.rst
| ... | ... | @@ -15,10 +15,10 @@ into a single counts cube: |
| 15 | 15 | .. code-block:: bash |
| 16 | 16 | |
| 17 | 17 | $ ctbin |
| 18 | - Event list or observation definition file [events2.fits] obs.xml | |
| 19 | - First coordinate of image center in degrees (RA or galactic l) [83.63] | |
| 20 | - Second coordinate of image center in degrees (DEC or galactic b) [22.01] | |
| 21 | - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] | |
| 18 | + Event list or observation definition file [events.fits] obs.xml | |
| 19 | + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] | |
| 20 | + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] | |
| 21 | + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 22 | 22 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] |
| 23 | 23 | Image scale (in degrees/pixel) [0.02] |
| 24 | 24 | Size of the X axis in pixels [200] |
| ... | ... | @@ -27,15 +27,16 @@ into a single counts cube: |
| 27 | 27 | Start value for first energy bin in TeV [0.1] |
| 28 | 28 | Stop value for last energy bin in TeV [100.0] |
| 29 | 29 | Number of energy bins [20] |
| 30 | - Output counts cube [cntcube2.fits] cntcube.fits | |
| 30 | + Output counts cube [cntcube.fits] | |
| 31 | 31 | |
| 32 | 32 | We now have a stacked counts cube ``cntcube.fits`` on disk. |
| 33 | 33 | Before we can use that counts cube in a maximum likelihood |
| 34 | 34 | analysis, we have to compute the instrument response and the |
| 35 | 35 | background model that are needed to describe the stacked data. |
| 36 | + | |
| 36 | 37 | For the former, we have to compute the total exposure for the stacked |
| 37 | 38 | cube (i.e. the sum of the effective areas for each observation multiplied |
| 38 | -by the corresponding lifetimes) and an effective point spread function | |
| 39 | +by the corresponding livetimes) and an effective point spread function | |
| 39 | 40 | (i.e. the point spread function of the different observations weighted by |
| 40 | 41 | the corresponding exposures). |
| 41 | 42 | To get both informations we use the :ref:`ctexpcube` and |
| ... | ... | @@ -45,29 +46,29 @@ To get both informations we use the :ref:`ctexpcube` and |
| 45 | 46 | |
| 46 | 47 | $ ctexpcube |
| 47 | 48 | Event list or observation definition file [NONE] obs.xml |
| 48 | - Calibration database [dummy] | |
| 49 | - Instrument response function [cta_dummy_irf] | |
| 49 | + Calibration database [prod2] | |
| 50 | + Instrument response function [South_50h] | |
| 50 | 51 | Counts cube for exposure cube definition [NONE] cntcube.fits |
| 51 | - Output exposure cube file [expcube.fits] | |
| 52 | + Output exposure cube file [expcube.fits] | |
| 52 | 53 | |
| 53 | 54 | .. code-block:: bash |
| 54 | 55 | |
| 55 | 56 | $ ctpsfcube |
| 56 | 57 | Event list or observation definition file [NONE] obs.xml |
| 57 | - Calibration database [dummy] | |
| 58 | - Instrument response function [cta_dummy_irf] | |
| 58 | + Calibration database [prod2] | |
| 59 | + Instrument response function [South_50h] | |
| 59 | 60 | Counts cube for psf cube definition [NONE] |
| 60 | - First coordinate of image center in degrees (RA or galactic l) [83.63] | |
| 61 | - Second coordinate of image center in degrees (DEC or galactic b) [22.01] | |
| 62 | - Projection method e.g. AIT|AZP|CAR|MER|MOL|STG|TAN (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 61 | + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] | |
| 62 | + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] | |
| 63 | + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 63 | 64 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] |
| 64 | 65 | Image scale (in degrees/pixel) [1.0] |
| 65 | 66 | Size of the X axis in pixels [10] |
| 66 | 67 | Size of the Y axis in pixels [10] |
| 67 | - Start value for first energy bin in TeV [0.1] | |
| 68 | - Stop value for last energy bin in TeV [100.0] | |
| 68 | + Lower energy limit (TeV) [0.1] | |
| 69 | + Upper energy limit (TeV) [100.0] | |
| 69 | 70 | Number of energy bins [20] |
| 70 | - Output psf cube file [psfcube.fits] | |
| 71 | + Output psf cube file [psfcube.fits] | |
| 71 | 72 | |
| 72 | 73 | We provide the ``obs.xml`` file on input to inform both tools which |
| 73 | 74 | observations have been combined. |
| ... | ... | @@ -93,17 +94,17 @@ background cube using the :ref:`ctbkgcube` tool: |
| 93 | 94 | |
| 94 | 95 | $ ctbkgcube |
| 95 | 96 | Input event list or observation definition file [NONE] obs.xml |
| 96 | - Calibration database [dummy] | |
| 97 | - Instrument response function [cta_dummy_irf] | |
| 98 | - Input (background) model XML file [NONE] $CTOOLS/share/models/crab.xml | |
| 97 | + Calibration database [prod2] | |
| 98 | + Instrument response function [South_50h] | |
| 99 | 99 | Counts cube for background cube definition [NONE] cntcube.fits |
| 100 | + Input model XML file [NONE] $CTOOLS/share/models/crab.xml | |
| 100 | 101 | Output background cube file [bkgcube.fits] |
| 101 | - Output (background) model XML file [NONE] model.xml | |
| 102 | + Output model XML file [NONE] model.xml | |
| 102 | 103 | |
| 103 | 104 | The usage of :ref:`ctbkgcube` is very similar to that of :ref:`ctexpcube`, |
| 104 | 105 | yet it takes the model XML file as an additional input parameter. |
| 105 | -We here use the usual ``$CTOOLS/share/models/crab.xml`` Crab plus | |
| 106 | -background model file that is shipped with the ctools. | |
| 106 | +We here use the usual ``$CTOOLS/share/models/crab.xml`` model | |
| 107 | +file that is shipped with the ctools. | |
| 107 | 108 | :ref:`ctbkgcube` provides on output the background cube file |
| 108 | 109 | ``bkgcube.fits`` and the model XML file ``model.xml`` that can |
| 109 | 110 | be used for further analysis. |
| ... | ... | @@ -125,25 +126,21 @@ modelling works: |
| 125 | 126 | <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" /> |
| 126 | 127 | </spatialModel> |
| 127 | 128 | </source> |
| 128 | - <source name="ctbkgcube default background model" type="CTACubeBackground"> | |
| 129 | + <source name="BackgroundModel" type="CTACubeBackground" instrument="CTA,HESS,MAGIC,VERITAS"> | |
| 129 | 130 | <spectrum type="PowerLaw"> |
| 130 | 131 | <parameter name="Prefactor" value="1" error="0" scale="1" min="0" free="1" /> |
| 131 | 132 | <parameter name="Index" value="0" error="0" scale="1" min="-10" max="10" free="1" /> |
| 132 | 133 | <parameter name="Scale" value="1" scale="1e+06" free="0" /> |
| 133 | 134 | </spectrum> |
| 134 | - <spatialModel type="MapCubeFunction" file="bkgcube.fits"> | |
| 135 | - <parameter name="Normalization" value="1" scale="1" min="0.001" max="1000" free="0" /> | |
| 136 | - </spatialModel> | |
| 137 | 135 | </source> |
| 138 | 136 | </source_library> |
| 139 | 137 | |
| 140 | 138 | The Crab source component is the same that is also present in |
| 141 | 139 | ``$CTOOLS/share/models/crab.xml`` and is not modified. |
| 142 | -The background component, however, has been replaced and now is | |
| 143 | -the ``ctbkgcube default background model``. | |
| 144 | -This model is of type ``CTACubeBackground`` which is a 3-dimensional | |
| 145 | -data cube that describes the expected background rate as function | |
| 146 | -of spatial position and energy. | |
| 140 | +The background component, however, has been replaced by a model of | |
| 141 | +type ``CTACubeBackground``. | |
| 142 | +This model is a 3-dimensional data cube that describes the expected | |
| 143 | +background rate as function of spatial position and energy. | |
| 147 | 144 | The data cube is multiplied by a power law spectrum that allows to adjust |
| 148 | 145 | the normalization and slope of the background spectrum in the fit. |
| 149 | 146 | This power law could be replaced by any spectral model that is found |
| ... | ... | @@ -166,87 +163,82 @@ analysis using the :ref:`ctlike` tool: |
| 166 | 163 | .. code-block:: bash |
| 167 | 164 | |
| 168 | 165 | $ ctlike |
| 169 | - Event list, counts cube or observation definition file [events.fits] cntcube.fits | |
| 170 | - Exposure cube file [NONE] expcube.fits | |
| 171 | - PSF cube file [NONE] psfcube.fits | |
| 166 | + Event list, counts cube or observation definition file [obs.xml] cntcube.fits | |
| 167 | + Exposure cube file (only needed for stacked analysis) [NONE] expcube.fits | |
| 168 | + PSF cube file (only needed for stacked analysis) [NONE] psfcube.fits | |
| 169 | + Background cube file (only needed for stacked analysis) [NONE] bkgcube.fits | |
| 172 | 170 | Source model [$CTOOLS/share/models/crab.xml] model.xml |
| 173 | - Source model output file [crab_results.xml] | |
| 171 | + Source model output file [crab_results.xml] | |
| 174 | 172 | |
| 175 | 173 | :ref:`ctlike` recognises that a counts cube should be analysed and queries |
| 176 | -for the exposure cube and PSF cube file names. | |
| 177 | -We specified the names of the files produced by the :ref:`ctexpcube` and | |
| 178 | -:ref:`ctpsfcube` tools and furthermore provided the ``model.xml`` file | |
| 179 | -that is generated by the :ref:`ctbkgcube` tool as source model. | |
| 174 | +for the exposure cube, the PSF cube, and the background cube file names. | |
| 175 | +We specified the names of the files produced by the :ref:`ctexpcube`, | |
| 176 | +the :ref:`ctpsfcube` and the :ref:`ctbkgcube` tools. | |
| 177 | +Furthermore we provided as model the ``model.xml`` file that has been | |
| 178 | +generated by the :ref:`ctbkgcube` tool. | |
| 179 | + | |
| 180 | 180 | The log file of the :ref:`ctlike` run is shown below. |
| 181 | 181 | Note that the spectral model that is multiplied with the background |
| 182 | -cube has a Prefactor of 1.06 +/- 0.02 and an Index of 0.004 +/- 0.009, | |
| 182 | +cube has a Prefactor of 1.09 +/- 0.02 and an Index of 0.03 +/- 0.01, | |
| 183 | 183 | indicating a very small correction to the actual spectrum of the background |
| 184 | 184 | cube. |
| 185 | 185 | Real life situations may of course require larger correction factors. |
| 186 | 186 | |
| 187 | 187 | .. code-block:: xml |
| 188 | 188 | |
| 189 | - 2015-02-04T23:00:25: +=================================+ | |
| 190 | - 2015-02-04T23:00:25: | Maximum likelihood optimisation | | |
| 191 | - 2015-02-04T23:00:25: +=================================+ | |
| 192 | - 2015-02-04T23:00:29: >Iteration 0: -logL=36748.112, Lambda=1.0e-03 | |
| 193 | - 2015-02-04T23:00:33: >Iteration 1: -logL=36734.170, Lambda=1.0e-03, delta=13.942, max(|grad|)=34.291911 [Index:8] | |
| 194 | - 2015-02-04T23:00:38: >Iteration 2: -logL=36734.127, Lambda=1.0e-04, delta=0.044, max(|grad|)=0.178088 [Index:8] | |
| 195 | - 2015-02-04T23:00:42: >Iteration 3: -logL=36734.127, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.001993 [Index:8] | |
| 196 | - 2015-02-04T23:00:46: | |
| 197 | - 2015-02-04T23:00:46: +=========================================+ | |
| 198 | - 2015-02-04T23:00:46: | Maximum likelihood optimization results | | |
| 199 | - 2015-02-04T23:00:46: +=========================================+ | |
| 200 | - 2015-02-04T23:00:46: === GOptimizerLM === | |
| 201 | - 2015-02-04T23:00:46: Optimized function value ..: 36734.127 | |
| 202 | - 2015-02-04T23:00:46: Absolute precision ........: 0.005 | |
| 203 | - 2015-02-04T23:00:46: Acceptable value decrease .: 2 | |
| 204 | - 2015-02-04T23:00:46: Optimization status .......: converged | |
| 205 | - 2015-02-04T23:00:46: Number of parameters ......: 11 | |
| 206 | - 2015-02-04T23:00:46: Number of free parameters .: 4 | |
| 207 | - 2015-02-04T23:00:46: Number of iterations ......: 3 | |
| 208 | - 2015-02-04T23:00:46: Lambda ....................: 1e-06 | |
| 209 | - 2015-02-04T23:00:46: Maximum log likelihood ....: -36734.127 | |
| 210 | - 2015-02-04T23:00:46: Observed events (Nobs) ...: 10685.000 | |
| 211 | - 2015-02-04T23:00:46: Predicted events (Npred) ..: 10685.000 (Nobs - Npred = 2.06522e-06) | |
| 212 | - 2015-02-04T23:00:46: === GModels === | |
| 213 | - 2015-02-04T23:00:46: Number of models ..........: 2 | |
| 214 | - 2015-02-04T23:00:46: Number of parameters ......: 11 | |
| 215 | - 2015-02-04T23:00:46: === GModelSky === | |
| 216 | - 2015-02-04T23:00:46: Name ......................: Crab | |
| 217 | - 2015-02-04T23:00:46: Instruments ...............: all | |
| 218 | - 2015-02-04T23:00:46: Instrument scale factors ..: unity | |
| 219 | - 2015-02-04T23:00:46: Observation identifiers ...: all | |
| 220 | - 2015-02-04T23:00:46: Model type ................: PointSource | |
| 221 | - 2015-02-04T23:00:46: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 222 | - 2015-02-04T23:00:46: Number of parameters ......: 6 | |
| 223 | - 2015-02-04T23:00:46: Number of spatial par's ...: 2 | |
| 224 | - 2015-02-04T23:00:46: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 225 | - 2015-02-04T23:00:46: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 226 | - 2015-02-04T23:00:46: Number of spectral par's ..: 3 | |
| 227 | - 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) | |
| 228 | - 2015-02-04T23:00:46: Index ....................: -2.49533 +/- 0.0179769 [-0,-5] (free,scale=-1,gradient) | |
| 229 | - 2015-02-04T23:00:46: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 230 | - 2015-02-04T23:00:46: Number of temporal par's ..: 1 | |
| 231 | - 2015-02-04T23:00:46: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 232 | - 2015-02-04T23:00:46: === GCTAModelCubeBackground === | |
| 233 | - 2015-02-04T23:00:46: Name ......................: ctbkgcube default background model | |
| 234 | - 2015-02-04T23:00:46: Instruments ...............: all | |
| 235 | - 2015-02-04T23:00:46: Instrument scale factors ..: unity | |
| 236 | - 2015-02-04T23:00:46: Observation identifiers ...: all | |
| 237 | - 2015-02-04T23:00:46: Model type ................: "MapCubeFunction" * "PowerLaw" * "Constant" | |
| 238 | - 2015-02-04T23:00:46: Number of parameters ......: 5 | |
| 239 | - 2015-02-04T23:00:46: Number of spatial par's ...: 1 | |
| 240 | - 2015-02-04T23:00:46: Normalization ............: 1 [0.001,1000] (fixed,scale=1,gradient) | |
| 241 | - 2015-02-04T23:00:46: Number of spectral par's ..: 3 | |
| 242 | - 2015-02-04T23:00:46: Prefactor ................: 1.05876 +/- 0.0178132 [0,infty[ ph/cm2/s/MeV (free,scale=1,gradient) | |
| 243 | - 2015-02-04T23:00:46: Index ....................: 0.00396962 +/- 0.00881842 [-10,10] (free,scale=1,gradient) | |
| 244 | - 2015-02-04T23:00:46: PivotEnergy ..............: 1e+06 MeV (fixed,scale=1e+06,gradient) | |
| 245 | - 2015-02-04T23:00:46: Number of temporal par's ..: 1 | |
| 246 | - 2015-02-04T23:00:46: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 247 | - 2015-02-04T23:00:46: | |
| 248 | - 2015-02-04T23:00:46: +==============+ | |
| 249 | - 2015-02-04T23:00:46: | Save results | | |
| 250 | - 2015-02-04T23:00:46: +==============+ | |
| 251 | - 2015-02-04T23:00:46: | |
| 252 | - 2015-02-04T23:00:46: Application "ctlike" terminated after 43 wall clock seconds, consuming 21.5624 seconds of CPU time. | |
| 189 | + 2015-05-22T21:10:09: +=================================+ | |
| 190 | + 2015-05-22T21:10:09: | Maximum likelihood optimisation | | |
| 191 | + 2015-05-22T21:10:09: +=================================+ | |
| 192 | + 2015-05-22T21:10:10: >Iteration 0: -logL=60663.798, Lambda=1.0e-03 | |
| 193 | + 2015-05-22T21:10:11: >Iteration 1: -logL=60642.413, Lambda=1.0e-03, delta=21.385, max(|grad|)=120.031102 [Index:7] | |
| 194 | + 2015-05-22T21:10:13: >Iteration 2: -logL=60642.233, Lambda=1.0e-04, delta=0.180, max(|grad|)=1.139187 [Index:7] | |
| 195 | + 2015-05-22T21:10:14: >Iteration 3: -logL=60642.233, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.001247 [Index:7] | |
| 196 | + 2015-05-22T21:10:16: | |
| 197 | + 2015-05-22T21:10:16: +=========================================+ | |
| 198 | + 2015-05-22T21:10:16: | Maximum likelihood optimization results | | |
| 199 | + 2015-05-22T21:10:16: +=========================================+ | |
| 200 | + 2015-05-22T21:10:16: === GOptimizerLM === | |
| 201 | + 2015-05-22T21:10:16: Optimized function value ..: 60642.233 | |
| 202 | + 2015-05-22T21:10:16: Absolute precision ........: 0.005 | |
| 203 | + 2015-05-22T21:10:16: Acceptable value decrease .: 2 | |
| 204 | + 2015-05-22T21:10:16: Optimization status .......: converged | |
| 205 | + 2015-05-22T21:10:16: Number of parameters ......: 10 | |
| 206 | + 2015-05-22T21:10:16: Number of free parameters .: 4 | |
| 207 | + 2015-05-22T21:10:16: Number of iterations ......: 3 | |
| 208 | + 2015-05-22T21:10:16: Lambda ....................: 1e-06 | |
| 209 | + 2015-05-22T21:10:16: Maximum log likelihood ....: -60642.233 | |
| 210 | + 2015-05-22T21:10:16: Observed events (Nobs) ...: 25963.000 | |
| 211 | + 2015-05-22T21:10:16: Predicted events (Npred) ..: 25963.000 (Nobs - Npred = 1.5749e-05) | |
| 212 | + 2015-05-22T21:10:16: === GModels === | |
| 213 | + 2015-05-22T21:10:16: Number of models ..........: 2 | |
| 214 | + 2015-05-22T21:10:16: Number of parameters ......: 10 | |
| 215 | + 2015-05-22T21:10:16: === GModelSky === | |
| 216 | + 2015-05-22T21:10:16: Name ......................: Crab | |
| 217 | + 2015-05-22T21:10:16: Instruments ...............: all | |
| 218 | + 2015-05-22T21:10:16: Instrument scale factors ..: unity | |
| 219 | + 2015-05-22T21:10:16: Observation identifiers ...: all | |
| 220 | + 2015-05-22T21:10:16: Model type ................: PointSource | |
| 221 | + 2015-05-22T21:10:16: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 222 | + 2015-05-22T21:10:16: Number of parameters ......: 6 | |
| 223 | + 2015-05-22T21:10:16: Number of spatial par's ...: 2 | |
| 224 | + 2015-05-22T21:10:16: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 225 | + 2015-05-22T21:10:16: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 226 | + 2015-05-22T21:10:16: Number of spectral par's ..: 3 | |
| 227 | + 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) | |
| 228 | + 2015-05-22T21:10:16: Index ....................: -2.49909 +/- 0.0118976 [-0,-5] (free,scale=-1,gradient) | |
| 229 | + 2015-05-22T21:10:16: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 230 | + 2015-05-22T21:10:16: Number of temporal par's ..: 1 | |
| 231 | + 2015-05-22T21:10:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 232 | + 2015-05-22T21:10:16: === GCTAModelCubeBackground === | |
| 233 | + 2015-05-22T21:10:16: Name ......................: BackgroundModel | |
| 234 | + 2015-05-22T21:10:16: Instruments ...............: CTA, HESS, MAGIC, VERITAS | |
| 235 | + 2015-05-22T21:10:16: Instrument scale factors ..: unity | |
| 236 | + 2015-05-22T21:10:16: Observation identifiers ...: all | |
| 237 | + 2015-05-22T21:10:16: Model type ................: "PowerLaw" * "Constant" | |
| 238 | + 2015-05-22T21:10:16: Number of parameters ......: 4 | |
| 239 | + 2015-05-22T21:10:16: Number of spectral par's ..: 3 | |
| 240 | + 2015-05-22T21:10:16: Prefactor ................: 1.08781 +/- 0.0212678 [0,infty[ ph/cm2/s/MeV (free,scale=1,gradient) | |
| 241 | + 2015-05-22T21:10:16: Index ....................: 0.0269681 +/- 0.0111532 [-10,10] (free,scale=1,gradient) | |
| 242 | + 2015-05-22T21:10:16: PivotEnergy ..............: 1e+06 MeV (fixed,scale=1e+06,gradient) | |
| 243 | + 2015-05-22T21:10:16: Number of temporal par's ..: 1 | |
| 244 | + 2015-05-22T21:10:16: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | ... | ... |
doc/source/user_manual/getting_started/beyond_tsmap.rst
| ... | ... | @@ -6,7 +6,7 @@ Generating a Test Statistic map |
| 6 | 6 | In the above examples we were always considering that we knew exactly |
| 7 | 7 | where the source is located, but in real life situations this may not |
| 8 | 8 | necessarily be the case. |
| 9 | -We thus need a mean to search for significant excess emission in our data. | |
| 9 | +We thus need a means to search for significant excess emission in our data. | |
| 10 | 10 | One possibility to accomplish this task is to compute the Test Statistic |
| 11 | 11 | for a specific source at a grid of trial positions. |
| 12 | 12 | 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. |
| 32 | 32 | |
| 33 | 33 | $ cttsmap |
| 34 | 34 | Input event list, counts cube or observation definition file [events.fits] obs.xml |
| 35 | - Calibration database [dummy] | |
| 36 | - Instrument response function [cta_dummy_irf] | |
| 35 | + Calibration database [prod2] | |
| 36 | + Instrument response function [South_50h] | |
| 37 | 37 | Source model [$CTOOLS/share/models/crab.xml] |
| 38 | 38 | Test source [Crab] |
| 39 | - First coordinate of image center in degrees (RA or galactic l) [83.63] | |
| 40 | - Second coordinate of image center in degrees (DEC or galactic b) [22.01] | |
| 41 | - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] | |
| 39 | + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] | |
| 40 | + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] | |
| 41 | + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 42 | 42 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] |
| 43 | 43 | Image scale (in degrees/pixel) [0.02] |
| 44 | 44 | Size of the X axis in pixels [200] 10 |
| 45 | 45 | Size of the Y axis in pixels [200] 10 |
| 46 | - Output Test Statistic map [tsmap.fits] | |
| 46 | + Output Test Statistic map [tsmap.fits] | |
| 47 | 47 | |
| 48 | 48 | :ref:`cttsmap` writes the Test Statistic map in the ``tsmap.fits`` file |
| 49 | 49 | that contains one extension for the Test Statistic value and further |
| 50 | 50 | extensions for the spectral parameters that have been fitted for the |
| 51 | 51 | source at each position of the grid. |
| 52 | 52 | The figure below show the Test Statistic map which reaches a maximum |
| 53 | -value of 13782 near the centre of the map. | |
| 53 | +value of 37484 near the centre of the map. | |
| 54 | 54 | |
| 55 | 55 | .. figure:: tsmap-crab.png |
| 56 | 56 | :height: 400px | ... | ... |
doc/source/user_manual/getting_started/caldb.tar.gz deleted
No preview for this file type
doc/source/user_manual/getting_started/irf-aeff.png
0 → 100644
3.24 KB
doc/source/user_manual/getting_started/irf-file.png
0 → 100644
7.1 KB
doc/source/user_manual/getting_started/models.rst
| ... | ... | @@ -319,22 +319,6 @@ CTA cube background |
| 319 | 319 | .. code-block:: xml |
| 320 | 320 | |
| 321 | 321 | <source name="Background" type="CTACubeBackground" instrument="CTA"> |
| 322 | - <spatialModel type="GaussFunction"> | |
| 323 | - <parameter name="RA" scale="1.0" value="83.6221" min="0.0" max="360.0" free="0"/> | |
| 324 | - <parameter name="DEC" scale="1.0" value="22.01" min="-90.0" max="90.0" free="0"/> | |
| 325 | - <parameter name="Sigma" scale="1.0" value="1.0" min="0.0" max="10.0" free="0"/> | |
| 326 | - </spatialModel> | |
| 327 | - <spectrum type="..."> | |
| 328 | - ... | |
| 329 | - </spectrum> | |
| 330 | - </source> | |
| 331 | - | |
| 332 | - .. code-block:: xml | |
| 333 | - | |
| 334 | - <source name="Background" type="CTACubeBackground" instrument="CTA"> | |
| 335 | - <spatialModel type="MapCubeFunction" file="map_cube.fits"> | |
| 336 | - <parameter name="Normalization" scale="1" value="1" min="0.001" max="1000.0" free="0"/> | |
| 337 | - </spatialModel> | |
| 338 | 322 | <spectrum type="..."> |
| 339 | 323 | ... |
| 340 | 324 | </spectrum> | ... | ... |
doc/source/user_manual/getting_started/python.rst
| ... | ... | @@ -20,7 +20,7 @@ generally not very useful. |
| 20 | 20 | |
| 21 | 21 | .. warning:: |
| 22 | 22 | |
| 23 | - The GammaLib module needs to be imported before the ctools | |
| 23 | + The GammaLib module needs to be imported **before** the ctools | |
| 24 | 24 | module so that GammaLib class types are handled correctly. |
| 25 | 25 | So make sure that you **always import the GammaLib module before the ctools |
| 26 | 26 | module.** |
| ... | ... | @@ -42,8 +42,8 @@ way as if it were executed from the command line. |
| 42 | 42 | >>> sim = ctools.ctobssim() |
| 43 | 43 | >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml") |
| 44 | 44 | >>> sim["outevents"].filename("events.fits") |
| 45 | - >>> sim["caldb"].string("dummy") | |
| 46 | - >>> sim["irf"].string("cta_dummy_irf") | |
| 45 | + >>> sim["caldb"].string("prod2") | |
| 46 | + >>> sim["irf"].string("South_50h") | |
| 47 | 47 | >>> sim["ra"].real(83.63) |
| 48 | 48 | >>> sim["dec"].real(22.01) |
| 49 | 49 | >>> sim["rad"].real(5.0) |
| ... | ... | @@ -95,13 +95,13 @@ in that observation you may type: |
| 95 | 95 | |
| 96 | 96 | >>> print(sim.obs()[0].events()) |
| 97 | 97 | === GCTAEventList === |
| 98 | - Number of events ..........: 12152 | |
| 98 | + Number of events ..........: 31928 | |
| 99 | 99 | Time interval .............: 51544.5 - 51544.5 days |
| 100 | 100 | === GEbounds === |
| 101 | 101 | Number of intervals .......: 1 |
| 102 | 102 | Energy range ..............: 100 GeV - 100 TeV |
| 103 | 103 | === GCTARoi === |
| 104 | - ROI centre ................: RA=83.63, DEC=22.01 [0, 0] | |
| 104 | + ROI centre ................: RA=83.63, DEC=22.01 [0,0] | |
| 105 | 105 | ROI radius ................: 5 deg |
| 106 | 106 | |
| 107 | 107 | The ``obs()[0]`` operator returns the first observation in the observation |
| ... | ... | @@ -114,11 +114,12 @@ To see what kind of object you actually got, use: |
| 114 | 114 | >>> type(sim.obs()[0].events()) |
| 115 | 115 | <class 'gammalib.cta.GCTAEventList'> |
| 116 | 116 | |
| 117 | -The CTA event list is implement as the ``GCTAEventList`` class in the | |
| 117 | +The CTA event list is implement by the ``GCTAEventList`` class in the | |
| 118 | 118 | ``cta`` module of GammaLib. |
| 119 | 119 | To visualise the individual events you can iterate over the events using a |
| 120 | 120 | for loop. |
| 121 | -This will show the simulated celestial coordinates (RA, DEC), energies and | |
| 121 | +This will show the simulated celestial coordinates (RA, DEC), the | |
| 122 | +coordinate in the camera system [DETX, DETY], energies and | |
| 122 | 123 | terrestrial times (TT) of all events. |
| 123 | 124 | |
| 124 | 125 | .. code-block:: python |
| ... | ... | @@ -127,9 +128,9 @@ terrestrial times (TT) of all events. |
| 127 | 128 | >>> for event in events: |
| 128 | 129 | ... print(event) |
| 129 | 130 | ... |
| 130 | - Dir=RA=83.6477, DEC=22.0202 [0.000178879, 0.000286637] Energy=3.235 TeV Time=-3.15576e+08 s (TT) | |
| 131 | - Dir=RA=83.482, DEC=22.0189 [0.000155643, -0.00239471] Energy=141.949 GeV Time=-3.15576e+08 s (TT) | |
| 132 | - Dir=RA=83.6058, DEC=22.1586 [0.00259306, -0.000391919] Energy=316.376 GeV Time=-3.15576e+08 s (TT) | |
| 131 | + Dir=RA=83.5759, DEC=21.9757 [-0.000597839,-0.000875483] Energy=328.153 GeV Time=-3.15576e+08 s (TT) | |
| 132 | + Dir=RA=83.5775, DEC=22.0128 [4.88943e-05,-0.000849504] Energy=353.264 GeV Time=-3.15576e+08 s (TT) | |
| 133 | + Dir=RA=83.4302, DEC=21.931 [-0.00137616,-0.0032343] Energy=117.999 GeV Time=-3.15576e+08 s (TT) | |
| 133 | 134 | ... |
| 134 | 135 | |
| 135 | 136 | .. note:: |
| ... | ... | @@ -150,13 +151,13 @@ terrestrial times (TT) of all events. |
| 150 | 151 | >>> sim.run() |
| 151 | 152 | >>> print(sim.obs()[0].events()) |
| 152 | 153 | === GCTAEventList === |
| 153 | - Number of events ..........: 6141 | |
| 154 | + Number of events ..........: 15964 | |
| 154 | 155 | Time interval .............: 51544.5 - 51544.5 days |
| 155 | 156 | === GEbounds === |
| 156 | 157 | Number of intervals .......: 1 |
| 157 | 158 | Energy range ..............: 100 GeV - 100 TeV |
| 158 | 159 | === GCTARoi === |
| 159 | - ROI centre ................: RA=83.63, DEC=22.01 [0, 0] | |
| 160 | + ROI centre ................: RA=83.63, DEC=22.01 [0,0] | |
| 160 | 161 | ROI radius ................: 5 deg |
| 161 | 162 | |
| 162 | 163 | |
| ... | ... | @@ -178,28 +179,30 @@ Where are the user parameters? |
| 178 | 179 | :ref:`ctlike` doesn't in fact need any as all the relevant information is |
| 179 | 180 | already contained in the observation container produced by the |
| 180 | 181 | :ref:`ctobssim` class. |
| 181 | -And you make have recognised that we constructed the :ref:`ctlike` | |
| 182 | +And you may have recognised that we constructed the :ref:`ctlike` | |
| 182 | 183 | instance by using the :ref:`ctobssim` observation container as |
| 183 | 184 | constructor argument. |
| 184 | 185 | |
| 185 | -To check how the fit went you may inspect the optimiser class used by | |
| 186 | +To check how the fit went you can inspect the optimiser used by | |
| 186 | 187 | :ref:`ctlike`: |
| 187 | 188 | |
| 188 | 189 | .. code-block:: python |
| 189 | 190 | |
| 190 | 191 | >>> print(like.opt()) |
| 191 | 192 | === GOptimizerLM === |
| 192 | - Optimized function value ..: 44578.761 | |
| 193 | + Optimized function value ..: 101048.382 | |
| 193 | 194 | Absolute precision ........: 0.005 |
| 194 | 195 | Acceptable value decrease .: 2 |
| 195 | 196 | Optimization status .......: converged |
| 196 | - Number of parameters ......: 9 | |
| 197 | + Number of parameters ......: 10 | |
| 197 | 198 | Number of free parameters .: 4 |
| 198 | - Number of iterations ......: 3 | |
| 199 | - Lambda ....................: 1e-06 | |
| 199 | + Number of iterations ......: 2 | |
| 200 | + Lambda ....................: 1e-05 | |
| 200 | 201 | |
| 201 | -Apparently, the fit converged after fitting 4 parameters in 3 iterations. | |
| 202 | -To inspect the fit results you may print the model container that is a | |
| 202 | +Apparently, the fit converged after 2 iterations. | |
| 203 | +Out of 10 parameters in the model 4 have been fitted (the others were kept | |
| 204 | +fixed). | |
| 205 | +To inspect the fit results you can print the model container that is a | |
| 203 | 206 | member of the observation container: |
| 204 | 207 | |
| 205 | 208 | .. code-block:: python |
| ... | ... | @@ -207,7 +210,7 @@ member of the observation container: |
| 207 | 210 | >>> print(like.obs().models()) |
| 208 | 211 | === GModels === |
| 209 | 212 | Number of models ..........: 2 |
| 210 | - Number of parameters ......: 9 | |
| 213 | + Number of parameters ......: 10 | |
| 211 | 214 | === GModelSky === |
| 212 | 215 | Name ......................: Crab |
| 213 | 216 | Instruments ...............: all |
| ... | ... | @@ -220,24 +223,24 @@ member of the observation container: |
| 220 | 223 | RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) |
| 221 | 224 | DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) |
| 222 | 225 | Number of spectral par's ..: 3 |
| 223 | - Prefactor ................: 6.13265e-16 +/- 2.05734e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) | |
| 224 | - Index ....................: -2.50565 +/- 0.0250831 [-0,-5] (free,scale=-1,gradient) | |
| 226 | + Prefactor ................: 5.80565e-16 +/- 1.11147e-17 [1e-23,1e-13] ph/cm2/s/MeV (free,scale=1e-16,gradient) | |
| 227 | + Index ....................: -2.49266 +/- 0.0163476 [-0,-5] (free,scale=-1,gradient) | |
| 225 | 228 | PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) |
| 226 | 229 | Number of temporal par's ..: 1 |
| 227 | - Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 228 | - === GCTAModelRadialAcceptance === | |
| 229 | - Name ......................: Background | |
| 230 | + Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 231 | + === GCTAModelIrfBackground === | |
| 232 | + Name ......................: CTABackgroundModel | |
| 230 | 233 | Instruments ...............: CTA |
| 231 | 234 | Instrument scale factors ..: unity |
| 232 | 235 | Observation identifiers ...: all |
| 233 | - Model type ................: "Gaussian" * "FileFunction" * "Constant" | |
| 234 | - Number of parameters ......: 3 | |
| 235 | - Number of radial par's ....: 1 | |
| 236 | - Sigma ....................: 3.03693 +/- 0.0304896 [0.01,10] deg2 (free,scale=1,gradient) | |
| 237 | - Number of spectral par's ..: 1 | |
| 238 | - Normalization ............: 0.998667 +/- 0.0172585 [0,1000] (free,scale=1,gradient) | |
| 236 | + Model type ................: "PowerLaw" * "Constant" | |
| 237 | + Number of parameters ......: 4 | |
| 238 | + Number of spectral par's ..: 3 | |
| 239 | + Prefactor ................: 1.01701 +/- 0.0216563 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) | |
| 240 | + Index ....................: 0.0230864 +/- 0.0123006 [-5,5] (free,scale=1,gradient) | |
| 241 | + PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 239 | 242 | Number of temporal par's ..: 1 |
| 240 | - Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 243 | + Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 241 | 244 | |
| 242 | 245 | Suppose you want to repeat the fit by optimising also the position of the |
| 243 | 246 | point source. |
| ... | ... | @@ -250,8 +253,8 @@ This is easy from Python: |
| 250 | 253 | >>> like.run() |
| 251 | 254 | >>> print(like.obs().models()) |
| 252 | 255 | ... |
| 253 | - RA .......................: 83.633 +/- 0.00137216 [-360,360] deg (free,scale=1) | |
| 254 | - DEC ......................: 22.0144 +/- 0.00127247 [-90,90] deg (free,scale=1) | |
| 256 | + RA .......................: 83.6341 +/- 0.000958947 [-360,360] deg (free,scale=1) | |
| 257 | + DEC ......................: 22.0139 +/- 0.000870912 [-90,90] deg (free,scale=1) | |
| 255 | 258 | |
| 256 | 259 | The ``like.obs().models()`` method provides the model container, using the |
| 257 | 260 | ``["Crab"]`` operator we access the Crab model in that container and using |
| ... | ... | @@ -293,12 +296,12 @@ the ``fix()`` method. |
| 293 | 296 | >>> print(like.obs()) |
| 294 | 297 | === GObservations === |
| 295 | 298 | Number of observations ....: 1 |
| 296 | - Number of predicted events : 6141 | |
| 299 | + Number of predicted events : 15964 | |
| 297 | 300 | |
| 298 | 301 | is okay as the ``ctools.ctlike(sim.obs())`` constructor will create |
| 299 | 302 | a copy of the observation container that lives within the :ref:`ctlike` |
| 300 | 303 | instance. |
| 301 | - To preserve an observation container after a ctools object went out | |
| 304 | + To preserve an observation container after a ctools object goes out | |
| 302 | 305 | of scope you have to create a local copy of the container using the |
| 303 | 306 | ``copy()`` method: |
| 304 | 307 | |
| ... | ... | @@ -327,8 +330,8 @@ Here an example of how to use ``obsutils``: |
| 327 | 330 | >>> import ctools |
| 328 | 331 | >>> from ctools import obsutils |
| 329 | 332 | >>> pattern = obsutils.set_obs_patterns("four", ra=83.63, dec=22.01, offset=1.0) |
| 330 | - >>> obs = obsutils.set_obs_list(pattern, duration=1800, emin=0.1, emax=100.0, rad=5.0, caldb="dummy", irf="cta_dummy_irf") | |
| 331 | - >>> print(like.obs()) | |
| 333 | + >>> obs = obsutils.set_obs_list(pattern, duration=1800, emin=0.1, emax=100.0, rad=5.0, caldb="prod2", irf="South_50h") | |
| 334 | + >>> print(obs) | |
| 332 | 335 | === GObservations === |
| 333 | 336 | Number of observations ....: 4 |
| 334 | 337 | Number of predicted events : 0 |
| ... | ... | @@ -339,7 +342,7 @@ Here an example of how to use ``obsutils``: |
| 339 | 342 | >>> print(like.obs().models()) |
| 340 | 343 | === GModels === |
| 341 | 344 | Number of models ..........: 2 |
| 342 | - Number of parameters ......: 9 | |
| 345 | + Number of parameters ......: 10 | |
| 343 | 346 | ... |
| 344 | 347 | |
| 345 | 348 | The module is imported using the ``from ctools import obsutils`` directive. | ... | ... |
doc/source/user_manual/getting_started/quickstart.rst
| ... | ... | @@ -39,14 +39,14 @@ type :ref:`ctobssim` at the console prompt (which is denoted by ``$``). |
| 39 | 39 | RA of pointing (degrees) (0-360) [83.63] |
| 40 | 40 | Dec of pointing (degrees) (-90-90) [22.01] |
| 41 | 41 | Radius of FOV (degrees) (0-180) [5.0] |
| 42 | - Start time (MET in s) (0) [0.0] | |
| 43 | - End time (MET in s) (0) [1800.0] | |
| 44 | - Lower energy limit (TeV) (0) [0.1] | |
| 45 | - Upper energy limit (TeV) (0) [100.0] | |
| 46 | - Calibration database [dummy] | |
| 47 | - Instrument response function [cta_dummy_irf] | |
| 42 | + Start time (MET in s) [0.0] | |
| 43 | + End time (MET in s) [1800.0] | |
| 44 | + Lower energy limit (TeV) [0.1] | |
| 45 | + Upper energy limit (TeV) [100.0] | |
| 46 | + Calibration database [prod2] | |
| 47 | + Instrument response function [South_50h] | |
| 48 | 48 | Model [$CTOOLS/share/models/crab.xml] |
| 49 | - Output event data file or observation definition file [events.fits] | |
| 49 | + Output event data file or observation definition file [events.fits] | |
| 50 | 50 | |
| 51 | 51 | Each line represents a query for one parameter value. |
| 52 | 52 | 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 |
| 62 | 62 | been used in the path name of the model. ctools will automatically expand |
| 63 | 63 | the environment variables in parameter inputs. |
| 64 | 64 | |
| 65 | -The CTA instrument properties (effective area, PSF width) are taken for | |
| 66 | -the moment from a dummy calibration database. | |
| 65 | +The CTA instrument properties (effective area, PSF width) are taken from | |
| 66 | +the prod2 database. The response for the southern array using the cuts | |
| 67 | +optimised for 50 hours of observing time are used. | |
| 68 | + | |
| 69 | +.. note:: | |
| 70 | + | |
| 71 | + ctools comes bundled with CTA response functions for the northern and | |
| 72 | + the southern array. The response functions are based on a Prod2 | |
| 73 | + analysis with cuts optimised for 0.5 hours, 5 hours and 50 hours of | |
| 74 | + observing time. The following Instrument Response Functions | |
| 75 | + (IRFs) are available: ``North_0.5h``, ``North_5h``, ``North_50h``, | |
| 76 | + ``South_0.5h``, ``South_5h``, and ``South_50h``. | |
| 67 | 77 | |
| 68 | 78 | Events are simulated based on the instrument properties and based on a |
| 69 | 79 | 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 |
| 90 | 100 | <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="0"/> |
| 91 | 101 | </spatialModel> |
| 92 | 102 | </source> |
| 93 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 94 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 95 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 103 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 104 | + <spectrum type="PowerLaw"> | |
| 105 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 106 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 107 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 96 | 108 | </spectrum> |
| 97 | - <radialModel type="Gaussian"> | |
| 98 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 99 | - </radialModel> | |
| 100 | - </source> | |
| 109 | + </source> | |
| 101 | 110 | </source_library> |
| 102 | 111 | |
| 103 | 112 | 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 |
| 107 | 116 | and a spatial component (tags ``<spectrum>`` and ``<spatialModel>``, |
| 108 | 117 | respectively). The spectrum is modelled by a power law, which is defined by |
| 109 | 118 | three parameters: the ``Prefactor``, the ``Index`` and the ``Scale``. |
| 110 | -The spatial model has two parameters: Right Ascension in degrees (RA), and | |
| 111 | -Declination in degrees (DEC). Each parameter has a value and a scale factor, | |
| 119 | +The spatial model has two parameters: Right Ascension in degrees (``RA``), and | |
| 120 | +Declination in degrees (``DEC``). Each parameter has a value and a scale factor, | |
| 112 | 121 | the real value of the parameter being the product ``value * scale``. Typically, |
| 113 | -scale is chosen so that value is of the order of 1 (this is relevant for | |
| 114 | -model fitting). In addition, value is bound by a minimum (min) and | |
| 115 | -maximum (max) value, and a parameter may be free (``free="1"``) or fixed | |
| 116 | -(``free="0"``). The min, max, and free attributes are not relevant here for | |
| 117 | -the simulations, but they will be important for the model fitting later. | |
| 122 | +``scale`` is chosen so that ``value`` is of the order of 1 (this is relevant for | |
| 123 | +model fitting). In addition, ``value`` is bound by a minimum (``min``) and | |
| 124 | +maximum (``max``) value, and a parameter may be free (``free="1"``) or fixed | |
| 125 | +(``free="0"``). The ``min``, ``max``, and ``free`` attributes are not | |
| 126 | +relevant here for the simulations, but they will be important for the model | |
| 127 | +fitting later. | |
| 118 | 128 | |
| 119 | 129 | The spectral intensity I(E) (in units of photons/cm2/s/MeV) of the power |
| 120 | 130 | law is given by |
| ... | ... | @@ -128,19 +138,20 @@ where the parameters in the XML definition have the following mappings: |
| 128 | 138 | * :math:`\gamma` = ``Index`` |
| 129 | 139 | * :math:`E_0` = ``Scale`` |
| 130 | 140 | |
| 131 | -Note that energies are given in MeV. This is a GammaLib convention that | |
| 132 | -can not be modified. **So make sure you always use MeV as energy unit in | |
| 133 | -an XML file.** | |
| 141 | +.. warning:: | |
| 142 | + | |
| 143 | + Energies are given in the XML file in MeV units. This is a GammaLib | |
| 144 | + convention that can not be modified. **So make sure you always use | |
| 145 | + MeV as energy unit in an XML file.** | |
| 134 | 146 | |
| 135 | -The instrumental background of CTA is modelled by a factorized data model | |
| 136 | -that has a spectral and a radial component (tags ``<spectrum>`` and | |
| 137 | -``<radialModel>``, respectively). The spectral component describes the | |
| 138 | -on-axis background counting rate of CTA as function of energy in units of | |
| 139 | -counts/s/sr/MeV. The radial component describes the variation of the | |
| 140 | -background rate with offset angle squared, (i.e. square of the offset angle | |
| 141 | -with respect to the pointing direction) which is modelled here by a Gaussian. | |
| 142 | -The only parameter of the radial component is the width of the Gaussian Sigma, | |
| 143 | -which is here set to 3 degrees squared. | |
| 147 | +The instrumental background of CTA is modelled using the background | |
| 148 | +information provided in the IRF (``CTAIrfBackground``) multipled | |
| 149 | +by a power law. As it is defined here, the power law represents a | |
| 150 | +constant of 1, hence the background IRF will be used without any | |
| 151 | +modification. The power law will become active when fitting the data | |
| 152 | +later and allows a spectral adjustment of the background model that | |
| 153 | +may account for uncertainties in the background information provided | |
| 154 | +in the IRF. | |
| 144 | 155 | |
| 145 | 156 | :ref:`ctobssim` has a couple of hidden parameters, the most important one being |
| 146 | 157 | certainly ``seed``. ``seed`` is an integer that specifies the seed value |
| ... | ... | @@ -167,25 +178,25 @@ from this file are shown here: |
| 167 | 178 | |
| 168 | 179 | .. code-block:: xml |
| 169 | 180 | |
| 170 | - 2015-02-04T15:04:56: +======================+ | |
| 171 | - 2015-02-04T15:04:56: | Simulate observation | | |
| 172 | - 2015-02-04T15:04:56: +======================+ | |
| 173 | - 2015-02-04T15:04:56: === Observation === | |
| 174 | - 2015-02-04T15:04:56: Simulation area ...........: 1.9635e+11 cm2 | |
| 175 | - 2015-02-04T15:04:56: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=5.5 deg | |
| 176 | - 2015-02-04T15:04:56: Time interval .............: 0 - 1800 s | |
| 177 | - 2015-02-04T15:04:56: Photon energy range .......: 100 GeV - 100 TeV | |
| 178 | - 2015-02-04T15:04:56: Event energy range ........: 100 GeV - 100 TeV | |
| 179 | - 2015-02-04T15:04:56: MC source photons .........: 207547 [Crab] | |
| 180 | - 2015-02-04T15:04:56: MC source events ..........: 995 [Crab] | |
| 181 | - 2015-02-04T15:04:56: MC source events ..........: 995 (all source models) | |
| 182 | - 2015-02-04T15:04:56: MC background events ......: 5146 | |
| 183 | - 2015-02-04T15:04:56: MC events .................: 6141 (all models) | |
| 181 | + 2015-05-22T19:24:53: +======================+ | |
| 182 | + 2015-05-22T19:24:53: | Simulate observation | | |
| 183 | + 2015-05-22T19:24:53: +======================+ | |
| 184 | + 2015-05-22T19:24:53: === Observation === | |
| 185 | + 2015-05-22T19:24:53: Simulation area ...........: 1.9635e+11 cm2 | |
| 186 | + 2015-05-22T19:24:53: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=5.5 deg | |
| 187 | + 2015-05-22T19:24:53: Time interval .............: 0 - 1800 s | |
| 188 | + 2015-05-22T19:24:53: Photon energy range .......: 100 GeV - 100 TeV | |
| 189 | + 2015-05-22T19:24:53: Event energy range ........: 100 GeV - 100 TeV | |
| 190 | + 2015-05-22T19:24:53: MC source photons .........: 207547 [Crab] | |
| 191 | + 2015-05-22T19:24:53: MC source events ..........: 2961 [Crab] | |
| 192 | + 2015-05-22T19:24:53: MC source events ..........: 2961 (all source models) | |
| 193 | + 2015-05-22T19:24:55: MC background events ......: 13003 | |
| 194 | + 2015-05-22T19:24:55: MC events .................: 15964 (all models) | |
| 184 | 195 | |
| 185 | 196 | Each line starts with the UTC time at which the line has been written. In |
| 186 | 197 | this run, 207547 Crab photons have been thrown over an area of 19.6 square |
| 187 | -kilometres during a time interval of 1800 seconds. 995 of these photons have | |
| 188 | -been registered by CTA as events. In the same time interval, 5146 background | |
| 198 | +kilometres during a time interval of 1800 seconds. 2961 of these photons have | |
| 199 | +been registered by CTA as events. In the same time interval, 13003 background | |
| 189 | 200 | events have been registred by CTA. |
| 190 | 201 | |
| 191 | 202 | You may change the name of the log file using the hidden parameter |
| ... | ... | @@ -233,9 +244,9 @@ control). |
| 233 | 244 | |
| 234 | 245 | $ ctbin |
| 235 | 246 | Event list or observation definition file [events.fits] |
| 236 | - First coordinate of image center in degrees (RA or galactic l) [83.63] | |
| 237 | - Second coordinate of image center in degrees (DEC or galactic b) [22.01] | |
| 238 | - Projection method e.g. AIT|AZP|CAR|MER|STG|TAN (AIT|AZP|CAR|MER|STG|TAN) [CAR] | |
| 247 | + First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] | |
| 248 | + Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] | |
| 249 | + Projection method (AIT|AZP|CAR|MER|MOL|STG|TAN) [CAR] | |
| 239 | 250 | Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] |
| 240 | 251 | Image scale (in degrees/pixel) [0.02] |
| 241 | 252 | Size of the X axis in pixels [200] |
| ... | ... | @@ -244,7 +255,7 @@ control). |
| 244 | 255 | Start value for first energy bin in TeV [0.1] |
| 245 | 256 | Stop value for last energy bin in TeV [100.0] |
| 246 | 257 | Number of energy bins [20] |
| 247 | - Output counts cube [cntcube.fits] | |
| 258 | + Output counts cube [cntcube.fits] | |
| 248 | 259 | |
| 249 | 260 | The counts cube will be centred on the location of the Crab (Right Ascension |
| 250 | 261 | 83.63 degrees, Declination 22.01 degrees) and will be aligned in celestial |
| ... | ... | @@ -285,41 +296,18 @@ reproduced below: |
| 285 | 296 | |
| 286 | 297 | .. code-block:: xml |
| 287 | 298 | |
| 288 | - 2015-02-04T15:33:34: +====================+ | |
| 289 | - 2015-02-04T15:33:34: | Binned observation | | |
| 290 | - 2015-02-04T15:33:34: +====================+ | |
| 291 | - 2015-02-04T15:33:34: === GObservations === | |
| 292 | - 2015-02-04T15:33:34: Number of observations ....: 1 | |
| 293 | - 2015-02-04T15:33:34: Number of predicted events : 0 | |
| 294 | - 2015-02-04T15:33:34: === GCTAObservation === | |
| 295 | - 2015-02-04T15:33:34: Name ......................: | |
| 296 | - 2015-02-04T15:33:34: Identifier ................: | |
| 297 | - 2015-02-04T15:33:34: Instrument ................: CTA | |
| 298 | - 2015-02-04T15:33:34: Event file ................: | |
| 299 | - 2015-02-04T15:33:34: Event type ................: CountsCube | |
| 300 | - 2015-02-04T15:33:34: Statistics ................: Poisson | |
| 301 | - 2015-02-04T15:33:34: Ontime ....................: 1800 s | |
| 302 | - 2015-02-04T15:33:34: Livetime ..................: 1710 s | |
| 303 | - 2015-02-04T15:33:34: Deadtime correction .......: 0.95 | |
| 304 | - 2015-02-04T15:33:34: User energy range .........: undefined | |
| 305 | - 2015-02-04T15:33:34: === GCTAPointing === | |
| 306 | - 2015-02-04T15:33:34: Pointing direction ........: (RA,Dec)=(83.63,22.01) | |
| 307 | - 2015-02-04T15:33:34: Response function .........: undefined | |
| 308 | - 2015-02-04T15:33:34: === GCTAEventCube === | |
| 309 | - 2015-02-04T15:33:34: Number of events ..........: 5542 | |
| 310 | - 2015-02-04T15:33:34: Number of elements ........: 800000 | |
| 311 | - 2015-02-04T15:33:34: Number of pixels ..........: 40000 | |
| 312 | - 2015-02-04T15:33:34: Number of energy bins .....: 20 | |
| 313 | - 2015-02-04T15:33:34: Time interval .............: 0 - 1800 sec | |
| 314 | - 2015-02-04T15:33:34: | |
| 315 | - 2015-02-04T15:33:34: +==================+ | |
| 316 | - 2015-02-04T15:33:34: | Save observation | | |
| 317 | - 2015-02-04T15:33:34: +==================+ | |
| 318 | - 2015-02-04T15:33:34: | |
| 319 | - 2015-02-04T15:33:34: Application "ctbin" terminated after 14 wall clock seconds, consuming 0.332675 seconds of CPU time. | |
| 320 | - | |
| 321 | -From the 6141 events that have been simulated and stored in the | |
| 322 | -``events.fits`` file, 5542 lie within the cube boundaries and are thus put | |
| 299 | + 2015-05-22T19:40:30: +=================+ | |
| 300 | + 2015-05-22T19:40:30: | Bin observation | | |
| 301 | + 2015-05-22T19:40:30: +=================+ | |
| 302 | + 2015-05-22T19:40:30: === Observation === | |
| 303 | + 2015-05-22T19:40:30: Events in list ............: 15964 | |
| 304 | + 2015-05-22T19:40:30: Events in cube ............: 13360 | |
| 305 | + 2015-05-22T19:40:30: Event bins outside RoI ....: 0 | |
| 306 | + 2015-05-22T19:40:30: Events outside cube area ..: 2604 | |
| 307 | + 2015-05-22T19:40:30: Events outside energy bins : 0 | |
| 308 | + | |
| 309 | +From the 15964 events that have been simulated and stored in the | |
| 310 | +``events.fits`` file, 13360 lie within the cube boundaries and are thus put | |
| 323 | 311 | into the resulting counts cube. The counts cube is stored in a cartesian |
| 324 | 312 | projection in a World Coordinate System (WCS) compliant format. |
| 325 | 313 | |
| ... | ... | @@ -340,12 +328,13 @@ and we do the fit by typing: |
| 340 | 328 | Event list, counts cube or observation definition file [events.fits] cntcube.fits |
| 341 | 329 | Exposure cube file (only needed for stacked analysis) [NONE] |
| 342 | 330 | PSF cube file (only needed for stacked analysis) [NONE] |
| 343 | - Calibration database [dummy] | |
| 344 | - Instrument response function [cta_dummy_irf] | |
| 331 | + Background cube file (only needed for stacked analysis) [NONE] | |
| 332 | + Calibration database [prod2] | |
| 333 | + Instrument response function [South_50h] | |
| 345 | 334 | Source model [$CTOOLS/share/models/crab.xml] |
| 346 | 335 | Source model output file [crab_results.xml] |
| 347 | 336 | |
| 348 | -Fitting of the data is done in *binned* mode, which means that the events | |
| 337 | +The data are fitted in *binned* mode, which means that the events | |
| 349 | 338 | have been binned into a counts cube and the fit computes the log-likelihood |
| 350 | 339 | function by summing over all 200 x 200 x 20 bins of the counts cube. There is |
| 351 | 340 | 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 |
| 356 | 345 | (we specified ``crab_results.xml`` in the example), and this file will be |
| 357 | 346 | a copy of the source model input XML file where the parameter values have |
| 358 | 347 | been replaced by the fit results. In addition, the statistical uncertainties |
| 359 | -are added for each fitted parameter using the attribute error. Below we show | |
| 360 | -the XML result file that has been produced by the run: | |
| 348 | +are added for each fitted parameter using the attribute ``error``. | |
| 349 | +Below we show the XML result file that has been produced by the run: | |
| 361 | 350 | |
| 362 | 351 | .. code-block:: xml |
| 363 | 352 | |
| ... | ... | @@ -365,8 +354,8 @@ the XML result file that has been produced by the run: |
| 365 | 354 | <source_library title="source library"> |
| 366 | 355 | <source name="Crab" type="PointSource"> |
| 367 | 356 | <spectrum type="PowerLaw"> |
| 368 | - <parameter name="Prefactor" value="6.07928" error="0.204582" scale="1e-16" min="1e-07" max="1000" free="1" /> | |
| 369 | - <parameter name="Index" value="2.5009" error="0.0252057" scale="-1" min="0" max="5" free="1" /> | |
| 357 | + <parameter name="Prefactor" value="5.78197" error="0.110889" scale="1e-16" min="1e-07" max="1000" free="1" /> | |
| 358 | + <parameter name="Index" value="2.49174" error="0.0164369" scale="-1" min="0" max="5" free="1" /> | |
| 370 | 359 | <parameter name="Scale" value="0.3" scale="1e+06" min="0.01" max="1000" free="0" /> |
| 371 | 360 | </spectrum> |
| 372 | 361 | <spatialModel type="SkyDirFunction"> |
| ... | ... | @@ -374,20 +363,31 @@ the XML result file that has been produced by the run: |
| 374 | 363 | <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" /> |
| 375 | 364 | </spatialModel> |
| 376 | 365 | </source> |
| 377 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 378 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 379 | - <parameter name="Normalization" value="0.990708" error="0.0192887" scale="1" min="0" max="1000" free="1" /> | |
| 366 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 367 | + <spectrum type="PowerLaw"> | |
| 368 | + <parameter name="Prefactor" value="1.02048" error="0.0280684" scale="1" min="0.001" max="1000" free="1" /> | |
| 369 | + <parameter name="Index" value="0.0197856" error="0.0156686" scale="1" min="-5" max="5" free="1" /> | |
| 370 | + <parameter name="Scale" value="1" scale="1e+06" min="0.01" max="1000" free="0" /> | |
| 380 | 371 | </spectrum> |
| 381 | - <radialModel type="Gaussian"> | |
| 382 | - <parameter name="Sigma" value="3.02523" error="0.0594117" scale="1" min="0.01" max="10" free="1" /> | |
| 383 | - </radialModel> | |
| 384 | 372 | </source> |
| 385 | 373 | </source_library> |
| 386 | 374 | |
| 387 | 375 | In this example, the ``Prefactor`` and ``Index`` of the spectral model for the |
| 388 | -Crab as well as the ``Normalization`` and ``Sigma`` parameter of the radial | |
| 389 | -acceptance model have been fitted (all parameters having the attribute | |
| 390 | -``free="1"`` are fitted). | |
| 376 | +Crab as well as the ``Prefactor`` and ``Index`` of the background spectral | |
| 377 | +model have been fitted (all parameters having the attribute ``free="1"`` are | |
| 378 | +fitted). Now we see also the effect of having multiplied the background | |
| 379 | +model with a power law. In that way, the amplitude of the background as | |
| 380 | +well as it's spectral slope is adjusted by the fit. Obviously, in this | |
| 381 | +example the adjustment compensates only for the statistical fluctuations | |
| 382 | +of the background, but with real data, the adjustment may account also for | |
| 383 | +some of the systematic uncertainties. | |
| 384 | + | |
| 385 | +.. warning:: | |
| 386 | + | |
| 387 | + As good practice, the amplitude of the background model should always be | |
| 388 | + left as a free parameter of the fit. Otherwise, any uncertainty in the | |
| 389 | + background rate will immediately propagate into the flux estimate of the | |
| 390 | + source. | |
| 391 | 391 | |
| 392 | 392 | To get more details about the model fitting you can inspect the log file. |
| 393 | 393 | Below the last lines of the ctlike.log log file that has been produced by |
| ... | ... | @@ -395,70 +395,63 @@ this run: |
| 395 | 395 | |
| 396 | 396 | .. code-block:: xml |
| 397 | 397 | |
| 398 | - 2015-02-04T15:50:43: +=================================+ | |
| 399 | - 2015-02-04T15:50:43: | Maximum likelihood optimisation | | |
| 400 | - 2015-02-04T15:50:43: +=================================+ | |
| 401 | - 2015-02-04T15:50:44: >Iteration 0: -logL=22752.553, Lambda=1.0e-03 | |
| 402 | - 2015-02-04T15:50:46: >Iteration 1: -logL=22750.640, Lambda=1.0e-03, delta=1.913, max(|grad|)=-0.941594 [Index:3] | |
| 403 | - 2015-02-04T15:50:47: >Iteration 2: -logL=22750.632, Lambda=1.0e-04, delta=0.008, max(|grad|)=-0.079270 [Index:3] | |
| 404 | - 2015-02-04T15:50:48: >Iteration 3: -logL=22750.632, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003073 [Index:3] | |
| 405 | - 2015-02-04T15:50:49: | |
| 406 | - 2015-02-04T15:50:49: +=========================================+ | |
| 407 | - 2015-02-04T15:50:49: | Maximum likelihood optimization results | | |
| 408 | - 2015-02-04T15:50:49: +=========================================+ | |
| 409 | - 2015-02-04T15:50:49: === GOptimizerLM === | |
| 410 | - 2015-02-04T15:50:49: Optimized function value ..: 22750.632 | |
| 411 | - 2015-02-04T15:50:49: Absolute precision ........: 0.005 | |
| 412 | - 2015-02-04T15:50:49: Acceptable value decrease .: 2 | |
| 413 | - 2015-02-04T15:50:49: Optimization status .......: converged | |
| 414 | - 2015-02-04T15:50:49: Number of parameters ......: 9 | |
| 415 | - 2015-02-04T15:50:49: Number of free parameters .: 4 | |
| 416 | - 2015-02-04T15:50:49: Number of iterations ......: 3 | |
| 417 | - 2015-02-04T15:50:49: Lambda ....................: 1e-06 | |
| 418 | - 2015-02-04T15:50:49: Maximum log likelihood ....: -22750.632 | |
| 419 | - 2015-02-04T15:50:49: Observed events (Nobs) ...: 5542.000 | |
| 420 | - 2015-02-04T15:50:49: Predicted events (Npred) ..: 5542.000 (Nobs - Npred = 3.3498e-06) | |
| 421 | - 2015-02-04T15:50:49: === GModels === | |
| 422 | - 2015-02-04T15:50:49: Number of models ..........: 2 | |
| 423 | - 2015-02-04T15:50:49: Number of parameters ......: 9 | |
| 424 | - 2015-02-04T15:50:49: === GModelSky === | |
| 425 | - 2015-02-04T15:50:49: Name ......................: Crab | |
| 426 | - 2015-02-04T15:50:49: Instruments ...............: all | |
| 427 | - 2015-02-04T15:50:49: Instrument scale factors ..: unity | |
| 428 | - 2015-02-04T15:50:49: Observation identifiers ...: all | |
| 429 | - 2015-02-04T15:50:49: Model type ................: PointSource | |
| 430 | - 2015-02-04T15:50:49: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 431 | - 2015-02-04T15:50:49: Number of parameters ......: 6 | |
| 432 | - 2015-02-04T15:50:49: Number of spatial par's ...: 2 | |
| 433 | - 2015-02-04T15:50:49: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 434 | - 2015-02-04T15:50:49: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 435 | - 2015-02-04T15:50:49: Number of spectral par's ..: 3 | |
| 436 | - 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) | |
| 437 | - 2015-02-04T15:50:49: Index ....................: -2.5009 +/- 0.0252057 [-0,-5] (free,scale=-1,gradient) | |
| 438 | - 2015-02-04T15:50:49: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 439 | - 2015-02-04T15:50:49: Number of temporal par's ..: 1 | |
| 440 | - 2015-02-04T15:50:49: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 441 | - 2015-02-04T15:50:49: === GCTAModelRadialAcceptance === | |
| 442 | - 2015-02-04T15:50:49: Name ......................: Background | |
| 443 | - 2015-02-04T15:50:49: Instruments ...............: CTA | |
| 444 | - 2015-02-04T15:50:49: Instrument scale factors ..: unity | |
| 445 | - 2015-02-04T15:50:49: Observation identifiers ...: all | |
| 446 | - 2015-02-04T15:50:49: Model type ................: "Gaussian" * "FileFunction" * "Constant" | |
| 447 | - 2015-02-04T15:50:49: Number of parameters ......: 3 | |
| 448 | - 2015-02-04T15:50:49: Number of radial par's ....: 1 | |
| 449 | - 2015-02-04T15:50:49: Sigma ....................: 3.02523 +/- 0.0594117 [0.01,10] deg2 (free,scale=1,gradient) | |
| 450 | - 2015-02-04T15:50:49: Number of spectral par's ..: 1 | |
| 451 | - 2015-02-04T15:50:49: Normalization ............: 0.990708 +/- 0.0192887 [0,1000] (free,scale=1,gradient) | |
| 452 | - 2015-02-04T15:50:49: Number of temporal par's ..: 1 | |
| 453 | - 2015-02-04T15:50:49: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 454 | - 2015-02-04T15:50:49: | |
| 455 | - 2015-02-04T15:50:49: +==============+ | |
| 456 | - 2015-02-04T15:50:49: | Save results | | |
| 457 | - 2015-02-04T15:50:49: +==============+ | |
| 458 | - 2015-02-04T15:50:49: | |
| 459 | - 2015-02-04T15:50:49: Application "ctlike" terminated after 15 wall clock seconds, consuming 5.92686 seconds of CPU time. | |
| 460 | - | |
| 461 | -The maximum likelihood optimizer required 3 iterations to converge. This | |
| 398 | + 2015-05-22T19:45:15: +=================================+ | |
| 399 | + 2015-05-22T19:45:15: | Maximum likelihood optimisation | | |
| 400 | + 2015-05-22T19:45:15: +=================================+ | |
| 401 | + 2015-05-22T19:45:16: >Iteration 0: -logL=39910.748, Lambda=1.0e-03 | |
| 402 | + 2015-05-22T19:45:18: >Iteration 1: -logL=39908.788, Lambda=1.0e-03, delta=1.960, max(|grad|)=6.701856 [Index:7] | |
| 403 | + 2015-05-22T19:45:19: >Iteration 2: -logL=39908.787, Lambda=1.0e-04, delta=0.001, max(|grad|)=-0.057041 [Index:3] | |
| 404 | + 2015-05-22T19:45:21: | |
| 405 | + 2015-05-22T19:45:21: +=========================================+ | |
| 406 | + 2015-05-22T19:45:21: | Maximum likelihood optimization results | | |
| 407 | + 2015-05-22T19:45:21: +=========================================+ | |
| 408 | + 2015-05-22T19:45:21: === GOptimizerLM === | |
| 409 | + 2015-05-22T19:45:21: Optimized function value ..: 39908.787 | |
| 410 | + 2015-05-22T19:45:21: Absolute precision ........: 0.005 | |
| 411 | + 2015-05-22T19:45:21: Acceptable value decrease .: 2 | |
| 412 | + 2015-05-22T19:45:21: Optimization status .......: converged | |
| 413 | + 2015-05-22T19:45:21: Number of parameters ......: 10 | |
| 414 | + 2015-05-22T19:45:21: Number of free parameters .: 4 | |
| 415 | + 2015-05-22T19:45:21: Number of iterations ......: 2 | |
| 416 | + 2015-05-22T19:45:21: Lambda ....................: 1e-05 | |
| 417 | + 2015-05-22T19:45:21: Maximum log likelihood ....: -39908.787 | |
| 418 | + 2015-05-22T19:45:21: Observed events (Nobs) ...: 13360.000 | |
| 419 | + 2015-05-22T19:45:21: Predicted events (Npred) ..: 13359.998 (Nobs - Npred = 0.00180799) | |
| 420 | + 2015-05-22T19:45:21: === GModels === | |
| 421 | + 2015-05-22T19:45:21: Number of models ..........: 2 | |
| 422 | + 2015-05-22T19:45:21: Number of parameters ......: 10 | |
| 423 | + 2015-05-22T19:45:21: === GModelSky === | |
| 424 | + 2015-05-22T19:45:21: Name ......................: Crab | |
| 425 | + 2015-05-22T19:45:21: Instruments ...............: all | |
| 426 | + 2015-05-22T19:45:21: Instrument scale factors ..: unity | |
| 427 | + 2015-05-22T19:45:21: Observation identifiers ...: all | |
| 428 | + 2015-05-22T19:45:21: Model type ................: PointSource | |
| 429 | + 2015-05-22T19:45:21: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 430 | + 2015-05-22T19:45:21: Number of parameters ......: 6 | |
| 431 | + 2015-05-22T19:45:21: Number of spatial par's ...: 2 | |
| 432 | + 2015-05-22T19:45:21: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 433 | + 2015-05-22T19:45:21: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 434 | + 2015-05-22T19:45:21: Number of spectral par's ..: 3 | |
| 435 | + 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) | |
| 436 | + 2015-05-22T19:45:21: Index ....................: -2.49174 +/- 0.0164369 [-0,-5] (free,scale=-1,gradient) | |
| 437 | + 2015-05-22T19:45:21: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 438 | + 2015-05-22T19:45:21: Number of temporal par's ..: 1 | |
| 439 | + 2015-05-22T19:45:21: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 440 | + 2015-05-22T19:45:21: === GCTAModelIrfBackground === | |
| 441 | + 2015-05-22T19:45:21: Name ......................: CTABackgroundModel | |
| 442 | + 2015-05-22T19:45:21: Instruments ...............: CTA | |
| 443 | + 2015-05-22T19:45:21: Instrument scale factors ..: unity | |
| 444 | + 2015-05-22T19:45:21: Observation identifiers ...: all | |
| 445 | + 2015-05-22T19:45:21: Model type ................: "PowerLaw" * "Constant" | |
| 446 | + 2015-05-22T19:45:21: Number of parameters ......: 4 | |
| 447 | + 2015-05-22T19:45:21: Number of spectral par's ..: 3 | |
| 448 | + 2015-05-22T19:45:21: Prefactor ................: 1.02048 +/- 0.0280684 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) | |
| 449 | + 2015-05-22T19:45:21: Index ....................: 0.0197856 +/- 0.0156686 [-5,5] (free,scale=1,gradient) | |
| 450 | + 2015-05-22T19:45:21: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 451 | + 2015-05-22T19:45:21: Number of temporal par's ..: 1 | |
| 452 | + 2015-05-22T19:45:21: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 453 | + | |
| 454 | +The maximum likelihood optimizer required 2 iterations to converge. This | |
| 462 | 455 | is pretty fast, but recall that we used the same model file for the simulation |
| 463 | 456 | and for fitting, hence the initial parameter values were already very close |
| 464 | 457 | 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 |
| 466 | 459 | XML file where you change the value attributes of the parameters that should be |
| 467 | 460 | fitted. You will see that the optimizer requires a couple of more iterations, |
| 468 | 461 | but it should converge to the same solution (provided that the initial values |
| 469 | -are not too far of the best fitting values). | |
| 462 | +are not too far from the best fitting values). | |
| 470 | 463 | |
| 471 | 464 | .. note:: |
| 472 | 465 | |
| ... | ... | @@ -502,17 +495,17 @@ are not too far of the best fitting values). |
| 502 | 495 | |
| 503 | 496 | .. code-block:: xml |
| 504 | 497 | |
| 505 | - 2015-02-05T08:29:07: === GModelSky === | |
| 506 | - 2015-02-05T08:29:07: Name ......................: Crab | |
| 507 | - 2015-02-05T08:29:07: Instruments ...............: all | |
| 508 | - 2015-02-05T08:29:07: Test Statistic ............: 6875.35 | |
| 498 | + 2015-05-22T19:58:43: === GModelSky === | |
| 499 | + 2015-05-22T19:58:43: Name ......................: Crab | |
| 500 | + 2015-05-22T19:58:43: Instruments ...............: all | |
| 501 | + 2015-05-22T19:58:43: Test Statistic ............: 18662.6 | |
| 509 | 502 | |
| 510 | 503 | The Test Statistic value will also be added as new attribute |
| 511 | 504 | ``ts`` to the XML result file: |
| 512 | 505 | |
| 513 | 506 | .. code-block:: xml |
| 514 | 507 | |
| 515 | - <source name="Crab" type="PointSource" ts="6875.350" tscalc="1"> | |
| 508 | + <source name="Crab" type="PointSource" ts="18662.576" tscalc="1"> | |
| 516 | 509 | |
| 517 | 510 | |
| 518 | 511 | .. _sec_unbinned_cta: |
| ... | ... | @@ -521,8 +514,8 @@ Doing an unbinned analysis |
| 521 | 514 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 522 | 515 | |
| 523 | 516 | As gamma-ray events are rare, the counts cubes generated by :ref:`ctbin` |
| 524 | -will in general be sparse, having many empty pixels, in particular at | |
| 525 | -high energies. | |
| 517 | +will in general be sparsly populated, having many empty pixels, in | |
| 518 | +particular at high energies. | |
| 526 | 519 | An alternative analysis technique consists of working directly on the event |
| 527 | 520 | list without binning the events in a counts cube. We will see the benefit of |
| 528 | 521 | such an analysis later once you re-run :ref:`ctlike` in unbinned mode. |
| ... | ... | @@ -553,10 +546,10 @@ following example shows how to run ctselect: |
| 553 | 546 | RA for ROI centre (degrees) (0-360) [83.63] |
| 554 | 547 | Dec for ROI centre (degrees) (-90-90) [22.01] |
| 555 | 548 | Radius of ROI (degrees) (0-180) [3.0] |
| 556 | - Start time (CTA MET in seconds) (0) [0.0] | |
| 557 | - End time (CTA MET in seconds) (0) [0.0] | |
| 558 | - Lower energy limit (TeV) (0) [0.1] | |
| 559 | - Upper energy limit (TeV) (0) [100.0] | |
| 549 | + Start time (CTA MET in seconds) [0.0] | |
| 550 | + End time (CTA MET in seconds) [0.0] | |
| 551 | + Lower energy limit (TeV) [0.1] | |
| 552 | + Upper energy limit (TeV) [100.0] | |
| 560 | 553 | Output event list or observation definition file [selected_events.fits] |
| 561 | 554 | |
| 562 | 555 | :ref:`ctselect` takes the input event list ``events.fits``, performs an |
| ... | ... | @@ -585,16 +578,16 @@ part: |
| 585 | 578 | |
| 586 | 579 | .. code-block:: xml |
| 587 | 580 | |
| 588 | - 2015-02-04T17:21:41: +=================+ | |
| 589 | - 2015-02-04T17:21:41: | Event selection | | |
| 590 | - 2015-02-04T17:21:41: +=================+ | |
| 591 | - 2015-02-04T17:21:41: === Observation === | |
| 592 | - 2015-02-04T17:21:41: Selected energy range .....: 0.1 - 100 TeV | |
| 593 | - 2015-02-04T17:21:41: Requested ROI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg | |
| 594 | - 2015-02-04T17:21:41: ROI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg | |
| 595 | - 2015-02-04T17:21:41: Selected ROI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg | |
| 596 | - 2015-02-04T17:21:41: cfitsio selection .........: ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000 | |
| 597 | - 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] | |
| 581 | + 2015-05-22T20:01:46: +=================+ | |
| 582 | + 2015-05-22T20:01:46: | Event selection | | |
| 583 | + 2015-05-22T20:01:46: +=================+ | |
| 584 | + 2015-05-22T20:01:46: === Observation === | |
| 585 | + 2015-05-22T20:01:47: Selected energy range .....: 0.1 - 100 TeV | |
| 586 | + 2015-05-22T20:01:47: Requested ROI .............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg | |
| 587 | + 2015-05-22T20:01:47: ROI of data ...............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=5 deg | |
| 588 | + 2015-05-22T20:01:47: Selected ROI ..............: Centre(RA,DEC)=(83.63, 22.01) deg, Radius=3 deg | |
| 589 | + 2015-05-22T20:01:47: cfitsio selection .........: ENERGY >= 0.10000000 && ENERGY <= 100.00000000 && ANGSEP(83.630000,22.010000,RA,DEC) <= 3.000000 | |
| 590 | + 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] | |
| 598 | 591 | |
| 599 | 592 | .. note:: |
| 600 | 593 | |
| ... | ... | @@ -608,10 +601,10 @@ part: |
| 608 | 601 | :ref:`ctselect` will automatically adjust |
| 609 | 602 | the selection parameters to guarantee full enclosure. To keep track of |
| 610 | 603 | this adjustment, the :ref:`ctselect` log file quotes the requested |
| 611 | - selection, and existing selections, and the selection that was finally | |
| 604 | + selection, any existing selections, and the selection that was finally | |
| 612 | 605 | applied. |
| 613 | 606 | |
| 614 | -.. note:: | |
| 607 | +.. warning:: | |
| 615 | 608 | |
| 616 | 609 | :ref:`ctselect` may of course also be used for event selection prior to |
| 617 | 610 | binned analysis, for example to select events for a given period in |
| ... | ... | @@ -627,24 +620,25 @@ instead of the counts cube: |
| 627 | 620 | |
| 628 | 621 | .. code-block:: bash |
| 629 | 622 | |
| 630 | - $ ctlike | |
| 631 | - Event list, counts cube or observation definition file [cntmap.fits] selected_events.fits | |
| 632 | - Calibration database [dummy] | |
| 633 | - Instrument response function [cta_dummy_irf] | |
| 634 | - Source model [$CTOOLS/share/models/crab.xml] | |
| 635 | - Source model output file [crab_results.xml] | |
| 623 | + $ ctlike | |
| 624 | + Event list, counts cube or observation definition file [cntcube.fits] selected_events.fits | |
| 625 | + Calibration database [prod2] | |
| 626 | + Instrument response function [South_50h] | |
| 627 | + Source model [$CTOOLS/share/models/crab.xml] | |
| 628 | + Source model output file [crab_results.xml] | |
| 636 | 629 | |
| 637 | 630 | You will recognise that :ref:`ctlike` runs much faster in unbinned mode |
| 638 | 631 | compared to binned mode. |
| 639 | 632 | This is understandable as the selected event list contains |
| 640 | -only 6127 events, while the binned counts cube we used before had | |
| 633 | +only 15312 events, while the binned counts cube we used before had | |
| 641 | 634 | 200 x 200 x 20 = 800000 pixels. As unbinned maximum likelihood fitting loops |
| 642 | 635 | over the events (while binned maximum likelihood loops over the pixels), |
| 643 | 636 | there are much less operations to perform in unbinned than in binned mode |
| 644 | 637 | (there is some additional overhead in unbinned mode that comes from |
| 645 | 638 | integrating the models over the region of interest, yet this is negligible |
| 646 | -compared to the operations needed when looping over the pixels). So as long | |
| 647 | -as you work with short event lists, unbinned mode is faster. | |
| 639 | +compared to the operations needed when looping over all pixels). So as long | |
| 640 | +as you work with small event lists, unbinned mode is faster (this | |
| 641 | +typically holds up to 100 hours of observing time). | |
| 648 | 642 | Unbinned :ref:`ctlike` should also be more precise as no binning is performed, |
| 649 | 643 | hence there is no loss of information due to histogramming. |
| 650 | 644 | |
| ... | ... | @@ -658,68 +652,62 @@ the same events for both analyses. |
| 658 | 652 | |
| 659 | 653 | .. code-block:: xml |
| 660 | 654 | |
| 661 | - 2015-02-04T17:31:58: +=================================+ | |
| 662 | - 2015-02-04T17:31:58: | Maximum likelihood optimisation | | |
| 663 | - 2015-02-04T17:31:58: +=================================+ | |
| 664 | - 2015-02-04T17:31:58: >Iteration 0: -logL=44395.244, Lambda=1.0e-03 | |
| 665 | - 2015-02-04T17:31:58: Iteration 1: -logL=44396.223, Lambda=1.0e-03, delta=-0.979, max(|grad|)=9.644743 [Sigma:6] (stalled) | |
| 666 | - 2015-02-04T17:31:58: >Iteration 2: -logL=44396.162, Lambda=1.0e-02, delta=0.061, max(|grad|)=-0.309683 [Normalization:7] | |
| 667 | - 2015-02-04T17:31:59: >Iteration 3: -logL=44396.162, Lambda=1.0e-03, delta=0.000, max(|grad|)=-0.008931 [Index:3] | |
| 668 | - 2015-02-04T17:31:59: | |
| 669 | - 2015-02-04T17:31:59: +=========================================+ | |
| 670 | - 2015-02-04T17:31:59: | Maximum likelihood optimization results | | |
| 671 | - 2015-02-04T17:31:59: +=========================================+ | |
| 672 | - 2015-02-04T17:31:59: === GOptimizerLM === | |
| 673 | - 2015-02-04T17:31:59: Optimized function value ..: 44396.162 | |
| 674 | - 2015-02-04T17:31:59: Absolute precision ........: 0.005 | |
| 675 | - 2015-02-04T17:31:59: Acceptable value decrease .: 2 | |
| 676 | - 2015-02-04T17:31:59: Optimization status .......: converged | |
| 677 | - 2015-02-04T17:31:59: Number of parameters ......: 9 | |
| 678 | - 2015-02-04T17:31:59: Number of free parameters .: 4 | |
| 679 | - 2015-02-04T17:31:59: Number of iterations ......: 3 | |
| 680 | - 2015-02-04T17:31:59: Lambda ....................: 0.0001 | |
| 681 | - 2015-02-04T17:31:59: Maximum log likelihood ....: -44396.162 | |
| 682 | - 2015-02-04T17:31:59: Observed events (Nobs) ...: 6127.000 | |
| 683 | - 2015-02-04T17:31:59: Predicted events (Npred) ..: 6127.000 (Nobs - Npred = 0.000303534) | |
| 684 | - 2015-02-04T17:31:59: === GModels === | |
| 685 | - 2015-02-04T17:31:59: Number of models ..........: 2 | |
| 686 | - 2015-02-04T17:31:59: Number of parameters ......: 9 | |
| 687 | - 2015-02-04T17:31:59: === GModelSky === | |
| 688 | - 2015-02-04T17:31:59: Name ......................: Crab | |
| 689 | - 2015-02-04T17:31:59: Instruments ...............: all | |
| 690 | - 2015-02-04T17:31:59: Instrument scale factors ..: unity | |
| 691 | - 2015-02-04T17:31:59: Observation identifiers ...: all | |
| 692 | - 2015-02-04T17:31:59: Model type ................: PointSource | |
| 693 | - 2015-02-04T17:31:59: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 694 | - 2015-02-04T17:31:59: Number of parameters ......: 6 | |
| 695 | - 2015-02-04T17:31:59: Number of spatial par's ...: 2 | |
| 696 | - 2015-02-04T17:31:59: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 697 | - 2015-02-04T17:31:59: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 698 | - 2015-02-04T17:31:59: Number of spectral par's ..: 3 | |
| 699 | - 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) | |
| 700 | - 2015-02-04T17:31:59: Index ....................: -2.5057 +/- 0.0250818 [-0,-5] (free,scale=-1,gradient) | |
| 701 | - 2015-02-04T17:31:59: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 702 | - 2015-02-04T17:31:59: Number of temporal par's ..: 1 | |
| 703 | - 2015-02-04T17:31:59: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 704 | - 2015-02-04T17:31:59: === GCTAModelRadialAcceptance === | |
| 705 | - 2015-02-04T17:31:59: Name ......................: Background | |
| 706 | - 2015-02-04T17:31:59: Instruments ...............: CTA | |
| 707 | - 2015-02-04T17:31:59: Instrument scale factors ..: unity | |
| 708 | - 2015-02-04T17:31:59: Observation identifiers ...: all | |
| 709 | - 2015-02-04T17:31:59: Model type ................: "Gaussian" * "FileFunction" * "Constant" | |
| 710 | - 2015-02-04T17:31:59: Number of parameters ......: 3 | |
| 711 | - 2015-02-04T17:31:59: Number of radial par's ....: 1 | |
| 712 | - 2015-02-04T17:31:59: Sigma ....................: 3.04429 +/- 0.0330227 [0.01,10] deg2 (free,scale=1,gradient) | |
| 713 | - 2015-02-04T17:31:59: Number of spectral par's ..: 1 | |
| 714 | - 2015-02-04T17:31:59: Normalization ............: 0.996767 +/- 0.0175227 [0,1000] (free,scale=1,gradient) | |
| 715 | - 2015-02-04T17:31:59: Number of temporal par's ..: 1 | |
| 716 | - 2015-02-04T17:31:59: Constant .................: 1 (relative value) (fixed,scale=1,gradient) | |
| 717 | - 2015-02-04T17:31:59: | |
| 718 | - 2015-02-04T17:31:59: +==============+ | |
| 719 | - 2015-02-04T17:31:59: | Save results | | |
| 720 | - 2015-02-04T17:31:59: +==============+ | |
| 721 | - 2015-02-04T17:31:59: | |
| 722 | - 2015-02-04T17:31:59: Application "ctlike" terminated after 8 wall clock seconds, consuming 0.21275 seconds of CPU time. | |
| 655 | + 2015-05-22T20:05:54: +=================================+ | |
| 656 | + 2015-05-22T20:05:54: | Maximum likelihood optimisation | | |
| 657 | + 2015-05-22T20:05:54: +=================================+ | |
| 658 | + 2015-05-22T20:05:54: >Iteration 0: -logL=93854.543, Lambda=1.0e-03 | |
| 659 | + 2015-05-22T20:05:54: >Iteration 1: -logL=93848.595, Lambda=1.0e-03, delta=5.948, max(|grad|)=22.480581 [Index:7] | |
| 660 | + 2015-05-22T20:05:54: >Iteration 2: -logL=93848.587, Lambda=1.0e-04, delta=0.008, max(|grad|)=-0.081846 [Index:3] | |
| 661 | + 2015-05-22T20:05:54: >Iteration 3: -logL=93848.587, Lambda=1.0e-05, delta=0.000, max(|grad|)=-0.003485 [Index:3] | |
| 662 | + 2015-05-22T20:05:54: | |
| 663 | + 2015-05-22T20:05:54: +=========================================+ | |
| 664 | + 2015-05-22T20:05:54: | Maximum likelihood optimization results | | |
| 665 | + 2015-05-22T20:05:54: +=========================================+ | |
| 666 | + 2015-05-22T20:05:54: === GOptimizerLM === | |
| 667 | + 2015-05-22T20:05:54: Optimized function value ..: 93848.587 | |
| 668 | + 2015-05-22T20:05:54: Absolute precision ........: 0.005 | |
| 669 | + 2015-05-22T20:05:54: Acceptable value decrease .: 2 | |
| 670 | + 2015-05-22T20:05:54: Optimization status .......: converged | |
| 671 | + 2015-05-22T20:05:54: Number of parameters ......: 10 | |
| 672 | + 2015-05-22T20:05:54: Number of free parameters .: 4 | |
| 673 | + 2015-05-22T20:05:54: Number of iterations ......: 3 | |
| 674 | + 2015-05-22T20:05:54: Lambda ....................: 1e-06 | |
| 675 | + 2015-05-22T20:05:54: Maximum log likelihood ....: -93848.587 | |
| 676 | + 2015-05-22T20:05:54: Observed events (Nobs) ...: 15312.000 | |
| 677 | + 2015-05-22T20:05:54: Predicted events (Npred) ..: 15312.000 (Nobs - Npred = 3.03823e-06) | |
| 678 | + 2015-05-22T20:05:54: === GModels === | |
| 679 | + 2015-05-22T20:05:54: Number of models ..........: 2 | |
| 680 | + 2015-05-22T20:05:54: Number of parameters ......: 10 | |
| 681 | + 2015-05-22T20:05:54: === GModelSky === | |
| 682 | + 2015-05-22T20:05:54: Name ......................: Crab | |
| 683 | + 2015-05-22T20:05:54: Instruments ...............: all | |
| 684 | + 2015-05-22T20:05:54: Instrument scale factors ..: unity | |
| 685 | + 2015-05-22T20:05:54: Observation identifiers ...: all | |
| 686 | + 2015-05-22T20:05:54: Model type ................: PointSource | |
| 687 | + 2015-05-22T20:05:54: Model components ..........: "SkyDirFunction" * "PowerLaw" * "Constant" | |
| 688 | + 2015-05-22T20:05:54: Number of parameters ......: 6 | |
| 689 | + 2015-05-22T20:05:54: Number of spatial par's ...: 2 | |
| 690 | + 2015-05-22T20:05:54: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1) | |
| 691 | + 2015-05-22T20:05:54: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1) | |
| 692 | + 2015-05-22T20:05:54: Number of spectral par's ..: 3 | |
| 693 | + 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) | |
| 694 | + 2015-05-22T20:05:54: Index ....................: -2.49282 +/- 0.0163467 [-0,-5] (free,scale=-1,gradient) | |
| 695 | + 2015-05-22T20:05:54: PivotEnergy ..............: 300000 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 696 | + 2015-05-22T20:05:54: Number of temporal par's ..: 1 | |
| 697 | + 2015-05-22T20:05:54: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 698 | + 2015-05-22T20:05:54: === GCTAModelIrfBackground === | |
| 699 | + 2015-05-22T20:05:54: Name ......................: CTABackgroundModel | |
| 700 | + 2015-05-22T20:05:54: Instruments ...............: CTA | |
| 701 | + 2015-05-22T20:05:54: Instrument scale factors ..: unity | |
| 702 | + 2015-05-22T20:05:54: Observation identifiers ...: all | |
| 703 | + 2015-05-22T20:05:54: Model type ................: "PowerLaw" * "Constant" | |
| 704 | + 2015-05-22T20:05:54: Number of parameters ......: 4 | |
| 705 | + 2015-05-22T20:05:54: Number of spectral par's ..: 3 | |
| 706 | + 2015-05-22T20:05:54: Prefactor ................: 1.03511 +/- 0.024311 [0.001,1000] ph/cm2/s/MeV (free,scale=1,gradient) | |
| 707 | + 2015-05-22T20:05:54: Index ....................: 0.0333176 +/- 0.0134386 [-5,5] (free,scale=1,gradient) | |
| 708 | + 2015-05-22T20:05:54: PivotEnergy ..............: 1e+06 [10000,1e+09] MeV (fixed,scale=1e+06,gradient) | |
| 709 | + 2015-05-22T20:05:54: Number of temporal par's ..: 1 | |
| 710 | + 2015-05-22T20:05:54: Normalization ............: 1 (relative value) (fixed,scale=1,gradient) | |
| 723 | 711 | |
| 724 | 712 | |
| 725 | 713 | .. _sec_butterfly_cta: |
| ... | ... | @@ -739,14 +727,14 @@ line. |
| 739 | 727 | .. code-block:: bash |
| 740 | 728 | |
| 741 | 729 | $ ctbutterfly |
| 742 | - Input event list, cube or observation definition file [events.fits] | |
| 743 | - Calibration database [dummy] | |
| 744 | - Instrument response function [cta_dummy_irf] | |
| 745 | - Source model [$CTOOLS/share/models/crab.xml] crab_results.xml | |
| 730 | + Input event list, counts cube or observation definition file [events.fits] | |
| 731 | + Calibration database [prod2] | |
| 732 | + Instrument response function [South_50h] | |
| 733 | + Source model [$CTOOLS/share/models/crab.xml] | |
| 746 | 734 | Source of interest [Crab] |
| 747 | 735 | Start value for first energy bin in TeV [0.1] |
| 748 | 736 | Stop value for last energy bin in TeV [100.0] |
| 749 | - Output ascii file [butterfly.txt] | |
| 737 | + Output ascii file [butterfly.txt] | |
| 750 | 738 | |
| 751 | 739 | Now that you have computed the confidence band of the spectral fit and |
| 752 | 740 | that you will have an ASCII file named ``butterfly.txt`` on disk you can | ... | ... |
doc/source/user_manual/getting_started/response.rst
| ... | ... | @@ -3,20 +3,6 @@ |
| 3 | 3 | CTA Instrument Response Functions |
| 4 | 4 | --------------------------------- |
| 5 | 5 | |
| 6 | -.. note :: | |
| 7 | - | |
| 8 | - Instrument response functions are formally not part of ctools as they | |
| 9 | - should be provided by the instrument teams. The GammaLib framework on | |
| 10 | - which ctools are built comes with a set of basic response functions, but | |
| 11 | - for getting the latest instrument response functions you should contact | |
| 12 | - the relevant instrument teams. CTA consortium members should | |
| 13 | - `download | |
| 14 | - <https://portal.cta-observatory.org/WG/DM/DM_wiki/DATA_Access/Pages/Science%20Tools.aspx>`_ | |
| 15 | - the latest calibration database containing Prod1 and Prod2 instrument | |
| 16 | - response functions from the consortium Sharepoint site (requires | |
| 17 | - password). | |
| 18 | - | |
| 19 | - | |
| 20 | 6 | What are instrument response functions? |
| 21 | 7 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 22 | 8 | |
| ... | ... | @@ -47,98 +33,64 @@ atmospheric conditions, etc.). All these quantities and hence the |
| 47 | 33 | instrument response function may depend on time. |
| 48 | 34 | |
| 49 | 35 | |
| 50 | -Data formats | |
| 51 | -~~~~~~~~~~~~ | |
| 52 | - | |
| 53 | -So far the data format of the CTA instrument response functions has not | |
| 54 | -yet been settled, and information about instrument response functions is | |
| 55 | -provided in various ways. Three types of data formats are supported: | |
| 56 | - | |
| 57 | -- :ref:`sec_cta_rsp_perftable` | |
| 58 | - | |
| 59 | -- :ref:`sec_cta_rsp_xspec` | |
| 60 | - | |
| 61 | -- :ref:`sec_cta_rsp_rsptable` | |
| 62 | - | |
| 63 | -All formats provide the instrument response as function of true (and | |
| 64 | -sometimes also measured) photon energy, typically from about 20 GeV to | |
| 65 | -about 125 TeV. | |
| 66 | -Performance tables provide the instrument response for on-axis sources. | |
| 67 | -ARF, RMF and PSF files provide the instrument response for a specific | |
| 68 | -source position (and region) within the field of view. | |
| 69 | -Response tables provide the instrument response as function of position in | |
| 70 | -the field of view. Response tables are thus the most universal form of | |
| 71 | -instrument response functions available, and we recommend using this form | |
| 72 | -for any analysis. | |
| 73 | - | |
| 74 | -.. note :: | |
| 75 | - | |
| 76 | - Instrument response functions are so far only provided for a fixed | |
| 77 | - zenith angle of 20 deg. Therefore, no zenith or azimuth angle dependence has | |
| 78 | - been implemented so far. | |
| 79 | - | |
| 80 | - | |
| 81 | -Installing the CTA calibration database | |
| 82 | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 83 | - | |
| 84 | -After `downloading | |
| 85 | -<https://portal.cta-observatory.org/WG/DM/DM_wiki/DATA_Access/Pages/Science%20Tools.aspx>`_ | |
| 86 | -the latest calibration database (only possible for CTA consortium members), | |
| 87 | -the database is installed using | |
| 88 | - | |
| 89 | -.. code-block:: bash | |
| 90 | - | |
| 91 | - $ [sudo] tar -C $CALDB -zxvf cta-caldb-20150220.tar.gz | |
| 92 | - | |
| 93 | -or | |
| 94 | - | |
| 95 | -.. code-block:: bash | |
| 96 | - | |
| 97 | - $ [sudo] tar -C $CALDB -xvf cta-caldb-20150220.tar | |
| 98 | - | |
| 99 | -depending on whether the database has been retrieved as a gzipped file or | |
| 100 | -not. Depending on your access rights to the ``$CALDB`` directory, | |
| 101 | -installation of the calibration database may require root privileges | |
| 102 | -(type ``sudo`` in this case, otherwise omit this part of the command). | |
| 103 | - | |
| 104 | -The calibration database must be installed into the directory to which you | |
| 105 | -``CALDB`` environment variable points. By default, ctools sets this | |
| 106 | -enviroment variable to | |
| 107 | - | |
| 108 | -.. code-block:: bash | |
| 109 | - | |
| 110 | - $CTOOLS/share/caldb | |
| 111 | - | |
| 112 | -but it may be that due to some other analysis software on your system the | |
| 113 | -``CALDB`` environment variable points to another directory. If in doubt, type | |
| 114 | - | |
| 115 | -.. code-block:: bash | |
| 116 | - | |
| 117 | - echo $CALDB | |
| 118 | - | |
| 119 | -to find out to which directory your ``CALDB`` environment variable points. | |
| 120 | -You may always overwrite this setting using | |
| 121 | - | |
| 122 | -.. code-block:: bash | |
| 123 | - | |
| 124 | - export CALDB=/my/preferred/caldb/directory | |
| 125 | - | |
| 126 | -which you can add to your ``.bashrc`` file to set the directory | |
| 127 | -permanently. | |
| 128 | -ctools will use the ``CALDB`` environment variable to find out where the | |
| 129 | -calibration database is located. If needed, this mechanism can be | |
| 130 | -circumvented (see :ref:`sec_cta_rsp_abspath`). | |
| 131 | - | |
| 132 | - | |
| 133 | -Specifying the CTA Instrument Response Functions | |
| 134 | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 36 | +CTA response functions | |
| 37 | +~~~~~~~~~~~~~~~~~~~~~~ | |
| 38 | + | |
| 39 | +The instrument response functions for CTA are factorised into | |
| 40 | +the effective area :math:`A_{\rm eff}(d, p, E, t)` (units :math:`cm^2`), | |
| 41 | +the point spread function :math:`PSF(p' | d, p, E, t)`, | |
| 42 | +and the energy dispersion :math:`E_{\rm disp}(E' | d, p, E, t)` | |
| 43 | +following: | |
| 44 | + | |
| 45 | +.. math:: | |
| 46 | + R(p', E', t' | d, p, E, t) = | |
| 47 | + A_{\rm eff}(d, p, E, t) \times | |
| 48 | + PSF(p' | d, p, E, t) \times | |
| 49 | + E_{\rm disp}(E' | d, p, E, t) | |
| 50 | + | |
| 51 | +ctools are shipped with response functions for the northern and southern | |
| 52 | +arrays, and variants are available that have been optimised for exposure | |
| 53 | +times of 0.5 hours, 5 hours and 50 hours. | |
| 54 | +In total, the following six instrument response functions are available: | |
| 55 | +``North_0.5h``, ``North_5h``, ``North_50h``, ``South_0.5h``, | |
| 56 | +``South_5h``, and ``South_50h``. | |
| 57 | + | |
| 58 | +Each response is stored in a single FITS file, and each component of | |
| 59 | +the response factorisation is stored in a binary table of that FITS | |
| 60 | +file. | |
| 61 | +In addition, the response files contain an additional table that | |
| 62 | +describes the background rate as function of energy and position in | |
| 63 | +the field of view. | |
| 64 | +An example of a CTA response file is shown below: | |
| 65 | + | |
| 66 | +.. figure:: irf-file.png | |
| 67 | + :width: 100% | |
| 68 | + | |
| 69 | +Each table in the response file is in a standardised format that is | |
| 70 | +the one that is also used for the Fermi/LAT telescope. | |
| 71 | +As an example, the effective area component of the response file | |
| 72 | +is shown below. | |
| 73 | +Response information is stored in a n-dimensional cube, and each axis | |
| 74 | +of this cube is described by the lower and upper edges of the axis bins. | |
| 75 | +In this example the effective area is stored as a 2D matrix with the | |
| 76 | +first axis being energy and the second axis being offaxis angle. | |
| 77 | +Effective area information is stored for true (``EFFAREA``) and | |
| 78 | +reconstructed (``EFFAREA_RECO``) energy. | |
| 79 | +Vector columns are used to store all information. | |
| 80 | + | |
| 81 | +.. figure:: irf-aeff.png | |
| 82 | + :width: 100% | |
| 83 | + | |
| 84 | + | |
| 85 | +Specifying CTA response functions | |
| 86 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 135 | 87 | |
| 136 | 88 | The specification of the CTA Instrument Response Functions depends on the |
| 137 | 89 | way how ctools are used. Common to all methods is that the IRFs are |
| 138 | 90 | defined by a response name and a calibration database name. |
| 139 | - | |
| 140 | -There are different means to specify the CTA Instrument Response Functions | |
| 141 | -when using ctools, and the following section describe the | |
| 91 | +ctools makes use of HEASARC's CALDB format to index and store | |
| 92 | +IRFs, and specification of the database and response names is | |
| 93 | +sufficient to access the response. | |
| 142 | 94 | |
| 143 | 95 | |
| 144 | 96 | Specifying the response function as input parameters |
| ... | ... | @@ -146,23 +98,22 @@ Specifying the response function as input parameters |
| 146 | 98 | |
| 147 | 99 | ctools that require instrument response functions have two parameters |
| 148 | 100 | to specify the calibration database name and the response function name. |
| 149 | -The following example shows a ``ctobssim`` run using the ``dummy`` | |
| 150 | -calibration database and the ``cta_dummy_irf`` response function: | |
| 101 | +The following example shows a ``ctobssim`` run using the ``prod2`` | |
| 102 | +calibration database and the ``South_50h`` response function: | |
| 151 | 103 | |
| 152 | 104 | .. code-block:: bash |
| 153 | 105 | |
| 154 | 106 | $ ctobssim |
| 155 | - Model [$CTOOLS/share/models/crab.xml] | |
| 156 | - Calibration database [dummy] | |
| 157 | - Instrument response function [cta_dummy_irf] | |
| 158 | 107 | RA of pointing (degrees) (0-360) [83.63] |
| 159 | - Dec of pointing (degrees) (-90-90) [22.01] | |
| 108 | + Dec of pointing (degrees) (-90-90) [22.51] | |
| 160 | 109 | Radius of FOV (degrees) (0-180) [5.0] |
| 161 | - Start time (MET in s) (0) [0.0] | |
| 162 | - End time (MET in s) (0) [1800.0] | |
| 163 | - Lower energy limit (TeV) (0) [0.1] | |
| 164 | - Upper energy limit (TeV) (0) [100.0] | |
| 165 | - Output event data file or observation definition file [events.fits] | |
| 110 | + Start time (MET in s) [0.0] | |
| 111 | + End time (MET in s) [1800.0] | |
| 112 | + Lower energy limit (TeV) [0.1] | |
| 113 | + Upper energy limit (TeV) [100.0] | |
| 114 | + Calibration database [prod2] | |
| 115 | + Instrument response function [South_50h] | |
| 116 | + Model [$CTOOLS/share/models/crab.xml] | |
| 166 | 117 | |
| 167 | 118 | Running the other tools is equivalent. |
| 168 | 119 | |
| ... | ... | @@ -180,7 +131,7 @@ definition file: |
| 180 | 131 | <observation_list title="observation library"> |
| 181 | 132 | <observation name="Crab" id="00001" instrument="CTA"> |
| 182 | 133 | <parameter name="EventList" file="events.fits"/> |
| 183 | - <parameter name="Calibration" database="dummy" response="cta_dummy_irf"/> | |
| 134 | + <parameter name="Calibration" database="prod2" response="South_50h"/> | |
| 184 | 135 | </observation> |
| 185 | 136 | </observation_list> |
| 186 | 137 | |
| ... | ... | @@ -190,9 +141,9 @@ response name. You can then pass this file directly to, e.g., ``ctlike``: |
| 190 | 141 | .. code-block:: bash |
| 191 | 142 | |
| 192 | 143 | $ ctlike |
| 193 | - Event list, counts map or observation definition file [events.fits] obs_rsp.xml | |
| 144 | + Event list, counts cube or observation definition file [events.fits] obs_irf.xml | |
| 194 | 145 | Source model [$CTOOLS/share/models/crab.xml] |
| 195 | - Source model output file [crab_results.xml] | |
| 146 | + Source model output file [crab_results.xml] | |
| 196 | 147 | |
| 197 | 148 | Note that ``ctlike`` does not ask for the calibration database and |
| 198 | 149 | response name as it found the relevant information in the XML file. |
| ... | ... | @@ -211,10 +162,10 @@ specify them individually in the XML observation file as follows: |
| 211 | 162 | <observation_list title="observation library"> |
| 212 | 163 | <observation name="Crab" id="00001" instrument="CTA"> |
| 213 | 164 | <parameter name="EventList" file="events.fits"/> |
| 214 | - <parameter name="EffectiveArea" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 215 | - <parameter name="PointSpreadFunction" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 216 | - <parameter name="EnergyDispersion" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 217 | - <parameter name="Background" file="$CALDB/data/cta/dummy/bcf/cta_dummy_irf.dat"/> | |
| 165 | + <parameter name="EffectiveArea" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/> | |
| 166 | + <parameter name="PointSpreadFunction" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/> | |
| 167 | + <parameter name="EnergyDispersion" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/> | |
| 168 | + <parameter name="Background" file="$CALDB/data/cta/prod2/bcf/North_0.5h/irf_file.fits.gz"/> | |
| 218 | 169 | </observation> |
| 219 | 170 | </observation_list> |
| 220 | 171 | |
| ... | ... | @@ -229,169 +180,12 @@ and response name from within Python: |
| 229 | 180 | |
| 230 | 181 | import gammalib |
| 231 | 182 | obs = gammalib.GCTAObservation() |
| 232 | - caldb = gammalib.GCaldb("cta", "dummy") | |
| 233 | - irf = "cta_dummy_irf" | |
| 183 | + caldb = gammalib.GCaldb("cta", "prod2") | |
| 184 | + irf = "South_50h" | |
| 234 | 185 | obs.response(irf, caldb) |
| 235 | 186 | |
| 236 | 187 | The calibration database is set by creating a ``GCaldb`` object. The |
| 237 | 188 | constructor takes as argument the mission (always ``cta``) and the |
| 238 | -database name, in our case ``dummy``. The response function is then set | |
| 239 | -by passing the response name (here ``cta_dummy_irf``) and the calibration | |
| 189 | +database name, in our case ``prod2``. The response function is then set | |
| 190 | +by passing the response name (here ``South_50h``) and the calibration | |
| 240 | 191 | database object to the ``response`` method. |
| 241 | - | |
| 242 | -Alternatively, you can specify a specific response file by using | |
| 243 | - | |
| 244 | -.. code-block:: python | |
| 245 | - | |
| 246 | - import gammalib | |
| 247 | - obs = gammalib.GCTAObservation() | |
| 248 | - caldb = gammalib.GCaldb("$CALDB/data/cta/dummy/bcf") | |
| 249 | - irf = "cta_dummy_irf.dat" | |
| 250 | - obs.response(irf, caldb) | |
| 251 | - | |
| 252 | -Here, the directory in which the calibration file resides is specified | |
| 253 | -as argument to the ``GCaldb`` constructor, and the filename is passed | |
| 254 | -as response function name to the ``response`` method. | |
| 255 | - | |
| 256 | - | |
| 257 | -What response functions are available? | |
| 258 | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 259 | - | |
| 260 | -To see what response functions are available on your system, type | |
| 261 | - | |
| 262 | -.. code-block:: bash | |
| 263 | - | |
| 264 | - $ cscaldb | |
| 265 | - | |
| 266 | -This creates the file ``cscaldb.log`` in your current working directory | |
| 267 | -that contains information about the available response functions. The | |
| 268 | -format of the file is: | |
| 269 | - | |
| 270 | -.. code-block:: bash | |
| 271 | - | |
| 272 | - 2014-02-20T17:15:21: +==============+ | |
| 273 | - 2014-02-20T17:15:21: | Mission: cta | | |
| 274 | - 2014-02-20T17:15:21: +==============+ | |
| 275 | - 2014-02-20T17:15:21: === Calibration: aar === | |
| 276 | - 2014-02-20T17:15:21: DESY20140105_50h | |
| 277 | - 2014-02-20T17:15:21: DESY20140105_50h_0deg | |
| 278 | - 2014-02-20T17:15:21: DESY20140105_50h_180deg | |
| 279 | - 2014-02-20T17:15:21: | |
| 280 | - 2014-02-20T17:15:21: === Calibration: aar500 === | |
| 281 | - 2014-02-20T17:15:21: DESY20140105_50h | |
| 282 | - 2014-02-20T17:15:21: DESY20140105_50h_0deg | |
| 283 | - 2014-02-20T17:15:21: DESY20140105_50h_180deg | |
| 284 | - | |
| 285 | -The name after ``Calibration`` is what we called earlier the calibration | |
| 286 | -database, and the names that are following each | |
| 287 | -``=== Calibration: xxx ===`` header are the response file names. | |
| 288 | - | |
| 289 | -To get the same information also onto the console, type | |
| 290 | - | |
| 291 | -.. code-block:: bash | |
| 292 | - | |
| 293 | - $ cscaldb debug=yes | |
| 294 | - | |
| 295 | - | |
| 296 | -Data format details | |
| 297 | -~~~~~~~~~~~~~~~~~~~ | |
| 298 | - | |
| 299 | -.. _sec_cta_rsp_perftable: | |
| 300 | - | |
| 301 | -Performance tables | |
| 302 | -^^^^^^^^^^^^^^^^^^ | |
| 303 | - | |
| 304 | -In the early days, the instrument performances derived from Monte-Carlo | |
| 305 | -simulations have been summarised in what we call here Performance | |
| 306 | -Tables, which are ASCII files that contain as function of energy the | |
| 307 | -on-axis performance parameters of CTA, such as effective area, point spread | |
| 308 | -function containment radius, energy resolution, background count rate and | |
| 309 | -differential sensitivity. | |
| 310 | - | |
| 311 | -Below an example of a CTA performance table:: | |
| 312 | - | |
| 313 | - log(E) Area r68 r80 ERes. BG Rate Diff Sens | |
| 314 | - -1.7 261.6 0.3621 0.4908 0.5134 0.0189924 6.88237e-11 | |
| 315 | - -1.5 5458.2 0.2712 0.3685 0.4129 0.1009715 1.72717e-11 | |
| 316 | - -1.3 15590.0 0.1662 0.2103 0.2721 0.0575623 6.16963e-12 | |
| 317 | - -1.1 26554.1 0.1253 0.1567 0.2611 0.0213008 2.89932e-12 | |
| 318 | - -0.9 52100.5 0.1048 0.1305 0.1987 0.0088729 1.39764e-12 | |
| 319 | - -0.7 66132.1 0.0827 0.1024 0.1698 0.0010976 6.03531e-13 | |
| 320 | - -0.5 108656.8 0.0703 0.0867 0.1506 0.0004843 3.98147e-13 | |
| 321 | - -0.3 129833.0 0.0585 0.0722 0.1338 0.0001575 3.23090e-13 | |
| 322 | - -0.1 284604.3 0.0531 0.0656 0.1008 0.0001367 2.20178e-13 | |
| 323 | - 0.1 263175.3 0.0410 0.0506 0.0831 0.0000210 1.87452e-13 | |
| 324 | - 0.3 778048.6 0.0470 0.0591 0.0842 0.0000692 1.53976e-13 | |
| 325 | - 0.5 929818.8 0.0391 0.0492 0.0650 0.0000146 1.18947e-13 | |
| 326 | - 0.7 1078450.0 0.0335 0.0415 0.0541 0.0000116 1.51927e-13 | |
| 327 | - 0.9 1448579.1 0.0317 0.0397 0.0516 0.0000047 1.42439e-13 | |
| 328 | - 1.1 1899905.0 0.0290 0.0372 0.0501 0.0000081 1.96670e-13 | |
| 329 | - 1.3 2476403.8 0.0285 0.0367 0.0538 0.0000059 2.20695e-13 | |
| 330 | - 1.5 2832570.6 0.0284 0.0372 0.0636 0.0000073 3.22523e-13 | |
| 331 | - 1.7 3534065.3 0.0290 0.0386 0.0731 0.0000135 4.84153e-13 | |
| 332 | - 1.9 3250103.4 0.0238 0.0308 0.0729 0.0000044 6.26265e-13 | |
| 333 | - 2.1 3916071.6 0.0260 0.0354 0.0908 0.0000023 7.69921e-13 | |
| 334 | - --------------------------------------------- | |
| 335 | - 1) log(E) = log10(E/TeV) - bin centre | |
| 336 | - 2) Eff Area - in square metres after background cut (no theta cut) | |
| 337 | - 3) Ang. Res - 68% containment radius of gamma-ray PSF post cuts - in degrees | |
| 338 | - 4) Ang. Res - 80% containment radius of gamma-ray PSF post cuts - in degrees | |
| 339 | - 5) Fractional Energy Resolution (rms) | |
| 340 | - 6) BG Rate - inside point-source selection region - post call cuts - in Hz | |
| 341 | - 7) Diff Sens - differential sensitivity for this bin expressed as E^2 dN/dE | |
| 342 | - - in erg cm^-2 s^-1 - for a 50 hours exposure - 5 sigma significance including | |
| 343 | - systematics and statistics and at least 10 photons. | |
| 344 | - | |
| 345 | - | |
| 346 | -.. _sec_cta_rsp_xspec: | |
| 347 | - | |
| 348 | -ARF, RMF and PSF files | |
| 349 | -^^^^^^^^^^^^^^^^^^^^^^ | |
| 350 | - | |
| 351 | -Instrument response information for the first CTA Data Challenge (1DC) has been | |
| 352 | -provided in a format that was heavily inspired by the | |
| 353 | -`RMF and ARF file formats | |
| 354 | -<http://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/docs/memos/cal_gen_92_002/cal_gen_92_002.html>`_ | |
| 355 | -that have been introduced by | |
| 356 | -`HEASARC <http://heasarc.gsfc.nasa.gov/>`_ | |
| 357 | -for spectral analysis of X-ray data. | |
| 358 | - | |
| 359 | -The Redistribution Matrix File (RMF) describes how an incoming photon with | |
| 360 | -a given true energy is redistributed in measured energy. In other words, it | |
| 361 | -describes the energy dispersion of the instrument. The RMF is organised as | |
| 362 | -a two-dimensional matrix, with the first axis being in true energies while | |
| 363 | -the second axis represents the measured energies. | |
| 364 | - | |
| 365 | -The Ancillary Response File (ARF) describes the sensitivity of the | |
| 366 | -instrument to photons of a given true energy. The ARF gives the effective | |
| 367 | -area of the detector system after applying an event selection cut | |
| 368 | -(theta cut). For computing the ARF, some knowledge of the Point Spread | |
| 369 | -Function (PSF) is needed, so that the fraction of photons that falls into | |
| 370 | -the event selection region for a given source can be properly estimated. | |
| 371 | -Once this is done, no further PSF information is needed for the analysis. | |
| 372 | - | |
| 373 | -ctools however relies on the full modelling of the instrument, including | |
| 374 | -the Point Spread Function, and hence, PSF information has also been | |
| 375 | -provided for 1DC. Two data formats have been used for this: a first that | |
| 376 | -is based on a simple one-dimensional vector, providing the width of a | |
| 377 | -2-dimensional Gaussian as function of energy; and a second that is based | |
| 378 | -on a three-component 2D Gaussian as function of energy and offset angle | |
| 379 | -in the camera system. While the former was implement by a simply FITS | |
| 380 | -table with two columns, the latter was implemented by | |
| 381 | -:ref:`sec_cta_rsp_rsptable`. | |
| 382 | - | |
| 383 | - | |
| 384 | -.. _sec_cta_rsp_rsptable: | |
| 385 | - | |
| 386 | -Response tables | |
| 387 | -^^^^^^^^^^^^^^^ | |
| 388 | - | |
| 389 | -The CTA response table class ``GCTAResponseTable`` provides a generic | |
| 390 | -handle for multi-dimensional response information. It is based on the | |
| 391 | -response format used for storing response information for the | |
| 392 | -*Fermi*/LAT telescope. In this format, all information is stored in | |
| 393 | -a single row of a FITS binary table. Each element of the row contains | |
| 394 | -a vector column, that describes the axes of the multi-dimensional response | |
| 395 | -cube and the response information. Note that this class may in the future | |
| 396 | -be promoted to the GammaLib core, as a similar class has been implemented | |
| 397 | -in the *Fermi*/LAT interface. | ... | ... |
doc/source/user_manual/getting_started/tsmap-crab.png
examples/README
| ... | ... | @@ -9,6 +9,13 @@ benchmark_cta_analysis.py |
| 9 | 9 | check_models.py |
| 10 | 10 | Checks a variety of models using an unbinned analysis. |
| 11 | 11 | |
| 12 | +make_pointings.py | |
| 13 | + This script creates pointings for CTA surveys. For the moment the | |
| 14 | + Galactic Plane Survey (gps), the Extragalactic Survey (extgal), | |
| 15 | + the Galactic Centre Survey (gc) and the LMC survey (lmc) are | |
| 16 | + implemented. The script outputs and ASCII file that can be used by | |
| 17 | + csobsdef. | |
| 18 | + | |
| 12 | 19 | make_pull_at_sensitivity_limit.py |
| 13 | 20 | This script creates pull distributions as function of energy |
| 14 | 21 | for a test source that is at the 5 sigma sensitivity limit for | ... | ... |
examples/benchmark_cta_analysis.py
| ... | ... | @@ -39,8 +39,8 @@ def unbinned_pipeline(duration): |
| 39 | 39 | """ |
| 40 | 40 | # Set script parameters |
| 41 | 41 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 42 | - caldb = "dummy" | |
| 43 | - irf = "cta_dummy_irf" | |
| 42 | + caldb = "prod2" | |
| 43 | + irf = "South_50h" | |
| 44 | 44 | ra = 83.63 |
| 45 | 45 | dec = 22.01 |
| 46 | 46 | rad_sim = 10.0 |
| ... | ... | @@ -103,8 +103,8 @@ def binned_pipeline(duration): |
| 103 | 103 | """ |
| 104 | 104 | # Set script parameters |
| 105 | 105 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 106 | - caldb = "dummy" | |
| 107 | - irf = "cta_dummy_irf" | |
| 106 | + caldb = "prod2" | |
| 107 | + irf = "South_50h" | |
| 108 | 108 | ra = 83.63 |
| 109 | 109 | dec = 22.01 |
| 110 | 110 | rad_sim = 10.0 |
| ... | ... | @@ -167,17 +167,17 @@ def binned_pipeline(duration): |
| 167 | 167 | return telapsed, tctlike |
| 168 | 168 | |
| 169 | 169 | |
| 170 | -# ============================ # | |
| 171 | -# Cube-style analysis pipeline # | |
| 172 | -# ============================ # | |
| 173 | -def cube_pipeline(duration): | |
| 170 | +# ========================= # | |
| 171 | +# Stacked analysis pipeline # | |
| 172 | +# ========================= # | |
| 173 | +def stacked_pipeline(duration): | |
| 174 | 174 | """ |
| 175 | 175 | Cube-style analysis pipeline. |
| 176 | 176 | """ |
| 177 | 177 | # Set script parameters |
| 178 | 178 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 179 | - caldb = "dummy" | |
| 180 | - irf = "cta_dummy_irf" | |
| 179 | + caldb = "prod2" | |
| 180 | + irf = "South_50h" | |
| 181 | 181 | ra = 83.63 |
| 182 | 182 | dec = 22.01 |
| 183 | 183 | rad_sim = 10.0 |
| ... | ... | @@ -260,17 +260,34 @@ def cube_pipeline(duration): |
| 260 | 260 | psfcube["yref"].real(dec) |
| 261 | 261 | psfcube.run() |
| 262 | 262 | |
| 263 | - # Set exposure and PSF cube for first CTA observation | |
| 264 | - obs = bin.obs() | |
| 265 | - cta = gammalib.GCTAObservation(obs[0]) | |
| 266 | - cta.response(expcube.expcube(), psfcube.psfcube()) | |
| 267 | - obs[0] = cta | |
| 263 | + # Create background cube | |
| 264 | + bkgcube = ctools.ctbkgcube(sim.obs()) | |
| 265 | + bkgcube["incube"].filename("NONE") | |
| 266 | + bkgcube["ebinalg"].string("LOG") | |
| 267 | + bkgcube["emin"].real(emin) | |
| 268 | + bkgcube["emax"].real(emax) | |
| 269 | + bkgcube["enumbins"].integer(enumbins) | |
| 270 | + bkgcube["nxpix"].integer(10) | |
| 271 | + bkgcube["nypix"].integer(10) | |
| 272 | + bkgcube["binsz"].real(1.0) | |
| 273 | + bkgcube["coordsys"].string(coordsys) | |
| 274 | + bkgcube["proj"].string(proj) | |
| 275 | + bkgcube["xref"].real(ra) | |
| 276 | + bkgcube["yref"].real(dec) | |
| 277 | + bkgcube.run() | |
| 278 | + | |
| 279 | + # Attach background model to observation container | |
| 280 | + bin.obs().models(bkgcube.models()) | |
| 281 | + | |
| 282 | + # Set Exposure and Psf cube for first CTA observation | |
| 283 | + # (ctbin will create an observation with a single container) | |
| 284 | + bin.obs()[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube()) | |
| 268 | 285 | |
| 269 | 286 | # Get ctlike start CPU time |
| 270 | 287 | tctlike = time.clock() |
| 271 | 288 | |
| 272 | 289 | # Perform maximum likelihood fitting |
| 273 | - like = ctools.ctlike(obs) | |
| 290 | + like = ctools.ctlike(bin.obs()) | |
| 274 | 291 | like.run() |
| 275 | 292 | |
| 276 | 293 | # Get stop CPU time |
| ... | ... | @@ -292,16 +309,16 @@ if __name__ == '__main__': |
| 292 | 309 | print("*************************************") |
| 293 | 310 | print("* CTA analysis benchmark *") |
| 294 | 311 | print("*************************************") |
| 295 | - print(" Duration Unbinned Binned Cube-style ctlike-UB ctlike-B ctlike-CS") | |
| 312 | + print(" Duration Unbinned Binned Stacked ctlike-UB ctlike-B ctlike-S") | |
| 296 | 313 | |
| 297 | 314 | # Initialize arrays |
| 298 | 315 | a_duration = [] |
| 299 | 316 | a_unbinned = [] |
| 300 | 317 | a_binned = [] |
| 301 | - a_cube = [] | |
| 318 | + a_stacked = [] | |
| 302 | 319 | c_unbinned = [] |
| 303 | 320 | c_binned = [] |
| 304 | - c_cube = [] | |
| 321 | + c_stacked = [] | |
| 305 | 322 | |
| 306 | 323 | # Perform benchmarks |
| 307 | 324 | duration = 1800.0 |
| ... | ... | @@ -309,22 +326,22 @@ if __name__ == '__main__': |
| 309 | 326 | |
| 310 | 327 | # Perform analyses |
| 311 | 328 | t_unbinned, ct_unbinned = unbinned_pipeline(duration) |
| 312 | - t_binned, ct_binned = binned_pipeline(duration) | |
| 313 | - t_cube, ct_cube = cube_pipeline(duration) | |
| 329 | + t_binned, ct_binned = binned_pipeline(duration) | |
| 330 | + t_stacked, ct_stacked = stacked_pipeline(duration) | |
| 314 | 331 | |
| 315 | 332 | # Collect results |
| 316 | 333 | a_duration.append(duration/3600.0) |
| 317 | 334 | a_unbinned.append(t_unbinned) |
| 318 | 335 | a_binned.append(t_binned) |
| 319 | - a_cube.append(t_cube) | |
| 336 | + a_stacked.append(t_stacked) | |
| 320 | 337 | c_unbinned.append(ct_unbinned) |
| 321 | 338 | c_binned.append(ct_binned) |
| 322 | - c_cube.append(ct_cube) | |
| 339 | + c_stacked.append(ct_stacked) | |
| 323 | 340 | |
| 324 | 341 | # Print results |
| 325 | 342 | print("%10.0f %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f" % \ |
| 326 | - (duration, t_unbinned, t_binned, t_cube, \ | |
| 327 | - ct_unbinned, ct_binned, ct_cube)) | |
| 343 | + (duration, t_unbinned, t_binned, t_stacked, \ | |
| 344 | + ct_unbinned, ct_binned, ct_stacked)) | |
| 328 | 345 | |
| 329 | 346 | # Increment duration |
| 330 | 347 | duration *= 2.0 |
| ... | ... | @@ -335,10 +352,10 @@ if __name__ == '__main__': |
| 335 | 352 | plt.title("CTA analysis benchmark") |
| 336 | 353 | plt.loglog(a_duration, a_unbinned, 'ro-', label='unbinned') |
| 337 | 354 | plt.loglog(a_duration, a_binned, 'bo-', label='binned') |
| 338 | - plt.loglog(a_duration, a_cube, 'go-', label='cube-style') | |
| 355 | + plt.loglog(a_duration, a_stacked, 'go-', label='cube-style') | |
| 339 | 356 | plt.loglog(a_duration, c_unbinned, 'ro--') |
| 340 | 357 | plt.loglog(a_duration, c_binned, 'bo--') |
| 341 | - plt.loglog(a_duration, c_cube, 'go--') | |
| 358 | + plt.loglog(a_duration, c_stacked, 'go--') | |
| 342 | 359 | plt.xlabel("Duration (hours)") |
| 343 | 360 | plt.ylabel("CPU time (seconds)") |
| 344 | 361 | plt.legend(loc="lower right") | ... | ... |
examples/check_models.py
| ... | ... | @@ -41,8 +41,8 @@ def pipeline(model_name): |
| 41 | 41 | FITS files on disk. All data is only hold in memory. |
| 42 | 42 | """ |
| 43 | 43 | # Set script parameters |
| 44 | - caldb = "dummy" | |
| 45 | - irf = "cta_dummy_irf" | |
| 44 | + caldb = "prod2" | |
| 45 | + irf = "South_50h" | |
| 46 | 46 | ra = 83.63 |
| 47 | 47 | dec = 22.01 |
| 48 | 48 | rad_sim = 10.0 | ... | ... |
examples/make_pointings.py
| 1 | 1 | #! /usr/bin/env python |
| 2 | 2 | # ========================================================================== |
| 3 | -# This script generated pointing patterns for CTA observations. | |
| 3 | +# This script generates pointing patterns for CTA observations. | |
| 4 | 4 | # |
| 5 | 5 | # Usage: |
| 6 | 6 | # ./make_pointings.py |
| ... | ... | @@ -124,19 +124,18 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \ |
| 124 | 124 | obs_site = site |
| 125 | 125 | |
| 126 | 126 | # Set site IRF |
| 127 | + caldb = "prod2" | |
| 127 | 128 | if obs_site == "North": |
| 128 | - caldb = "tenerife" | |
| 129 | 129 | if lst: |
| 130 | - irf = "DESY20140105_50h" | |
| 130 | + irf = "North_50h" | |
| 131 | 131 | else: |
| 132 | - irf = "DESY20140105_50h_noLST" | |
| 132 | + irf = "North_50h" | |
| 133 | 133 | exposure_north += duration |
| 134 | 134 | else: |
| 135 | - caldb = "aar" | |
| 136 | 135 | if lst: |
| 137 | - irf = "DESY20140105_50h" | |
| 136 | + irf = "South_50h" | |
| 138 | 137 | else: |
| 139 | - irf = "DESY20140105_50h_noLST" | |
| 138 | + irf = "South_50h" | |
| 140 | 139 | exposure_south += duration |
| 141 | 140 | |
| 142 | 141 | # Set IRF information |
| ... | ... | @@ -241,6 +240,59 @@ def set_gc(lst=True): |
| 241 | 240 | return obsdef |
| 242 | 241 | |
| 243 | 242 | |
| 243 | +# ============= # | |
| 244 | +# Setup LMC KSP # | |
| 245 | +# ============= # | |
| 246 | +def set_lmc(hours=250.0, lst=True): | |
| 247 | + """ | |
| 248 | + Setup LMC KSP. | |
| 249 | + """ | |
| 250 | + # Initialise observation definition | |
| 251 | + obsdef = [] | |
| 252 | + | |
| 253 | + # Set LMC centre | |
| 254 | + centre = gammalib.GSkyDir() | |
| 255 | + centre.radec_deg(80.0, -69.0) | |
| 256 | + | |
| 257 | + # Set offset angle and number of pointings | |
| 258 | + offset = 1.0 # degrees | |
| 259 | + n_pnt = 12 | |
| 260 | + | |
| 261 | + # Prepare computations | |
| 262 | + dphi = 360.0/n_pnt | |
| 263 | + duration = hours*3600.0/float(n_pnt) | |
| 264 | + | |
| 265 | + # Loop over pointings | |
| 266 | + for ipnt in range(n_pnt): | |
| 267 | + | |
| 268 | + # Compute pointing direction | |
| 269 | + pnt = centre.copy() | |
| 270 | + pnt.rotate_deg(ipnt*dphi, offset) | |
| 271 | + lon = pnt.l_deg() | |
| 272 | + lat = pnt.b_deg() | |
| 273 | + | |
| 274 | + # Set positions and duration | |
| 275 | + obs = {'lon': lon, 'lat': lat, 'duration': duration} | |
| 276 | + | |
| 277 | + # Add IRF | |
| 278 | + caldb = "prod2" | |
| 279 | + if lst: | |
| 280 | + irf = "South_50h" | |
| 281 | + else: | |
| 282 | + irf = "South_50h" | |
| 283 | + obs['caldb'] = caldb | |
| 284 | + obs['irf'] = irf | |
| 285 | + | |
| 286 | + # Append observation | |
| 287 | + obsdef.append(obs) | |
| 288 | + | |
| 289 | + # Dump statistics | |
| 290 | + print("Number of pointings: %d (%.2f sec)" % (n_pnt,duration)) | |
| 291 | + | |
| 292 | + # Return observation definition | |
| 293 | + return obsdef | |
| 294 | + | |
| 295 | + | |
| 244 | 296 | # ======================================= # |
| 245 | 297 | # Write observation definition dictionary # |
| 246 | 298 | # ======================================= # |
| ... | ... | @@ -291,7 +343,6 @@ if __name__ == '__main__': |
| 291 | 343 | need_help = False |
| 292 | 344 | |
| 293 | 345 | # Test for command line arguments |
| 294 | - #print(sys.argv[0]) | |
| 295 | 346 | if (len(sys.argv) > 1): |
| 296 | 347 | if sys.argv[1] == "-h": |
| 297 | 348 | need_help = True |
| ... | ... | @@ -304,13 +355,14 @@ if __name__ == '__main__': |
| 304 | 355 | if need_help: |
| 305 | 356 | print("Usage: make_pointing.py [OPTIONS]") |
| 306 | 357 | print(" -h Display this usage message") |
| 307 | - print(" gps Galactic plane scan (2 row scheme)") | |
| 308 | - print(" gps3 Galactic plane scan (3 row scheme)") | |
| 358 | + print(" gps Galactic plane survey (2 row scheme)") | |
| 359 | + print(" gps3 Galactic plane survey (3 row scheme)") | |
| 309 | 360 | print(" extgal Extragalactic survey") |
| 310 | - print(" gc Galactic centre") | |
| 361 | + print(" gc Galactic centre survey") | |
| 362 | + print(" lmc LMC survey") | |
| 311 | 363 | sys.exit() |
| 312 | 364 | |
| 313 | - # Galactic plane scan | |
| 365 | + # Galactic plane survey | |
| 314 | 366 | if obsname == "gps": |
| 315 | 367 | obsdef = set_gps(lst=True) |
| 316 | 368 | write_obsdef("gps.dat", obsdef) |
| ... | ... | @@ -328,6 +380,11 @@ if __name__ == '__main__': |
| 328 | 380 | obsdef = set_gc(lst=True) |
| 329 | 381 | write_obsdef("gc.dat", obsdef) |
| 330 | 382 | |
| 383 | + # LMC | |
| 384 | + elif obsname == "lmc": | |
| 385 | + obsdef = set_lmc(lst=True) | |
| 386 | + write_obsdef("lmc.dat", obsdef) | |
| 387 | + | |
| 331 | 388 | # Invalid pattern |
| 332 | 389 | else: |
| 333 | 390 | print("Unknown option \""+obsname+"\"") | ... | ... |
examples/make_pull_at_sensitivity_limit.py
| ... | ... | @@ -61,8 +61,8 @@ def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0, \ |
| 61 | 61 | pull.models(models) |
| 62 | 62 | pull["outfile"] = outfile |
| 63 | 63 | pull["ntrials"] = ntrials |
| 64 | - pull["caldb"] = "${CALDB}/data/cta/dummy/bcf" | |
| 65 | - pull["irf"] = "cta_dummy_irf" | |
| 64 | + pull["caldb"] = "prod2" | |
| 65 | + pull["irf"] = "South_50h" | |
| 66 | 66 | pull["ra"] = 83.6331 |
| 67 | 67 | pull["dec"] = 22.0145 |
| 68 | 68 | pull["emin"] = emin | ... | ... |
examples/make_spectrum.py
| ... | ... | @@ -36,8 +36,8 @@ def make_spectrum(): |
| 36 | 36 | """ |
| 37 | 37 | # Set script parameters |
| 38 | 38 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 39 | - caldb = "dummy" | |
| 40 | - irf = "cta_dummy_irf" | |
| 39 | + caldb = "prod2" | |
| 40 | + irf = "South_50h" | |
| 41 | 41 | ra = 83.63 |
| 42 | 42 | dec = 22.01 |
| 43 | 43 | rad_sim = 3.0 |
| ... | ... | @@ -88,7 +88,7 @@ def plot_spectrum(spectrum): |
| 88 | 88 | spectrum['flux']['value'], 'ro', label='Crab') |
| 89 | 89 | plt.errorbar(spectrum['energy']['value'], \ |
| 90 | 90 | spectrum['flux']['value'], \ |
| 91 | - spectrum['flux']['ed_value'], fmt=None, ecolor='r') | |
| 91 | + spectrum['flux']['ed_value'], ecolor='r') | |
| 92 | 92 | |
| 93 | 93 | # Put labels |
| 94 | 94 | plt.xlabel("Energy ("+spectrum['energy']['unit']+")") | ... | ... |
examples/make_ts_distributions.py
| ... | ... | @@ -61,21 +61,23 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ |
| 61 | 61 | |
| 62 | 62 | # Setup cstsdist tool |
| 63 | 63 | tsdist = cstsdist() |
| 64 | - tsdist["outfile"] = outfile | |
| 65 | - tsdist["ntrials"] = ntrials | |
| 66 | - tsdist["caldb"] = "${CALDB}/data/cta/dummy/bcf" | |
| 67 | - tsdist["irf"] = "cta_dummy_irf" | |
| 68 | - tsdist["type"] = "point" | |
| 69 | - tsdist["index"] = -2.48 | |
| 70 | - tsdist["offset"] = 0.0 | |
| 71 | - tsdist["bkg"] = "${CTOOLS}/share/models/bkg_dummy.txt" | |
| 72 | - tsdist["emin"] = float(emin) | |
| 73 | - tsdist["emax"] = float(emax) | |
| 74 | - tsdist["enumbins"] = int(enumbins) | |
| 75 | - tsdist["duration"] = float(duration) | |
| 76 | - tsdist["rad"] = 5.0 | |
| 77 | - tsdist["npix"] = 200 | |
| 78 | - tsdist["binsz"] = 0.05 | |
| 64 | + tsdist["inmodel"].filename("$CTOOLS/share/models/crab.xml") | |
| 65 | + tsdist["srcname"].string("Crab") | |
| 66 | + tsdist["outfile"].filename(outfile) | |
| 67 | + tsdist["ntrials"].integer(ntrials) | |
| 68 | + tsdist["caldb"].string("prod2") | |
| 69 | + tsdist["irf"].string("South_50h") | |
| 70 | + tsdist["ra"].real(83.63) | |
| 71 | + tsdist["dec"].real(22.01) | |
| 72 | + tsdist["emin"].real(float(emin)) | |
| 73 | + tsdist["emax"].real(float(emax)) | |
| 74 | + tsdist["enumbins"].integer(int(enumbins)) | |
| 75 | + tsdist["tmin"].real(0.0) | |
| 76 | + tsdist["tmax"].real(float(duration)) | |
| 77 | + tsdist["rad"].real(5.0) | |
| 78 | + tsdist["npix"].integer(200) | |
| 79 | + tsdist["binsz"].real(0.05) | |
| 80 | + #tsdist["debug"].boolean(True) | |
| 79 | 81 | |
| 80 | 82 | # Optionally open the log file |
| 81 | 83 | if log: |
| ... | ... | @@ -139,14 +141,10 @@ if __name__ == '__main__': |
| 139 | 141 | enumbins = pars[1]['value'] |
| 140 | 142 | duration = pars[2]['value'] |
| 141 | 143 | max_threads = pars[3]['value'] |
| 142 | - #print ntrials | |
| 143 | - #print enumbins | |
| 144 | - #print duration | |
| 145 | - #print max_threads | |
| 146 | 144 | |
| 147 | 145 | # Loop over energy bands. The energy bands are those that are also |
| 148 | 146 | # used for sensitivity computation. |
| 149 | - for ieng in range(21): | |
| 147 | + for ieng in range(20): | |
| 150 | 148 | |
| 151 | 149 | # Set energies |
| 152 | 150 | loge = -1.7 + ieng * 0.2 | ... | ... |
examples/pipeline_binned_disk.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | |
| ... | ... | @@ -96,7 +96,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ |
| 96 | 96 | enumbins=20, nxpix=200, nypix=200, binsz=0.02, \ |
| 97 | 97 | coordsys="CEL", proj="CAR", \ |
| 98 | 98 | model="${CTOOLS}/share/models/crab.xml", \ |
| 99 | - caldb="dummy", irf="cta_dummy_irf", \ | |
| 99 | + caldb="prod2", irf="South_50h", \ | |
| 100 | 100 | debug=False): |
| 101 | 101 | """ |
| 102 | 102 | Simulation and binned analysis pipeline. |
| ... | ... | @@ -165,6 +165,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ |
| 165 | 165 | like["outmodel"].filename("fit_results.xml") |
| 166 | 166 | like["expcube"].filename("NONE") |
| 167 | 167 | like["psfcube"].filename("NONE") |
| 168 | + like["bkgcube"].filename("NONE") | |
| 168 | 169 | like["caldb"].string(caldb) |
| 169 | 170 | like["irf"].string(irf) |
| 170 | 171 | like["debug"].boolean(True) # Switch this always on for results in console | ... | ... |
examples/pipeline_binned_mem.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | ... | ... |
examples/pipeline_stacked_disk.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | |
| ... | ... | @@ -96,7 +96,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ |
| 96 | 96 | enumbins=20, nxpix=200, nypix=200, binsz=0.02, \ |
| 97 | 97 | coordsys="CEL", proj="CAR", \ |
| 98 | 98 | model="${CTOOLS}/share/models/crab.xml", \ |
| 99 | - caldb="dummy", irf="cta_dummy_irf", \ | |
| 99 | + caldb="prod2", irf="South_50h", \ | |
| 100 | 100 | debug=False): |
| 101 | 101 | """ |
| 102 | 102 | Simulation and stacked analysis pipeline. |
| ... | ... | @@ -210,6 +210,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ |
| 210 | 210 | like["outmodel"].filename("fit_results.xml") |
| 211 | 211 | like["expcube"].filename("expcube.fits") |
| 212 | 212 | like["psfcube"].filename("psfcube.fits") |
| 213 | + like["bkgcube"].filename("bkgcube.fits") | |
| 213 | 214 | like["caldb"].string(caldb) |
| 214 | 215 | like["irf"].string(irf) |
| 215 | 216 | like["debug"].boolean(True) # Switch this always on for results in console | ... | ... |
examples/pipeline_stacked_mem.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | |
| ... | ... | @@ -188,7 +188,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ |
| 188 | 188 | |
| 189 | 189 | # Set Exposure and Psf cube for first CTA observation |
| 190 | 190 | # (ctbin will create an observation with a single container) |
| 191 | - bin.obs()[0].response(expcube.expcube(), psfcube.psfcube()) | |
| 191 | + bin.obs()[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube()) | |
| 192 | 192 | |
| 193 | 193 | # Perform maximum likelihood fitting |
| 194 | 194 | like = ctools.ctlike(bin.obs()) | ... | ... |
examples/pipeline_unbinned_disk.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | |
| ... | ... | @@ -96,7 +96,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \ |
| 96 | 96 | emin=0.1, emax=100.0, \ |
| 97 | 97 | tmin=0.0, tmax=0.0, \ |
| 98 | 98 | model="${CTOOLS}/share/models/crab.xml", \ |
| 99 | - caldb="dummy", irf="cta_dummy_irf", \ | |
| 99 | + caldb="prod2", irf="South_50h", \ | |
| 100 | 100 | debug=False): |
| 101 | 101 | """ |
| 102 | 102 | Simulation and unbinned analysis pipeline. | ... | ... |
examples/pipeline_unbinned_mem.py
| ... | ... | @@ -36,7 +36,7 @@ from ctools import obsutils |
| 36 | 36 | def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \ |
| 37 | 37 | emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \ |
| 38 | 38 | deadc=0.95, \ |
| 39 | - caldb="dummy", irf="cta_dummy_irf"): | |
| 39 | + caldb="prod2", irf="South_50h"): | |
| 40 | 40 | """ |
| 41 | 41 | Returns an observation container. |
| 42 | 42 | ... | ... |
examples/show_response.py
| ... | ... | @@ -167,6 +167,7 @@ def show_one_sensitivity(rsp, name, color="r", duration=180000.0, alpha=0.2, sig |
| 167 | 167 | """ |
| 168 | 168 | # Set constants |
| 169 | 169 | r68_to_sigma = 0.6624305 |
| 170 | + TeV2erg = 1.0e6 * gammalib.MeV2erg | |
| 170 | 171 | |
| 171 | 172 | # Set to figure 3 |
| 172 | 173 | plt.figure(3) |
| ... | ... | @@ -189,8 +190,16 @@ def show_one_sensitivity(rsp, name, color="r", duration=180000.0, alpha=0.2, sig |
| 189 | 190 | if Noff > 0: |
| 190 | 191 | Non = Non_lima(sigma, Noff) |
| 191 | 192 | src_counts = Non - bgd_counts |
| 192 | - flux[i] = src_counts / (0.68*aeff * duration) * E[i]*1.0e6 * gammalib.MeV2erg | |
| 193 | - #print logE[i], flux[i] | |
| 193 | + if src_counts < 0.05*bgd_counts: | |
| 194 | + src_counts = 0.05*bgd_counts | |
| 195 | + if src_counts < 10: | |
| 196 | + src_counts = 10.0 | |
| 197 | + emin = gammalib.GEnergy(math.pow(10.0, logE[i]-0.1), "TeV") | |
| 198 | + emax = gammalib.GEnergy(math.pow(10.0, logE[i]+0.1), "TeV") | |
| 199 | + epivot = gammalib.GEnergy(math.pow(10.0, logE[i]), "TeV") | |
| 200 | + plaw = gammalib.GModelSpectralPlaw(1.0e-6, -2.6, epivot) | |
| 201 | + conv = TeV2erg*E[i]*E[i]/plaw.flux(emin, emax) | |
| 202 | + flux[i] = conv * src_counts / (duration * aeff*0.68) | |
| 194 | 203 | |
| 195 | 204 | # Plot data |
| 196 | 205 | plt.loglog(E, flux, color+'-', label=name) | ... | ... |
examples/show_sensitivity.py
| ... | ... | @@ -99,7 +99,7 @@ def show_sensitivity(sensitivity, filename): |
| 99 | 99 | plt.grid() |
| 100 | 100 | |
| 101 | 101 | # Show differential sensitivity |
| 102 | - plt.plot(sensitivity['energy'], sensitivity['eflux'], 'ro-') | |
| 102 | + plt.plot(sensitivity['energy'], sensitivity['sensitivity'], 'ro-') | |
| 103 | 103 | |
| 104 | 104 | # Set labels |
| 105 | 105 | plt.xlabel("Energy (TeV)") | ... | ... |
examples/simulate_events.py
| ... | ... | @@ -38,7 +38,7 @@ except: |
| 38 | 38 | # ======================== # |
| 39 | 39 | def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \ |
| 40 | 40 | emin=0.1, emax=100.0, duration=360000.0, deadc=0.95, \ |
| 41 | - irf="cta_dummy_irf", caldb="$CTOOLS/share/caldb/data/cta/dummy"): | |
| 41 | + irf="South_50h", caldb="prod2"): | |
| 42 | 42 | """ |
| 43 | 43 | Create CTA observation. |
| 44 | 44 | """ | ... | ... |
models/Makefile.am
| 1 | 1 | ## Process this file with automake to produce Makefile.in |
| 2 | 2 | |
| 3 | 3 | # Background rate files to distribute |
| 4 | -bkgs = bkg_dummy.txt | |
| 5 | -bkgsdir = $(datadir)/models | |
| 6 | -bkgs_DATA = $(bkgs) | |
| 4 | +#bkgs = bkg_dummy.txt | |
| 5 | +#bkgsdir = $(datadir)/models | |
| 6 | +#bkgs_DATA = $(bkgs) | |
| 7 | 7 | |
| 8 | 8 | # Models to distribute |
| 9 | 9 | models = crab.xml \ |
| ... | ... | @@ -16,4 +16,4 @@ modelsdir = $(datadir)/models |
| 16 | 16 | models_DATA = $(models) |
| 17 | 17 | |
| 18 | 18 | # Extra files to be distributed in the tar file |
| 19 | -EXTRA_DIST = $(bkgs) $(models) | |
| 19 | +EXTRA_DIST = $(models) | ... | ... |
models/bkg_dummy.txt deleted
| 1 | -19952.6231497 0.00888770093889 | |
| 2 | -31622.7766017 0.0528862764556 | |
| 3 | -50118.7233627 0.0584088588708 | |
| 4 | -79432.8234724 0.0245627698931 | |
| 5 | -125892.541179 0.00930817022553 | |
| 6 | -199526.231497 0.00117990856387 | |
| 7 | -316227.766017 0.000458229904465 | |
| 8 | -501187.233627 0.000135628482432 | |
| 9 | -794328.234724 8.99472876298e-05 | |
| 10 | -1258925.41179 1.46319988679e-05 | |
| 11 | -1995262.31497 2.23452132224e-05 | |
| 12 | -3162277.66017 4.28526605833e-06 | |
| 13 | -5011872.33627 3.02154407423e-06 | |
| 14 | -7943282.34724 8.46588074886e-07 | |
| 15 | -12589254.1179 1.05217831413e-06 | |
| 16 | -19952623.1497 4.95410035794e-07 | |
| 17 | -31622776.6017 3.77171043065e-07 | |
| 18 | -50118723.3627 4.05250267135e-07 | |
| 19 | -79432823.4724 1.31996926243e-07 | |
| 20 | -125892541.179 3.23120422483e-08 |
models/crab.xml
| ... | ... | @@ -11,12 +11,11 @@ |
| 11 | 11 | <parameter name="DEC" scale="1.0" value="22.0145" min="-90" max="90" free="0"/> |
| 12 | 12 | </spatialModel> |
| 13 | 13 | </source> |
| 14 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 15 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 16 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 14 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 15 | + <spectrum type="PowerLaw"> | |
| 16 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 17 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 18 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 17 | 19 | </spectrum> |
| 18 | - <radialModel type="Gaussian"> | |
| 19 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 20 | - </radialModel> | |
| 21 | - </source> | |
| 20 | + </source> | |
| 22 | 21 | </source_library> | ... | ... |
models/disk.xml
| ... | ... | @@ -12,12 +12,11 @@ |
| 12 | 12 | <parameter name="Radius" scale="1.0" value="0.45" min="0.01" max="10" free="1"/> |
| 13 | 13 | </spatialModel> |
| 14 | 14 | </source> |
| 15 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 16 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 17 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 15 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 16 | + <spectrum type="PowerLaw"> | |
| 17 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 18 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 19 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 18 | 20 | </spectrum> |
| 19 | - <radialModel type="Gaussian"> | |
| 20 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 21 | - </radialModel> | |
| 22 | - </source> | |
| 21 | + </source> | |
| 23 | 22 | </source_library> | ... | ... |
models/gauss.xml
| ... | ... | @@ -12,12 +12,11 @@ |
| 12 | 12 | <parameter name="Sigma" scale="1.0" value="0.20" min="0.01" max="10" free="1"/> |
| 13 | 13 | </spatialModel> |
| 14 | 14 | </source> |
| 15 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 16 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 17 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 15 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 16 | + <spectrum type="PowerLaw"> | |
| 17 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 18 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 19 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 18 | 20 | </spectrum> |
| 19 | - <radialModel type="Gaussian"> | |
| 20 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 21 | - </radialModel> | |
| 22 | - </source> | |
| 21 | + </source> | |
| 23 | 22 | </source_library> | ... | ... |
models/shell.xml
| ... | ... | @@ -13,12 +13,11 @@ |
| 13 | 13 | <parameter name="Width" scale="1.0" value="0.10" min="0.01" max="10" free="1"/> |
| 14 | 14 | </spatialModel> |
| 15 | 15 | </source> |
| 16 | - <source name="Background" type="RadialAcceptance" instrument="CTA"> | |
| 17 | - <spectrum type="FileFunction" file="$CTOOLS/share/models/bkg_dummy.txt"> | |
| 18 | - <parameter scale="1.0" name="Normalization" min="0.0" max="1000.0" value="1.0" free="1"/> | |
| 16 | + <source name="CTABackgroundModel" type="CTAIrfBackground" instrument="CTA"> | |
| 17 | + <spectrum type="PowerLaw"> | |
| 18 | + <parameter name="Prefactor" scale="1.0" value="1.0" min="1e-3" max="1e+3" free="1"/> | |
| 19 | + <parameter name="Index" scale="1.0" value="0.0" min="-5.0" max="+5.0" free="1"/> | |
| 20 | + <parameter name="Scale" scale="1e6" value="1.0" min="0.01" max="1000.0" free="0"/> | |
| 19 | 21 | </spectrum> |
| 20 | - <radialModel type="Gaussian"> | |
| 21 | - <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> | |
| 22 | - </radialModel> | |
| 23 | - </source> | |
| 22 | + </source> | |
| 24 | 23 | </source_library> | ... | ... |
pyext/ctbkgcube.i
pyext/ctools/obsutils.py
| ... | ... | @@ -26,7 +26,7 @@ import math |
| 26 | 26 | # ===================== # |
| 27 | 27 | # Simulate observations # |
| 28 | 28 | # ===================== # |
| 29 | -def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, | |
| 29 | +def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, | |
| 30 | 30 | binsz=0.05, npix=200, proj="TAN", coord="GAL"): |
| 31 | 31 | """ |
| 32 | 32 | Simulate events for all observations in the container. |
| ... | ... | @@ -55,6 +55,9 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, |
| 55 | 55 | # Optionally switch-on debugging model |
| 56 | 56 | if debug: |
| 57 | 57 | sim["debug"].boolean(True) |
| 58 | + | |
| 59 | + # Set chatter level | |
| 60 | + sim["chatter"].chatter = chatter | |
| 58 | 61 | |
| 59 | 62 | # Run ctobssim application. This will loop over all observations in the |
| 60 | 63 | # container and simulation the events for each observation. Note that |
| ... | ... | @@ -101,6 +104,9 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, |
| 101 | 104 | if debug: |
| 102 | 105 | bin["debug"].boolean(True) |
| 103 | 106 | |
| 107 | + # Set chatter level | |
| 108 | + bin["chatter"].chatter = chatter | |
| 109 | + | |
| 104 | 110 | # Run ctbin application. This will loop over all observations in |
| 105 | 111 | # the container and bin the events in counts maps |
| 106 | 112 | bin.run() |
| ... | ... | @@ -127,7 +133,7 @@ def sim(obs, log=False, debug=False, edisp=False, seed=0, nbins=0, |
| 127 | 133 | # ================ # |
| 128 | 134 | # Fit observations # |
| 129 | 135 | # ================ # |
| 130 | -def fit(obs, log=False, debug=False, edisp=False): | |
| 136 | +def fit(obs, log=False, debug=False, chatter=2, edisp=False): | |
| 131 | 137 | """ |
| 132 | 138 | Perform maximum likelihood fitting of observations in the container. |
| 133 | 139 | |
| ... | ... | @@ -148,6 +154,9 @@ def fit(obs, log=False, debug=False, edisp=False): |
| 148 | 154 | # Optionally switch-on debugging model |
| 149 | 155 | if debug: |
| 150 | 156 | like["debug"].boolean(True) |
| 157 | + | |
| 158 | + # Set chatter level | |
| 159 | + like["chatter"].chatter = chatter | |
| 151 | 160 | |
| 152 | 161 | # Optionally apply energy dispersion |
| 153 | 162 | like["edisp"].boolean(edisp) |
| ... | ... | @@ -310,7 +319,7 @@ def modmap(obs, eref=0.1, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ |
| 310 | 319 | # ===================================== # |
| 311 | 320 | def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 312 | 321 | emin=0.1, emax=100.0, rad=5.0, \ |
| 313 | - irf="cta_dummy_irf", caldb="dummy"): | |
| 322 | + irf="South_50h", caldb="prod2"): | |
| 314 | 323 | """ |
| 315 | 324 | Obsolete function, use set_obs instead. |
| 316 | 325 | """ |
| ... | ... | @@ -331,7 +340,7 @@ def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 331 | 340 | # ======================= # |
| 332 | 341 | def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 333 | 342 | emin=0.1, emax=100.0, rad=5.0, \ |
| 334 | - irf="cta_dummy_irf", caldb="dummy", id="000000", instrument="CTA"): | |
| 343 | + irf="South_50h", caldb="prod2", id="000000", instrument="CTA"): | |
| 335 | 344 | """ |
| 336 | 345 | Returns a single CTA observation containing an empty CTA event list. |
| 337 | 346 | By looping over this function you can add CTA observations to the |
| ... | ... | @@ -406,7 +415,7 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 406 | 415 | # ============================ # |
| 407 | 416 | def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 408 | 417 | emin=0.1, emax=100.0, rad=5.0, \ |
| 409 | - irf="cta_dummy_irf", caldb="dummy"): | |
| 418 | + irf="South_50h", caldb="prod2"): | |
| 410 | 419 | """ |
| 411 | 420 | Returns an observation container filled with a list of CTA observations. |
| 412 | 421 | The list is defined by the obsdeflist parameter which is a dictionnary |
| ... | ... | @@ -606,9 +615,9 @@ def spectrum(obs, source, ebounds): |
| 606 | 615 | |
| 607 | 616 | # Clone observations and reset energy thresholds |
| 608 | 617 | select = ctools.ctselect(obs) |
| 609 | - select["ra"].real(-1.0) | |
| 610 | - select["dec"].real(-1.0) | |
| 611 | - select["rad"].real(-1.0) | |
| 618 | + select["ra"].value("UNDEF") | |
| 619 | + select["dec"].value("UNDEF") | |
| 620 | + select["rad"].value("UNDEF") | |
| 612 | 621 | select["tmin"].real(0.0) |
| 613 | 622 | select["tmax"].real(0.0) |
| 614 | 623 | select["emin"].real(ebounds.emin(i).TeV()) | ... | ... |
scripts/Makefile.am
| ... | ... | @@ -6,20 +6,19 @@ binscripts = cta_kb_bkgrates.py cta_root2irf.py cta_make_nodes.py \ |
| 6 | 6 | |
| 7 | 7 | # Scripts to be distributed in pythondir |
| 8 | 8 | pythonscripts = cspull.py cssens.py cstsdist.py cscaldb.py csresmap.py cshessobs.py \ |
| 9 | - csobsdef.py csspec.py \ | |
| 10 | - lsmodel.py \ | |
| 11 | - obsutils.py | |
| 9 | + csobsdef.py csspec.py cslightcrv.py \ | |
| 10 | + lsmodel.py | |
| 12 | 11 | |
| 13 | 12 | # Scripts for which symbolic links will be created in bindir |
| 14 | 13 | linkscripts = cspull cssens cstsdist cscaldb csresmap \ |
| 15 | - csobsdef csspec cshessobs\ | |
| 14 | + csobsdef csspec cshessobs cslightcrv \ | |
| 16 | 15 | lsmodel |
| 17 | 16 | |
| 18 | 17 | # Distribute scripts |
| 19 | 18 | EXTRA_DIST = $(binscripts) $(pythonscripts) |
| 20 | 19 | binscriptsdir = $(bindir) |
| 21 | 20 | binscripts_DATA = $(binscripts) |
| 22 | -pythonscriptsdir = $(pythondir) | |
| 21 | +pythonscriptsdir = $(pythondir)/ctools | |
| 23 | 22 | pythonscripts_DATA = $(pythonscripts) |
| 24 | 23 | |
| 25 | 24 | # Add hook rule to create symbolic links for cscripts |
| ... | ... | @@ -31,7 +30,7 @@ install-data-hook: |
| 31 | 30 | @linklist='$(linkscripts)';\ |
| 32 | 31 | for p in $$linklist; do \ |
| 33 | 32 | rm -rf "$(DESTDIR)$(bindir)/$$p"; \ |
| 34 | - ln -s "$(DESTDIR)$(pythondir)/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \ | |
| 35 | - chmod +x "$(DESTDIR)$(pythondir)/$$p.py"; \ | |
| 33 | + ln -s "$(DESTDIR)$(pythondir)/ctools/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \ | |
| 34 | + chmod +x "$(DESTDIR)$(pythondir)/ctools/$$p.py"; \ | |
| 36 | 35 | done |
| 37 | 36 | ... | ... |
scripts/cshessobs.py
| ... | ... | @@ -44,6 +44,7 @@ class cshessobs(ctools.cscript): |
| 44 | 44 | # Set name |
| 45 | 45 | self.name = "cshessobs" |
| 46 | 46 | self.version = "0.1.0" |
| 47 | + self.datapath = "" | |
| 47 | 48 | |
| 48 | 49 | # Check on existence of HESSFITS environment variable |
| 49 | 50 | try: |
| ... | ... | @@ -53,7 +54,6 @@ class cshessobs(ctools.cscript): |
| 53 | 54 | "Please set the environment variable \"HESSFITS\" to use this script") |
| 54 | 55 | |
| 55 | 56 | # Initialise some members |
| 56 | - self.datapath = "" | |
| 57 | 57 | self.inmodels = None |
| 58 | 58 | self.outobs = "obs.xml" |
| 59 | 59 | self.nodes = 1 |
| ... | ... | @@ -450,7 +450,13 @@ class cshessobs(ctools.cscript): |
| 450 | 450 | # Open fits file to determine the observation name |
| 451 | 451 | fits = gammalib.GFits(eventfile) |
| 452 | 452 | object_name = fits["EVENTS"].string("OBJECT") |
| 453 | - trgrate = fits["EVENTS"].real("ZTRGRATE") | |
| 453 | + | |
| 454 | + # Retrieve trigger rate if available | |
| 455 | + trgrate = 0.0 | |
| 456 | + if fits["EVENTS"].has_card("ZTRGRATE"): | |
| 457 | + trgrate = fits["EVENTS"].real("ZTRGRATE") | |
| 458 | + | |
| 459 | + # Close FITS file | |
| 454 | 460 | fits.close() |
| 455 | 461 | |
| 456 | 462 | # Append observation to XML and set attributes | ... | ... |
scripts/cslightcrv.py
0 → 100755
| 1 | +#! /usr/bin/env python | |
| 2 | +# ========================================================================== | |
| 3 | +# Light curve generation script. | |
| 4 | +# | |
| 5 | +# Copyright (C) 2014-2015 Michael Mayer | |
| 6 | +# | |
| 7 | +# This program is free software: you can redistribute it and/or modify | |
| 8 | +# it under the terms of the GNU General Public License as published by | |
| 9 | +# the Free Software Foundation, either version 3 of the License, or | |
| 10 | +# (at your option) any later version. | |
| 11 | +# | |
| 12 | +# This program is distributed in the hope that it will be useful, | |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | +# GNU General Public License for more details. | |
| 16 | +# | |
| 17 | +# You should have received a copy of the GNU General Public License | |
| 18 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 19 | +# | |
| 20 | +# ========================================================================== | |
| 21 | +import gammalib | |
| 22 | +import ctools | |
| 23 | +import sys | |
| 24 | + | |
| 25 | +# ============ # | |
| 26 | +# csspec class # | |
| 27 | +# ============ # | |
| 28 | +class cslightcrv(ctools.cscript): | |
| 29 | + """ | |
| 30 | + This class implements the creation of a light curve. It derives from | |
| 31 | + the ctools.cscript class which provides support for parameter files, | |
| 32 | + command line arguments, and logging. In that way the Python script | |
| 33 | + behaves just as a regular ctool. | |
| 34 | + """ | |
| 35 | + def __init__(self, *argv): | |
| 36 | + """ | |
| 37 | + Constructor. | |
| 38 | + """ | |
| 39 | + | |
| 40 | + # Set name | |
| 41 | + self.name = "cslightcrv" | |
| 42 | + self.version = "1.0.0" | |
| 43 | + | |
| 44 | + # Initialise some members | |
| 45 | + self.obs = None | |
| 46 | + | |
| 47 | + # Initialise some members | |
| 48 | + if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations): | |
| 49 | + self.obs = argv[0] | |
| 50 | + argv = argv[1:] | |
| 51 | + else: | |
| 52 | + self.obs = gammalib.GObservations() | |
| 53 | + self.obs.clear() | |
| 54 | + self.m_outfile = "" | |
| 55 | + | |
| 56 | + # Make sure that parfile exists | |
| 57 | + file = self.parfile() | |
| 58 | + | |
| 59 | + # Initialise application | |
| 60 | + if len(argv) == 0: | |
| 61 | + ctools.cscript.__init__(self, self.name, self.version) | |
| 62 | + elif len(argv) ==1: | |
| 63 | + ctools.cscript.__init__(self, self.name, self.version, *argv) | |
| 64 | + else: | |
| 65 | + raise TypeError("Invalid number of arguments given.") | |
| 66 | + | |
| 67 | + # Set logger properties | |
| 68 | + self.log_header() | |
| 69 | + self.log.date(True) | |
| 70 | + | |
| 71 | + # Return | |
| 72 | + return | |
| 73 | + | |
| 74 | + def __del__(self): | |
| 75 | + """ | |
| 76 | + Destructor. | |
| 77 | + """ | |
| 78 | + # Write separator into logger | |
| 79 | + if self.logTerse(): | |
| 80 | + self.log("\n") | |
| 81 | + | |
| 82 | + # Return | |
| 83 | + return | |
| 84 | + | |
| 85 | + def parfile(self): | |
| 86 | + """ | |
| 87 | + Check if parfile exists. If parfile does not exist then create a | |
| 88 | + default parfile. This kluge avoids shipping the cscript with a parfile. | |
| 89 | + """ | |
| 90 | + # Set parfile name | |
| 91 | + parfile = self.name+".par" | |
| 92 | + | |
| 93 | + try: | |
| 94 | + pars = gammalib.GApplicationPars(parfile) | |
| 95 | + except: | |
| 96 | + # Signal if parfile was not found | |
| 97 | + sys.stdout.write("Parfile "+parfile+" not found. Create default parfile.\n") | |
| 98 | + | |
| 99 | + # Create default parfile | |
| 100 | + pars = gammalib.GApplicationPars() | |
| 101 | + pars.append(gammalib.GApplicationPar("inobs","f","a","events.fits","","","Event list, counts cube, or observation definition file")) | |
| 102 | + pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) | |
| 103 | + pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) | |
| 104 | + pars.append(gammalib.GApplicationPar("outfile","f","a","lightcurve.fits","","","Output file name")) | |
| 105 | + pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Exposure cube file (only needed for stacked analysis)")) | |
| 106 | + pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","PSF cube file (only needed for stacked analysis)")) | |
| 107 | + pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) | |
| 108 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 109 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 110 | + pars.append(gammalib.GApplicationPar("tbinalg","s","h","GTI","FILE|LIN|GTI","", "Algorithm for defining time bins")) | |
| 111 | + pars.append(gammalib.GApplicationPar("tmin","r","a","51544.5","","days","Lightcurve start time [MJD]")) | |
| 112 | + pars.append(gammalib.GApplicationPar("tmax","r","a","51544.6","","days","Lightcurve stop time [MJD]")) | |
| 113 | + pars.append(gammalib.GApplicationPar("tbins","i","a","5","","","Number of time bins")) | |
| 114 | + pars.append(gammalib.GApplicationPar("tbinfile","f","a","tbins.fits","","", "File defining the time binning")) | |
| 115 | + #pars.append(gammalib.GApplicationPar("binned","b","a","no","yes|no","","Use binned analysis in each time bin")) | |
| 116 | + pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins per light curve bin (0=unbinned)")) | |
| 117 | + pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit of events (TeV)")) | |
| 118 | + pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit of events (TeV)")) | |
| 119 | + pars.append(gammalib.GApplicationPar("coordsys","s","a","CEL","CEL|GAL","","Coordinate System")) | |
| 120 | + pars.append(gammalib.GApplicationPar("proj","s","a","CAR","AIT|AZP|CAR|MER|MOL|STG|TAN","","Projection method")) | |
| 121 | + pars.append(gammalib.GApplicationPar("xref","r","a","83.63","0","360","First coordinate of image center in degrees (RA or galactic l)")) | |
| 122 | + pars.append(gammalib.GApplicationPar("yref","r","a","22.01","-90","90","Second coordinate of image center in degrees (DEC or galactic b)")) | |
| 123 | + pars.append(gammalib.GApplicationPar("nxpix","i","a","200","","","Size of the X axis in pixels")) | |
| 124 | + pars.append(gammalib.GApplicationPar("nypix","i","a","200","","","Size of the Y axis in pixels")) | |
| 125 | + pars.append(gammalib.GApplicationPar("binsz","r","a","0.02","","","Pixel size (deg/pixel)")) | |
| 126 | + pars.append(gammalib.GApplicationPar("calc_ts","b","h","yes","yes|no","","Compute TS value for each bin?")) | |
| 127 | + pars.append(gammalib.GApplicationPar("calc_ulim","b","h","yes","yes|no","","Compute upper limit for each bin?")) | |
| 128 | + pars.append(gammalib.GApplicationPar("fix_srcs","b","h","yes","yes|no","","Fix other sky model parameters?")) | |
| 129 | + pars.append(gammalib.GApplicationPar("fix_bkg","b","h","no","yes|no","","Fix background model parameters?")) | |
| 130 | + pars.append_standard() | |
| 131 | + pars.append(gammalib.GApplicationPar("logfile","f","h","cslightcrv.log","","","Log filename")) | |
| 132 | + pars.save(parfile) | |
| 133 | + | |
| 134 | + # Return | |
| 135 | + return | |
| 136 | + | |
| 137 | + def create_tbounds(self): | |
| 138 | + | |
| 139 | + # Create time bin container | |
| 140 | + self.m_tbins = gammalib.GGti() | |
| 141 | + | |
| 142 | + # check for binning algorithm | |
| 143 | + if self["tbinalg"].string() == "FILE": | |
| 144 | + try: | |
| 145 | + self.m_tbins.load(self["tbinfile"].filename()) | |
| 146 | + except: | |
| 147 | + csv = gammalib.GCsv(self["tbinfile"].filename()) | |
| 148 | + for i in range(csv.nrows()): | |
| 149 | + tmin = gammalib.GTime() | |
| 150 | + tmax = gammalib.GTime() | |
| 151 | + tmin.mjd(csv.real(i,0)) | |
| 152 | + tmax.mjd(csv.real(i,1)) | |
| 153 | + self.m_tbins.append(tmin,tmax) | |
| 154 | + elif self["tbinalg"].string() == "LIN": | |
| 155 | + # Use linear time binning | |
| 156 | + time_min = self["tmin"].real() | |
| 157 | + time_max = self["tmax"].real() | |
| 158 | + nbins = self["tbins"].integer() | |
| 159 | + step = (time_max - time_min) / float(nbins) | |
| 160 | + for i in range(nbins): | |
| 161 | + tmin = gammalib.GTime() | |
| 162 | + tmin.mjd(time_min + i*step)# ref) | |
| 163 | + tmax = gammalib.GTime() | |
| 164 | + tmax.mjd(time_min + (i+1)*step)#ref) | |
| 165 | + self.m_tbins.append(tmin,tmax) | |
| 166 | + elif self["tbinalg"].string() == "GTI": | |
| 167 | + # Use GTIs of observations | |
| 168 | + for obs in self.obs: | |
| 169 | + for i in range(obs.events().gti().size()): | |
| 170 | + self.m_tbins.append(obs.events().gti().tstart(i),obs.events().gti().tstop(i)) | |
| 171 | + else: | |
| 172 | + raise AttributeError("tbinalg=\""+self["tbinalg"].string()+"\" unkown. Must be one of \"FILE\", \"LIN\" or \"GTI\"") | |
| 173 | + | |
| 174 | + # Return | |
| 175 | + return | |
| 176 | + | |
| 177 | + def get_parameters(self): | |
| 178 | + """ | |
| 179 | + Get parameters from parfile and setup the observation. | |
| 180 | + """ | |
| 181 | + # Set observation if not done before | |
| 182 | + if self.obs == None or self.obs.size() == 0: | |
| 183 | + self.require_inobs("cslightcrv::get_parameters()") | |
| 184 | + self.obs = self.get_observations() | |
| 185 | + | |
| 186 | + # Set models if we have none | |
| 187 | + if self.obs.models().size() == 0: | |
| 188 | + self.obs.models(self["inmodel"].filename()) | |
| 189 | + | |
| 190 | + # Get source name | |
| 191 | + self.m_srcname = self["srcname"].string() | |
| 192 | + | |
| 193 | + # Get time boundaries | |
| 194 | + self.create_tbounds() | |
| 195 | + | |
| 196 | + # Unbinned or binned analysis? | |
| 197 | + self.m_ebins = self["enumbins"].integer() | |
| 198 | + if self.m_ebins == 0: | |
| 199 | + self.m_binned = False | |
| 200 | + else: | |
| 201 | + self.m_binned = True | |
| 202 | + | |
| 203 | + # Get energy range | |
| 204 | + self.m_emin = self["emin"].real() | |
| 205 | + self.m_emax = self["emax"].real() | |
| 206 | + | |
| 207 | + # Get binning flag | |
| 208 | + #self.m_binned = self["binned"].boolean() | |
| 209 | + if self.m_binned: | |
| 210 | + self.m_coordsys = self["coordsys"].string() | |
| 211 | + self.m_proj = self["proj"].string() | |
| 212 | + self.m_xref = self["xref"].real() | |
| 213 | + self.m_yref = self["yref"].real() | |
| 214 | + self.m_nxpix = self["nxpix"].integer() | |
| 215 | + self.m_nypix = self["nypix"].integer() | |
| 216 | + self.m_binsz = self["binsz"].real() | |
| 217 | + #self.m_ebins = self["enumbins"].integer() | |
| 218 | + #self.m_emin = self["emin"].real() | |
| 219 | + #self.m_emax = self["emax"].real() | |
| 220 | + | |
| 221 | + # Read other parameters | |
| 222 | + self.m_outfile = self["outfile"].filename() | |
| 223 | + | |
| 224 | + # Get other parameeters | |
| 225 | + self.m_calc_ulimit = self["calc_ulim"].boolean() | |
| 226 | + self.m_calc_ts = self["calc_ts"].boolean() | |
| 227 | + self.m_fix_bkg = self["fix_bkg"].boolean() | |
| 228 | + self.m_fix_srcs = self["fix_srcs"].boolean() | |
| 229 | + | |
| 230 | + # Set some fixed parameters | |
| 231 | + self.m_log = False # Logging in client tools | |
| 232 | + self.m_chatter = self["chatter"].integer() | |
| 233 | + self.m_clobber = self["clobber"].boolean() | |
| 234 | + self.m_debug = self["debug"].boolean() | |
| 235 | + | |
| 236 | + # Return | |
| 237 | + return | |
| 238 | + | |
| 239 | + def models(self, models): | |
| 240 | + """ | |
| 241 | + Set model. | |
| 242 | + """ | |
| 243 | + # Copy models | |
| 244 | + self.obs.models(models.clone()) | |
| 245 | + | |
| 246 | + # Return | |
| 247 | + return | |
| 248 | + | |
| 249 | + def execute(self): | |
| 250 | + """ | |
| 251 | + Execute the script. | |
| 252 | + """ | |
| 253 | + # Run the script | |
| 254 | + self.run() | |
| 255 | + | |
| 256 | + # Save residual map | |
| 257 | + self.fits.saveto(self.m_outfile, self.m_clobber) | |
| 258 | + | |
| 259 | + # Return | |
| 260 | + return | |
| 261 | + | |
| 262 | + def run(self): | |
| 263 | + """ | |
| 264 | + Run the script. | |
| 265 | + """ | |
| 266 | + # Switch screen logging on in debug mode | |
| 267 | + if self.logDebug(): | |
| 268 | + self.log.cout(True) | |
| 269 | + | |
| 270 | + # Get parameters | |
| 271 | + self.get_parameters() | |
| 272 | + | |
| 273 | + # Write input parameters into logger | |
| 274 | + if self.logTerse(): | |
| 275 | + self.log_parameters() | |
| 276 | + self.log("\n") | |
| 277 | + | |
| 278 | + # Write observation into logger | |
| 279 | + if self.logTerse(): | |
| 280 | + self.log("\n") | |
| 281 | + self.log.header1("Observation") | |
| 282 | + self.log(str(self.obs)) | |
| 283 | + self.log("\n") | |
| 284 | + | |
| 285 | + # Write header | |
| 286 | + if self.logTerse(): | |
| 287 | + self.log("\n") | |
| 288 | + self.log.header1("Adjust model parameters") | |
| 289 | + | |
| 290 | + # Adjust model parameters dependent on input user parameters | |
| 291 | + for model in self.obs.models(): | |
| 292 | + | |
| 293 | + # Set TS flag for all models to false. | |
| 294 | + # Source of interest will be set to true later | |
| 295 | + model.tscalc(False) | |
| 296 | + | |
| 297 | + # Log model name | |
| 298 | + if self.logExplicit(): | |
| 299 | + self.log.header3(model.name()) | |
| 300 | + | |
| 301 | + # Deal with the source of interest | |
| 302 | + if model.name() == self.m_srcname: | |
| 303 | + if self.m_calc_ts: | |
| 304 | + model.tscalc(True) | |
| 305 | + | |
| 306 | + elif self.m_fix_bkg and not model.classname() == "GModelSky": | |
| 307 | + for par in model: | |
| 308 | + if par.is_free() and self.logExplicit(): | |
| 309 | + self.log(" Fixing \""+par.name()+"\"\n") | |
| 310 | + par.fix() | |
| 311 | + | |
| 312 | + elif self.m_fix_srcs and model.classname() == "GModelSky": | |
| 313 | + for par in model: | |
| 314 | + if par.is_free() and self.logExplicit(): | |
| 315 | + self.log(" Fixing \""+par.name()+"\"\n") | |
| 316 | + par.fix() | |
| 317 | + | |
| 318 | + # Write header | |
| 319 | + if self.logTerse(): | |
| 320 | + self.log("\n") | |
| 321 | + self.log.header1("Generate lightcurve") | |
| 322 | + | |
| 323 | + # Initialise FITS Table with extension "LIGHTCURVE" | |
| 324 | + table = gammalib.GFitsBinTable(self.m_tbins.size()) | |
| 325 | + table.extname("LIGHTCURVE") | |
| 326 | + | |
| 327 | + # Add Header for compatibility with gammalib.GMWLSpectrum | |
| 328 | + table.card("INSTRUME", "CTA", "Name of Instrument") | |
| 329 | + table.card("TELESCOP", "CTA", "Name of Telescope") | |
| 330 | + | |
| 331 | + # Create FITS table columns | |
| 332 | + MJD = gammalib.GFitsTableDoubleCol("MJD", self.m_tbins.size()) | |
| 333 | + MJD.unit("days") | |
| 334 | + e_MJD = gammalib.GFitsTableDoubleCol("e_MJD", self.m_tbins.size()) | |
| 335 | + e_MJD.unit("days") | |
| 336 | + | |
| 337 | + # Create a FITS column for every free parameter | |
| 338 | + columns = [] | |
| 339 | + for par in self.obs.models()[self.m_srcname]: | |
| 340 | + if par.is_free(): | |
| 341 | + col = gammalib.GFitsTableDoubleCol(par.name(), self.m_tbins.size()) | |
| 342 | + col.unit(par.unit()) | |
| 343 | + columns.append(col) | |
| 344 | + e_col = gammalib.GFitsTableDoubleCol("e_"+par.name(), self.m_tbins.size()) | |
| 345 | + e_col.unit(par.unit()) | |
| 346 | + columns.append(e_col) | |
| 347 | + | |
| 348 | + # Create TS and upper limit columns | |
| 349 | + TSvalues = gammalib.GFitsTableDoubleCol("TS", self.m_tbins.size()) | |
| 350 | + ulim_values = gammalib.GFitsTableDoubleCol("UpperLimit", self.m_tbins.size()) | |
| 351 | + ulim_values.unit("ph/cm2/s") | |
| 352 | + | |
| 353 | + # Loop over energy bins | |
| 354 | + for i in range(self.m_tbins.size()): | |
| 355 | + | |
| 356 | + # Log information | |
| 357 | + if self.logTerse(): | |
| 358 | + self.log("\n") | |
| 359 | + self.log.header2("Time bin "+str(i)) | |
| 360 | + | |
| 361 | + # Get time boundaries | |
| 362 | + tmin = self.m_tbins.tstart(i) | |
| 363 | + tmax = self.m_tbins.tstop(i) | |
| 364 | + | |
| 365 | + # Compute time bin center and time width | |
| 366 | + tmean = (tmin + tmax) | |
| 367 | + tmean *= 0.5 | |
| 368 | + twidth = (tmax - tmin) | |
| 369 | + twidth *= 0.5 | |
| 370 | + | |
| 371 | + # Store time as MJD | |
| 372 | + MJD[i] = tmean.mjd() | |
| 373 | + e_MJD[i] = twidth.days() | |
| 374 | + | |
| 375 | + # Log information | |
| 376 | + if self.logExplicit(): | |
| 377 | + self.log.header3("Selecting events") | |
| 378 | + | |
| 379 | + # Select events | |
| 380 | + select = ctools.ctselect(self.obs) | |
| 381 | + select["emin"].real(self.m_emin) | |
| 382 | + select["emax"].real(self.m_emax) | |
| 383 | + select["tmin"].real(tmin.convert(select.time_reference())) | |
| 384 | + select["tmax"].real(tmax.convert(select.time_reference())) | |
| 385 | + select["rad"].value("UNDEFINED") | |
| 386 | + select["ra"].value("UNDEFINED") | |
| 387 | + select["dec"].value("UNDEFINED") | |
| 388 | + select.run() | |
| 389 | + | |
| 390 | + # Retrieve observation | |
| 391 | + obs = select.obs() | |
| 392 | + | |
| 393 | + # Binned analysis | |
| 394 | + if self.m_binned: | |
| 395 | + | |
| 396 | + # Header | |
| 397 | + if self.logTerse(): | |
| 398 | + self.log.header3("Binning events") | |
| 399 | + | |
| 400 | + # Bin events | |
| 401 | + bin = ctools.ctbin(select.obs()) | |
| 402 | + bin["usepnt"].boolean(False) | |
| 403 | + bin["ebinalg"].string("LOG") | |
| 404 | + bin["xref"].real(self.m_xref) | |
| 405 | + bin["yref"].real(self.m_yref) | |
| 406 | + bin["binsz"].real(self.m_binsz) | |
| 407 | + bin["nxpix"].integer(self.m_nxpix) | |
| 408 | + bin["nypix"].integer(self.m_nypix) | |
| 409 | + bin["enumbins"].integer(self.m_ebins) | |
| 410 | + bin["emin"].real(self.m_emin) | |
| 411 | + bin["emax"].real(self.m_emax) | |
| 412 | + bin["coordsys"].string(self.m_coordsys) | |
| 413 | + bin["proj"].string(self.m_proj) | |
| 414 | + bin.run() | |
| 415 | + | |
| 416 | + # Header | |
| 417 | + if self.logTerse(): | |
| 418 | + self.log.header3("Creating exposure cube") | |
| 419 | + | |
| 420 | + # Create exposure cube | |
| 421 | + expcube = ctools.ctexpcube(select.obs()) | |
| 422 | + expcube["incube"].filename("NONE") | |
| 423 | + expcube["usepnt"].boolean(False) | |
| 424 | + expcube["ebinalg"].string("LOG") | |
| 425 | + expcube["xref"].real(self.m_xref) | |
| 426 | + expcube["yref"].real(self.m_yref) | |
| 427 | + expcube["binsz"].real(self.m_binsz) | |
| 428 | + expcube["nxpix"].integer(self.m_nxpix) | |
| 429 | + expcube["nypix"].integer(self.m_nypix) | |
| 430 | + expcube["enumbins"].integer(self.m_ebins) | |
| 431 | + expcube["emin"].real(self.m_emin) | |
| 432 | + expcube["emax"].real(self.m_emax) | |
| 433 | + expcube["coordsys"].string(self.m_coordsys) | |
| 434 | + expcube["proj"].string(self.m_proj) | |
| 435 | + expcube.run() | |
| 436 | + | |
| 437 | + # Header | |
| 438 | + if self.logTerse(): | |
| 439 | + self.log.header3("Creating PSF cube") | |
| 440 | + | |
| 441 | + # Create psf cube | |
| 442 | + psfcube = ctools.ctpsfcube(select.obs()) | |
| 443 | + psfcube["incube"].filename("NONE") | |
| 444 | + psfcube["usepnt"].boolean(False) | |
| 445 | + psfcube["ebinalg"].string("LOG") | |
| 446 | + psfcube["xref"].real(self.m_xref) | |
| 447 | + psfcube["yref"].real(self.m_yref) | |
| 448 | + psfcube["binsz"].real(self.m_binsz) | |
| 449 | + psfcube["nxpix"].integer(self.m_nxpix) | |
| 450 | + psfcube["nypix"].integer(self.m_nypix) | |
| 451 | + psfcube["enumbins"].integer(self.m_ebins) | |
| 452 | + psfcube["emin"].real(self.m_emin) | |
| 453 | + psfcube["emax"].real(self.m_emax) | |
| 454 | + psfcube["coordsys"].string(self.m_coordsys) | |
| 455 | + psfcube["proj"].string(self.m_proj) | |
| 456 | + psfcube.run() | |
| 457 | + | |
| 458 | + # Header | |
| 459 | + if self.logTerse(): | |
| 460 | + self.log.header3("Creating background cube") | |
| 461 | + | |
| 462 | + # Create background cube | |
| 463 | + bkgcube = ctools.ctbkgcube(select.obs()) | |
| 464 | + bkgcube["incube"].filename("NONE") | |
| 465 | + bkgcube["usepnt"].boolean(False) | |
| 466 | + bkgcube["ebinalg"].string("LOG") | |
| 467 | + bkgcube["xref"].real(self.m_xref) | |
| 468 | + bkgcube["yref"].real(self.m_yref) | |
| 469 | + bkgcube["binsz"].real(self.m_binsz) | |
| 470 | + bkgcube["nxpix"].integer(self.m_nxpix) | |
| 471 | + bkgcube["nypix"].integer(self.m_nypix) | |
| 472 | + bkgcube["enumbins"].integer(self.m_ebins) | |
| 473 | + bkgcube["emin"].real(self.m_emin) | |
| 474 | + bkgcube["emax"].real(self.m_emax) | |
| 475 | + bkgcube["coordsys"].string(self.m_coordsys) | |
| 476 | + bkgcube["proj"].string(self.m_proj) | |
| 477 | + bkgcube.run() | |
| 478 | + | |
| 479 | + # Set new binned observation | |
| 480 | + obs = bin.obs() | |
| 481 | + | |
| 482 | + # Set precomputed binned response | |
| 483 | + obs[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube()) | |
| 484 | + | |
| 485 | + # Get new models | |
| 486 | + models = bkgcube.models() | |
| 487 | + | |
| 488 | + # Fix background models if required | |
| 489 | + if self.m_fix_bkg: | |
| 490 | + for model in models: | |
| 491 | + if not model.classname() == "GModelSky": | |
| 492 | + for par in model: | |
| 493 | + par.fix() | |
| 494 | + | |
| 495 | + # Set new models to binned observation | |
| 496 | + obs.models(models) | |
| 497 | + | |
| 498 | + # Header | |
| 499 | + if self.logTerse(): | |
| 500 | + self.log.header3("Performing fit") | |
| 501 | + | |
| 502 | + # Likelihood | |
| 503 | + like = ctools.ctlike(obs) | |
| 504 | + like.run() | |
| 505 | + | |
| 506 | + # Skip bin if no event was present | |
| 507 | + if like.obs().logL() == 0.0: | |
| 508 | + | |
| 509 | + # Log information | |
| 510 | + if self.logTerse(): | |
| 511 | + self.log("No event in this time bin. Bin is skipped\n") | |
| 512 | + | |
| 513 | + # Set all values to 0 | |
| 514 | + for col in columns: | |
| 515 | + col[i] = 0.0 | |
| 516 | + TSvalues[i] = 0.0 | |
| 517 | + ulim_values[i] = 0.0 | |
| 518 | + continue | |
| 519 | + | |
| 520 | + # Get results | |
| 521 | + fitted_models = like.obs().models() | |
| 522 | + source = fitted_models[self.m_srcname] | |
| 523 | + | |
| 524 | + # Calculate Upper Limit | |
| 525 | + ulimit_value = -1.0 | |
| 526 | + if self.m_calc_ulimit: | |
| 527 | + | |
| 528 | + # Logging information | |
| 529 | + if self.logTerse(): | |
| 530 | + self.log.header3("Computing upper limit") | |
| 531 | + | |
| 532 | + # Create upper limit object | |
| 533 | + ulimit = ctools.ctulimit(like.obs()) | |
| 534 | + ulimit["srcname"].string(self.m_srcname) | |
| 535 | + ulimit["eref"].real(1.0) | |
| 536 | + | |
| 537 | + # Try to run upper limit and catch exceptions | |
| 538 | + try: | |
| 539 | + ulimit.run() | |
| 540 | + ulimit_value = ulimit.flux_ulimit() | |
| 541 | + except: | |
| 542 | + if self.logTerse(): | |
| 543 | + self.log("Upper limit calculation failed\n") | |
| 544 | + ulimit_value = -1.0 | |
| 545 | + | |
| 546 | + # Get TS value | |
| 547 | + TS = -1.0 | |
| 548 | + if self.m_calc_ts: | |
| 549 | + TS = source.ts() | |
| 550 | + | |
| 551 | + # Set values for storage | |
| 552 | + TSvalues[i] = TS | |
| 553 | + | |
| 554 | + # Set FITS column values | |
| 555 | + for col in columns: | |
| 556 | + if "e_" == col.name()[:2]: | |
| 557 | + col[i] = source.spectral()[col.name()[2:]].error() | |
| 558 | + else: | |
| 559 | + col[i] = source.spectral()[col.name()].value() | |
| 560 | + | |
| 561 | + # Store upper limit value if available | |
| 562 | + if ulimit_value > 0.0: | |
| 563 | + ulim_values[i] = ulimit_value | |
| 564 | + | |
| 565 | + # Log information | |
| 566 | + if self.logExplicit(): | |
| 567 | + self.log.header3("Results of bin "+str(i)+": MJD "+str(tmin.mjd())+"-"+str(tmax.mjd())) | |
| 568 | + for col in columns: | |
| 569 | + if "e_" == col.name()[:2]: | |
| 570 | + continue | |
| 571 | + value = source.spectral()[col.name()].value() | |
| 572 | + error = source.spectral()[col.name()].error() | |
| 573 | + unit = source.spectral()[col.name()].unit() | |
| 574 | + self.log(" > "+col.name()+": "+str(value)+" +- "+str(error)+" "+unit+"\n") | |
| 575 | + if self.m_calc_ts and TSvalues[i] > 0.0: | |
| 576 | + self.log(" > TS = "+str(TS)+" \n") | |
| 577 | + if self.m_calc_ulimit and ulim_values[i] > 0.0: | |
| 578 | + self.log(" > UL = "+str(ulim_values[i])+" [ph/cm2/s]") | |
| 579 | + self.log("\n") | |
| 580 | + | |
| 581 | + # Append filles columns to fits table | |
| 582 | + table.append(MJD) | |
| 583 | + table.append(e_MJD) | |
| 584 | + for col in columns: | |
| 585 | + table.append(col) | |
| 586 | + table.append(TSvalues) | |
| 587 | + table.append(ulim_values) | |
| 588 | + | |
| 589 | + # Create the FITS file now | |
| 590 | + self.fits = gammalib.GFits() | |
| 591 | + self.fits.append(table) | |
| 592 | + | |
| 593 | + # Return | |
| 594 | + return | |
| 595 | + | |
| 596 | + | |
| 597 | +# ======================== # | |
| 598 | +# Main routine entry point # | |
| 599 | +# ======================== # | |
| 600 | +if __name__ == '__main__': | |
| 601 | + """ | |
| 602 | + Generates light curve. | |
| 603 | + """ | |
| 604 | + # Create instance of application | |
| 605 | + app = cslightcrv(sys.argv) | |
| 606 | + | |
| 607 | + # Open logfile | |
| 608 | + app.logFileOpen() | |
| 609 | + | |
| 610 | + # Execute application | |
| 611 | + app.execute() | ... | ... |
scripts/cspull.py
| ... | ... | @@ -99,20 +99,20 @@ class cspull(ctools.cscript): |
| 99 | 99 | pars.append(gammalib.GApplicationPar("expcube","s","a","NONE","","","Exposure cube file (only needed for stacked analysis)")) |
| 100 | 100 | pars.append(gammalib.GApplicationPar("psfcube","s","a","NONE","","","PSF cube file (only needed for stacked analysis)")) |
| 101 | 101 | pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) |
| 102 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 103 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 102 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 103 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 104 | + pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) | |
| 104 | 105 | pars.append(gammalib.GApplicationPar("edisp","b","h","no","","","Apply energy dispersion?")) |
| 105 | 106 | pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) |
| 106 | 107 | pars.append(gammalib.GApplicationPar("ra","r","a","83.6331","0","360","RA of pointing (deg)")) |
| 107 | 108 | pars.append(gammalib.GApplicationPar("dec","r","a","22.0145","-90","90","Dec of pointing (deg)")) |
| 108 | 109 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) |
| 109 | 110 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) |
| 111 | + pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) | |
| 110 | 112 | pars.append(gammalib.GApplicationPar("tmin","r","h","0.0","","","Start time (MET in s)")) |
| 111 | 113 | pars.append(gammalib.GApplicationPar("tmax","r","a","1800.0","","","Duration (in s)")) |
| 112 | - pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) | |
| 113 | 114 | pars.append(gammalib.GApplicationPar("npix","i","a","200","","","Number of pixels for binned")) |
| 114 | 115 | pars.append(gammalib.GApplicationPar("binsz","r","a","0.05","","","Pixel size for binned (deg/pixel)")) |
| 115 | - pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) | |
| 116 | 116 | pars.append(gammalib.GApplicationPar("rad","r","h","5.0","0","180","Radius of ROI (deg)")) |
| 117 | 117 | pars.append(gammalib.GApplicationPar("pattern","s","h","single","","","Observation pattern (single/four)")) |
| 118 | 118 | pars.append(gammalib.GApplicationPar("offset","r","h","1.5","","","Observation pattern offset (deg)")) | ... | ... |
scripts/csresmap.py
| ... | ... | @@ -47,11 +47,11 @@ class csresmap(ctools.cscript): |
| 47 | 47 | self.resmap = None |
| 48 | 48 | |
| 49 | 49 | # Initialise some members |
| 50 | - if isinstance(argv[0],gammalib.GObservations): | |
| 50 | + if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations): | |
| 51 | 51 | self.obs = argv[0] |
| 52 | - argv = argv[1:] | |
| 52 | + argv = argv[1:] | |
| 53 | 53 | else: |
| 54 | - self.obs = gammalib.GObservations() | |
| 54 | + self.obs = gammalib.GObservations() | |
| 55 | 55 | self.obs.clear() |
| 56 | 56 | self.outfile = "" |
| 57 | 57 | |
| ... | ... | @@ -103,8 +103,8 @@ class csresmap(ctools.cscript): |
| 103 | 103 | pars.append(gammalib.GApplicationPar("inobs","f","a","events.fits","","","Event list, counts cube, or observation definition file")) |
| 104 | 104 | pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) |
| 105 | 105 | pars.append(gammalib.GApplicationPar("outmap","f","a","resmap.fits","","","Output residual map")) |
| 106 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 107 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 106 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 107 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 108 | 108 | pars.append(gammalib.GApplicationPar("ebinalg","s","h","LOG","LIN|LOG|FILE","","Binning algorithm")) |
| 109 | 109 | pars.append(gammalib.GApplicationPar("emin","r","h","0.1","","","Lower energy limit (TeV)")) |
| 110 | 110 | pars.append(gammalib.GApplicationPar("emax","r","h","100.0","","","Upper energy limit (TeV)")) | ... | ... |
scripts/cssens.py
| ... | ... | @@ -101,8 +101,8 @@ class cssens(ctools.cscript): |
| 101 | 101 | pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) |
| 102 | 102 | pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) |
| 103 | 103 | pars.append(gammalib.GApplicationPar("offset","r","h","0.0","","","Source offset angle (deg)")) |
| 104 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 105 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 104 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 105 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 106 | 106 | pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","0","1","Deadtime correction factor")) |
| 107 | 107 | pars.append(gammalib.GApplicationPar("outfile","f","h","sensitivity.dat","","","Output file name")) |
| 108 | 108 | pars.append(gammalib.GApplicationPar("duration","r","a","180000.0","","","Effective exposure time (s)")) |
| ... | ... | @@ -200,7 +200,8 @@ class cssens(ctools.cscript): |
| 200 | 200 | self.log("\n") |
| 201 | 201 | |
| 202 | 202 | # Initialise script |
| 203 | - colnames = ['loge', 'emin', 'emax', 'crab', 'pflux', 'eflux', 'diffSens'] | |
| 203 | + colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux', \ | |
| 204 | + 'energy_flux', 'sensitivity'] | |
| 204 | 205 | results = [] |
| 205 | 206 | |
| 206 | 207 | # Initialise models |
| ... | ... | @@ -412,18 +413,10 @@ class cssens(ctools.cscript): |
| 412 | 413 | # Set energy boundaries |
| 413 | 414 | self.set_obs_ebounds(emin, emax) |
| 414 | 415 | |
| 415 | - # Determine energy boundaries from first observation in | |
| 416 | - # the container | |
| 417 | - #for run in obs: | |
| 418 | - # emin = run.events().ebounds().emin() | |
| 419 | - # emax = run.events().ebounds().emax() | |
| 420 | - # loge = math.log10(math.sqrt(emin.TeV()*emax.TeV())) | |
| 421 | - # erg_mean = math.pow(10.0, loge) * tev2erg | |
| 422 | - # erg_width = (emax.TeV()-emin.TeV()) * tev2erg | |
| 423 | - # break | |
| 416 | + # Determine energy boundaries from first observation in the container | |
| 424 | 417 | loge = math.log10(math.sqrt(emin.TeV()*emax.TeV())) |
| 425 | - erg_mean = math.pow(10.0, loge) * tev2erg | |
| 426 | - erg_width = (emax.TeV()-emin.TeV()) * tev2erg | |
| 418 | + e_mean = math.pow(10.0, loge) | |
| 419 | + erg_mean = e_mean * tev2erg | |
| 427 | 420 | |
| 428 | 421 | # Compute Crab unit (this is the factor with which the Prefactor needs |
| 429 | 422 | # to be multiplied to get 1 Crab |
| ... | ... | @@ -446,12 +439,12 @@ class cssens(ctools.cscript): |
| 446 | 439 | self.log("\n") |
| 447 | 440 | |
| 448 | 441 | # Initialise loop |
| 449 | - flux_value = [] | |
| 450 | - pflux_value = [] | |
| 451 | - eflux_value = [] | |
| 452 | - diffSens_value = [] | |
| 453 | - iter = 0 | |
| 454 | - test_cflux = 0.1 # This is the initial test flux in Crab units (100 mCrab) | |
| 442 | + crab_flux_value = [] | |
| 443 | + photon_flux_value = [] | |
| 444 | + energy_flux_value = [] | |
| 445 | + sensitivity_value = [] | |
| 446 | + iter = 0 | |
| 447 | + test_crab_flux = 0.1 # Initial test flux in Crab units (100 mCrab) | |
| 455 | 448 | |
| 456 | 449 | # Loop until we break |
| 457 | 450 | while True: |
| ... | ... | @@ -463,13 +456,13 @@ class cssens(ctools.cscript): |
| 463 | 456 | if self.logExplicit(): |
| 464 | 457 | self.log.header2("Iteration "+str(iter)) |
| 465 | 458 | |
| 466 | - # Set test flux | |
| 459 | + # Set source model. crab_prefactor is the Prefactor that | |
| 460 | + # corresponds to 1 Crab | |
| 467 | 461 | src_model = full_model.copy() |
| 468 | 462 | crab_prefactor = src_model[self.m_srcname]['Prefactor'].value() * crab_unit |
| 469 | - src_model[self.m_srcname]['Prefactor'].value(crab_prefactor * test_cflux) | |
| 463 | + src_model[self.m_srcname]['Prefactor'].value(crab_prefactor * test_crab_flux) | |
| 470 | 464 | obs.models(src_model) |
| 471 | 465 | |
| 472 | - | |
| 473 | 466 | # Simulate events |
| 474 | 467 | sim = obsutils.sim(obs, nbins=self.m_enumbins, seed=iter, \ |
| 475 | 468 | binsz=self.m_binsz, npix=self.m_npix, \ |
| ... | ... | @@ -572,48 +565,45 @@ class cssens(ctools.cscript): |
| 572 | 565 | continue |
| 573 | 566 | |
| 574 | 567 | # Get fitted Crab, photon and energy fluxes |
| 575 | - cflux = result_all[self.m_srcname]['Prefactor'].value() / crab_prefactor | |
| 576 | - cflux_err = result_all[self.m_srcname]['Prefactor'].error() / crab_prefactor | |
| 577 | - pflux = result_all[self.m_srcname].spectral().flux(emin, emax) | |
| 578 | - eflux = result_all[self.m_srcname].spectral().eflux(emin, emax) | |
| 568 | + crab_flux = result_all[self.m_srcname]['Prefactor'].value() / crab_prefactor | |
| 569 | + crab_flux_err = result_all[self.m_srcname]['Prefactor'].error() / crab_prefactor | |
| 570 | + photon_flux = result_all[self.m_srcname].spectral().flux(emin, emax) | |
| 571 | + energy_flux = result_all[self.m_srcname].spectral().eflux(emin, emax) | |
| 579 | 572 | |
| 580 | - # Compute differential sensitivity | |
| 581 | - diffSens = pflux / erg_width * erg_mean*erg_mean | |
| 573 | + # Compute differential sensitivity in unit erg/cm2/s | |
| 574 | + energy = gammalib.GEnergy(e_mean, "TeV") | |
| 575 | + time = gammalib.GTime() | |
| 576 | + sensitivity = result_all[self.m_srcname].spectral().eval(energy, time) * \ | |
| 577 | + erg_mean*erg_mean * 1.0e6 | |
| 582 | 578 | |
| 583 | 579 | # Compute flux correction factor based on average TS |
| 584 | 580 | correct = 1.0 |
| 585 | 581 | if ts > 0: |
| 586 | 582 | correct = math.sqrt(self.m_ts_thres/ts) |
| 587 | - #if self.m_use_ts: | |
| 588 | - # if ts > 0: | |
| 589 | - # correct = math.sqrt(self.m_ts_thres/ts) | |
| 590 | - #else: | |
| 591 | - # if cflux > 0 and cflux_err > 0: | |
| 592 | - # correct = math.sqrt(self.m_ts_thres)/(cflux/cflux_err) | |
| 593 | 583 | |
| 594 | 584 | # Compute extrapolated fluxes |
| 595 | - flux = correct * cflux | |
| 596 | - pflux = correct * pflux | |
| 597 | - eflux = correct * eflux | |
| 598 | - diffSens = correct * diffSens | |
| 599 | - flux_value.append(flux) | |
| 600 | - pflux_value.append(pflux) | |
| 601 | - eflux_value.append(eflux) | |
| 602 | - diffSens_value.append(diffSens) | |
| 585 | + crab_flux = correct * crab_flux | |
| 586 | + photon_flux = correct * photon_flux | |
| 587 | + energy_flux = correct * energy_flux | |
| 588 | + sensitivity = correct * sensitivity | |
| 589 | + crab_flux_value.append(crab_flux) | |
| 590 | + photon_flux_value.append(photon_flux) | |
| 591 | + energy_flux_value.append(energy_flux) | |
| 592 | + sensitivity_value.append(sensitivity) | |
| 603 | 593 | |
| 604 | 594 | # Write background and test source fit results |
| 605 | 595 | if self.logExplicit(): |
| 606 | 596 | self.log.parformat("Photon flux") |
| 607 | - self.log(pflux) | |
| 597 | + self.log(photon_flux) | |
| 608 | 598 | self.log(" ph/cm2/s\n") |
| 609 | 599 | self.log.parformat("Energy flux") |
| 610 | - self.log(eflux) | |
| 600 | + self.log(energy_flux) | |
| 611 | 601 | self.log(" erg/cm2/s\n") |
| 612 | 602 | self.log.parformat("Crab flux") |
| 613 | - self.log(cflux*1000.0) | |
| 603 | + self.log(crab_flux*1000.0) | |
| 614 | 604 | self.log(" mCrab\n") |
| 615 | 605 | self.log.parformat("Differential sensitivity") |
| 616 | - self.log(diffSens) | |
| 606 | + self.log(sensitivity) | |
| 617 | 607 | self.log(" erg/cm2/s\n") |
| 618 | 608 | for model in result_all: |
| 619 | 609 | self.log.parformat("Model") |
| ... | ... | @@ -629,40 +619,40 @@ class cssens(ctools.cscript): |
| 629 | 619 | self.log("corr=") |
| 630 | 620 | self.log(correct) |
| 631 | 621 | self.log(" ") |
| 632 | - self.log(pflux) | |
| 622 | + self.log(photon_flux) | |
| 633 | 623 | self.log(" ph/cm2/s = ") |
| 634 | - self.log(eflux) | |
| 624 | + self.log(energy_flux) | |
| 635 | 625 | self.log(" erg/cm2/s = ") |
| 636 | - self.log(cflux*1000.0) | |
| 626 | + self.log(crab_flux*1000.0) | |
| 637 | 627 | self.log(" mCrab = ") |
| 638 | - self.log(diffSens) | |
| 628 | + self.log(sensitivity) | |
| 639 | 629 | self.log(" erg/cm2/s\n") |
| 640 | 630 | |
| 641 | 631 | # Compute sliding average of extrapolated fitted prefactor, |
| 642 | 632 | # photon and energy flux. This damps out fluctuations and |
| 643 | 633 | # improves convergence |
| 644 | - flux = 0.0 | |
| 645 | - pflux = 0.0 | |
| 646 | - eflux = 0.0 | |
| 647 | - diffSens = 0.0 | |
| 648 | - num = 0.0 | |
| 634 | + crab_flux = 0.0 | |
| 635 | + photon_flux = 0.0 | |
| 636 | + energy_flux = 0.0 | |
| 637 | + sensitivity = 0.0 | |
| 638 | + num = 0.0 | |
| 649 | 639 | for k in range(self.m_num_avg): |
| 650 | - inx = len(flux_value) - k - 1 | |
| 640 | + inx = len(crab_flux_value) - k - 1 | |
| 651 | 641 | if inx >= 0: |
| 652 | - flux += flux_value[inx] | |
| 653 | - pflux += pflux_value[inx] | |
| 654 | - eflux += eflux_value[inx] | |
| 655 | - diffSens += diffSens_value[inx] | |
| 642 | + crab_flux += crab_flux_value[inx] | |
| 643 | + photon_flux += photon_flux_value[inx] | |
| 644 | + energy_flux += energy_flux_value[inx] | |
| 645 | + sensitivity += sensitivity_value[inx] | |
| 656 | 646 | num += 1.0 |
| 657 | - flux /= num | |
| 658 | - pflux /= num | |
| 659 | - eflux /= num | |
| 660 | - diffSens /= num | |
| 647 | + crab_flux /= num | |
| 648 | + photon_flux /= num | |
| 649 | + energy_flux /= num | |
| 650 | + sensitivity /= num | |
| 661 | 651 | |
| 662 | 652 | # Compare average flux to last average |
| 663 | 653 | if iter > self.m_num_avg: |
| 664 | - if test_cflux > 0: | |
| 665 | - ratio = flux/test_cflux | |
| 654 | + if test_crab_flux > 0: | |
| 655 | + ratio = crab_flux/test_crab_flux | |
| 666 | 656 | |
| 667 | 657 | # We have 2 convergence criteria: |
| 668 | 658 | # 1. The average flux does not change |
| ... | ... | @@ -678,7 +668,7 @@ class cssens(ctools.cscript): |
| 678 | 668 | break |
| 679 | 669 | |
| 680 | 670 | # Use average for next iteration |
| 681 | - test_cflux = flux | |
| 671 | + test_crab_flux = crab_flux | |
| 682 | 672 | |
| 683 | 673 | # Exit loop if number of trials exhausted |
| 684 | 674 | if (iter >= self.m_max_iter): |
| ... | ... | @@ -693,16 +683,16 @@ class cssens(ctools.cscript): |
| 693 | 683 | self.log(ts) |
| 694 | 684 | self.log("\n") |
| 695 | 685 | self.log.parformat("Photon flux") |
| 696 | - self.log(pflux) | |
| 686 | + self.log(photon_flux) | |
| 697 | 687 | self.log(" ph/cm2/s\n") |
| 698 | 688 | self.log.parformat("Energy flux") |
| 699 | - self.log(eflux) | |
| 689 | + self.log(energy_flux) | |
| 700 | 690 | self.log(" erg/cm2/s\n") |
| 701 | 691 | self.log.parformat("Crab flux") |
| 702 | - self.log(cflux*1000.0) | |
| 692 | + self.log(crab_flux*1000.0) | |
| 703 | 693 | self.log(" mCrab\n") |
| 704 | 694 | self.log.parformat("Differential sensitivity") |
| 705 | - self.log(diffSens) | |
| 695 | + self.log(sensitivity) | |
| 706 | 696 | self.log(" erg/cm2/s\n") |
| 707 | 697 | self.log.parformat("Number of simulated events") |
| 708 | 698 | self.log(nevents) |
| ... | ... | @@ -736,8 +726,9 @@ class cssens(ctools.cscript): |
| 736 | 726 | |
| 737 | 727 | # Store result |
| 738 | 728 | result = {'loge': loge, 'emin': emin.TeV(), 'emax': emax.TeV(), \ |
| 739 | - 'crab': flux, 'pflux': pflux, 'eflux': eflux, \ | |
| 740 | - 'diffSens': diffSens} | |
| 729 | + 'crab_flux': crab_flux, 'photon_flux': photon_flux, \ | |
| 730 | + 'energy_flux': energy_flux, \ | |
| 731 | + 'sensitivity': sensitivity} | |
| 741 | 732 | |
| 742 | 733 | # Return result |
| 743 | 734 | return result | ... | ... |
scripts/csspec.py
| ... | ... | @@ -21,10 +21,11 @@ |
| 21 | 21 | import gammalib |
| 22 | 22 | import ctools |
| 23 | 23 | import sys |
| 24 | +import tempfile | |
| 24 | 25 | |
| 25 | -# ============== # | |
| 26 | -# cstsdist class # | |
| 27 | -# ============== # | |
| 26 | +# ============ # | |
| 27 | +# csspec class # | |
| 28 | +# ============ # | |
| 28 | 29 | class csspec(ctools.cscript): |
| 29 | 30 | """ |
| 30 | 31 | This class implements the creation of spectral points. It derives from |
| ... | ... | @@ -42,14 +43,14 @@ class csspec(ctools.cscript): |
| 42 | 43 | self.version = "1.0.0" |
| 43 | 44 | |
| 44 | 45 | # Initialise some members |
| 45 | - self.obs = None | |
| 46 | + self.obs = None | |
| 46 | 47 | |
| 47 | 48 | # Initialise some members |
| 48 | - if isinstance(argv[0],gammalib.GObservations): | |
| 49 | + if len(argv) > 0 and isinstance(argv[0],gammalib.GObservations): | |
| 49 | 50 | self.obs = argv[0] |
| 50 | - argv = argv[1:] | |
| 51 | + argv = argv[1:] | |
| 51 | 52 | else: |
| 52 | - self.obs = gammalib.GObservations() | |
| 53 | + self.obs = gammalib.GObservations() | |
| 53 | 54 | self.obs.clear() |
| 54 | 55 | self.m_outfile = "" |
| 55 | 56 | |
| ... | ... | @@ -104,12 +105,22 @@ class csspec(ctools.cscript): |
| 104 | 105 | pars.append(gammalib.GApplicationPar("outfile","f","a","spectrum.fits","","","Output file name")) |
| 105 | 106 | pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Exposure cube file (only needed for stacked analysis)")) |
| 106 | 107 | pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","PSF cube file (only needed for stacked analysis)")) |
| 107 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 108 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 109 | - pars.append(gammalib.GApplicationPar("emin","r","h","0.1","","","Lower energy limit (TeV)")) | |
| 110 | - pars.append(gammalib.GApplicationPar("emax","r","h","100.0","","","Upper energy limit (TeV)")) | |
| 111 | - pars.append(gammalib.GApplicationPar("enumbins","i","a","20","","","Number of energy bins")) | |
| 112 | - pars.append(gammalib.GApplicationPar("ebinalg","s","h","LOG","LIN|LOG|FILE","","Binning algorithm")) | |
| 108 | + pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) | |
| 109 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 110 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 111 | + pars.append(gammalib.GApplicationPar("emin","r","h","0.1","","","Lower energy limit for spectral points(TeV)")) | |
| 112 | + pars.append(gammalib.GApplicationPar("emax","r","h","100.0","","","Upper energy limit for spectral points(TeV)")) | |
| 113 | + pars.append(gammalib.GApplicationPar("enumbins","i","a","20","","","Number of spectral points")) | |
| 114 | + pars.append(gammalib.GApplicationPar("ebinalg","s", "h","LOG","FILE|LIN|LOG","", "Algorithm for defining energy bins")) | |
| 115 | + pars.append(gammalib.GApplicationPar("binned","b","a","no","yes|no","","Use binned analysis in each energy bin")) | |
| 116 | + pars.append(gammalib.GApplicationPar("nebins","i","h","5","","","Number of energy bins per spectral point")) | |
| 117 | + pars.append(gammalib.GApplicationPar("coordsys","s","a","CEL","CEL|GAL","","Coordinate System")) | |
| 118 | + pars.append(gammalib.GApplicationPar("proj","s","a","CAR","AIT|AZP|CAR|MER|MOL|STG|TAN","","Projection method")) | |
| 119 | + pars.append(gammalib.GApplicationPar("xref","r","a","83.63","0","360","First coordinate of image center in degrees (RA or galactic l)")) | |
| 120 | + pars.append(gammalib.GApplicationPar("yref","r","a","22.01","-90","90","Second coordinate of image center in degrees (DEC or galactic b)")) | |
| 121 | + pars.append(gammalib.GApplicationPar("nxpix","i","a","200","","","Size of the X axis in pixels")) | |
| 122 | + pars.append(gammalib.GApplicationPar("nypix","i","a","200","","","Size of the Y axis in pixels")) | |
| 123 | + pars.append(gammalib.GApplicationPar("binsz","r","a","0.02","","","Pixel size (deg/pixel)")) | |
| 113 | 124 | pars.append(gammalib.GApplicationPar("calc_ts","b","h","yes","yes|no","","Compute TS value in each bin")) |
| 114 | 125 | pars.append(gammalib.GApplicationPar("calc_ulim","b","h","yes","yes|no","","Compute upper limit in each bin")) |
| 115 | 126 | pars.append(gammalib.GApplicationPar("fix_srcs","b","h","yes","yes|no","","Fix other skymodel parameters")) |
| ... | ... | @@ -125,7 +136,6 @@ class csspec(ctools.cscript): |
| 125 | 136 | """ |
| 126 | 137 | Get parameters from parfile and setup the observation. |
| 127 | 138 | """ |
| 128 | - # Get parameters | |
| 129 | 139 | # Set observation if not done before |
| 130 | 140 | if self.obs == None or self.obs.size() == 0: |
| 131 | 141 | self.require_inobs("csspec::get_parameters()") |
| ... | ... | @@ -138,9 +148,21 @@ class csspec(ctools.cscript): |
| 138 | 148 | # Get source name |
| 139 | 149 | self.m_srcname = self["srcname"].string() |
| 140 | 150 | |
| 141 | - # Get ebounds | |
| 151 | + # Get ebounds | |
| 142 | 152 | self.m_ebounds = self.create_ebounds() |
| 143 | 153 | |
| 154 | + # Get binning flag | |
| 155 | + self.m_binned = self["binned"].boolean() | |
| 156 | + if self.m_binned: | |
| 157 | + self.m_xref = self["xref"].real() | |
| 158 | + self.m_yref = self["yref"].real() | |
| 159 | + self.m_nxpix = self["nxpix"].integer() | |
| 160 | + self.m_nypix = self["nypix"].integer() | |
| 161 | + self.m_binsz = self["binsz"].real() | |
| 162 | + self.m_coordsys = self["coordsys"].string() | |
| 163 | + self.m_proj = self["proj"].string() | |
| 164 | + self.m_ebins = self["nebins"].integer() | |
| 165 | + | |
| 144 | 166 | # Read other parameters |
| 145 | 167 | self.m_outfile = self["outfile"].filename() |
| 146 | 168 | |
| ... | ... | @@ -210,21 +232,39 @@ class csspec(ctools.cscript): |
| 210 | 232 | self.log("\n") |
| 211 | 233 | self.log.header1("Adjust model parameters") |
| 212 | 234 | |
| 235 | + # Adjust model parameters dependent on input user parameters | |
| 213 | 236 | for model in self.obs.models(): |
| 237 | + | |
| 238 | + # Set TS flag for all models to false. | |
| 239 | + # Source of interest will be set to true later | |
| 214 | 240 | model.tscalc(False) |
| 241 | + | |
| 242 | + # Log model name | |
| 243 | + if self.logExplicit(): | |
| 244 | + self.log.header3(model.name()) | |
| 245 | + | |
| 246 | + # Deal with the source of interest | |
| 215 | 247 | if model.name() == self.m_srcname: |
| 216 | 248 | for par in model: |
| 249 | + if par.is_free() and self.logExplicit(): | |
| 250 | + self.log(" Fixing \""+par.name()+"\"\n") | |
| 217 | 251 | par.fix() |
| 252 | + if par.is_fixed() and self.logExplicit(): | |
| 253 | + self.log(" Freeing \""+par.name()+"\"\n") | |
| 218 | 254 | model.spectral()[0].free() |
| 219 | 255 | if self.m_calc_ts: |
| 220 | 256 | model.tscalc(True) |
| 221 | 257 | |
| 222 | - elif self.m_fix_bkg and not model.classname() == "GModelData": | |
| 258 | + elif self.m_fix_bkg and not model.classname() == "GModelSky": | |
| 223 | 259 | for par in model: |
| 260 | + if par.is_free() and self.logExplicit(): | |
| 261 | + self.log(" Fixing \""+par.name()+"\"\n") | |
| 224 | 262 | par.fix() |
| 225 | 263 | |
| 226 | 264 | elif self.m_fix_srcs and model.classname() == "GModelSky": |
| 227 | 265 | for par in model: |
| 266 | + if par.is_free() and self.logExplicit(): | |
| 267 | + self.log(" Fixing \""+par.name()+"\"\n") | |
| 228 | 268 | par.fix() |
| 229 | 269 | |
| 230 | 270 | # Write header |
| ... | ... | @@ -237,14 +277,16 @@ class csspec(ctools.cscript): |
| 237 | 277 | table.extname("SPECTRUM") |
| 238 | 278 | |
| 239 | 279 | # Add Header for compatibility with gammalib.GMWLSpectrum |
| 240 | - table.card("Instrument", "CTA", "Name of Instrument") | |
| 241 | - table.card("Telescope", "CTA", "Name of Telescope") | |
| 280 | + table.card("INSTRUME", "CTA", "Name of Instrument") | |
| 281 | + table.card("TELESCOP", "CTA", "Name of Telescope") | |
| 242 | 282 | |
| 243 | 283 | # Create FITS table columns |
| 244 | 284 | energy = gammalib.GFitsTableDoubleCol("Energy", self.m_ebounds.size()) |
| 245 | 285 | energy.unit("TeV") |
| 246 | - energy_err = gammalib.GFitsTableDoubleCol("e_Energy", self.m_ebounds.size()) | |
| 247 | - energy_err.unit("TeV") | |
| 286 | + energy_low = gammalib.GFitsTableDoubleCol("ed_Energy", self.m_ebounds.size()) | |
| 287 | + energy_low.unit("TeV") | |
| 288 | + energy_high = gammalib.GFitsTableDoubleCol("eu_Energy", self.m_ebounds.size()) | |
| 289 | + energy_high.unit("TeV") | |
| 248 | 290 | flux = gammalib.GFitsTableDoubleCol("Flux", self.m_ebounds.size()) |
| 249 | 291 | flux.unit("erg/cm2/s") |
| 250 | 292 | flux_err = gammalib.GFitsTableDoubleCol("e_Flux", self.m_ebounds.size()) |
| ... | ... | @@ -252,16 +294,31 @@ class csspec(ctools.cscript): |
| 252 | 294 | TSvalues = gammalib.GFitsTableDoubleCol("TS", self.m_ebounds.size()) |
| 253 | 295 | ulim_values = gammalib.GFitsTableDoubleCol("UpperLimit", self.m_ebounds.size()) |
| 254 | 296 | ulim_values.unit("erg/cm2/s") |
| 255 | - | |
| 297 | + | |
| 256 | 298 | # Loop over energy bins |
| 257 | 299 | for i in range(self.m_ebounds.size()): |
| 258 | 300 | |
| 301 | + # Log information | |
| 302 | + if self.logTerse(): | |
| 303 | + self.log("\n") | |
| 304 | + self.log.header2("Energy bin "+str(i)) | |
| 305 | + | |
| 259 | 306 | # Get energy boundaries |
| 260 | 307 | emin = self.m_ebounds.emin(i) |
| 261 | 308 | emax = self.m_ebounds.emax(i) |
| 262 | - emean = self.m_ebounds.emean(i) | |
| 263 | 309 | elogmean = self.m_ebounds.elogmean(i) |
| 264 | - elogmean2 = elogmean.MeV() * elogmean.MeV() | |
| 310 | + elogmean2 = elogmean.MeV() * elogmean.MeV() | |
| 311 | + | |
| 312 | + # Store energy as TeV | |
| 313 | + energy[i] = elogmean.TeV() | |
| 314 | + | |
| 315 | + # Store energy errors | |
| 316 | + energy_low[i] = (elogmean - emin).TeV() | |
| 317 | + energy_high[i] = (emax - elogmean).TeV() | |
| 318 | + | |
| 319 | + # Log information | |
| 320 | + if self.logExplicit(): | |
| 321 | + self.log.header3("Selecting events") | |
| 265 | 322 | |
| 266 | 323 | # Select events |
| 267 | 324 | select = ctools.ctselect(self.obs) |
| ... | ... | @@ -272,23 +329,163 @@ class csspec(ctools.cscript): |
| 272 | 329 | select["rad"].value("UNDEFINED") |
| 273 | 330 | select["ra"].value("UNDEFINED") |
| 274 | 331 | select["dec"].value("UNDEFINED") |
| 275 | - select.run() | |
| 276 | - | |
| 277 | - # likelihood | |
| 278 | - like = ctools.ctlike(select.obs()) | |
| 332 | + select.run() | |
| 333 | + | |
| 334 | + # Retrieve observation | |
| 335 | + obs = select.obs() | |
| 336 | + | |
| 337 | + # Binned analysis | |
| 338 | + if self.m_binned: | |
| 339 | + | |
| 340 | + # Header | |
| 341 | + if self.logTerse(): | |
| 342 | + self.log.header3("Binning events") | |
| 343 | + | |
| 344 | + # Bin events | |
| 345 | + bin = ctools.ctbin(select.obs()) | |
| 346 | + bin["usepnt"].boolean(False) | |
| 347 | + bin["ebinalg"].string("LOG") | |
| 348 | + bin["xref"].real(self.m_xref) | |
| 349 | + bin["yref"].real(self.m_yref) | |
| 350 | + bin["binsz"].real(self.m_binsz) | |
| 351 | + bin["nxpix"].integer(self.m_nxpix) | |
| 352 | + bin["nypix"].integer(self.m_nypix) | |
| 353 | + bin["enumbins"].integer(self.m_ebins) | |
| 354 | + bin["emin"].real(emin.TeV()) | |
| 355 | + bin["emax"].real(emax.TeV()) | |
| 356 | + bin["coordsys"].string(self.m_coordsys) | |
| 357 | + bin["proj"].string(self.m_proj) | |
| 358 | + bin.run() | |
| 359 | + | |
| 360 | + # Header | |
| 361 | + if self.logTerse(): | |
| 362 | + self.log.header3("Creating exposure cube") | |
| 363 | + | |
| 364 | + # Create exposure cube | |
| 365 | + expcube = ctools.ctexpcube(select.obs()) | |
| 366 | + expcube["incube"].filename("NONE") | |
| 367 | + expcube["usepnt"].boolean(False) | |
| 368 | + expcube["ebinalg"].string("LOG") | |
| 369 | + expcube["xref"].real(self.m_xref) | |
| 370 | + expcube["yref"].real(self.m_yref) | |
| 371 | + expcube["binsz"].real(self.m_binsz) | |
| 372 | + expcube["nxpix"].integer(self.m_nxpix) | |
| 373 | + expcube["nypix"].integer(self.m_nypix) | |
| 374 | + expcube["enumbins"].integer(self.m_ebins) | |
| 375 | + expcube["emin"].real(emin.TeV()) | |
| 376 | + expcube["emax"].real(emax.TeV()) | |
| 377 | + expcube["coordsys"].string(self.m_coordsys) | |
| 378 | + expcube["proj"].string(self.m_proj) | |
| 379 | + expcube.run() | |
| 380 | + | |
| 381 | + # Header | |
| 382 | + if self.logTerse(): | |
| 383 | + self.log.header3("Creating PSF cube") | |
| 384 | + | |
| 385 | + # Create psf cube | |
| 386 | + psfcube = ctools.ctpsfcube(select.obs()) | |
| 387 | + psfcube["incube"].filename("NONE") | |
| 388 | + psfcube["usepnt"].boolean(False) | |
| 389 | + psfcube["ebinalg"].string("LOG") | |
| 390 | + psfcube["xref"].real(self.m_xref) | |
| 391 | + psfcube["yref"].real(self.m_yref) | |
| 392 | + psfcube["binsz"].real(self.m_binsz) | |
| 393 | + psfcube["nxpix"].integer(self.m_nxpix) | |
| 394 | + psfcube["nypix"].integer(self.m_nypix) | |
| 395 | + psfcube["enumbins"].integer(self.m_ebins) | |
| 396 | + psfcube["emin"].real(emin.TeV()) | |
| 397 | + psfcube["emax"].real(emax.TeV()) | |
| 398 | + psfcube["coordsys"].string(self.m_coordsys) | |
| 399 | + psfcube["proj"].string(self.m_proj) | |
| 400 | + psfcube.run() | |
| 401 | + | |
| 402 | + # Header | |
| 403 | + if self.logTerse(): | |
| 404 | + self.log.header3("Creating background cube") | |
| 405 | + | |
| 406 | + # Create background cube | |
| 407 | + bkgcube = ctools.ctbkgcube(select.obs()) | |
| 408 | + bkgcube["incube"].filename("NONE") | |
| 409 | + bkgcube["usepnt"].boolean(False) | |
| 410 | + bkgcube["ebinalg"].string("LOG") | |
| 411 | + bkgcube["xref"].real(self.m_xref) | |
| 412 | + bkgcube["yref"].real(self.m_yref) | |
| 413 | + bkgcube["binsz"].real(self.m_binsz) | |
| 414 | + bkgcube["nxpix"].integer(self.m_nxpix) | |
| 415 | + bkgcube["nypix"].integer(self.m_nypix) | |
| 416 | + bkgcube["enumbins"].integer(self.m_ebins) | |
| 417 | + bkgcube["emin"].real(emin.TeV()) | |
| 418 | + bkgcube["emax"].real(emax.TeV()) | |
| 419 | + bkgcube["coordsys"].string(self.m_coordsys) | |
| 420 | + bkgcube["proj"].string(self.m_proj) | |
| 421 | + bkgcube.run() | |
| 422 | + | |
| 423 | + # Set new binned observation | |
| 424 | + obs = bin.obs() | |
| 425 | + | |
| 426 | + # Set precomputed binned response | |
| 427 | + obs[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube()) | |
| 428 | + | |
| 429 | + # Get new models | |
| 430 | + models = bkgcube.models() | |
| 431 | + | |
| 432 | + # Fix background models if required | |
| 433 | + if self.m_fix_bkg: | |
| 434 | + for model in models: | |
| 435 | + if not model.classname() == "GModelSky": | |
| 436 | + for par in model: | |
| 437 | + par.fix() | |
| 438 | + | |
| 439 | + # Set new models to binned observation | |
| 440 | + obs.models(models) | |
| 441 | + | |
| 442 | + # Header | |
| 443 | + if self.logTerse(): | |
| 444 | + self.log.header3("Performing fit") | |
| 445 | + | |
| 446 | + # Likelihood | |
| 447 | + like = ctools.ctlike(obs) | |
| 279 | 448 | like.run() |
| 280 | 449 | |
| 450 | + # Skip bin if no event was present | |
| 451 | + if like.obs().logL() == 0.0: | |
| 452 | + | |
| 453 | + # Log information | |
| 454 | + if self.logTerse(): | |
| 455 | + self.log("No event in this bin. Bin is skipped\n") | |
| 456 | + | |
| 457 | + # Set all values to 0 | |
| 458 | + flux[i] = 0.0 | |
| 459 | + flux_err[i] = 0.0 | |
| 460 | + TSvalues[i] = 0.0 | |
| 461 | + ulim_values[i] = 0.0 | |
| 462 | + continue | |
| 463 | + | |
| 281 | 464 | # Get results |
| 282 | 465 | fitted_models = like.obs().models() |
| 283 | 466 | source = fitted_models[self.m_srcname] |
| 284 | - | |
| 467 | + | |
| 285 | 468 | # Calculate Upper Limit |
| 286 | 469 | ulimit_value = -1.0 |
| 287 | - #if self.m_calc_ulimit: | |
| 288 | - # ulimit = ctools.ctulimit(like.obs()) | |
| 289 | - # ulimit["eref"].real(elogmean.TeV()) | |
| 290 | - # ulimit.run() | |
| 291 | - # ulimit_value.ulimit.diff_ulimit() | |
| 470 | + if self.m_calc_ulimit: | |
| 471 | + | |
| 472 | + # Logging information | |
| 473 | + if self.logTerse(): | |
| 474 | + self.log.header3("Computing upper limit") | |
| 475 | + | |
| 476 | + # Create upper limit object | |
| 477 | + ulimit = ctools.ctulimit(like.obs()) | |
| 478 | + ulimit["srcname"].string(self.m_srcname) | |
| 479 | + ulimit["eref"].real(elogmean.TeV()) | |
| 480 | + | |
| 481 | + # Try to run upper limit and catch exceptions | |
| 482 | + try: | |
| 483 | + ulimit.run() | |
| 484 | + ulimit_value = ulimit.diff_ulimit() | |
| 485 | + except: | |
| 486 | + if self.logTerse(): | |
| 487 | + self.log("Upper limit calculation failed\n") | |
| 488 | + ulimit_value = -1.0 | |
| 292 | 489 | |
| 293 | 490 | # Get TS value |
| 294 | 491 | TS = -1.0 |
| ... | ... | @@ -306,19 +503,12 @@ class csspec(ctools.cscript): |
| 306 | 503 | # Set values for storage |
| 307 | 504 | TSvalues[i] = TS |
| 308 | 505 | |
| 309 | - # Store energy as TeV | |
| 310 | - energy[i] = elogmean.TeV() | |
| 311 | - | |
| 312 | - # Store energy error | |
| 313 | - energy_err[i] = (emax - emean).TeV() | |
| 314 | - | |
| 315 | 506 | # Convert fluxes to nuFnu |
| 316 | 507 | flux[i] = fitted_flux * elogmean2 * gammalib.MeV2erg |
| 317 | 508 | flux_err[i] = e_flux * elogmean2 * gammalib.MeV2erg |
| 318 | 509 | if ulimit_value > 0.0: |
| 319 | 510 | ulim_values[i] = ulimit_value * elogmean2 * gammalib.MeV2erg |
| 320 | - | |
| 321 | - | |
| 511 | + | |
| 322 | 512 | # Log information |
| 323 | 513 | if self.logExplicit(): |
| 324 | 514 | self.log("Bin "+str(i)+" ["+str(emin.TeV())+"-"+str(emax.TeV())+"] TeV: ") |
| ... | ... | @@ -329,10 +519,11 @@ class csspec(ctools.cscript): |
| 329 | 519 | if self.m_calc_ulimit and ulim_values[i] > 0.0: |
| 330 | 520 | self.log(", UL = "+str(ulim_values[i])+" [erg/cm2/s]") |
| 331 | 521 | self.log("\n") |
| 332 | - | |
| 522 | + | |
| 333 | 523 | # Append filles columns to fits table |
| 334 | 524 | table.append(energy) |
| 335 | - table.append(energy_err) | |
| 525 | + table.append(energy_low) | |
| 526 | + table.append(energy_high) | |
| 336 | 527 | table.append(flux) |
| 337 | 528 | table.append(flux_err) |
| 338 | 529 | table.append(TSvalues) | ... | ... |
scripts/cstsdist.py
| ... | ... | @@ -95,27 +95,29 @@ class cstsdist(ctools.cscript): |
| 95 | 95 | # Create default parfile |
| 96 | 96 | pars = gammalib.GApplicationPars() |
| 97 | 97 | pars.append(gammalib.GApplicationPar("inobs","f","h","NONE","","","Event list, counts cube, or observation definition file")) |
| 98 | - pars.append(gammalib.GApplicationPar("outfile","f","h","ts.dat","","","Output file name")) | |
| 98 | + pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Source model")) | |
| 99 | + pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) | |
| 100 | + pars.append(gammalib.GApplicationPar("outfile","f","a","ts.dat","","","Output file name")) | |
| 99 | 101 | pars.append(gammalib.GApplicationPar("expcube","s","a","NONE","","","Exposure cube file (only needed for stacked analysis)")) |
| 100 | 102 | pars.append(gammalib.GApplicationPar("psfcube","s","a","NONE","","","PSF cube file (only needed for stacked analysis)")) |
| 101 | - pars.append(gammalib.GApplicationPar("caldb","s","a","dummy","","","Calibration database")) | |
| 102 | - pars.append(gammalib.GApplicationPar("irf","s","a","cta_dummy_irf","","","Instrument response function")) | |
| 103 | - pars.append(gammalib.GApplicationPar("ra","r","h","83.63","0","360","RA of pointing (deg)")) | |
| 104 | - pars.append(gammalib.GApplicationPar("dec","r","h","22.01","-90","90","Dec of pointing (deg)")) | |
| 103 | + pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Background cube file (only needed for stacked analysis)")) | |
| 104 | + pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) | |
| 105 | + pars.append(gammalib.GApplicationPar("irf","s","a","South_50h","","","Instrument response function")) | |
| 106 | + pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","","","Deadtime correction factor")) | |
| 107 | + pars.append(gammalib.GApplicationPar("edisp","b","h","no","","","Apply energy dispersion?")) | |
| 108 | + pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) | |
| 109 | + pars.append(gammalib.GApplicationPar("ra","r","a","83.63","0","360","RA of pointing (deg)")) | |
| 110 | + pars.append(gammalib.GApplicationPar("dec","r","a","22.01","-90","90","Dec of pointing (deg)")) | |
| 105 | 111 | pars.append(gammalib.GApplicationPar("emin","r","a","0.1","","","Lower energy limit (TeV)")) |
| 106 | 112 | pars.append(gammalib.GApplicationPar("emax","r","a","100.0","","","Upper energy limit (TeV)")) |
| 113 | + pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) | |
| 107 | 114 | pars.append(gammalib.GApplicationPar("tmin","r","h","0.0","","","Start time (MET in s)")) |
| 108 | 115 | pars.append(gammalib.GApplicationPar("tmax","r","a","1800.0","","","Observation duration (in s)")) |
| 109 | - pars.append(gammalib.GApplicationPar("enumbins","i","a","0","","","Number of energy bins (0=unbinned)")) | |
| 110 | - pars.append(gammalib.GApplicationPar("npix","i","h","200","","","Number of pixels for binned")) | |
| 111 | - pars.append(gammalib.GApplicationPar("binsz","r","h","0.05","","","Pixel size for binned (deg/pixel)")) | |
| 112 | - pars.append(gammalib.GApplicationPar("deadc","r","h","0.95","","","Deadtime correction factor")) | |
| 116 | + pars.append(gammalib.GApplicationPar("npix","i","a","200","","","Number of pixels for binned")) | |
| 117 | + pars.append(gammalib.GApplicationPar("binsz","r","a","0.05","","","Pixel size for binned (deg/pixel)")) | |
| 113 | 118 | pars.append(gammalib.GApplicationPar("rad","r","h","5.0","","","Radius of ROI (deg)")) |
| 114 | - pars.append(gammalib.GApplicationPar("ntrials","i","a","10","","","Number of trials")) | |
| 115 | - pars.append(gammalib.GApplicationPar("type","s","a","point","","","Source model type (point/gauss/shell/disk)")) | |
| 116 | - pars.append(gammalib.GApplicationPar("index","r","h","-2.48","","","Spectral index")) | |
| 117 | - pars.append(gammalib.GApplicationPar("offset","r","a","0.0","","","Source offset angle (deg)")) | |
| 118 | - pars.append(gammalib.GApplicationPar("bkg","s","a","$CTOOLS/share/models/bkg_dummy.txt","","","Background model file function")) | |
| 119 | + pars.append(gammalib.GApplicationPar("pattern","s","h","single","","","Observation pattern (single/four)")) | |
| 120 | + pars.append(gammalib.GApplicationPar("offset","r","h","1.5","","","Observation pattern offset (deg)")) | |
| 119 | 121 | pars.append_standard() |
| 120 | 122 | pars.append(gammalib.GApplicationPar("logfile","f","h","cstsdist.log","","","Log filename")) |
| 121 | 123 | pars.save(parfile) |
| ... | ... | @@ -131,6 +133,15 @@ class cstsdist(ctools.cscript): |
| 131 | 133 | # Set observation if not done before |
| 132 | 134 | if self.obs == None or self.obs.size() == 0: |
| 133 | 135 | self.obs = self.get_observations() |
| 136 | + | |
| 137 | + # Check for requested pattern and use above | |
| 138 | + # observation parameters to set wobble pattern | |
| 139 | + self.m_pattern = self["pattern"].string() | |
| 140 | + if self.m_pattern == "four": | |
| 141 | + self.obs = self.set_obs() | |
| 142 | + | |
| 143 | + # Get source name | |
| 144 | + self.m_srcname = self["srcname"].string() | |
| 134 | 145 | |
| 135 | 146 | # Get number of energy bins |
| 136 | 147 | self.m_enumbins = self["enumbins"].integer() |
| ... | ... | @@ -143,36 +154,21 @@ class cstsdist(ctools.cscript): |
| 143 | 154 | # Set dummy values (required by obsutils) |
| 144 | 155 | self.m_npix = 0 |
| 145 | 156 | self.m_binsz = 0.0 |
| 157 | + | |
| 158 | + # Set models if we have none | |
| 159 | + if self.obs.models().size() == 0: | |
| 160 | + self.obs.models(self["inmodel"].filename()) | |
| 146 | 161 | |
| 147 | 162 | # Get other parameters |
| 148 | - self.m_outfile = self["outfile"].filename() | |
| 149 | - self.m_ntrials = self["ntrials"].integer() | |
| 150 | - self.m_type = self["type"].string() | |
| 151 | - self.m_index = self["index"].real() | |
| 152 | - self.m_offset = self["offset"].real() | |
| 153 | - self.m_bkg = self["bkg"].string() | |
| 163 | + self.m_outfile = self["outfile"].filename() | |
| 164 | + self.m_ntrials = self["ntrials"].integer() | |
| 165 | + self.m_edisp = self["edisp"].boolean() | |
| 166 | + self.m_offset = self["offset"].real() | |
| 154 | 167 | |
| 155 | 168 | # Set some fixed parameters |
| 156 | - self.m_log = False # Logging in client tools | |
| 157 | - self.m_debug = False # Debugging in client tools | |
| 158 | - | |
| 159 | - pnt = gammalib.GSkyDir() | |
| 160 | - pnt.radec_deg(self["ra"].real(),self["dec"].real()) | |
| 161 | - | |
| 162 | - # Initialise models. Note that we centre the point source at the | |
| 163 | - # center of our observation, so we're onaxis. | |
| 164 | - self.bkg_model = gammalib.GModels() | |
| 165 | - self.full_model = gammalib.GModels() | |
| 166 | - self.bkg_model.append(self.set_bkg_model()) | |
| 167 | - self.full_model.append(self.set_bkg_model()) | |
| 168 | - self.full_model.append(self.set_src_model(pnt.l_deg(), pnt.b_deg()+self.m_offset, \ | |
| 169 | - flux=0.010, \ | |
| 170 | - type=self.m_type, \ | |
| 171 | - index=self.m_index)) | |
| 172 | - | |
| 173 | - # Attach background model to observation container | |
| 174 | - self.obs.models(self.bkg_model) | |
| 175 | - | |
| 169 | + self.m_log = False # Logging in client tools | |
| 170 | + self.m_debug = self["debug"].boolean() # Debugging in client tools | |
| 171 | + | |
| 176 | 172 | # Return |
| 177 | 173 | return |
| 178 | 174 | |
| ... | ... | @@ -211,6 +207,20 @@ class cstsdist(ctools.cscript): |
| 211 | 207 | if self.logTerse(): |
| 212 | 208 | self.log_parameters() |
| 213 | 209 | self.log("\n") |
| 210 | + | |
| 211 | + # Initialise models | |
| 212 | + full_model, bkg_model = self.set_models() | |
| 213 | + | |
| 214 | + # Write models into logger | |
| 215 | + if self.logTerse(): | |
| 216 | + self.log("\n") | |
| 217 | + self.log.header1("Models") | |
| 218 | + self.log.header2("Background model") | |
| 219 | + self.log(str(bkg_model)) | |
| 220 | + self.log("\n\n") | |
| 221 | + self.log.header2("Full model") | |
| 222 | + self.log(str(full_model)) | |
| 223 | + self.log("\n") | |
| 214 | 224 | |
| 215 | 225 | # Write observation into logger |
| 216 | 226 | if self.logTerse(): |
| ... | ... | @@ -235,7 +245,7 @@ class cstsdist(ctools.cscript): |
| 235 | 245 | for seed in range(self.m_ntrials): |
| 236 | 246 | |
| 237 | 247 | # Make a trial |
| 238 | - result = self.trial(seed) | |
| 248 | + result = self.trial(seed, full_model, bkg_model) | |
| 239 | 249 | |
| 240 | 250 | # Write out result immediately |
| 241 | 251 | if seed == 0: |
| ... | ... | @@ -251,97 +261,89 @@ class cstsdist(ctools.cscript): |
| 251 | 261 | # Return |
| 252 | 262 | return |
| 253 | 263 | |
| 254 | - def set_bkg_model(self, fitsigma=False): | |
| 264 | + def set_models(self, fitpos=False, fitspec=False): | |
| 255 | 265 | """ |
| 256 | - Setup CTA background model. | |
| 266 | + Set full and background model. | |
| 257 | 267 | """ |
| 258 | - # Define radial component | |
| 259 | - radial = gammalib.GCTAModelRadialGauss(3.0) | |
| 260 | - if fitsigma: | |
| 261 | - radial["Sigma"].free() | |
| 262 | - else: | |
| 263 | - radial["Sigma"].fix() | |
| 264 | - | |
| 265 | - # Define spectral component | |
| 266 | - spectrum = gammalib.GModelSpectralFunc(self.m_bkg, 1.0) | |
| 268 | + # Retrieve full model from observation container | |
| 269 | + full_model = self.obs.models().copy() | |
| 270 | + | |
| 271 | + # Get source model | |
| 272 | + model = full_model[self.m_srcname] | |
| 267 | 273 | |
| 268 | - # Create background model | |
| 269 | - model = gammalib.GCTAModelRadialAcceptance(radial, spectrum) | |
| 270 | - model.name("Background") | |
| 271 | - model.instruments("CTA") | |
| 272 | - | |
| 273 | - # Return background model | |
| 274 | - return model | |
| 275 | - | |
| 276 | - def set_src_model(self, l, b, flux=1.0, index=-2.48, \ | |
| 277 | - type="point", sigma=1.0, radius=1.0, width=0.1, \ | |
| 278 | - fitpos=False, fitidx=False): | |
| 279 | - """ | |
| 280 | - Returns a single source with Crab-like spectrum. The source flux | |
| 281 | - can be scaled in Crab units. The Crab spectrum is based on MAGIC | |
| 282 | - observations (Albert et al. 2008, ApJ, 674, 1037). | |
| 274 | + # Check that model has a Prefactor | |
| 275 | + if not model.has_par("Prefactor"): | |
| 276 | + msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ | |
| 277 | + " Only spectral models with a \"Prefactor\" parameter are supported." | |
| 278 | + raise gammalib.GException.invalid_value("cssens", msg) | |
| 283 | 279 | |
| 284 | - Parameters: | |
| 285 | - l - Galactic longitude of source location [deg] | |
| 286 | - b - Galactic latitude of source location [deg] | |
| 287 | - Keywords: | |
| 288 | - flux - Source flux [Crabs] | |
| 289 | - index - Spectral index | |
| 290 | - type - Source type ("point", "gauss", "disk", "shell") | |
| 291 | - sigma - Gaussian sigma (for type="gauss") | |
| 292 | - radius - Disk or shell inner radius [deg] (for type="disk" and type="shell") | |
| 293 | - width - Shell width [deg] (for type="shell") | |
| 294 | - fitpos - Fit position? (default: True) | |
| 295 | - fitidx - Fit index? (default: True) | |
| 296 | - """ | |
| 297 | - # Set source location | |
| 298 | - location = gammalib.GSkyDir() | |
| 299 | - location.lb_deg(l, b) | |
| 300 | - | |
| 301 | - # Set source spectrum | |
| 302 | - spectrum = gammalib.GModelSpectralPlaw(flux*5.7e-16, index, gammalib.GEnergy(0.3, "TeV")) | |
| 303 | - if fitidx: | |
| 304 | - spectrum["Index"].free() | |
| 280 | + # Fit or fix spatial parameters | |
| 281 | + if fitpos: | |
| 282 | + if model.has_par("RA"): | |
| 283 | + model["RA"].free() | |
| 284 | + if model.has_par("DEC"): | |
| 285 | + model["DEC"].free() | |
| 286 | + if model.has_par("Sigma"): | |
| 287 | + model["Sigma"].free() | |
| 288 | + if model.has_par("Radius"): | |
| 289 | + model["Radius"].free() | |
| 290 | + if model.has_par("Width"): | |
| 291 | + model["Width"].free() | |
| 305 | 292 | else: |
| 306 | - spectrum["Index"].fix() | |
| 307 | - | |
| 308 | - # Set source | |
| 309 | - if type == "point": | |
| 310 | - spatial = gammalib.GModelSpatialPointSource(location) | |
| 311 | - if fitpos: | |
| 312 | - spatial[0].free() | |
| 313 | - spatial[1].free() | |
| 314 | - elif type == "gauss": | |
| 315 | - spatial = gammalib.GModelSpatialRadialGauss(location, sigma) | |
| 316 | - if fitpos: | |
| 317 | - spatial[0].free() | |
| 318 | - spatial[1].free() | |
| 319 | - elif type == "disk": | |
| 320 | - spatial = gammalib.GModelSpatialRadialDisk(location, radius) | |
| 321 | - if fitpos: | |
| 322 | - spatial[0].free() | |
| 323 | - spatial[1].free() | |
| 324 | - elif type == "shell": | |
| 325 | - spatial = gammalib.GModelSpatialRadialShell(location, radius, width) | |
| 326 | - if fitpos: | |
| 327 | - spatial[0].free() | |
| 328 | - spatial[1].free() | |
| 293 | + if model.has_par("RA"): | |
| 294 | + model["RA"].fix() | |
| 295 | + if model.has_par("DEC"): | |
| 296 | + model["DEC"].fix() | |
| 297 | + if model.has_par("Sigma"): | |
| 298 | + model["Sigma"].fix() | |
| 299 | + if model.has_par("Radius"): | |
| 300 | + model["Radius"].fix() | |
| 301 | + if model.has_par("Width"): | |
| 302 | + model["Width"].fix() | |
| 303 | + | |
| 304 | + # Fit or fix spectral parameters | |
| 305 | + if fitspec: | |
| 306 | + if model.has_par("Index"): | |
| 307 | + model["Index"].free() | |
| 308 | + if model.has_par("Cutoff"): | |
| 309 | + model["Cutoff"].free() | |
| 329 | 310 | else: |
| 330 | - self.log("ERROR: Unknown source type '"+type+"'.\n") | |
| 331 | - return None | |
| 332 | - source = gammalib.GModelSky(spatial, spectrum) | |
| 311 | + if model.has_par("Index"): | |
| 312 | + model["Index"].fix() | |
| 313 | + if model.has_par("Cutoff"): | |
| 314 | + model["Cutoff"].fix() | |
| 333 | 315 | |
| 334 | - # Set source name | |
| 335 | - source.name("Test") | |
| 316 | + # Create background model | |
| 317 | + bkg_model = full_model.copy() | |
| 318 | + bkg_model.remove(self.m_srcname) | |
| 319 | + | |
| 320 | + # Return models | |
| 321 | + return full_model, bkg_model | |
| 322 | + | |
| 323 | + def set_obs(self): | |
| 324 | + """ | |
| 325 | + Returns an observation container with a set of CTA observations. | |
| 336 | 326 | |
| 337 | - # Turn TS value computation off | |
| 338 | - # since we compute it by hand later on | |
| 339 | - source.tscalc(False) | |
| 340 | - | |
| 341 | - # Return source | |
| 342 | - return source | |
| 327 | + Keywords: | |
| 328 | + """ | |
| 329 | + | |
| 330 | + # Setup observation definition list | |
| 331 | + obsdeflist = obsutils.set_obs_patterns(self.m_pattern, \ | |
| 332 | + ra=self["ra"].real(), dec=self["dec"].real(), \ | |
| 333 | + offset=self["offset"].real()) | |
| 334 | + | |
| 335 | + # Create list of observations | |
| 336 | + obs = obsutils.set_obs_list(obsdeflist, \ | |
| 337 | + tstart=self["tmin"].real(), duration=self["tmax"].real()-self["tmin"].real(), \ | |
| 338 | + deadc=self["deadc"].real(), \ | |
| 339 | + emin=self["emin"].real(), emax=self["emax"].real(), \ | |
| 340 | + rad=self["rad"].real(), \ | |
| 341 | + irf=self["irf"].string(), caldb=self["caldb"].string()) | |
| 343 | 342 | |
| 344 | - def trial(self, seed): | |
| 343 | + # Return observation container | |
| 344 | + return obs | |
| 345 | + | |
| 346 | + def trial(self, seed, full_model, bkg_model): | |
| 345 | 347 | """ |
| 346 | 348 | Create the TS for a single trial. |
| 347 | 349 | |
| ... | ... | @@ -373,9 +375,9 @@ class cstsdist(ctools.cscript): |
| 373 | 375 | self.log("\n") |
| 374 | 376 | |
| 375 | 377 | # Fit background only |
| 376 | - sim.models(self.bkg_model) | |
| 378 | + sim.models(bkg_model) | |
| 377 | 379 | like_bgm = obsutils.fit(sim, log=self.m_log, debug=self.m_debug) |
| 378 | - result_bgm = like_bgm.obs().models() | |
| 380 | + result_bgm = like_bgm.obs().models().copy() | |
| 379 | 381 | LogL_bgm = like_bgm.opt().value() |
| 380 | 382 | npred_bgm = like_bgm.obs().npred() |
| 381 | 383 | |
| ... | ... | @@ -396,9 +398,9 @@ class cstsdist(ctools.cscript): |
| 396 | 398 | self.log(str(par)+"\n") |
| 397 | 399 | |
| 398 | 400 | # Fit background and test source |
| 399 | - sim.models(self.full_model) | |
| 401 | + sim.models(full_model) | |
| 400 | 402 | like_all = obsutils.fit(sim, log=self.m_log, debug=self.m_debug) |
| 401 | - result_all = like_all.obs().models() | |
| 403 | + result_all = like_all.obs().models().copy() | |
| 402 | 404 | LogL_all = like_all.opt().value() |
| 403 | 405 | npred_all = like_all.obs().npred() |
| 404 | 406 | ts = 2.0*(LogL_bgm-LogL_all) |
| ... | ... | @@ -428,9 +430,9 @@ class cstsdist(ctools.cscript): |
| 428 | 430 | self.log("TS=") |
| 429 | 431 | self.log(ts) |
| 430 | 432 | self.log(" Prefactor=") |
| 431 | - self.log(result_all["Test"]["Prefactor"].value()) | |
| 433 | + self.log(result_all[self.m_srcname]["Prefactor"].value()) | |
| 432 | 434 | self.log("+/-") |
| 433 | - self.log(result_all["Test"]["Prefactor"].error()) | |
| 435 | + self.log(result_all[self.m_srcname]["Prefactor"].error()) | |
| 434 | 436 | self.log("\n") |
| 435 | 437 | |
| 436 | 438 | # Initialise results | ... | ... |
scripts/obsutils.py deleted
src/ctbin/ctbin.cpp
| ... | ... | @@ -455,6 +455,15 @@ void ctbin::fill_cube(GCTAObservation* obs) |
| 455 | 455 | // Get the RoI |
| 456 | 456 | const GCTARoi& roi = events->roi(); |
| 457 | 457 | |
| 458 | + // Check for RoI sanity | |
| 459 | + if (!roi.is_valid()) { | |
| 460 | + std::string msg = "No RoI information found in input observation " | |
| 461 | + "\""+obs->name()+"\". Run ctselect to specify " | |
| 462 | + "an RoI for this observation before running " | |
| 463 | + "ctbin."; | |
| 464 | + throw GException::invalid_value(G_FILL_CUBE, msg); | |
| 465 | + } | |
| 466 | + | |
| 458 | 467 | // Initialise binning statistics |
| 459 | 468 | int num_outside_roi = 0; |
| 460 | 469 | int num_outside_map = 0; | ... | ... |
src/ctbkgcube/ctbkgcube.hpp
| ... | ... | @@ -59,7 +59,7 @@ public: |
| 59 | 59 | void clear(void); |
| 60 | 60 | void run(void); |
| 61 | 61 | void save(void); |
| 62 | - const GCTACubeBackground& cube(void) const; | |
| 62 | + const GCTACubeBackground& bkgcube(void) const; | |
| 63 | 63 | const GModels& models(void) const; |
| 64 | 64 | |
| 65 | 65 | protected: |
| ... | ... | @@ -86,7 +86,7 @@ protected: |
| 86 | 86 | * @return Background response cube. |
| 87 | 87 | ***************************************************************************/ |
| 88 | 88 | inline |
| 89 | -const GCTACubeBackground& ctbkgcube::cube(void) const | |
| 89 | +const GCTACubeBackground& ctbkgcube::bkgcube(void) const | |
| 90 | 90 | { |
| 91 | 91 | // Return background cube |
| 92 | 92 | return (m_background); | ... | ... |
src/ctbkgcube/ctbkgcube.par
| ... | ... | @@ -22,8 +22,8 @@ inmodel, f, a, "NONE",,, "Input model XML file" |
| 22 | 22 | incube, f, a, "NONE",,, "Counts cube for background cube definition" |
| 23 | 23 | outcube, f, a, "bkgcube.fits",,, "Output background cube file" |
| 24 | 24 | outmodel, f, a, "NONE",,, "Output model XML file" |
| 25 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 26 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 25 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 26 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 27 | 27 | # |
| 28 | 28 | # Energy binning parameters |
| 29 | 29 | #========================== | ... | ... |
src/ctbutterfly/ctbutterfly.par
| ... | ... | @@ -23,8 +23,8 @@ srcname, s, a, "Crab",,,"Source of interest" |
| 23 | 23 | expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" |
| 24 | 24 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 25 | 25 | bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" |
| 26 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 27 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 26 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 27 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 28 | 28 | outfile, f, a, "butterfly.txt",,, "Output ascii file" |
| 29 | 29 | matrix, f, h, "NONE",,, "Input covariance Matrix FITS file" |
| 30 | 30 | ... | ... |
src/ctexpcube/ctexpcube.par
| ... | ... | @@ -20,8 +20,8 @@ |
| 20 | 20 | inobs, f, a, "NONE",,, "Event list or observation definition file" |
| 21 | 21 | incube, f, a, "NONE",,, "Counts cube for exposure cube definition" |
| 22 | 22 | outcube, f, a, "expcube.fits",,, "Output exposure cube file" |
| 23 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 24 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 23 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 24 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 25 | 25 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 26 | 26 | # |
| 27 | 27 | # Energy binning parameters | ... | ... |
src/ctlike/ctlike.cpp
| ... | ... | @@ -401,6 +401,14 @@ void ctlike::get_parameters(void) |
| 401 | 401 | m_outmodel = (*this)["outmodel"].filename(); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | + // Set optimizer logger | |
| 405 | + if (logTerse()) { | |
| 406 | + static_cast<GOptimizerLM*>(m_opt)->logger(&log); | |
| 407 | + } | |
| 408 | + else { | |
| 409 | + static_cast<GOptimizerLM*>(m_opt)->logger(NULL); | |
| 410 | + } | |
| 411 | + | |
| 404 | 412 | // Return |
| 405 | 413 | return; |
| 406 | 414 | } |
| ... | ... | @@ -411,22 +419,6 @@ void ctlike::get_parameters(void) |
| 411 | 419 | ***************************************************************************/ |
| 412 | 420 | void ctlike::optimize_lm(void) |
| 413 | 421 | { |
| 414 | - // Free any existing optimizer | |
| 415 | - if (m_opt != NULL) delete m_opt; | |
| 416 | - m_opt = NULL; | |
| 417 | - | |
| 418 | - // Allocate optimizer. The logger is only passed to the optimizer | |
| 419 | - // constructor if optimizer logging is requested. | |
| 420 | - GOptimizerLM* opt = (logTerse()) ? new GOptimizerLM(log) | |
| 421 | - : new GOptimizerLM(); | |
| 422 | - | |
| 423 | - // Assign optimizer | |
| 424 | - m_opt = opt; | |
| 425 | - | |
| 426 | - // Set optimizer parameters | |
| 427 | - opt->max_iter(m_max_iter); | |
| 428 | - opt->max_stalls(m_max_stall); | |
| 429 | - | |
| 430 | 422 | // Write Header for optimization and indent for optimizer logging |
| 431 | 423 | if (logTerse()) { |
| 432 | 424 | log << std::endl; |
| ... | ... | @@ -435,7 +427,7 @@ void ctlike::optimize_lm(void) |
| 435 | 427 | } |
| 436 | 428 | |
| 437 | 429 | // Perform LM optimization |
| 438 | - m_obs.optimize(*opt); | |
| 430 | + m_obs.optimize(*m_opt); | |
| 439 | 431 | |
| 440 | 432 | // Optionally refit |
| 441 | 433 | if (m_refit) { |
| ... | ... | @@ -449,15 +441,15 @@ void ctlike::optimize_lm(void) |
| 449 | 441 | } |
| 450 | 442 | |
| 451 | 443 | // Optimise again |
| 452 | - m_obs.optimize(*opt); | |
| 444 | + m_obs.optimize(*m_opt); | |
| 453 | 445 | |
| 454 | 446 | } |
| 455 | 447 | |
| 456 | 448 | // Compute errors |
| 457 | - m_obs.errors(*opt); | |
| 449 | + m_obs.errors(*m_opt); | |
| 458 | 450 | |
| 459 | 451 | // Store maximum log likelihood value |
| 460 | - m_logL = -(opt->value()); | |
| 452 | + m_logL = -(m_opt->value()); | |
| 461 | 453 | |
| 462 | 454 | // Remove indent |
| 463 | 455 | log.indent(0); |
| ... | ... | @@ -473,15 +465,6 @@ void ctlike::optimize_lm(void) |
| 473 | 465 | ***************************************************************************/ |
| 474 | 466 | double ctlike::reoptimize_lm(void) |
| 475 | 467 | { |
| 476 | - // Allocate optimizer. The logger is only passed to the optimizer | |
| 477 | - // constructor if optimizer logging is requested. | |
| 478 | - GOptimizerLM* opt = (logTerse()) ? new GOptimizerLM(log) | |
| 479 | - : new GOptimizerLM(); | |
| 480 | - | |
| 481 | - // Set optimizer parameters | |
| 482 | - opt->max_iter(m_max_iter); | |
| 483 | - opt->max_stalls(m_max_stall); | |
| 484 | - | |
| 485 | 468 | // Write Header for optimization and indent for optimizer logging |
| 486 | 469 | if (logTerse()) { |
| 487 | 470 | log << std::endl; |
| ... | ... | @@ -490,22 +473,22 @@ double ctlike::reoptimize_lm(void) |
| 490 | 473 | } |
| 491 | 474 | |
| 492 | 475 | // Perform LM optimization |
| 493 | - m_obs.optimize(*opt); | |
| 476 | + m_obs.optimize(*m_opt); | |
| 494 | 477 | |
| 495 | 478 | // Optionally refit |
| 496 | 479 | if (m_refit) { |
| 497 | - m_obs.optimize(*opt); | |
| 480 | + m_obs.optimize(*m_opt); | |
| 498 | 481 | } |
| 499 | 482 | |
| 500 | 483 | // Store maximum log likelihood value |
| 501 | - double logL = -(opt->value()); | |
| 484 | + double logL = -(m_opt->value()); | |
| 502 | 485 | |
| 503 | 486 | // Write optimization results |
| 504 | 487 | log.indent(0); |
| 505 | 488 | if (logTerse()) { |
| 506 | 489 | log << std::endl; |
| 507 | 490 | log.header1("Maximum likelihood re-optimization results"); |
| 508 | - log << *opt << std::endl; | |
| 491 | + log << *m_opt << std::endl; | |
| 509 | 492 | } |
| 510 | 493 | |
| 511 | 494 | // Return |
| ... | ... | @@ -537,6 +520,16 @@ void ctlike::init_members(void) |
| 537 | 520 | // Set logger properties |
| 538 | 521 | log.date(true); |
| 539 | 522 | |
| 523 | + // Allocate LM optimizer | |
| 524 | + GOptimizerLM* opt = new GOptimizerLM(); | |
| 525 | + | |
| 526 | + // Set optimizer parameters | |
| 527 | + opt->max_iter(m_max_iter); | |
| 528 | + opt->max_stalls(m_max_stall); | |
| 529 | + | |
| 530 | + // Set optimizer pointer | |
| 531 | + m_opt = opt; | |
| 532 | + | |
| 540 | 533 | // Return |
| 541 | 534 | return; |
| 542 | 535 | } |
| ... | ... | @@ -551,7 +544,7 @@ void ctlike::copy_members(const ctlike& app) |
| 551 | 544 | { |
| 552 | 545 | // Copy attributes |
| 553 | 546 | m_refit = app.m_refit; |
| 554 | - m_outmodel = app.m_outmodel; | |
| 547 | + m_outmodel = app.m_outmodel; | |
| 555 | 548 | m_obs = app.m_obs; |
| 556 | 549 | m_max_iter = app.m_max_iter; |
| 557 | 550 | m_max_stall = app.m_max_stall; | ... | ... |
src/ctlike/ctlike.par
| ... | ... | @@ -22,8 +22,8 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" |
| 22 | 22 | expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" |
| 23 | 23 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 24 | 24 | bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" |
| 25 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 26 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 25 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 26 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 27 | 27 | outmodel, f, a, "crab_results.xml",,, "Source model output file" |
| 28 | 28 | stat, s, h, "POISSON",,, "Optimization statistics" |
| 29 | 29 | edisp, b, h, no,,, "Apply energy dispersion?" | ... | ... |
src/ctmodel/ctmodel.par
| ... | ... | @@ -28,8 +28,8 @@ inobs, f, a, "NONE",,, "Event list, counts cube or observation definition fil |
| 28 | 28 | expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" |
| 29 | 29 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 30 | 30 | bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" |
| 31 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 32 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 31 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 32 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 33 | 33 | ra, r, a, 83.63,0,360, "RA of pointing (degrees)" |
| 34 | 34 | dec, r, a, 22.01,-90,90, "Dec of pointing (degrees)" |
| 35 | 35 | rad, r, a, 5.0,0,180, "Radius of FOV (degrees)" | ... | ... |
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -730,8 +730,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 730 | 730 | GEnergy e_true_min = emin; |
| 731 | 731 | GEnergy e_true_max = emax; |
| 732 | 732 | if (rsp->use_edisp()) { |
| 733 | - e_true_min = rsp->ebounds_src(e_true_min).emin(); | |
| 734 | - e_true_max = rsp->ebounds_src(e_true_max).emax(); | |
| 733 | + e_true_min = rsp->ebounds(e_true_min).emin(); | |
| 734 | + e_true_max = rsp->ebounds(e_true_max).emax(); | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | // Dump energy range |
| ... | ... | @@ -762,7 +762,6 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 762 | 762 | // number of simulated photons to m_max_photons. |
| 763 | 763 | // The photon rate is estimated from the model flux |
| 764 | 764 | // and used to set the duration of the time slice. |
| 765 | - //double flux = model->spectral()->flux(emin, emax); | |
| 766 | 765 | double flux = get_model_flux(model, emin, emax, |
| 767 | 766 | dir, rad); |
| 768 | 767 | double rate = flux * m_area; |
| ... | ... | @@ -966,7 +965,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 966 | 965 | * |
| 967 | 966 | * @param[in] model Sky model. |
| 968 | 967 | * @param[in] emin Minimum energy. |
| 969 | - * @param[in] emin Maximum energy. | |
| 968 | + * @param[in] emax Maximum energy. | |
| 970 | 969 | * @param[in] centre Centre of region for photon rate determination. |
| 971 | 970 | * @param[in] radius Radius of region for photon rate determination. |
| 972 | 971 | * @return Model flux (photons/cm2/sec). | ... | ... |
src/ctobssim/ctobssim.par
| ... | ... | @@ -24,8 +24,8 @@ prefix, s, h, "sim_events_",,, "Prefix for event lists in observation definit |
| 24 | 24 | # |
| 25 | 25 | # Observation parameters |
| 26 | 26 | #======================= |
| 27 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 28 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 27 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 28 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 29 | 29 | # |
| 30 | 30 | # Simulation parameters |
| 31 | 31 | #====================== | ... | ... |
src/ctpsfcube/ctpsfcube.par
| ... | ... | @@ -20,8 +20,8 @@ |
| 20 | 20 | inobs, f, a, "NONE",,, "Event list or observation definition file" |
| 21 | 21 | incube, f, a, "NONE",,, "Counts cube for psf cube definition" |
| 22 | 22 | outcube, f, a, "psfcube.fits",,, "Output psf cube file" |
| 23 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 24 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 23 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 24 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 25 | 25 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 26 | 26 | # |
| 27 | 27 | # Energy binning parameters | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -268,6 +268,16 @@ void ctselect::run(void) |
| 268 | 268 | // Save event file name (for possible saving) |
| 269 | 269 | m_infiles[i] = obs->eventfile(); |
| 270 | 270 | |
| 271 | + // Fall through in case that the event file is empty | |
| 272 | + if (obs->events()->size() == 0) { | |
| 273 | + if (logTerse()) { | |
| 274 | + log << " Warning: No events in event file \""; | |
| 275 | + log << m_infiles[i] << "\". Event selection skipped."; | |
| 276 | + log << std::endl; | |
| 277 | + } | |
| 278 | + continue; | |
| 279 | + } | |
| 280 | + | |
| 271 | 281 | // Get temporary file name |
| 272 | 282 | #if G_USE_MKSTEMP |
| 273 | 283 | char tpl[] = "ctselectXXXXXX"; |
| ... | ... | @@ -837,7 +847,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) |
| 837 | 847 | int nevents = file.table("EVENTS")->nrows(); |
| 838 | 848 | |
| 839 | 849 | // If the selected event list is empty or if removal of all events |
| 840 | - // has been requesten then append an empty event list to the observation. | |
| 850 | + // has been requested then append an empty event list to the observation. | |
| 841 | 851 | if ((nevents < 1) || (remove_all)) { |
| 842 | 852 | |
| 843 | 853 | // Create empty event list |
| ... | ... | @@ -1006,7 +1016,9 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds& ebounds) co |
| 1006 | 1016 | |
| 1007 | 1017 | // Set selection energy boundaries |
| 1008 | 1018 | GEbounds result; |
| 1009 | - result.append(GEnergy(emin, "TeV"), GEnergy(emax, "TeV")); | |
| 1019 | + if (emax > emin) { | |
| 1020 | + result.append(GEnergy(emin, "TeV"), GEnergy(emax, "TeV")); | |
| 1021 | + } | |
| 1010 | 1022 | |
| 1011 | 1023 | // Return result |
| 1012 | 1024 | return result; | ... | ... |
src/cttsmap/cttsmap.cpp
| ... | ... | @@ -242,7 +242,7 @@ void cttsmap::run(void) |
| 242 | 242 | int binmax = (m_binmax == -1) ? m_tsmap.npix() : m_binmax; |
| 243 | 243 | |
| 244 | 244 | // Initialise optimizer |
| 245 | - GOptimizerLM* opt = (logExplicit()) ? new GOptimizerLM(log) | |
| 245 | + GOptimizerLM* opt = (logExplicit()) ? new GOptimizerLM(&log) | |
| 246 | 246 | : new GOptimizerLM(); |
| 247 | 247 | |
| 248 | 248 | // Store initial models | ... | ... |
src/cttsmap/cttsmap.par
| ... | ... | @@ -23,8 +23,8 @@ srcname, s, a, "Crab",,, "Test source" |
| 23 | 23 | expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" |
| 24 | 24 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 25 | 25 | bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" |
| 26 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 27 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 26 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 27 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 28 | 28 | outmap, f, a, "tsmap.fits",,, "Output Test Statistic map" |
| 29 | 29 | |
| 30 | 30 | # | ... | ... |
src/ctulimit/ctulimit.par
| ... | ... | @@ -23,8 +23,8 @@ srcname, s, a, "Crab",,, "Source of interest" |
| 23 | 23 | expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" |
| 24 | 24 | psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" |
| 25 | 25 | bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" |
| 26 | -caldb, s, a, "dummy",,, "Calibration database" | |
| 27 | -irf, s, a, "cta_dummy_irf",,, "Instrument response function" | |
| 26 | +caldb, s, a, "prod2",,, "Calibration database" | |
| 27 | +irf, s, a, "South_50h",,, "Instrument response function" | |
| 28 | 28 | |
| 29 | 29 | # |
| 30 | 30 | # Upper limit calculation parameters | ... | ... |
test/test_cscripts.sh.in
| ... | ... | @@ -136,13 +136,14 @@ $ECHO " ok" |
| 136 | 136 | $ECHO -n "Test cstsdist: " |
| 137 | 137 | chmod +x @abs_top_srcdir@/scripts/cstsdist.py |
| 138 | 138 | @abs_top_srcdir@/scripts/cstsdist.py \ |
| 139 | + inmodel="data/crab.xml" \ | |
| 140 | + srcname="Crab" \ | |
| 139 | 141 | outfile="ts.dat" \ |
| 140 | 142 | ntrials="1" \ |
| 141 | 143 | caldb="irf" \ |
| 142 | 144 | irf="cta_dummy_irf" \ |
| 143 | - type="point" \ | |
| 144 | - offset="0.0" \ | |
| 145 | - bkg="data/bkg_dummy.txt" \ | |
| 145 | + ra=83.63 \ | |
| 146 | + dec=22.01 \ | |
| 146 | 147 | emin=0.1 \ |
| 147 | 148 | emax=100.0 \ |
| 148 | 149 | enumbins=0 \ |
| ... | ... | @@ -160,6 +161,7 @@ else |
| 160 | 161 | fi |
| 161 | 162 | $ECHO " ok" |
| 162 | 163 | |
| 164 | + | |
| 163 | 165 | # |
| 164 | 166 | # Test csresmap |
| 165 | 167 | # ============= |
| ... | ... | @@ -189,10 +191,11 @@ else |
| 189 | 191 | fi |
| 190 | 192 | $ECHO " ok" |
| 191 | 193 | |
| 194 | + | |
| 192 | 195 | # |
| 193 | -# Test csspec | |
| 194 | -# ============= | |
| 195 | -$ECHO -n "Test csspec: " | |
| 196 | +# Test csspec (unbinned) | |
| 197 | +# ===================== | |
| 198 | +$ECHO -n "Test csspec (unbinned): " | |
| 196 | 199 | chmod +x @abs_top_srcdir@/scripts/csspec.py |
| 197 | 200 | @abs_top_srcdir@/scripts/csspec.py \ |
| 198 | 201 | inobs="data/crab_events.fits" \ |
| ... | ... | @@ -203,6 +206,7 @@ chmod +x @abs_top_srcdir@/scripts/csspec.py |
| 203 | 206 | srcname="Crab" \ |
| 204 | 207 | emin=0.1 \ |
| 205 | 208 | emax=100.0 \ |
| 209 | + binned=no \ | |
| 206 | 210 | outfile="spectrum.fits" > csspec.log |
| 207 | 211 | $ECHO -n "." |
| 208 | 212 | if [ -s "spectrum.fits" ] |
| ... | ... | @@ -215,3 +219,100 @@ fi |
| 215 | 219 | $ECHO " ok" |
| 216 | 220 | |
| 217 | 221 | |
| 222 | +# | |
| 223 | +# Test csspec (binned) | |
| 224 | +# ==================== | |
| 225 | +$ECHO -n "Test csspec (binned): " | |
| 226 | +chmod +x @abs_top_srcdir@/scripts/csspec.py | |
| 227 | +@abs_top_srcdir@/scripts/csspec.py \ | |
| 228 | + inobs="data/crab_events.fits" \ | |
| 229 | + inmodel="data/crab.xml" \ | |
| 230 | + caldb="irf" \ | |
| 231 | + irf="cta_dummy_irf" \ | |
| 232 | + enumbins=3 \ | |
| 233 | + srcname="Crab" \ | |
| 234 | + emin=0.1 \ | |
| 235 | + emax=100.0 \ | |
| 236 | + binned=yes \ | |
| 237 | + nxpix=10 \ | |
| 238 | + nypix=10 \ | |
| 239 | + binsz=0.1 \ | |
| 240 | + nebins=2 \ | |
| 241 | + coordsys="CEL" \ | |
| 242 | + xref=83.63 \ | |
| 243 | + yref=22.01 \ | |
| 244 | + proj="CAR" \ | |
| 245 | + outfile="spectrum.fits" > csspec.log | |
| 246 | +$ECHO -n "." | |
| 247 | +if [ -s "spectrum.fits" ] | |
| 248 | +then | |
| 249 | + $ECHO -n "." | |
| 250 | +else | |
| 251 | + $ECHO " spectrum.fits file is not valid" | |
| 252 | + exit 1 | |
| 253 | +fi | |
| 254 | +$ECHO " ok" | |
| 255 | + | |
| 256 | + | |
| 257 | +# | |
| 258 | +# Test cslightcrv (unbinned) | |
| 259 | +# ========================== | |
| 260 | +$ECHO -n "Test cslightcrv (unbinned): " | |
| 261 | +chmod +x @abs_top_srcdir@/scripts/cslightcrv.py | |
| 262 | +@abs_top_srcdir@/scripts/cslightcrv.py \ | |
| 263 | + inobs="data/crab_events.fits" \ | |
| 264 | + inmodel="data/crab.xml" \ | |
| 265 | + srcname="Crab" \ | |
| 266 | + caldb="irf" \ | |
| 267 | + irf="cta_dummy_irf" \ | |
| 268 | + tbinalg="LIN" \ | |
| 269 | + tmin=51544.5 \ | |
| 270 | + tmax=51544.53 \ | |
| 271 | + tbins=3 \ | |
| 272 | + enumbins=0 \ | |
| 273 | + emin=0.1 \ | |
| 274 | + emax=100.0 \ | |
| 275 | + outfile="lightcurve.fits" > cslightcrv.log | |
| 276 | +$ECHO -n "." | |
| 277 | +if [ -s "lightcurve.fits" ] | |
| 278 | +then | |
| 279 | + $ECHO -n "." | |
| 280 | +else | |
| 281 | + $ECHO " lightcurve.fits file is not valid" | |
| 282 | + exit 1 | |
| 283 | +fi | |
| 284 | +$ECHO " ok" | |
| 285 | + | |
| 286 | + | |
| 287 | +# | |
| 288 | +# Test cslightcrv (binned) | |
| 289 | +# ======================== | |
| 290 | +$ECHO -n "Test cslightcrv (binned): " | |
| 291 | +chmod +x @abs_top_srcdir@/scripts/cslightcrv.py | |
| 292 | +@abs_top_srcdir@/scripts/cslightcrv.py \ | |
| 293 | + inobs="data/crab_events.fits" \ | |
| 294 | + inmodel="data/crab.xml" \ | |
| 295 | + srcname="Crab" \ | |
| 296 | + caldb="irf" \ | |
| 297 | + irf="cta_dummy_irf" \ | |
| 298 | + tbinalg="GTI" \ | |
| 299 | + enumbins=2 \ | |
| 300 | + emin=0.1 \ | |
| 301 | + emax=100.0 \ | |
| 302 | + coordsys="CEL" \ | |
| 303 | + proj="CAR" \ | |
| 304 | + xref=83.63 \ | |
| 305 | + yref=22.01 \ | |
| 306 | + nxpix=10 \ | |
| 307 | + nypix=10 \ | |
| 308 | + binsz=0.1 \ | |
| 309 | + outfile="lightcurve.fits" > cslightcrv.log | |
| 310 | +$ECHO -n "." | |
| 311 | +if [ -s "lightcurve.fits" ] | |
| 312 | +then | |
| 313 | + $ECHO -n "." | |
| 314 | +else | |
| 315 | + $ECHO " lightcurve.fits file is not valid" | |
| 316 | + exit 1 | |
| 317 | +fi | |
| 318 | +$ECHO " ok" | ... | ... |
testall.sh
| ... | ... | @@ -33,7 +33,6 @@ cd examples |
| 33 | 33 | |
| 34 | 34 | # Create local environment |
| 35 | 35 | rm -rf ctools |
| 36 | -#mkdir -p ctools/share | |
| 37 | 36 | mkdir -p ctools/share/caldb |
| 38 | 37 | ln -s $base/caldb ctools/share/caldb/cta |
| 39 | 38 | ln -s $base/models ctools/share/models |
| ... | ... | @@ -52,11 +51,11 @@ export CTOOLS=$PWD/ctools |
| 52 | 51 | |
| 53 | 52 | # Run makers |
| 54 | 53 | ./make_survey.py |
| 55 | -./make_ts_distributions.py 2 2 | |
| 54 | +./make_ts_distributions.py -n 2 -e 0 -d 1800 | |
| 56 | 55 | #./make_pull_at_sensitivity_limit.py |
| 57 | 56 | |
| 58 | 57 | # Remove local environment |
| 59 | -rm -rf gammalib | |
| 58 | +rm -rf ctools | |
| 60 | 59 | |
| 61 | 60 | # Step back to base directory |
| 62 | 61 | cd $base | ... | ... |