{%trans%} The ctools philosophy inherited from ftools consists of providing
+
{%trans%} The ctools philosophy is inherited from ftools and consists of providing
building blocks that perform well-defined science data analysis tasks, including
observation and event selection, binning, sky map creation, source detection,
model fitting, spectra, phase curve and light curve generation, and observation
diff --git a/doc/source/about.rst b/doc/source/about.rst
index 2e22143..89c2c4f 100755
--- a/doc/source/about.rst
+++ b/doc/source/about.rst
@@ -10,7 +10,7 @@ VERITAS, MAGIC and CTA. ctools supports also the analysis of data from
CGRO/COMPTEL, Fermi/LAT and INTEGRAL/SPI, enabling the exploration of the full
gamma-ray energy band, spanning from hundreds of keV to hundreds of TeV.
-The ctools philosophy inherited from ftools consists of providing building
+The ctools philosophy is inherited from ftools and consists of providing building
blocks that perform well-defined science data analysis tasks, including
observation and event selection, binning, sky map creation, source detection,
model fitting, spectra, phase curve and light curve generation, and observation
diff --git a/doc/source/admin/install_devel.rst b/doc/source/admin/install_devel.rst
index 3a7695d..9188eb5 100644
--- a/doc/source/admin/install_devel.rst
+++ b/doc/source/admin/install_devel.rst
@@ -147,7 +147,7 @@ version as follows:
.. code-block:: bash
- $ conda create -n ctools-devel python=3.6
+ $ conda create -n ctools-devel python=3.9
$ source activate ctools-devel
$ conda install --use-local ctools=2.0.0.dev
@@ -157,5 +157,5 @@ Python version you can build the conda package as follows:
.. code-block:: bash
- $ conda-build dev/conda.recipe --python 3.6
+ $ conda-build dev/conda.recipe --python 3.9
diff --git a/doc/source/admin/release_history/1.6.2.rst b/doc/source/admin/release_history/1.6.2.rst
index 28d336b..5d2c2dd 100644
--- a/doc/source/admin/release_history/1.6.2.rst
+++ b/doc/source/admin/release_history/1.6.2.rst
@@ -13,7 +13,7 @@ The following bugs were fixed:
* [`2962 `_] -
Improve documentation and tutorials
* [`2954 `_] -
- Correct handling of flux for diffuse cube models in csspec
+ Correct handling of flux for diffuse cube models in :ref:`csspec`
* [`2912 `_] -
Fix OpenMP issue in ctbin when using energy bounds from file
* [`2862 `_] -
diff --git a/doc/source/admin/release_history/1.6.rst b/doc/source/admin/release_history/1.6.rst
index f8ba993..155283b 100644
--- a/doc/source/admin/release_history/1.6.rst
+++ b/doc/source/admin/release_history/1.6.rst
@@ -32,8 +32,8 @@ Bug fixes
* [`2694 `_] -
Compute ``DETX`` and ``DETY`` in :ref:`ctmodel` if they are not available
* [`2686 `_] -
- Do no longer set missing boundaries in ``ctool::get_observations`` and
- ``ctool::setup_observations``
+ Do no longer set missing boundaries in :doxy:`ctool::get_observations` and
+ :doxy:`ctool::setup_observations`
* [`2682 `_] -
Avoid :ref:`ctselect` error in case that RoI radius is unchanged
* [`2652 `_] -
@@ -71,7 +71,7 @@ Improvements
* [`2711 `_] -
:ref:`csphagen` now creates appropriate model for likelihood fitting
* [`2685 `_] -
- Add ``ctbkgcube::cntcube()`` method
+ Add :doxy:`ctbkgcube::cntcube` method
Account for varying energy thresholds in :ref:`ctbin` weight computation
Unnormalize background cube values in :ref:`ctbkgcube`
* Add ``use_model_bkg`` parameter to :ref:`cslightcrv`
diff --git a/doc/source/admin/release_history/1.7.4.rst b/doc/source/admin/release_history/1.7.4.rst
index d521f3b..40960cc 100644
--- a/doc/source/admin/release_history/1.7.4.rst
+++ b/doc/source/admin/release_history/1.7.4.rst
@@ -15,4 +15,4 @@ The following bugs were fixed:
* [`3624 `_] -
Replace spectral model by file function in :ref:`csspec`
* [`3623 `_] -
- Update csinfo script
+ Update :doxy:`csinfo` script
diff --git a/doc/source/admin/release_history/1.7.rst b/doc/source/admin/release_history/1.7.rst
index ee1566c..22113fb 100644
--- a/doc/source/admin/release_history/1.7.rst
+++ b/doc/source/admin/release_history/1.7.rst
@@ -56,5 +56,5 @@ Improvements
New features
------------
* [`2961 `_] -
- Add csscs script for spectral component separation
+ Add :ref:`csscs` script for spectral component separation
diff --git a/doc/source/admin/release_history/2.0.rst b/doc/source/admin/release_history/2.0.rst
index 850755d..a20c0c5 100644
--- a/doc/source/admin/release_history/2.0.rst
+++ b/doc/source/admin/release_history/2.0.rst
@@ -26,7 +26,7 @@ Improvements
------------
* [`3592 `_] -
- Rename virtual abstract ``ctool::run()`` method to ``ctool::process()`` and add non-abstract ``ctool::run()`` method (#3592)
+ Rename virtual abstract :doxy:`ctool::run` method to :doxy:`ctool::process` and add non-abstract :doxy:`ctool::run` method
* Add methods to access :ref:`ctlike` attributes
* Add restart of bisection in case of bad convergence in :ref:`ctulimit`
* [`3662 `_] -
@@ -43,14 +43,14 @@ Improvements
Add hidden ``fix_spat`` parameter to :ref:`cttsmap`
* [`3555 `_] -
Use test source position in :ref:`cssens`
-* Add optimizer setter to ``ctlikelihood`` base class.
+* Add optimizer setter to :doxy:`ctlikelihood` base class.
* Add ``refit_if_failed`` parameter to :ref:`ctlike`
* [`3441 `_] -
- Add ``models()`` method to :ref:`ctobssim`
+ Add :doxy:`ctobssim::models` method
* [`3431 `_] -
Add :ref:`ctlike` results to XML file
* [`3324 `_] -
- Replace ``std::tmpnam()`` by ``gammalib::tmpnam()`` function in :ref:`ctselect`
+ Replace :doxy:`std::tmpnam` by :doxy:`gammalib::tmpnam` function in :ref:`ctselect`
* [`3324 `_] -
Remove implicit conversion warnings
* [`1707 `_] -
@@ -65,3 +65,5 @@ New features
* [`3738 `_] -
Add COMPTEL analysis scripts
* Add :ref:`csadd2caldb` script
+* [`3592 `_] -
+ Add :ref:`csfootprint` script
diff --git a/doc/source/develop/coding/python.rst b/doc/source/develop/coding/python.rst
index 417da50..f60e86c 100755
--- a/doc/source/develop/coding/python.rst
+++ b/doc/source/develop/coding/python.rst
@@ -251,12 +251,12 @@ User Documentation
.. code-block:: python
- Methods
- -------
- read(filename)
- Read a table from a file
- sort(column, order='ascending')
- Sort by `column`
+ Methods
+ -------
+ read(filename)
+ Read a table from a file
+ sort(column, order='ascending')
+ Sort by column
Naming Conventions
diff --git a/doc/source/help/issues.rst b/doc/source/help/issues.rst
index 15a85ce..5802dcb 100755
--- a/doc/source/help/issues.rst
+++ b/doc/source/help/issues.rst
@@ -45,7 +45,7 @@ Installation issues
export GIT_SSL_NO_VERIFY=true
- .. _conda_python:
+.. _conda_python:
.. topic:: ctools does not compile against conda Python
diff --git a/doc/source/users/reference_manual/index.rst b/doc/source/users/reference_manual/index.rst
index 9f163f2..3d14e08 100755
--- a/doc/source/users/reference_manual/index.rst
+++ b/doc/source/users/reference_manual/index.rst
@@ -92,8 +92,8 @@ IACT database management scripts
csiactcopy --- Copies IACT data from one location to another
-COMPTEL Science Analysis scripts
---------------------------------
+COMPTEL analysis scripts
+------------------------
.. toctree::
:maxdepth: 1
diff --git a/doc/source/users/tutorials/comptel/binning.rst b/doc/source/users/tutorials/comptel/binning.rst
new file mode 100755
index 0000000..d19db1b
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/binning.rst
@@ -0,0 +1,92 @@
+.. _comptel_binning:
+
+Binning the data
+----------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to bin COMPTEL data for an analysis with ctools.
+
+
+Data need to be binned for the analysis with ctools. The data are binned
+in three-dimensional data cubes, called ``DRI`` (Data Required for Imaging).
+``DRI`` datasets are spanned by the scatter directions :math:`\chi` and
+:math:`\psi` and the Compton scatter angle :math:`\bar{\varphi}`.
+Binned data products for an observation include event data (``DRE``),
+geometry factors (``DRG``) and a background model (``DRB``). In addition,
+a two-dimensional exposure map (``DRX``) is needed. Finally, the binned
+data products also include the Instrument Response Function in the so-called
+``IAQ`` format, which is a two-dimensional map that provides the interaction
+probabilities as function of :math:`\varphi_{\rm geo}` and :math:`\bar{\varphi}`
+
+You bin the data with the :ref:`comobsbin` tool. Binned data products will be
+written in a so-called data store so that they can be reused in different analyses.
+:ref:`comobsbin` will only create binned data files that do not yet exist
+in the datastore. The example below shows how you create binned data products
+for viewing period ``0001``.
+
+.. code-block:: bash
+
+ $ comobsbin
+ Input observation definition file [obs.xml]
+ Response type (MODEL|SIM2|SIM3) [MODEL]
+ Algorithm for defining energy bins (FILE|LIN|LOG) [FILE] LOG
+ Minimum energy (MeV) (0.05-50.0) [0.75]
+ Maximum energy (MeV) (0.05-50.0) [30.0]
+ Number of energy bins (1-20) [1] 4
+ Phase expression in the format phasemin0-phasemax0;phasemin1-phasemax1;... [NONE]
+ Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
+ Projection method (AIT|AZP|CAR|GLS|MOL|SFL|SIN|STG|TAN) [TAN]
+ Output folder for files [$COMDATASTORE] binned
+ Output observation definition file [obs_binned.xml]
+
+.. warning::
+
+ Note that the creation of binned data products is relatively time
+ consuming, in particular for geometry (``DRG``) and exposure
+ files (``DRX``). :ref:`comobsbin` may typically take between
+ 30 min and 2 hours to process the data for one viewing period,
+ depending on the operating system and processor speed.
+
+:ref:`comobsbin` produces on output an
+:ref:`observation definition file `
+which in the example is named ``obs_binned.xml``. The content of this file
+is shown below. According to the user parameter, the energy interval
+0.75-30 MeV was split into four logarithmically spaced energy bins,
+and a model Instrument Response Function was computed for each of the
+energy bins. :ref:`comobsbin` also generates a Phibar-normalised geometry
+function as a first order approximation of the instrumental background model.
+
+.. code-block:: bash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/source/users/tutorials/comptel/download.rst b/doc/source/users/tutorials/comptel/download.rst
new file mode 100755
index 0000000..c8db0ab
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/download.rst
@@ -0,0 +1,145 @@
+.. _comptel_download:
+
+Download COMPTEL data
+---------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to download COMPTEL data for an analysis with
+ ctools.
+
+
+Using HEASARC's Xamin interface
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can download COMPTEL data from the HEASARC data server through the
+`Xamin Web Interface `_.
+As example, the figure below shows a request for data around the Crab pulsar.
+
+.. figure:: download_query.png
+ :width: 600px
+ :align: center
+
+ *Xamin Web Interface to query COMPTEL data*
+
+Click on the button ``"Show table"`` in the upper left which opens a new
+window that shows all available data sets. Click on the ``+`` symbol of an
+observation identifier to show all available data products. In the example
+below we selected that data products for obsid ``c.vp0001_0``,
+which is the COMPTEL viewing period ``0001``, and inspected specifically
+the Event and housekeeping data.
+
+.. figure:: download_products.png
+ :width: 600px
+ :align: center
+
+ *Available COMPTEL data products for viewing period 0001*
+
+.. note::
+
+ The COMPTEL obervations are divided into so-called viewing periods (``vp``) of
+ typically 14 days. The Crab nebula was observed during many viewing periods.
+ In this example, the data for the viewing period ``0001`` were selected.
+
+.. note::
+
+ The CGRO mission was devided into nine mission phases that correspond to the
+ nine years of satellite operations. Viewing periods for ``phase01`` start
+ with ``00``, viewing periods for ``phase02`` start with ``02``, and so on.
+
+
+Clicking on the carts of files will add data products to your Data Products
+Cart for download. In the example below, we added all Orbit/Aspect Data
+files, a Processed Event file and the Exposure Time file. The latter
+is actually a misnomer, since the corresponding file does not contain the
+exposure time but the Good Time Intervals for viewing period ``0001``.
+
+.. figure:: download_cart.png
+ :width: 600px
+ :align: center
+
+ *Data products cart for viewing period 0001*
+
+Clicking on the ``"Download As Tar File"`` tab will download all data products
+in a single tar file. Once the download is finished you need to put the
+data in a standardised directory structure using the following commands:
+
+.. code-block:: bash
+
+ $ mkdir -p data/phase01
+ $ tar xvfz xamin_download.tar.gz -C data/phase01/
+ x vp0001_0/m10695_tim.fits.gz
+ x vp0001_0/m20037_oad.fits.gz
+ x vp0001_0/m20039_oad.fits.gz
+ x vp0001_0/m20041_oad.fits.gz
+ x vp0001_0/m20045_oad.fits.gz
+ x vp0001_0/m20048_oad.fits.gz
+ x vp0001_0/m20050_oad.fits.gz
+ x vp0001_0/m20054_oad.fits.gz
+ x vp0001_0/m20058_oad.fits.gz
+ x vp0001_0/m20064_oad.fits.gz
+ x vp0001_0/m20066_oad.fits.gz
+ x vp0001_0/m20068_oad.fits.gz
+ x vp0001_0/m20071_oad.fits.gz
+ x vp0001_0/m20073_oad.fits.gz
+ x vp0001_0/m20078_oad.fits.gz
+ x vp0001_0/m20081_oad.fits.gz
+ x vp0001_0/m28511_evp.fits.gz
+
+.. note::
+
+ ctools expects that the COMPTEL data from HEASARC are stored in a standardised
+ directory structure that starts with a top-level data directory of any name
+ under which there are directories for each of the nine mission phases:
+
+ .. code-block:: bash
+
+ data
+ data/phase01
+ data/phase02
+ data/phase03
+ data/phase04
+ data/phase05
+ data/phase06
+ data/phase07
+ data/phase08
+ data/phase09
+
+Once you untared and installed the downloaded data you need to create a database for
+ctools analysis using :ref:`comgendb`. Before that we recommend to create a ``COMDATA``
+environment variable that holds the absolute path to the COMPTEL data archive. You do
+these steps with the following commands:
+
+.. code-block:: bash
+
+ $ export COMDATA=$PWD/data
+ $ comgendb
+ COMPTEL HEASARC archive directory [$COMDATA]
+ COMPTEL database directory [$COMDATA/dbase]
+
+You are now setup for COMPTEL science data analysis.
+
+
+Using :ref:`comgendb`
+~~~~~~~~~~~~~~~~~~~~~
+
+You may alternatively use :ref:`comgendb` to download the full HEASARC COMPTEL
+database on your computer. This requires ``wget`` to be installed on your system.
+Downloading the full archive is useful if you intend to analyse more than a few
+viewing periods. You can download the full archive and generate a database for
+this archive using
+
+.. code-block:: bash
+
+ $ export COMDATA=$PWD/data
+ $ comgendb download=yes
+ COMPTEL HEASARC archive directory [$COMDATA]
+ COMPTEL database directory [$COMDATA/dbase]
+
+Once you have setup your database in that way you have all data needed for COMPTEL
+data analysis on your system and you never need to repeat this step again.
+
+.. warning::
+
+ The download of the full COMPTEL database from HEASARC will take several
+ hours.
diff --git a/doc/source/users/tutorials/comptel/download_cart.png b/doc/source/users/tutorials/comptel/download_cart.png
new file mode 100644
index 0000000..c824d11
Binary files /dev/null and b/doc/source/users/tutorials/comptel/download_cart.png differ
diff --git a/doc/source/users/tutorials/comptel/download_products.png b/doc/source/users/tutorials/comptel/download_products.png
new file mode 100644
index 0000000..5352a74
Binary files /dev/null and b/doc/source/users/tutorials/comptel/download_products.png differ
diff --git a/doc/source/users/tutorials/comptel/download_query.png b/doc/source/users/tutorials/comptel/download_query.png
new file mode 100644
index 0000000..2f7727f
Binary files /dev/null and b/doc/source/users/tutorials/comptel/download_query.png differ
diff --git a/doc/source/users/tutorials/comptel/fitting.rst b/doc/source/users/tutorials/comptel/fitting.rst
new file mode 100755
index 0000000..4f7ce43
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/fitting.rst
@@ -0,0 +1,92 @@
+.. _comptel_fitting:
+
+Fitting the data
+----------------
+
+ .. admonition:: What you will learn
+
+ You will learn how you fit a model to COMPTEL data.
+
+
+Now you are prepared to fit the model to COMPTEL data. You do this using
+the :ref:`comlixfit` script. In the example below the script is run with the
+``debug=yes`` option so that the fit results are directly displayed in the
+terminal. :ref:`comlixfit` performs an iterative background fitting using the
+SRCLIX approach; in particuliar, the BGDLIXE method is used for background
+model computation.
+
+The fit took 3 SRCLIX iterations to converge. The Crab is detected with
+a test statistic value of 1074.78. The fit determined the position of the
+gamma-ray source and the spectral power law parameters, which are the intensity
+at a pivot energy of 1 MeV and the spectral index. As a quality check, the
+fit predicted 517813.013 events in the model which is close to the observed
+number of 517813 events.
+
+.. code-block:: bash
+
+ $ comlixfit debug=yes
+ Input observation definition file [obs.xml] obs_binned.xml
+ Input model definition file [models.xml]
+ Method for background computation (PHINOR|BGDLIXA|BGDLIXE) [BGDLIXE]
+ Output observation definition file [outobs.xml]
+ Output model definition file [results.xml]
+ ...
+ 2022-03-17T13:20:40: +====================+
+ 2022-03-17T13:20:40: | Input observations |
+ 2022-03-17T13:20:40: +====================+
+ 2022-03-17T13:20:40: === GObservations ===
+ 2022-03-17T13:20:40: Number of observations ....: 4
+ 2022-03-17T13:20:40: Number of models ..........: 5
+ 2022-03-17T13:20:40: Number of observed events .: 517813
+ 2022-03-17T13:20:40: Number of predicted events : 0
+ 2022-03-17T13:20:40:
+ 2022-03-17T13:20:40: +============================================+
+ 2022-03-17T13:20:40: | Iterative maximum likelihood model fitting |
+ 2022-03-17T13:20:40: +============================================+
+ 2022-03-17T13:20:48: logL after iteration 1 ....: -28465.83123
+ 2022-03-17T13:20:55: logL after iteration 2 ....: -28466.41211 (0.58088)
+ 2022-03-17T13:21:00: logL after iteration 3 ....: -28466.29714 (-0.11498)
+ 2022-03-17T13:21:09: logL after final iteration : -28466.41290 (0.00079)
+ 2022-03-17T13:21:09:
+ 2022-03-17T13:21:09: +=========================================+
+ 2022-03-17T13:21:09: | Maximum likelihood optimisation results |
+ 2022-03-17T13:21:09: +=========================================+
+ 2022-03-17T13:21:09: === GOptimizerLM ===
+ 2022-03-17T13:21:09: Optimized function value ..: -28466.413
+ 2022-03-17T13:21:09: Absolute precision ........: 0.005
+ 2022-03-17T13:21:09: Acceptable value decrease .: 0
+ 2022-03-17T13:21:09: Optimization status .......: converged
+ 2022-03-17T13:21:09: Number of parameters ......: 106
+ 2022-03-17T13:21:09: Number of free parameters .: 99
+ 2022-03-17T13:21:09: Number of iterations ......: 4
+ 2022-03-17T13:21:09: Lambda ....................: 0.1
+ 2022-03-17T13:21:09: Total number of iterations : 14
+ 2022-03-17T13:21:09: Maximum log likelihood ....: 28466.4129009
+ 2022-03-17T13:21:09: Observed events (Nobs) ...: 517813.0
+ 2022-03-17T13:21:09: Predicted events (Npred) ..: 517813.012556
+ 2022-03-17T13:21:09: Nobs - Npred ..............: -0.012555927271
+ 2022-03-17T13:21:09: === GModels ===
+ 2022-03-17T13:21:09: Number of models ..........: 5
+ 2022-03-17T13:21:09: Number of parameters ......: 106
+ 2022-03-17T13:21:09: === GModelSky ===
+ 2022-03-17T13:21:09: Name ......................: Crab
+ 2022-03-17T13:21:09: Instruments ...............: all
+ 2022-03-17T13:21:09: Test Statistic ............: 1074.78358831939
+ 2022-03-17T13:21:09: Observation identifiers ...: all
+ 2022-03-17T13:21:09: Model type ................: PointSource
+ 2022-03-17T13:21:09: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
+ 2022-03-17T13:21:09: Number of parameters ......: 6
+ 2022-03-17T13:21:09: Number of spatial par's ...: 2
+ 2022-03-17T13:21:09: RA .......................: 83.7688330639726 +/- 0.111131701366959 deg (free,scale=1)
+ 2022-03-17T13:21:09: DEC ......................: 21.6073511262309 +/- 0.101155131386771 deg (free,scale=1)
+ 2022-03-17T13:21:09: Number of spectral par's ..: 3
+ 2022-03-17T13:21:09: Prefactor ................: 0.00213237276990501 +/- 9.60239430063358e-05 [1e-25,infty[ ph/cm2/s/MeV (free,scale=0.002,gradient)
+ 2022-03-17T13:21:09: Index ....................: -2.1249932516377 +/- 0.0369030627304123 [-10,10] (free,scale=-2,gradient)
+ 2022-03-17T13:21:09: PivotEnergy ..............: 1 MeV (fixed,scale=1,gradient)
+ 2022-03-17T13:21:09: Number of temporal par's ..: 1
+ 2022-03-17T13:21:09: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
+ 2022-03-17T13:21:09: Number of scale par's .....: 0
+
+.. note::
+
+ To shorten the output, omitted lines were replaced by three dots.
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap.png b/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap.png
deleted file mode 100644
index 94528bf..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap_5vp.png b/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap_5vp.png
deleted file mode 100644
index 6412900..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_1.8MeV_tsmap_5vp.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_archive.png b/doc/source/users/tutorials/comptel/howto_comptel_archive.png
deleted file mode 100755
index ba23826..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_archive.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_butterfly.png b/doc/source/users/tutorials/comptel/howto_comptel_butterfly.png
deleted file mode 100755
index c432723..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_butterfly.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_butterfly.rst b/doc/source/users/tutorials/comptel/howto_comptel_butterfly.rst
deleted file mode 100755
index 2b44ad2..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_butterfly.rst
+++ /dev/null
@@ -1,39 +0,0 @@
-.. _howto_comptel_butterfly:
-
-Generate a butterfly diagram for a model component
---------------------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctbutterfly` to create a butterfly diagram
- for a model component from COMPTEL data.
-
-A butterfly diagram shows the envelope of all spectral models that are
-statistically compatible with the data. You can create such a butterfly
-diagram for the Crab using the :ref:`ctbutterfly` tool by providing
-the
-:ref:`model definition file `
-output file from :ref:`ctlike` as input:
-
-.. code-block:: bash
-
- $ ctbutterfly fit=yes
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Source of interest [Crab]
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
- Start value for first energy bin in TeV [0.1] 0.00000075
- Stop value for last energy bin in TeV [100.0] 0.00003
- Output ASCII file [butterfly.txt]
-
-:ref:`ctbutterfly` produces the ASCII file ``butterfly.txt`` that contains
-the envelope of the butterfly diagram. The figure below gives a graphical
-representation of the envelope. The red data points show the combined
-Crab nebular and pulsar spectrum from
-`Kuiper et al. 2001, A&A, 378, 918 `_
-for comparison.
-
-.. figure:: howto_comptel_butterfly.png
- :width: 600px
- :align: center
-
- *Butterfly diagram of the fitted Crab spectrum*
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_datasets.jpg b/doc/source/users/tutorials/comptel/howto_comptel_datasets.jpg
deleted file mode 100755
index bccd12f..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_datasets.jpg and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_download.rst b/doc/source/users/tutorials/comptel/howto_comptel_download.rst
deleted file mode 100755
index 5d87204..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_download.rst
+++ /dev/null
@@ -1,61 +0,0 @@
-.. _howto_comptel_download:
-
-Download COMPTEL data
----------------------
-
- .. admonition:: What you will learn
-
- You will learn how to prepare COMPTEL data for an analysis with
- ctools.
-
-
-COMPTEL data can be downloaded from the HEASARC data server through the
-`Xamin Web Interface `_.
-As example, the figure below shows a request for data around the Crab pulsar.
-
-.. figure:: howto_comptel_query.jpg
- :width: 600px
- :align: center
-
- *Xamin Web Interface to query COMPTEL data*
-
-Click on the button ``Show table`` in the upper left which opens a new
-window that shows all available data sets. Click on the ``+`` symbol of a
-dataset to get a link to the data archive directory.
-
-.. figure:: howto_comptel_datasets.jpg
- :width: 600px
- :align: center
-
- *Available COMPTEL data for the Crab region*
-
-Clicking on the link brings you to the archive directory, shown below.
-
-.. figure:: howto_comptel_archive.png
- :width: 600px
- :align: center
-
- *COMPTEL data archive for viewing period 0001*
-
-The COMPTEL obervations were divided in so-called viewing periods (``vp``) of
-typically 14 days. The Crab nebula was observed during many viewing periods.
-In this example, the data for the viewing period 0001 was selected. From the
-archive you now have to download the following files:
-
-* ``m32171_drx.fits.gz`` - Exposure map
-* ``m34997_drg.fits.gz`` - Geometry factors (needed for response computation)
-* ``m50438_dre.fits.gz`` - Counts cube for energy interval 0.75 - 1 MeV
-* ``m50439_dre.fits.gz`` - Counts cube for energy interval 1 - 3 MeV
-* ``m50440_dre.fits.gz`` - Counts cube for energy interval 3 - 10 MeV
-* ``m50441_dre.fits.gz`` - Counts cube for energy interval 10 - 30 MeV
-
-The COMPTEL data are usually processed for four standard energy intervals,
-and a 3-dimensional counts cube exists for each of these energy intervals.
-Counts cubes are always suffixed ``_dre``, exposures ``_drx`` and geometry
-factors ``_drg``.
-
-.. warning::
- The files in the HEASARC archive have a ``.gz`` extension but apparently
- the files are not gzipped. You may however leave the file names as they
- are and specify later the file names without the ``.gz`` extension since
- reading of gzipped files is transparent for ctools.
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_dri.rst b/doc/source/users/tutorials/comptel/howto_comptel_dri.rst
deleted file mode 100644
index be0f4e9..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_dri.rst
+++ /dev/null
@@ -1,290 +0,0 @@
-.. _howto_comptel_dri:
-
-Generating your own event selection
------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use the GammaLib classes to generate your own
- data cubes and response functions for a COMPTEL analysis.
-
-The data in the
-`HEASARC archive `_
-comprises counts cubes for the standard COMPTEL energy ranges (0.75-1 MeV,
-1-3 MeV, 3-10 MeV and 10-30 MeV) per viewing period. In case that you want
-to analyse a different energy range, or that you want to perform a different
-event selection, you need to create ``DRE``, ``DRG``, ``DRB`` and ``DRX``
-data and the corresponding ``IAQ`` response function yourself. You can do
-this with GammaLib.
-
-Let's assume you want to make a 1.8 MeV line map of the Galactic centre.
-You can use for this the data of the COMPTEL viewing period 16 in phase 1 of
-the mission. Go to the
-`HEASARC archive `_
-and download the ``EVP``, ``TIM`` and ``OAD`` datasets. Once this is done,
-create the following
-:ref:`observation definition file `:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-.. note::
- There exist two formats for the
- :ref:`observation definition file `
- for COMPTEL data, one that describes the locations of the COMPTEL
- data space cubes and response functions, and one that desribes
- the location of an ``EVP`` event list, a ``TIM`` Good Time
- Interval file, and an arbitrary number of ``OAD`` Orbit Aspect
- Data files. In general there exists one ``OAD`` per day, while
- there is one ``EVP`` event file and one ``TIM`` Good Time Interval
- file per viewing period.
-
- In the example above, the environment variable ``$COMDATA`` was set
- to the root directory of the COMPTEL archive.
-
-Now you are ready to generate the ``DRE``, ``DRG``, ``DRB``, ``DRX`` and
-``IAQ`` datasets that you need for a ctools analysis of COMPTEL data.
-This will take a few minutes. Start
-`Python `_
-in your terminal and type the following:
-
-.. code-block:: python
-
- # You need GammaLib, of course ;)
- import gammalib
-
- # Create sky map for the definition of the DRE and DRG data cubes
- cube = gammalib.GSkyMap('TAN', 'GAL', 0.0, 20.0, 1.0, 1.0, 80, 80)
-
- # Create sky map for the definition of the DRX exposure map
- expo = gammalib.GSkyMap('CAR', 'GAL', 0.0, 0.0, 1.0, 1.0, 360, 180)
-
- # Allocate DRE, DRG and DRX. DRE and DRG have a 3rd Phibar dimension, starting at 0.0 deg,
- # with a binsize of 2.0 deg, and 25 Phibar layers.
- dre = gammalib.GCOMDri(cube, 0.0, 2.0, 25)
- drg = gammalib.GCOMDri(cube, 0.0, 2.0, 25)
- drx = gammalib.GCOMDri(expo)
-
- # Set DRE energy range to 1.7-1.9 MeV, DRG and DRX are energy independent
- dre.ebounds(gammalib.GEbounds(gammalib.GEnergy(1.7, 'MeV'),
- gammalib.GEnergy(1.9, 'MeV')))
-
- # Load observation definition XML file 'obs.xml' (the file you created above)
- obsdef = gammalib.GObservations('obs.xml')
-
- # Compute DRE, DRG and DRX for the first observation in the XML file
- dre.compute_dre(obsdef[0])
- drg.compute_drg(obsdef[0])
- drx.compute_drx(obsdef[0])
-
- # Save DRE, DRG and DRX ('True' indicates to overwrite any existing file)
- dre.save('dre.fits', True)
- drg.save('drg.fits', True)
- drx.save('drx.fits', True)
-
- # Load DRE and DRG to generate a DRB background model cube
- dre = gammalib.GCOMDri('dre.fits')
- drb = gammalib.GCOMDri('drg.fits')
-
- # Normalise DRB on the Phibar distribution of the DRE cube
- npix = dre.nchi() * dre.npsi()
- for k in range(dre.nphibar()):
- sum_dre = 0.0
- sum_drb = 0.0
- for i in range(npix):
- index = i + k * npix
- sum_dre += dre[index]
- sum_drb += drb[index]
- if sum_drb > 0:
- for i in range(npix):
- index = i + k * npix
- drb[index] *= sum_dre / sum_drb
-
- # Save DRB
- drb.save('drb.fits', True)
-
- # Initialise IAQ that will hold the response function
- iaq = gammalib.GCOMIaq(55.0, 1.0, 50.0, 2.0)
-
- # Compute IAQ for a line energy of 1.809 MeV and an energy band of 1.7-1.9 MeV
- iaq.set(gammalib.GEnergy(1.809, 'MeV'),
- gammalib.GEbounds(gammalib.GEnergy(1.7, 'MeV'),
- gammalib.GEnergy(1.9, 'MeV')))
-
- # Save IAQ and you are done
- iaq.save('iaq.fits', True)
-
-Now you have everything at hand to perform a COMPTEL maximum likelihood
-analysis. For that purpoe you need to gather all the datasets that you
-just created in a new
-:ref:`observation definition file `
-that should look as follows:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-.. warning::
- Be aware that the attribute for the ``IAQ`` parameter is ``value`` and
- not ``file`` since the ``IAQ`` parameter is not necessarily a file
- but can be also a response name of the calibration database.
-
-Before doing a model fit you need a model. We included one in the ctools package
-that you can find at ``$CTOOLS/share/models/comptel_howto_gc.xml``. Here the
-first few lines of this model:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ...
-
-
-
-
-
-
-
-This file contains a single point source at the position of the Galactic
-Centre. The spectral model is a simple constant normalisation that will
-return the gamma-ray line flux in units of
-:math:`{\rm photons}\,{\rm cm}^{-2}\,{\rm s}^{-1}`.
-For the background we do a Phibar fitting of the ``DRB`` cube. Since the
-first four layers of the ``DRE`` cube are empty we start the nodes at the
-fifth layer which corresponds to a Phibar value of 9 degrees. There are
-subsequent nodes spaced by 2 degrees (not shown) up to a Phibar value of
-49 degrees.
-
-Now it's time for model fitting. You can produce for example a Test Statistic
-map of the region around the Galactic centre as follows:
-
-.. code-block:: bash
-
- $ cttsmap
- Input event list, counts cube or observation definition XML file [events.fits] obs_dri.xml
- Test source name [Crab] GC
- Input model definition XML file [$CTOOLS/share/models/crab.xml] $CTOOLS/share/models/comptel_howto_gc.xml
- Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL] GAL
- Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
- First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 0.0
- Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] 0.0
- Image scale (in degrees/pixel) [0.02] 1.0
- Size of the X axis in pixels [200] 50
- Size of the Y axis in pixels [200] 30
- Output Test Statistic map file [tsmap.fits]
-
-Below is the resulting Test Statistic map that shows 1.8 MeV emission
-following the Galactic plane and peaking near the Galactic centre.
-
-.. figure:: howto_comptel_1.8MeV_tsmap.png
- :width: 500px
- :align: center
-
- *1.8 MeV Test Statistic map for COMPTEL viewing period 16 of the Galactic Centre*
-
-It is left to you as an exercise to extend this example. To get a better
-statistics you may for example combine observations. For that purpose you
-can add the ``DRI`` datasets of multiple observations into single ``DRE``,
-``DRG``, ``DRB`` and ``DRX`` datasets,
-that's the way how the COMPTEL analysis was done. You can however also leave
-the ``DRI`` datasets separate and combine their description in the
-:ref:`observation definition file `.
-To combine for example the data of viewing periods 5, 7.5, 13, 16 and 27
-the
-:ref:`observation definition file `
-should look like this:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The corresponding Test Statistic map is shown below.
-
-.. figure:: howto_comptel_1.8MeV_tsmap_5vp.png
- :width: 500px
- :align: center
-
- *1.8 MeV Test Statistic map for COMPTEL viewing periods 5, 7.5, 13, 16 and 27 of the Galactic Centre*
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_fitting.rst b/doc/source/users/tutorials/comptel/howto_comptel_fitting.rst
deleted file mode 100755
index f638e62..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_fitting.rst
+++ /dev/null
@@ -1,285 +0,0 @@
-.. _howto_comptel_fitting:
-
-Fit a model to the data
------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctlike` to fit a parametric model to
- COMPTEL data.
-
-Start with creating an
-:ref:`observation definition file `
-that defines the names of the counts cube files, geometry factor files
-and exposure map files. In addition you will need background model files,
-but since those are not distributed with the data you will use the geometry
-factors also as background files, which is a reasonable zero order
-approximation of the instrumental background distribution in COMPTEL.
-
-Below the
-:ref:`observation definition file `
-that is needed for the following analyses. Since the four counts cubes
-correspond to the four energy bands, and every observation holds a single
-counts cube, an observation has been added for every energy band.
-The ``IAQ`` parameter indicates the instrument response, which needs
-to be given for each band in the specified format.
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Then you also need a
-:ref:`model definition file `
-that describes the source and background model that you want to fit. In the
-example below, a point source with a ower law is fit at the position of the
-Crab on top of an instrumental background model.
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ...
-
-
-
-
-
-
- ...
-
-
-
-
-
-
- ...
-
-
-
-
-
-
- ...
-
-
-
-Since the file is relatively long it is not entirely reproduced here, but you
-can download the file :download:`models.xml ` by clicking on
-the file name.
-
-The first source in the
-:ref:`model definition file `
-is the point source for the Crab, the next four sources are background
-model components for each of the energy bands.
-
-You may have recognised the ``id`` attribute for each model component. This
-attribute links a given model component to a given observation. For example,
-``Background(1.0-3.0)MeV`` has ``id="200001"`` and will hence only be used
-to model the background for the observation that corresponds to the 1 - 3 MeV
-band.
-
-Each background model implements a so called Phibar-fitting of the file that
-was specified for the background model (recall that you specified the geometry
-factors as background model). Phibar-fitting means that the background model
-is fitted to the data for each Phibar-layer of the counts cube. Each background
-model is composed of 25 nodes, corresponding to the number of Phibar layers
-of a COMPTEL counts cube, and each node is defined by it's Phibar value
-(a fixed parameter) and it's Normalization (in general a free parameter).
-For some background models some normalizations of Phibar layers have been set
-to zero and the parameters fixed to exclude layers from the fitting that do
-not contain any data (the filling-factor of a counts cube is energy dependent;
-for the 0.75 - 1 MeV energy bin the first 8 layers are in fact empty).
-
-Now you are ready to fit the model using the :ref:`ctlike` model tool. You do
-this as follows:
-
-.. code-block:: bash
-
- $ ctlike
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
- Output model definition XML file [crab_results.xml]
-
-:ref:`ctlike` creates on output the
-:ref:`model definition file `
-``crab_results.xml`` where the parameter values were updated by their
-fitted values, and where the statistical uncertainties were added using the
-``error`` attribute. To investigate how the fit went you should inspect the
-log file ``ctlike.log`` that was also created by :ref:`ctlike`:
-
-.. code-block:: none
-
- 2019-04-04T15:11:31: +=================================+
- 2019-04-04T15:11:31: | Maximum likelihood optimisation |
- 2019-04-04T15:11:31: +=================================+
- 2019-04-04T15:11:32: >Iteration 0: -logL=988079.891, Lambda=1.0e-03
- 2019-04-04T15:11:32: >Iteration 1: -logL=670528.685, Lambda=1.0e-03, delta=317551.206, step=1.0e+00, max(|grad|)=86223.268050 [Index:3]
- 2019-04-04T15:11:33: >Iteration 2: -logL=387041.036, Lambda=1.0e-04, delta=283487.648, step=1.0e+00, max(|grad|)=69889.358952 [Index:3]
- 2019-04-04T15:11:34: >Iteration 3: -logL=154421.136, Lambda=1.0e-05, delta=232619.900, step=1.0e+00, max(|grad|)=47995.573198 [Index:3]
- 2019-04-04T15:11:35: >Iteration 4: -logL=-12398.051, Lambda=1.0e-06, delta=166819.188, step=1.0e+00, max(|grad|)=24764.034734 [Index:3]
- 2019-04-04T15:11:35: >Iteration 5: -logL=-108274.155, Lambda=1.0e-07, delta=95876.104, step=1.0e+00, max(|grad|)=7544.055951 [Index:3]
- 2019-04-04T15:11:36: >Iteration 6: -logL=-145907.646, Lambda=1.0e-08, delta=37633.490, step=1.0e+00, max(|grad|)=1167.458562 [Index:3]
- 2019-04-04T15:11:36: >Iteration 7: -logL=-152898.181, Lambda=1.0e-09, delta=6990.535, step=1.0e+00, max(|grad|)=110.883829 [Index:3]
- 2019-04-04T15:11:37: >Iteration 8: -logL=-153217.048, Lambda=1.0e-10, delta=318.867, step=1.0e+00, max(|grad|)=-2.969678 [Scale factor 2:111]
- 2019-04-04T15:11:37: >Iteration 9: -logL=-153218.258, Lambda=1.0e-11, delta=1.210, step=1.0e+00, max(|grad|)=-0.047105 [Index:3]
- 2019-04-04T15:11:38: >Iteration 10: -logL=-153218.258, Lambda=1.0e-12, delta=0.000, step=1.0e+00, max(|grad|)=-0.001877 [Index:3]
- 2019-04-04T15:11:38:
- 2019-04-04T15:11:38: +====================================+
- 2019-04-04T15:11:38: | Maximum likelihood re-optimisation |
- 2019-04-04T15:11:38: +====================================+
- 2019-04-04T15:11:39: >Iteration 0: -logL=-152378.895, Lambda=1.0e-03
- 2019-04-04T15:11:39: >Iteration 1: -logL=-152759.255, Lambda=1.0e-03, delta=380.360, step=1.0e+00, max(|grad|)=-2.480233 [Scale factor 10:21]
- 2019-04-04T15:11:39: >Iteration 2: -logL=-152760.518, Lambda=1.0e-04, delta=1.263, step=1.0e+00, max(|grad|)=-0.019021 [Scale factor 10:21]
- 2019-04-04T15:11:40: >Iteration 3: -logL=-152760.518, Lambda=1.0e-05, delta=0.000, step=1.0e+00, max(|grad|)=-0.000001 [Scale factor 10:21]
- 2019-04-04T15:11:40:
- 2019-04-04T15:11:40: +============================================+
- 2019-04-04T15:11:40: | Maximum likelihood re-optimisation results |
- 2019-04-04T15:11:40: +============================================+
- 2019-04-04T15:11:40: === GOptimizerLM ===
- 2019-04-04T15:11:40: Optimized function value ..: -152760.518
- 2019-04-04T15:11:40: Absolute precision ........: 0.005
- 2019-04-04T15:11:40: Acceptable value decrease .: 2
- 2019-04-04T15:11:40: Optimization status .......: converged
- 2019-04-04T15:11:40: Number of parameters ......: 200
- 2019-04-04T15:11:40: Number of free parameters .: 87
- 2019-04-04T15:11:40: Number of iterations ......: 3
- 2019-04-04T15:11:40: Lambda ....................: 1e-06
- 2019-04-04T15:11:40:
- 2019-04-04T15:11:40: +=========================================+
- 2019-04-04T15:11:40: | Maximum likelihood optimisation results |
- 2019-04-04T15:11:40: +=========================================+
- 2019-04-04T15:11:40: === GOptimizerLM ===
- 2019-04-04T15:11:40: Optimized function value ..: -153218.258
- 2019-04-04T15:11:40: Absolute precision ........: 0.005
- 2019-04-04T15:11:40: Acceptable value decrease .: 2
- 2019-04-04T15:11:40: Optimization status .......: converged
- 2019-04-04T15:11:40: Number of parameters ......: 206
- 2019-04-04T15:11:40: Number of free parameters .: 89
- 2019-04-04T15:11:40: Number of iterations ......: 10
- 2019-04-04T15:11:40: Lambda ....................: 1e-13
- 2019-04-04T15:11:40: Maximum log likelihood ....: 153218.258
- 2019-04-04T15:11:40: Observed events (Nobs) ...: 527595.000
- 2019-04-04T15:11:40: Predicted events (Npred) ..: 527594.000 (Nobs - Npred = 1.00004248635378)
- 2019-04-04T15:11:40: === GModels ===
- 2019-04-04T15:11:40: Number of models ..........: 5
- 2019-04-04T15:11:40: Number of parameters ......: 206
- 2019-04-04T15:11:40: === GModelSky ===
- 2019-04-04T15:11:40: Name ......................: Crab
- 2019-04-04T15:11:40: Instruments ...............: all
- 2019-04-04T15:11:40: Test Statistic ............: 915.478960024426
- 2019-04-04T15:11:40: Observation identifiers ...: all
- 2019-04-04T15:11:40: Model type ................: PointSource
- 2019-04-04T15:11:40: Model components ..........: "PointSource" * "PowerLaw" * "Constant"
- 2019-04-04T15:11:40: Number of parameters ......: 6
- 2019-04-04T15:11:40: Number of spatial par's ...: 2
- 2019-04-04T15:11:40: RA .......................: 83.6331 [-360,360] deg (fixed,scale=1)
- 2019-04-04T15:11:40: DEC ......................: 22.0145 [-90,90] deg (fixed,scale=1)
- 2019-04-04T15:11:40: Number of spectral par's ..: 3
- 2019-04-04T15:11:40: Prefactor ................: 0.00237485707890478 +/- 0.000107670251181817 [-1,1] ph/cm2/s/MeV (free,scale=0.001,gradient)
- 2019-04-04T15:11:40: Index ....................: -2.47146337740947 +/- 0.0500850436160353 [5,-5] (free,scale=-1,gradient)
- 2019-04-04T15:11:40: PivotEnergy ..............: 1 [0.01,1000] MeV (fixed,scale=1,gradient)
- 2019-04-04T15:11:40: Number of temporal par's ..: 1
- 2019-04-04T15:11:40: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
- 2019-04-04T15:11:40: Number of scale par's .....: 0
-
-The fit converged after 10 iterations and did a second fit without the
-source component to determine the Test Statistic value of the Crab.
-The source is detected with a Test Statistic of 915.7 which corresponds to
-a detection significance of about 30 sigma.
-
-.. note::
- `Kuiper et al. 2001, A&A, 378, 918 `_
- presented the most comprehensive analysis of the COMPTEL Crab observations
- and summarize in their Table 3 the gamma-ray intensity as function of
- energy for the unpulsed and pulsed component of source. By adding the
- intensities and fitting the resulting values we obtained a prefactor
- of 2.5e-3, which is very close to the prefactor of 2.4e-3 obtained
- in the analysis above. The spectral index of the Kuiper's data is
- -2.2, a bit harder than the index of -2.5 obtained in the fit.
-
-.. note::
- The position of a point source can also be adjusted by :ref:`ctlike` for
- an analysis of COMPTEL data, hence you may set the corresponding parameters
- to ``free="1"`` to determine also the best fitting source position.
-
-.. warning::
- ctools supports for the moment only the fitting of point sources for
- COMPTEL data. Other spatial shapes will be implemented in the future.
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_query.jpg b/doc/source/users/tutorials/comptel/howto_comptel_query.jpg
deleted file mode 100755
index e6165e9..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_query.jpg and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_spectrum.png b/doc/source/users/tutorials/comptel/howto_comptel_spectrum.png
deleted file mode 100755
index e5c4dc3..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_spectrum.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_spectrum.rst b/doc/source/users/tutorials/comptel/howto_comptel_spectrum.rst
deleted file mode 100755
index e417d12..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_spectrum.rst
+++ /dev/null
@@ -1,42 +0,0 @@
-.. _howto_comptel_spectrum:
-
-Generate a spectral energy distribution for a source
-----------------------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctlike` to derive the spectral energy
- density of a source from COMPTEL data.
-
-To determine a spectrum of the Crab nebula you can use the :ref:`csspec`
-script. To do this, type
-
-.. code-block:: bash
-
- $ csspec
- Input event list, counts cube, or observation definition XML file [events.fits] obs.xml
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
- Source name [Crab]
- Spectrum generation method (SLICE|NODES|AUTO) [AUTO]
- Algorithm for defining energy bins (FILE|LIN|LOG|POW) [LOG]
- Start value for first energy bin in TeV [0.1] 0.00000075
- Stop value for last energy bin in TeV [100.0] 0.00003
- Number of energy bins (1-200) [20] 4
- Output spectrum file [spectrum.fits]
-
-This will generate a logarithmically spaced spectrum composed of 4 energy bins
-comprised within 0.75 MeV and 30 GeV. The :ref:`csspec` tool is run in the ``AUTO``
-mode, which for COMPTEL data corresponds to the ``NODES`` method. :ref:`csspec`
-will convert the Crab spectrum in the input model into a node function and fit
-all intensity nodes using :ref:`ctlike`. The resulting node intensities are
-then interpreted as the spectral point, and are displayed as red data points
-in the figure below. The black data points show the combined Crab nebular and
-pulsar spectrum from
-`Kuiper et al. 2001, A&A, 378, 918 `_
-for comparison.
-
-.. figure:: howto_comptel_spectrum.png
- :width: 600px
- :align: center
-
- *Spectrum of the Crab derived using a node function*
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_tsmap.png b/doc/source/users/tutorials/comptel/howto_comptel_tsmap.png
deleted file mode 100755
index 08ddb6f..0000000
Binary files a/doc/source/users/tutorials/comptel/howto_comptel_tsmap.png and /dev/null differ
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_tsmap.rst b/doc/source/users/tutorials/comptel/howto_comptel_tsmap.rst
deleted file mode 100755
index 1c2ddb6..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_tsmap.rst
+++ /dev/null
@@ -1,42 +0,0 @@
-.. _howto_comptel_tsmap:
-
-Generate a Test Statistic map
------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`cttsmap` to generate a Test Staristic
- map from COMPTEL data.
-
-The Test Statistic (or maximum likelihood ratio) is a measure of the detection
-significance of a gamma-ray source. By displacing the location of a test source
-on a grid of positions you can generate a Test Statistic map that helps in
-finding significant source and assessing the position uncertainty of a
-source. You do this by using the :ref:`cttsmap` tool as follows:
-
-.. code-block:: bash
-
- $ cttsmap
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Test source name [Crab]
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
- Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
- Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
- First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63]
- Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01]
- Image scale (in degrees/pixel) [0.02] 1.0
- Size of the X axis in pixels [200] 10
- Size of the Y axis in pixels [200] 10
- Output Test Statistic map file [tsmap.fits]
-
-:ref:`cttsmap` created a 10 x 10 pixels map with a pixel size of 1 degree
-around the location of the Crab and saved the result in the FITS file
-``tsmap.fits``. The file also contains the values of all fitted parameters
-at each grid position. The Test Statistics map is displayed using
-`ds9 `_ in the figure below:
-
-.. figure:: howto_comptel_tsmap.png
- :width: 400px
- :align: center
-
- *Test Statistic map for COMPTEL viewing period 1 of the Crab nebula*
diff --git a/doc/source/users/tutorials/comptel/howto_comptel_ulimit.rst b/doc/source/users/tutorials/comptel/howto_comptel_ulimit.rst
deleted file mode 100755
index 766efc3..0000000
--- a/doc/source/users/tutorials/comptel/howto_comptel_ulimit.rst
+++ /dev/null
@@ -1,106 +0,0 @@
-.. _howto_comptel_ulimit:
-
-Derive upper flux limits for a source
--------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctulimit` to determine upper flux limits
- from COMPTEL data using a likelihood profile method.
-
-Suppose we have tried to get the flux from a source, for example the Vela
-pulsar, but we have not managed to detect the source and now want to determine
-an upper flux limit for that object. You can do this with the :ref:`ctulimit`
-tool.
-
-First you have to retreive the COMPTEL data for the Vela pulsar. You can
-do this by following
-:ref:`the tutorial that explains how to download COMPTEL data `.
-Suppose you have selected the data from viewing period 8. You then have to
-create the following
-:ref:`observation definition file `:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-As next step you have to create a
-:ref:`model definition file `.
-You can copy the file used for the Crab and adjust the point source
-component as shown below. Note that you need to fix the spectral index, and
-you should also constrain the ``Prefactor`` to positive values.
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ...
-
-
-Now you can run the :ref:`ctulimit` tool as follows. Since the tool is normally
-tuned for Cherenkov Telescope data analysis, energies are by default given in
-TeV. To specify a reference energy of the differential flux limit of 1 MeV you
-need to provide the hidden parameter ``eref=0.000001``. You can also set the
-flux interval for the intergal flux computation to 0.75 - 30 MeV by
-specifying ``emin=0.000000075 emax=0.00003`` (all values are given in TeV):
-
-.. code-block:: bash
-
- $ ctulimit eref=0.000001 emin=0.000000075 emax=0.00003
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Source of interest [Crab] Vela
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
-
-The results of the upper limit computation can then be extracted from the
-``ctulimit.log`` file that is created by :ref:`ctulimit`:
-
-.. code-block:: bash
-
- 2019-04-04T15:47:22: +=====================+
- 2019-04-04T15:47:22: | Upper limit results |
- 2019-04-04T15:47:22: +=====================+
- 2019-04-04T15:47:22: Differential flux limit ...: 9.26467937144868e-06 ph/cm2/s/MeV at 1e-06 TeV
- 2019-04-04T15:47:22: Integral flux limit .......: 6.42766691440729e-05 ph/cm2/s within [7.5e-08-3e-05] TeV
- 2019-04-04T15:47:22: Energy flux limit .........: 1.54473853201363e-10 erg/cm2/s within [7.5e-08-3e-05] TeV
diff --git a/doc/source/users/tutorials/comptel/index.rst b/doc/source/users/tutorials/comptel/index.rst
index 01cd9ea..1ae1a63 100755
--- a/doc/source/users/tutorials/comptel/index.rst
+++ b/doc/source/users/tutorials/comptel/index.rst
@@ -12,10 +12,11 @@ COMPTEL
.. toctree::
:maxdepth: 1
- howto_comptel_download
- howto_comptel_fitting
- howto_comptel_butterfly
- howto_comptel_spectrum
- howto_comptel_tsmap
- howto_comptel_ulimit
- howto_comptel_dri
+ download
+ selection
+ binning
+ modelling
+ fitting
+ residuals
+ tsmap
+ pulsar
diff --git a/doc/source/users/tutorials/comptel/modelling.rst b/doc/source/users/tutorials/comptel/modelling.rst
new file mode 100755
index 0000000..cb4e217
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/modelling.rst
@@ -0,0 +1,83 @@
+.. _comptel_modelling:
+
+Modeling the data
+-----------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to generate a
+ :ref:`model definition file `
+ for the analysis of COMPTEL data.
+
+
+As next step you need to create a model to describe the COMPTEL data.
+This step is accomplished using the :ref:`comobsmodel` script. The
+example below shows how you can generate a model for a point source at
+the position of the Crab.
+
+.. code-block:: bash
+
+ $ comobsmodel
+ Input observation definition file [obs.xml] obs_binned.xml
+ Right Ascension of point source (deg) [NONE] 83.6331
+ Declination of point source (deg) [NONE] 22.0145
+ Name of point source [NONE] Crab
+ Bremsstrahlung component (NONE|MAP|CUBE) [NONE]
+ Inverse Compton component (NONE|MAP|CUBE) [NONE]
+ Isotropic component (NONE|CONST|CONSTFIX) [NONE]
+ Output model definition file [models.xml]
+
+:ref:`comobsmodel` produces on output a
+:ref:`model definition file `
+which in the example is named ``models.xml``. The content of this file
+is shown below. The model comprises a point source with power law spectrum at the
+position of the Crab and a background model component for each of the four energy
+bins. By default the background model is of type ``DRBPhibarBins`` which defines
+a free scaling factor for each of the :math:`\bar{\varphi}` layers of the COMPTEL data space.
+
+.. code-block:: bash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ...
+
+
+
+
+
+ ...
+
+
+
+
+ ...
+
+
+
+
+ ...
+
+
+
+
+.. note::
+
+ To shorten the display, identical lines were replaced by three dots.
+
diff --git a/doc/source/users/tutorials/comptel/models.xml b/doc/source/users/tutorials/comptel/models.xml
deleted file mode 100755
index f2e4821..0000000
--- a/doc/source/users/tutorials/comptel/models.xml
+++ /dev/null
@@ -1,422 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/source/users/tutorials/comptel/pulsar.png b/doc/source/users/tutorials/comptel/pulsar.png
new file mode 100644
index 0000000..0e3e24f
Binary files /dev/null and b/doc/source/users/tutorials/comptel/pulsar.png differ
diff --git a/doc/source/users/tutorials/comptel/pulsar.rst b/doc/source/users/tutorials/comptel/pulsar.rst
new file mode 100755
index 0000000..7f1835f
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/pulsar.rst
@@ -0,0 +1,35 @@
+.. _comptel_pulsar:
+
+Creating pulsar pulse profiles
+------------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how you can generate pulse profiles for pulsars.
+
+
+Some of the gamma-ray sources in our Galaxy are pulsars, and eventually you
+want to study their pulse profiles in the MeV band using COMPTEL data.
+You do this using the :ref:`compulbin` script that generates a pulse profile
+FITS file. Below an example of how you can do this for the Crab pulsar.
+
+.. code-block:: bash
+
+ $ compulbin
+ Input observation definition file [obs.xml]
+ Pulsar name [PSR B0531+21]
+ Pulsar ephemerides file [$CTOOLS/share/models/ephem_xte.psrtime]
+ Minimum energy (MeV) (0.05-50.0) [0.75]
+ Maximum energy (MeV) (0.05-50.0) [30.0]
+ Number of phase bins (1-200) [33]
+ Output pulsar phase bins file [pulsar.fits]
+
+On output, :ref:`compulbin` creates a pulse profile FITS file that is displayed
+in the figure below.
+
+.. figure:: pulsar.png
+ :width: 400px
+ :align: center
+
+ *Crab pulsar pulse profile for viewing period 0001*
+
diff --git a/doc/source/users/tutorials/comptel/residuals.png b/doc/source/users/tutorials/comptel/residuals.png
new file mode 100644
index 0000000..8bfc512
Binary files /dev/null and b/doc/source/users/tutorials/comptel/residuals.png differ
diff --git a/doc/source/users/tutorials/comptel/residuals.rst b/doc/source/users/tutorials/comptel/residuals.rst
new file mode 100755
index 0000000..d88514f
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/residuals.rst
@@ -0,0 +1,38 @@
+.. _comptel_residuals:
+
+Inspecting fit residuals
+------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how you can inspect the residuals after model fitting.
+
+
+Following a model fit it is good practice to inspect the fit residuals, i.e.
+the difference between the observed and the modelled event distributions. You do
+this using the :ref:`comobsres` script that projects the fit residuals along
+an event cone onto the sky. The example below show how a residual map is
+created for the fit of the Crab point source model.
+
+.. code-block:: bash
+
+ $ comobsres
+ Input observation definition file [obs.xml] outobs.xml
+ Input model definition file [models.xml] results.xml
+ Residual map computation algorithm (SUB|SUBDIV|SUBDIVSQRT|SIGNIFICANCE) [SIGNIFICANCE]
+ Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [GAL]
+ Projection method (AIT|AZP|CAR|GLS|MOL|SFL|SIN|STG|TAN) [TAN]
+ Output residual map [resmap.fits]
+
+On output :ref:`comobsres` creates a residual map that in the example above
+is named ``resmap.fits``. The residual map is actually a map cube, containing
+a residual map for each energy bin. The map cube is displayed in the Figure
+below. The color scale ranges from -4 to +4 sigma. Some residuals appear to be
+present in the data, with the largest residuals being generally observed at
+low energies.
+
+.. figure:: residuals.png
+ :width: 600px
+ :align: center
+
+ *Residual maps for the four energy bins*
diff --git a/doc/source/users/tutorials/comptel/selection.rst b/doc/source/users/tutorials/comptel/selection.rst
new file mode 100755
index 0000000..082ae33
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/selection.rst
@@ -0,0 +1,65 @@
+.. _comptel_selection:
+
+Select data from database
+-------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to select COMPTEL data for an analysis with ctools.
+
+
+The first step of a COMPTEL science analysis consists in the selection
+of the relevant viewing periods. You do this with the :ref:`comobsselect`
+script. In the following example, all viewing periods with pointing directions
+within 30 degrees of the Crab and with dates between April and May 1991
+are selected.
+
+.. code-block:: bash
+
+ $ comobsselect
+ Pointing selection region shape (CIRCLE|BOX) [CIRCLE]
+ Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [GAL]
+ Galactic longitude of selection centre (deg) (0-360) [184.56]
+ Galactic latitude of selection centre (deg) (-90-90) [-5.79]
+ Radius of selection circle (deg) (0-180) [30]
+ Start time (UTC string, JD, MJD or MET in seconds) [NONE] 1991-05-01T00:00:00
+ Stop time (UTC string, JD, MJD or MET in seconds) [NONE] 1991-06-01T00:00:00
+ Output observation definition file [obs.xml]
+
+Giving the limits on the start and stop time, only viewing period ``0001``
+will be selected by :ref:`comobsselect`. The resulting
+:ref:`observation definition file `
+``obs.xml`` will have the following content:
+
+.. code-block:: bash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+The file contains a single observation, composed of an event file (``EVP``),
+a Good Time Interval file (``TIM``) and 15 Orbit Aspect data files (``OAD``).
+
+.. note::
+
+ If no limit on the observation dates should be applied then specify ``NONE``
+ as the start or stop time.
diff --git a/doc/source/users/tutorials/comptel/tsmap.png b/doc/source/users/tutorials/comptel/tsmap.png
new file mode 100644
index 0000000..f572059
Binary files /dev/null and b/doc/source/users/tutorials/comptel/tsmap.png differ
diff --git a/doc/source/users/tutorials/comptel/tsmap.rst b/doc/source/users/tutorials/comptel/tsmap.rst
new file mode 100755
index 0000000..1d32287
--- /dev/null
+++ b/doc/source/users/tutorials/comptel/tsmap.rst
@@ -0,0 +1,54 @@
+.. _comptel_tsmap:
+
+Generating a TS map
+-------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how you can generate a Test Statistic map for COMPTEL
+ data.
+
+
+Eventually you may want to investigate if gamma-ray sources are present
+in a specific data set. You do this using the :ref:`comlixmap` script that
+generates a maximum likelihood map, also known as Test Statistic map. In the
+example below, a Test Statistic map with 10x10 pixels is generated around
+the position of the Crab pulsar and pulsar wind nebula. Note that :ref:`comlixmap`
+will fit a test source jointly for the four energy bins that are present in
+the
+:ref:`observation definition file ` ``obs_binned.xml``.
+
+
+.. code-block:: bash
+
+ $ comlixmap
+ Input observation definition file [obs.xml] obs_binned.xml
+ Input model definition file [models.xml]
+ Test source name [Crab]
+ Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [GAL]
+ Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [TAN]
+ First coordinate of image center in degrees (RA or galactic l) (0-360) [180.24] 184.6
+ Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [-1.50] -5.8
+ Image scale (in degrees/pixel) (0.01-10.0) [1.0]
+ Size of the X axis in pixels (1-500) [10]
+ Size of the Y axis in pixels (1-500) [10]
+ Method for background computation (PHINOR|BGDLIXA|BGDLIXE) [BGDLIXE]
+ Output Test Statistic map file [tsmap.fits]
+
+.. warning::
+
+ The executing of the :ref:`comlixmap` script takes some time since an iterative
+ SRCLIX analysis is performed at each of the map's grid positions. The example
+ above takes between 30 min and 2 hours, depending on operating system and
+ processor speed.
+
+On output :ref:`comlixmap` creates a Test Statistic map, which in the example
+above is named ``tsmap.fits``. The figure below shows the content of the map,
+which reveals a significant gamma-ray source at the position of the Crab.
+
+.. figure:: tsmap.png
+ :width: 400px
+ :align: center
+
+ *Test statistic map around the Crab for viewing period 0001*
+
diff --git a/doc/source/users/tutorials/cta/1dc/index.rst b/doc/source/users/tutorials/cta/1dc/index.rst
deleted file mode 100755
index 4f4b71e..0000000
--- a/doc/source/users/tutorials/cta/1dc/index.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-.. _cta_1dc:
-
-First CTA Data Challenge
-========================
-
-.. toctree::
- :maxdepth: 1
-
- scope
- getting_data
- data_organisation
- first
-
diff --git a/doc/source/users/tutorials/cta/howto/index.rst b/doc/source/users/tutorials/cta/howto/index.rst
deleted file mode 100755
index a8c5e47..0000000
--- a/doc/source/users/tutorials/cta/howto/index.rst
+++ /dev/null
@@ -1,50 +0,0 @@
-.. _cta_howto:
-
-CTA How-tos
-===========
-
-The following sections teach you how to use ctools to address some typical
-CTA science analysis.
-
-CTA data analysis
------------------
-
-.. toctree::
- :maxdepth: 1
-
- howto_combine_observations
- howto_stacked_analysis
- howto_model_handling_python
- howto_advanced_python_fitting
- howto_scs
- howto_connect_irfs
- howto_connect_models
- howto_xspec
- howto_likelihood_profiles
-
-
-CTA first Data Challenge data analysis
---------------------------------------
-
-.. toctree::
- :maxdepth: 1
-
- howto_prepare_1dc
- howto_ts
- howto_tsmap
- howto_extent
- howto_ulimit
- howto_lightcurve
- howto_phasecurve
- howto_exclude
- howto_display
- howto_vo
-
-
-Analysis of data from other instruments
----------------------------------------
-
-.. toctree::
- :maxdepth: 1
-
- howto_combine_instruments
diff --git a/doc/source/users/tutorials/cta/index.rst b/doc/source/users/tutorials/cta/index.rst
index 416376e..e1ddd9f 100755
--- a/doc/source/users/tutorials/cta/index.rst
+++ b/doc/source/users/tutorials/cta/index.rst
@@ -1,7 +1,7 @@
.. _tutorials_cta:
-Cherenkov Telescope Array
-=========================
+CTA
+===
.. admonition:: What you will learn
@@ -9,9 +9,78 @@ Cherenkov Telescope Array
`Cherenkov Telescope Array `_
with ctools.
+
+First steps with ctools
+-----------------------
+
+.. toctree::
+ :maxdepth: 1
+
+ quickstart/simulating
+ quickstart/selecting
+ quickstart/skymap
+ quickstart/binning
+ quickstart/response
+ quickstart/fitting
+ quickstart/residual_map
+ quickstart/residual_spectrum
+ quickstart/butterfly
+ quickstart/spectrum
+ quickstart/unbinned
+ quickstart/energy_dispersion
+ quickstart/onoff
+ quickstart/ctools-from-python
+
+First CTA Data Challenge
+------------------------
+
+.. toctree::
+ :maxdepth: 1
+
+ 1dc/scope
+ 1dc/getting_data
+ 1dc/data_organisation
+ 1dc/first
+
+CTA data analysis
+-----------------
+
+.. toctree::
+ :maxdepth: 1
+
+ howto/howto_combine_observations
+ howto/howto_stacked_analysis
+ howto/howto_model_handling_python
+ howto/howto_advanced_python_fitting
+ howto/howto_scs
+ howto/howto_connect_irfs
+ howto/howto_connect_models
+ howto/howto_xspec
+ howto/howto_likelihood_profiles
+
+
+CTA first Data Challenge data analysis
+--------------------------------------
+
+.. toctree::
+ :maxdepth: 1
+
+ howto/howto_prepare_1dc
+ howto/howto_ts
+ howto/howto_tsmap
+ howto/howto_extent
+ howto/howto_ulimit
+ howto/howto_lightcurve
+ howto/howto_phasecurve
+ howto/howto_exclude
+ howto/howto_display
+ howto/howto_vo
+
+
+Analysis of data from other instruments
+---------------------------------------
+
.. toctree::
:maxdepth: 1
- quickstart/index
- 1dc/index
- howto/index
+ howto/howto_combine_instruments
diff --git a/doc/source/users/tutorials/cta/quickstart/index.rst b/doc/source/users/tutorials/cta/quickstart/index.rst
deleted file mode 100755
index 1013587..0000000
--- a/doc/source/users/tutorials/cta/quickstart/index.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-.. _cta_quickstart:
-
-First steps with ctools
------------------------
-
-This section provides a hands-on introduction of ctools. By means of an
-example you will learn how to simulate and analyse CTA event data. This
-section is intended to be read by newcomers. The reading and executing of the
-examples should take about an hour, so grab some coffee before you start.
-
-.. toctree::
- :maxdepth: 1
-
- simulating
- selecting
- skymap
- binning
- response
- fitting
- residual_map
- residual_spectrum
- butterfly
- spectrum
- unbinned
- energy_dispersion
- onoff
- ctools-from-python
diff --git a/doc/source/users/tutorials/fermi/fermi_butterfly.png b/doc/source/users/tutorials/fermi/fermi_butterfly.png
new file mode 100644
index 0000000..80b8ef0
Binary files /dev/null and b/doc/source/users/tutorials/fermi/fermi_butterfly.png differ
diff --git a/doc/source/users/tutorials/fermi/fermi_butterfly.rst b/doc/source/users/tutorials/fermi/fermi_butterfly.rst
new file mode 100755
index 0000000..e3644dd
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_butterfly.rst
@@ -0,0 +1,46 @@
+.. _fermi_butterfly:
+
+Generate a butterfly diagram
+----------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`ctbutterfly` to create a butterfly diagram
+ for a model component from Fermi-LAT data.
+
+A butterfly diagram shows the envelope of all spectral models that are
+statistically compatible with the data. You can create such a butterfly
+diagram for the Vela pulsar using the :ref:`ctbutterfly` tool by providing
+the
+:ref:`model definition file `
+output file from :ref:`ctlike` as input:
+
+.. code-block:: bash
+
+ $ ctbutterfly
+ Input event list, counts cube or observation definition XML file [events.fits] obs.xml
+ Source of interest [Crab] Vela
+ Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
+ Start value for first energy bin in TeV [0.1] 0.0001
+ Stop value for last energy bin in TeV [100.0] 0.1
+ Output ASCII file [butterfly.txt]
+
+:ref:`ctbutterfly` produces the ASCII file ``butterfly.txt`` that contains
+the envelope of the butterfly diagram. The figure below gives a graphical
+representation of the envelope.
+
+.. figure:: fermi_butterfly.png
+ :width: 600px
+ :align: center
+
+ *Butterfly diagram of the fitted Vela pulsar spectrum*
+
+.. note::
+ The figure was created using the ``show_butterfly.py`` script that is
+ located in the ctools example folder. The example script requires the
+ `matplotlib `_ Python module for display.
+ You may reproduce the plot by typing
+
+ .. code-block:: bash
+
+ $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt
diff --git a/doc/source/users/tutorials/fermi/fermi_data.jpg b/doc/source/users/tutorials/fermi/fermi_data.jpg
new file mode 100755
index 0000000..bd17969
Binary files /dev/null and b/doc/source/users/tutorials/fermi/fermi_data.jpg differ
diff --git a/doc/source/users/tutorials/fermi/fermi_errors.rst b/doc/source/users/tutorials/fermi/fermi_errors.rst
new file mode 100755
index 0000000..f55ef1f
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_errors.rst
@@ -0,0 +1,112 @@
+.. _fermi_errors:
+
+Determine errors for a model parameters
+---------------------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`cterror` to derive asymmetric model
+ parameter errors from Fermi-LAT data using a likelihood profile method.
+
+The :ref:`ctlike` tool computes errors for each fitted parameter value based
+on the covariance matrix of the fit. This assumes a Gaussian approximation
+of the uncertainties around the best fitting values. Uncertainties may however
+by asymmetric.
+
+To test the symmetry of the uncertainties you can use the :ref:`cterror`
+tool. :ref:`cterror` will make use of the likelihood profile to determine
+the confidence interval for each fitted parameter, allowing thus also for
+asymmetric errors. You use :ref:`cterror` as follows:
+
+.. code-block:: bash
+
+ $ cterror
+ Input event list, counts cube or observation definition XML file [events.fits] obs.xml
+ Source of interest [Crab] Vela
+ Input model definiton XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
+ Output model definiton XML file [results.xml] vela_errors.xml
+
+The confidence intervals can then be extracted from the ``cterror.log`` log file
+that was created by :ref:`cterror`. As you will see, the parameter errors
+are essentially symmetric and very close to the values determined using the
+covariance matrix.
+
+.. code-block:: none
+
+ 2019-04-04T15:04:51: +================================================+
+ 2019-04-04T15:04:51: | Compute error for source "Vela" parameter "RA" |
+ 2019-04-04T15:04:51: +================================================+
+ 2019-04-04T15:04:51: Confidence level ..........: 68 %
+ 2019-04-04T15:04:51: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:04:51: Initial factor range ......: [128.819554251886, 128.851989886469]
+ 2019-04-04T15:05:10: Lower parameter factor ....: 128.834
+ 2019-04-04T15:05:10: Upper parameter factor ....: 128.837
+ 2019-04-04T15:05:10: Error from curvature ......: 0.00162178172918532 deg
+ 2019-04-04T15:05:10: Error from profile ........: 0.00169067577726878 deg
+ 2019-04-04T15:05:10: Negative profile error ....: 0.00165900035287336 deg
+ 2019-04-04T15:05:10: Positive profile error ....: 0.0017223512016642 deg
+ 2019-04-04T15:05:10:
+ 2019-04-04T15:05:10: +=================================================+
+ 2019-04-04T15:05:10: | Compute error for source "Vela" parameter "DEC" |
+ 2019-04-04T15:05:10: +=================================================+
+ 2019-04-04T15:05:10: Confidence level ..........: 68 %
+ 2019-04-04T15:05:10: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:05:10: Initial factor range ......: [-45.1949881925207, -45.1721741960936]
+ 2019-04-04T15:05:31: Lower parameter factor ....: -45.1847
+ 2019-04-04T15:05:31: Upper parameter factor ....: -45.1824
+ 2019-04-04T15:05:31: Error from curvature ......: 0.00114069982135549 deg
+ 2019-04-04T15:05:31: Error from profile ........: 0.0011654855352532 deg
+ 2019-04-04T15:05:31: Negative profile error ....: 0.00115852325606625 deg
+ 2019-04-04T15:05:31: Positive profile error ....: 0.00117244781444015 deg
+ 2019-04-04T15:05:31:
+ 2019-04-04T15:05:31: +=======================================================+
+ 2019-04-04T15:05:31: | Compute error for source "Vela" parameter "Prefactor" |
+ 2019-04-04T15:05:31: +=======================================================+
+ 2019-04-04T15:05:31: Confidence level ..........: 68 %
+ 2019-04-04T15:05:31: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:05:31: Initial factor range ......: [1e-07, 9.09784331943508]
+ 2019-04-04T15:06:15: Lower parameter factor ....: 3.93674
+ 2019-04-04T15:06:15: Upper parameter factor ....: 4.89558
+ 2019-04-04T15:06:15: Error from curvature ......: 4.74564602405264e-10 ph/cm2/s/MeV
+ 2019-04-04T15:06:15: Error from profile ........: 4.79421031332425e-10 ph/cm2/s/MeV
+ 2019-04-04T15:06:15: Negative profile error ....: 4.15456324070932e-10 ph/cm2/s/MeV
+ 2019-04-04T15:06:15: Positive profile error ....: 5.43385738593917e-10 ph/cm2/s/MeV
+ 2019-04-04T15:06:15:
+ 2019-04-04T15:06:15: +====================================================+
+ 2019-04-04T15:06:15: | Compute error for source "Vela" parameter "Index1" |
+ 2019-04-04T15:06:15: +====================================================+
+ 2019-04-04T15:06:15: Confidence level ..........: 68 %
+ 2019-04-04T15:06:15: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:06:15: Initial factor range ......: [1.03239332172832, 1.65461803910225]
+ 2019-04-04T15:07:01: Lower parameter factor ....: 1.31084
+ 2019-04-04T15:07:01: Upper parameter factor ....: 1.37275
+ 2019-04-04T15:07:01: Error from curvature ......: 0.0311112358686962
+ 2019-04-04T15:07:01: Error from profile ........: 0.0309517300207367
+ 2019-04-04T15:07:01: Negative profile error ....: 0.0326607212488756
+ 2019-04-04T15:07:01: Positive profile error ....: 0.0292427387925978
+ 2019-04-04T15:07:01:
+ 2019-04-04T15:07:01: +==========================================================+
+ 2019-04-04T15:07:01: | Compute error for source "Vela" parameter "CutoffEnergy" |
+ 2019-04-04T15:07:01: +==========================================================+
+ 2019-04-04T15:07:01: Confidence level ..........: 68 %
+ 2019-04-04T15:07:01: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:07:01: Initial factor range ......: [0.001, 2.80853448937906]
+ 2019-04-04T15:07:45: Lower parameter factor ....: 0.81239
+ 2019-04-04T15:07:45: Upper parameter factor ....: 1.17294
+ 2019-04-04T15:07:45: Error from curvature ......: 181.899981373502 MeV
+ 2019-04-04T15:07:45: Error from profile ........: 180.277267455479 MeV
+ 2019-04-04T15:07:45: Negative profile error ....: 177.144641582696 MeV
+ 2019-04-04T15:07:45: Positive profile error ....: 183.409893328263 MeV
+ 2019-04-04T15:07:45:
+ 2019-04-04T15:07:45: +====================================================+
+ 2019-04-04T15:07:45: | Compute error for source "Vela" parameter "Index2" |
+ 2019-04-04T15:07:45: +====================================================+
+ 2019-04-04T15:07:45: Confidence level ..........: 68 %
+ 2019-04-04T15:07:45: Log-likelihood difference .: 0.494473
+ 2019-04-04T15:07:45: Initial factor range ......: [0.3080285257564, 0.866644263519715]
+ 2019-04-04T15:08:32: Lower parameter factor ....: 0.559037
+ 2019-04-04T15:08:32: Upper parameter factor ....: 0.615056
+ 2019-04-04T15:08:32: Error from curvature ......: 0.0279307868881658
+ 2019-04-04T15:08:32: Error from profile ........: 0.0280092058454933
+ 2019-04-04T15:08:32: Negative profile error ....: 0.028299015035617
+ 2019-04-04T15:08:32: Positive profile error ....: 0.0277193966553695
diff --git a/doc/source/users/tutorials/fermi/fermi_fitting.rst b/doc/source/users/tutorials/fermi/fermi_fitting.rst
new file mode 100755
index 0000000..fd772f0
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_fitting.rst
@@ -0,0 +1,257 @@
+.. _fermi_fitting:
+
+Fit a model to the data
+-----------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`ctlike` to fit a parametric model to
+ Fermi-LAT data.
+
+Start with creating an
+:ref:`observation definition file `
+that defines the names of the counts map file, the exposure map file, the
+live time cube file and the name of the instrument response function that
+should be used for the analysis:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+This will be your input file to all tools.
+Then you also need a
+:ref:`model definition file `
+that describes the source and background model that you want to fit. In the
+example below, a point source with a super exponentially cut-off power law is
+fit at the position of the Vela pulsar on top of a Galactic diffuse and an
+extragalactic isotropic source component.
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. warning::
+ The names of the diffuse model components have to be identical to the
+ names used when preparing the ``srcmaps.fits`` file using ``gtsrcmap``.
+
+Now you are ready to fit the model using the :ref:`ctlike` model tool. You do
+this as follows:
+
+.. code-block:: bash
+
+ $ ctlike
+ Input event list, counts cube or observation definition XML file [events.fits] obs.xml
+ Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
+ Output model definition XML file [crab_results.xml] vela_results.xml
+
+:ref:`ctlike` creates on output the
+:ref:`model definition file `
+``vela_results.xml`` where the parameter values were updated by their
+fitted values, and where the statistical uncertainties were added using the
+``error`` attribute. To investigate how the fit went you should inspect the
+log file ``ctlike.log`` that was also created by :ref:`ctlike`:
+
+.. code-block:: none
+
+ 2019-04-04T14:34:18: +=================================+
+ 2019-04-04T14:34:18: | Maximum likelihood optimisation |
+ 2019-04-04T14:34:18: +=================================+
+ 2019-04-04T14:34:20: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03
+ 2019-04-04T14:34:20: >Iteration 1: -logL=-198931.136, Lambda=1.0e-03, delta=21698.809, step=1.0e+00, max(|grad|)=-22717.063466 [CutoffEnergy:4]
+ 2019-04-04T14:34:21: >Iteration 2: -logL=-200269.888, Lambda=1.0e-04, delta=1338.753, step=1.0e+00, max(|grad|)=-67629.683813 [CutoffEnergy:4]
+ 2019-04-04T14:34:21: >Iteration 3: -logL=-212351.965, Lambda=1.0e-05, delta=12082.076, step=1.0e+00, max(|grad|)=23026.802441 [Index2:6]
+ 2019-04-04T14:34:22: >Iteration 4: -logL=-213954.259, Lambda=1.0e-06, delta=1602.294, step=1.0e+00, max(|grad|)=-8297.380921 [CutoffEnergy:4]
+ 2019-04-04T14:34:22: >Iteration 5: -logL=-215347.973, Lambda=1.0e-07, delta=1393.714, step=1.0e+00, max(|grad|)=2746.754045 [Index2:6]
+ 2019-04-04T14:34:23: >Iteration 6: -logL=-215497.807, Lambda=1.0e-08, delta=149.834, step=1.0e+00, max(|grad|)=699.848487 [Index2:6]
+ 2019-04-04T14:34:23: Iteration 7: -logL=-215497.807, Lambda=1.0e-09, delta=-13.845, step=1.0e+00, max(|grad|)=-1201.982876 [Index1:3] (stalled)
+ 2019-04-04T14:34:24: Iteration 8: -logL=-215497.807, Lambda=1.0e-08, delta=-13.844, step=1.0e+00, max(|grad|)=-1201.959648 [Index1:3] (stalled)
+ 2019-04-04T14:34:24: Iteration 9: -logL=-215497.807, Lambda=1.0e-07, delta=-13.835, step=1.0e+00, max(|grad|)=-1201.727402 [Index1:3] (stalled)
+ 2019-04-04T14:34:24: Iteration 10: -logL=-215497.807, Lambda=1.0e-06, delta=-13.744, step=1.0e+00, max(|grad|)=-1199.408718 [Index1:3] (stalled)
+ 2019-04-04T14:34:25: Iteration 11: -logL=-215497.807, Lambda=1.0e-05, delta=-12.858, step=1.0e+00, max(|grad|)=-1176.594022 [Index1:3] (stalled)
+ 2019-04-04T14:34:26: Iteration 12: -logL=-215497.807, Lambda=1.0e-04, delta=-6.126, step=1.0e+00, max(|grad|)=-980.833964 [Index1:3] (stalled)
+ 2019-04-04T14:34:26: >Iteration 13: -logL=-215503.803, Lambda=1.0e-03, delta=5.995, step=1.0e+00, max(|grad|)=-285.964915 [Index1:3]
+ 2019-04-04T14:34:27: Iteration 14: -logL=-215503.803, Lambda=1.0e-04, delta=-8.762, step=1.0e+00, max(|grad|)=-730.461327 [Index1:3] (stalled)
+ 2019-04-04T14:34:27: >Iteration 15: -logL=-215504.976, Lambda=1.0e-03, delta=1.173, step=1.0e+00, max(|grad|)=-153.941337 [Index1:3]
+ 2019-04-04T14:34:28: Iteration 16: -logL=-215503.593, Lambda=1.0e-04, delta=-1.383, step=1.0e+00, max(|grad|)=-327.368446 [Index1:3] (stalled)
+ 2019-04-04T14:34:28: >Iteration 17: -logL=-215505.817, Lambda=1.0e-03, delta=2.225, step=1.0e+00, max(|grad|)=3.256215 [Index2:6]
+ 2019-04-04T14:34:29: >Iteration 18: -logL=-215505.824, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.190315 [CutoffEnergy:4]
+ 2019-04-04T14:34:29: >Iteration 19: -logL=-215505.826, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.635264 [Index2:6]
+ 2019-04-04T14:34:30:
+ 2019-04-04T14:34:30: +=========================================+
+ 2019-04-04T14:34:30: | Maximum likelihood optimisation results |
+ 2019-04-04T14:34:30: +=========================================+
+ 2019-04-04T14:34:30: === GOptimizerLM ===
+ 2019-04-04T14:34:30: Optimized function value ..: -215505.826
+ 2019-04-04T14:34:30: Absolute precision ........: 0.005
+ 2019-04-04T14:34:30: Acceptable value decrease .: 2
+ 2019-04-04T14:34:30: Optimization status .......: converged
+ 2019-04-04T14:34:30: Number of parameters ......: 14
+ 2019-04-04T14:34:30: Number of free parameters .: 7
+ 2019-04-04T14:34:30: Number of iterations ......: 19
+ 2019-04-04T14:34:30: Lambda ....................: 1e-06
+ 2019-04-04T14:34:30: Maximum log likelihood ....: 215505.826
+ 2019-04-04T14:34:30: Observed events (Nobs) ...: 202330.000
+ 2019-04-04T14:34:30: Predicted events (Npred) ..: 202318.925 (Nobs - Npred = 11.0749567862367)
+ 2019-04-04T14:34:30: === GModels ===
+ 2019-04-04T14:34:30: Number of models ..........: 3
+ 2019-04-04T14:34:30: Number of parameters ......: 14
+ 2019-04-04T14:34:30: === GModelSky ===
+ 2019-04-04T14:34:30: Name ......................: Vela
+ 2019-04-04T14:34:30: Instruments ...............: all
+ 2019-04-04T14:34:30: Observation identifiers ...: all
+ 2019-04-04T14:34:30: Model type ................: PointSource
+ 2019-04-04T14:34:30: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant"
+ 2019-04-04T14:34:30: Number of parameters ......: 8
+ 2019-04-04T14:34:30: Number of spatial par's ...: 2
+ 2019-04-04T14:34:30: RA .......................: 128.835772118406 +/- 0.00162177814111823 [-360,360] deg (free,scale=1)
+ 2019-04-04T14:34:30: DEC ......................: -45.1835812138759 +/- 0.00114069728372229 [-90,90] deg (free,scale=1)
+ 2019-04-04T14:34:30: Number of spectral par's ..: 5
+ 2019-04-04T14:34:30: Prefactor ................: 4.35032346843698e-09 +/- 4.73845090232622e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient)
+ 2019-04-04T14:34:30: Index1 ...................: -1.34367731364905 +/- 0.0310888116010815 [-0,-5] (free,scale=-1,gradient)
+ 2019-04-04T14:34:30: CutoffEnergy .............: 990.275379021926 +/- 181.814299577731 [1,1000000] MeV (free,scale=1000,gradient)
+ 2019-04-04T14:34:30: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient)
+ 2019-04-04T14:34:30: Index2 ...................: 0.58755011716699 +/- 0.027919253961318 [0.1,5] (free,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of temporal par's ..: 1
+ 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of scale par's .....: 0
+ 2019-04-04T14:34:30: === GModelSky ===
+ 2019-04-04T14:34:30: Name ......................: Galactic_diffuse
+ 2019-04-04T14:34:30: Instruments ...............: all
+ 2019-04-04T14:34:30: Observation identifiers ...: all
+ 2019-04-04T14:34:30: Model type ................: DiffuseSource
+ 2019-04-04T14:34:30: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant"
+ 2019-04-04T14:34:30: Number of parameters ......: 3
+ 2019-04-04T14:34:30: Number of spatial par's ...: 1
+ 2019-04-04T14:34:30: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of spectral par's ..: 1
+ 2019-04-04T14:34:30: Normalization ............: 1.10941973066989 +/- 0.00503412002600817 [0.1,1000] (free,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of temporal par's ..: 1
+ 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of scale par's .....: 0
+ 2019-04-04T14:34:30: === GModelSky ===
+ 2019-04-04T14:34:30: Name ......................: Extragalactic_diffuse
+ 2019-04-04T14:34:30: Instruments ...............: all
+ 2019-04-04T14:34:30: Observation identifiers ...: all
+ 2019-04-04T14:34:30: Model type ................: DiffuseSource
+ 2019-04-04T14:34:30: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant"
+ 2019-04-04T14:34:30: Number of parameters ......: 3
+ 2019-04-04T14:34:30: Number of spatial par's ...: 1
+ 2019-04-04T14:34:30: Value ....................: 1 [0,10] (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of spectral par's ..: 1
+ 2019-04-04T14:34:30: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of temporal par's ..: 1
+ 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
+ 2019-04-04T14:34:30: Number of scale par's .....: 0
+
+The fit converged after 19 iterations with spectral parameters that are
+reasonably close to those found in
+`Abdo et al. 2010, ApJ, 713, 154 `_
+using the Fermi-LAT Science Tools.
+
+.. note::
+ The fit results can be compared to the corresponding output of gtlike
+ when the tool is applied to the same test data. As you will see below,
+ the fitted model parameters are basically identical.
+
+ .. code-block:: none
+
+ Extragalactic_diffuse:
+ Normalization: 1
+ Flux: 0.000149604 photons/cm^2/s
+
+ Galactic_diffuse:
+ Value: 1.11394 +/- 0.00508393
+ Flux: 0.00054415 +/- 2.48325e-06 photons/cm^2/s
+
+ Vela:
+ Prefactor: 4.3344 +/- 0.65258
+ Index1: 1.34634 +/- 0.0429336
+ Scale: 1
+ Cutoff: 1.00992 +/- 0.25512
+ Index2: 0.595018 +/- 0.0398585
+ TS value: 326648
+ Flux: 1.0758e-05 +/- 4.33949e-08 photons/cm^2/s
+
+ WARNING: Fit may be bad in range [100, 149.23] (MeV)
+ WARNING: Fit may be bad in range [182.299, 405.972] (MeV)
+ WARNING: Fit may be bad in range [6690.96, 8173.66] (MeV)
+ WARNING: Fit may be bad in range [14900.5, 18202.4] (MeV)
+ WARNING: Fit may be bad in range [33182.8, 40536] (MeV)
+ WARNING: Fit may be bad in range [49518.7, 60491.9] (MeV)
+
+ Total number of observed counts: 202330
+ Total number of model events: 202327
+
+ -log(Likelihood): -215606.3555
+
+ Elapsed CPU time: 72.33
+
+ You may also compute the Test Statistic value using :ref:`ctlike` by
+ adding the ``tscalc="1"`` attribute to the
+ :ref:`model definition file `:
+
+ .. code-block:: xml
+
+
+
+
+ ...
+
+
+ This results in
+
+ .. code-block:: none
+
+ 2019-04-04T14:37:50: Name ......................: Vela
+ 2019-04-04T14:37:50: Instruments ...............: all
+ 2019-04-04T14:37:50: Test Statistic ............: 326341.43991719
+
+ which is also close to the value determined by gtlike.
+
+.. note::
+ Unlike gtlike, :ref:`ctlike` can also fit the source location. This has been
+ done in the example above by setting the parameter attributes to ``free="1"``.
+
+.. warning::
+ ctools supports for the moment only the fitting of point sources for
+ Fermi-LAT data. Other spatial shapes need to be preconvolved with the
+ instrument response functions and added to the ``srcmaps.fits`` file.
diff --git a/doc/source/users/tutorials/fermi/fermi_prepare.rst b/doc/source/users/tutorials/fermi/fermi_prepare.rst
new file mode 100755
index 0000000..0db2f92
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_prepare.rst
@@ -0,0 +1,222 @@
+.. _fermi_prepare:
+
+Prepare Fermi-LAT data
+----------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to prepare Fermi-LAT data for an analysis with
+ ctools.
+
+ You will find more information about the Fermi-LAT software and data
+ analysis at the
+ `Fermi Science Support Center (FSSC) `_
+ web site.
+
+
+Prerequisits
+~~~~~~~~~~~~
+
+The following sections assume that you have properly installed the Fermi-LAT
+Science Tools. The Fermi-LAT Science Tools can be downloaded from the
+`Fermi Science Support Center (FSSC) `_.
+
+
+Get data from the Fermi-LAT data server
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Start with requesting the data you are interested in from the
+`Fermi-LAT Data server `_.
+As example the figure below shows a request for data around the Vela pulsar.
+
+.. figure:: fermi_query.jpg
+ :width: 600px
+ :align: center
+
+ *Fermi-LAT data server interface*
+
+After submitting the request you will get information of how to retrieve the
+data:
+
+.. figure:: fermi_data.jpg
+ :width: 600px
+ :align: center
+
+ *Fermi-LAT data retrieval information*
+
+Now you download the data using the ``wget`` tool. At the same time of
+downloading the data you should also download the input files for the diffuse
+galactic and extragalactic model components. In the current example the
+following files were downloaded:
+
+.. code-block:: bash
+
+ $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_SC00.fits
+ $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_PH00.fits
+ $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_PH01.fits
+ $ wget https://fermi.gsfc.nasa.gov/ssc/data/analysis/software/aux/gll_iem_v06.fits
+ $ wget https://fermi.gsfc.nasa.gov/ssc/data/analysis/software/aux/iso_P8R2_SOURCE_V6_v06.txt
+
+.. warning::
+ In the current example data within a radius of only 10 degrees around the
+ source of interest were selected. This was mainly for getting a small
+ data set. The
+ `Fermi Science Support Center (FSSC) `_
+ recommends to use larger regions for the Fermi-LAT data analysis.
+
+
+Data preparation
+~~~~~~~~~~~~~~~~
+
+First you need to combine the event lists into a single file. At the same
+time you will select the region of interest for the analysis. You do this
+using the ``gtselect`` tool:
+
+.. code-block:: bash
+
+ $ ls *_PH* > events.txt
+ $ gtselect evclass=128 evtype=3
+ Input FT1 file[] @events.txt
+ Output FT1 file[] events_fermi.fits
+ RA for new search center (degrees) (0:360) [INDEF] 128.84
+ Dec for new search center (degrees) (-90:90) [INDEF] -45.18
+ radius of new search region (degrees) (0:180) [INDEF] 10.0
+ start time (MET in s) (0:) [INDEF]
+ end time (MET in s) (0:) [INDEF]
+ lower energy limit (MeV) (0:) [30] 100.0
+ upper energy limit (MeV) (0:) [300000] 300000.0
+ maximum zenith angle value (degrees) (0:180) [180] 90.0
+
+Now you have to select from all events those which fall into periods where
+data quality is good, the telescope is configured for science, and the rocking
+angle is not too large. You do this using the ``gtmktime`` tool that defines
+the Good Time Intervals for your analysis:
+
+.. code-block:: bash
+
+ $ gtmktime
+ Spacecraft data file[] L1708251631252315B1AD08_SC00.fits
+ Filter expression[DATA_QUAL>0 && LAT_CONFIG==1 && ABS(ROCK_ANGLE)<52]
+ Apply ROI-based zenith angle cut[yes] no
+ Event data file[] events_fermi.fits
+ Output event file name[] events_fermi_gti.fits
+
+The events are now ready to be binned into a counts cube using the
+``gtbin`` tool:
+
+.. code-block:: bash
+
+ $ gtbin
+ This is gtbin version ScienceTools-10-01-01
+ Type of output file (CCUBE|CMAP|LC|PHA1|PHA2|HEALPIX) [PHA2] CCUBE
+ Event data file name[] events_fermi_gti.fits
+ Output file name[] cntmap.fits
+ Spacecraft data file name[NONE] L1708251631252315B1AD08_SC00.fits
+ Size of the X axis in pixels[] 60
+ Size of the Y axis in pixels[] 60
+ Image scale (in degrees/pixel)[] 0.2
+ Coordinate system (CEL - celestial, GAL -galactic) (CEL|GAL) [CEL]
+ First coordinate of image center in degrees (RA or galactic l)[] 128.84
+ Second coordinate of image center in degrees (DEC or galactic b)[] -45.18
+ Rotation angle of image axis, in degrees[0.]
+ Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN:[AIT] TAN
+ Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
+ Start value for first energy bin in MeV[30] 100.0
+ Stop value for last energy bin in MeV[200000] 300000.0
+ Number of logarithmically uniform energy bins[] 40
+
+As next step you need to compute a livetime cube which is a computational
+intensive task. You do this using the ``gtltcube`` tool:
+
+.. code-block:: bash
+
+ $ gtltcube zmax=90
+ Event data file[] events_fermi_gti.fits
+ Spacecraft data file[] L1708251631252315B1AD08_SC00.fits
+ Output file[expCube.fits] ltcube.fits
+ Step size in cos(theta) (0.:1.) [0.025]
+ Pixel size (degrees)[1]
+ Working on file L1708251631252315B1AD08_SC00.fits
+ .....................!
+
+The little dots indicate the progress while the tool is computing. Once
+finished you need to compute the binned exposure map using the ``gtexpcube2``
+tool:
+
+.. code-block:: bash
+
+ $ gtexpcube2
+ Livetime cube file[] ltcube.fits
+ Counts map file[] none
+ Output file name[] expmap.fits
+ Response functions to use[CALDB] P8R2_SOURCE_V6
+ Size of the X axis in pixels[INDEF] 200
+ Size of the Y axis in pixels[INDEF] 200
+ Image scale (in degrees/pixel)[INDEF] 0.2
+ Coordinate system (CEL - celestial, GAL -galactic) (CEL|GAL) [GAL] CEL
+ First coordinate of image center in degrees (RA or galactic l)[INDEF] 128.84
+ Second coordinate of image center in degrees (DEC or galactic b)[INDEF] -45.18
+ Rotation angle of image axis, in degrees[0]
+ Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN[CAR] TAN
+ Start energy (MeV) of first bin[INDEF] 100.0
+ Stop energy (MeV) of last bin[INDEF] 300000.0
+ Number of logarithmically-spaced energy bins[INDEF] 40
+ Computing binned exposure map....................!
+
+
+Generate source maps
+~~~~~~~~~~~~~~~~~~~~
+
+Now you are ready to produce source maps for all diffuse model components.
+Start with putting the diffuse model components into a
+:ref:`model definition XML file `:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. warning::
+ While ctools also implements the syntax used for Fermi-LAT Science Tools
+ :ref:`model definition files `,
+ the Fermi-LAT Science Tools naming conventions are not very homogenous,
+ hence we usually advocate to use the more coherent ctools syntax. For the
+ Fermi-LAT Science Tools you have to use however the Fermi-LAT syntax.
+
+Now you can generate the source maps using ``gtsrcmaps``:
+
+.. code-block:: bash
+
+ $ gtsrcmaps ptsrc=no
+ Exposure hypercube file[] ltcube.fits
+ Counts map file[] cntmap.fits
+ Source model file[] diffuse.xml
+ Binned exposure map[none] expmap.fits
+ Source maps output file[] srcmaps.fits
+ Response functions[CALDB] P8R2_SOURCE_V6
+ Generating SourceMap for Extragalactic_diffuse....................!
+ Generating SourceMap for Galactic_diffuse....................!
+
+And you are done with the preparation of the Fermi-LAT data. You now have
+the following files in your working directory:
+
+* ``srcmaps.fits`` - Counts cube including source maps
+* ``ltcube.fits`` - Livetime cube
+* ``expmap.fits`` - Exposure map
diff --git a/doc/source/users/tutorials/fermi/fermi_query.jpg b/doc/source/users/tutorials/fermi/fermi_query.jpg
new file mode 100755
index 0000000..077047d
Binary files /dev/null and b/doc/source/users/tutorials/fermi/fermi_query.jpg differ
diff --git a/doc/source/users/tutorials/fermi/fermi_spectrum.png b/doc/source/users/tutorials/fermi/fermi_spectrum.png
new file mode 100755
index 0000000..9e1aca0
Binary files /dev/null and b/doc/source/users/tutorials/fermi/fermi_spectrum.png differ
diff --git a/doc/source/users/tutorials/fermi/fermi_spectrum.rst b/doc/source/users/tutorials/fermi/fermi_spectrum.rst
new file mode 100755
index 0000000..dd62f30
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_spectrum.rst
@@ -0,0 +1,48 @@
+.. _fermi_spectrum:
+
+Generate a spectrum
+-------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`csspec` to derive the spectral energy
+ density of a source from Fermi-LAT data.
+
+To determine a spectrum of the Vela pulsar you can use the :ref:`csspec`
+script. To do this, type
+
+.. code-block:: bash
+
+ $ csspec
+ Input event list, counts cube, or observation definition XML file [events.fits] obs.xml
+ Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
+ Source name [Crab] Vela
+ Spectrum generation method (SLICE|NODES|AUTO) [AUTO]
+ Algorithm for defining energy bins (FILE|LIN|LOG|POW) [LOG]
+ Start value for first energy bin in TeV [0.1] 0.0001
+ Stop value for last energy bin in TeV [100.0] 0.1
+ Number of energy bins (1-200) [20] 10
+ Output spectrum file [spectrum.fits]
+
+This will generate a logarithmically spaced spectrum composed of 10 energy bins
+comprised within 100 MeV and 100 GeV. The :ref:`csspec` tool is run in the ``AUTO``
+mode, which for Fermi-LAT data corresponds to the ``NODES`` method. :ref:`csspec`
+will convert the Vela spectrum in the input model into a node function and fit
+all intensity nodes using :ref:`ctlike`. The resulting node intensities are
+then interpreted as the spectral point, and are displayed graphically below:
+
+.. figure:: fermi_spectrum.png
+ :width: 600px
+ :align: center
+
+ *Spectrum of the Vela pulsar derived using csspec*
+
+.. note::
+ The figure was created using the ``show_spectrum.py`` script that is
+ located in the ctools example folder. The example script requires the
+ `matplotlib `_ Python module for display.
+ You may reproduce the plot by typing
+
+ .. code-block:: bash
+
+ $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits
diff --git a/doc/source/users/tutorials/fermi/fermi_tsmap.png b/doc/source/users/tutorials/fermi/fermi_tsmap.png
new file mode 100644
index 0000000..0ac75eb
Binary files /dev/null and b/doc/source/users/tutorials/fermi/fermi_tsmap.png differ
diff --git a/doc/source/users/tutorials/fermi/fermi_tsmap.rst b/doc/source/users/tutorials/fermi/fermi_tsmap.rst
new file mode 100644
index 0000000..d01379d
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_tsmap.rst
@@ -0,0 +1,42 @@
+.. _fermi_tsmap:
+
+Generate a Test Statistic map
+-----------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`cttsmap` to generate a Test Staristic
+ map from Fermi-LAT data.
+
+The Test Statistic (or maximum likelihood ratio) is a measure of the detection
+significance of a gamma-ray source. By displacing the location of a test source
+on a grid of positions you can generate a Test Statistic map that helps in
+finding significant source and assessing the position uncertainty of a
+source. You do this by using the :ref:`cttsmap` tool as follows:
+
+.. code-block:: bash
+
+ $ cttsmap
+ Input event list, counts cube or observation definition XML file [events.fits] obs.xml
+ Test source name [Crab] Vela
+ Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
+ Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
+ Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
+ First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 128.84
+ Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] -45.18
+ Image scale (in degrees/pixel) [0.02] 0.3
+ Size of the X axis in pixels [200] 10
+ Size of the Y axis in pixels [200] 10
+ Output Test Statistic map file [tsmap.fits]
+
+:ref:`cttsmap` created a 10 x 10 pixels map with a pixel size of 0.3 degrees
+around the location of the Vela pulsar and saved the result in the FITS file
+``tsmap.fits``. The file also contains the values of all fitted parameters
+at each grid position. The Test Statistics map is displayed using
+`ds9 `_ in the figure below:
+
+.. figure:: fermi_tsmap.png
+ :width: 400px
+ :align: center
+
+ *Test Statistic map for Fermi-LAT of the Vela pulsar*
diff --git a/doc/source/users/tutorials/fermi/fermi_ulimit.rst b/doc/source/users/tutorials/fermi/fermi_ulimit.rst
new file mode 100755
index 0000000..bad2aee
--- /dev/null
+++ b/doc/source/users/tutorials/fermi/fermi_ulimit.rst
@@ -0,0 +1,61 @@
+.. _fermi_ulimit:
+
+Derive upper flux limits
+------------------------
+
+ .. admonition:: What you will learn
+
+ You will learn how to use :ref:`ctulimit` to determine upper flux limits
+ from Fermi-LAT data using a likelihood profile method.
+
+Suppose there is another potential source in the field of view but you cannot
+see this source in a counts map, hence you want to derive an upper flux limit
+for the source. To do this you first have to add an additional source to the
+:ref:`model definition file `. An example for a source at
+:math:`\alpha=122^\circ` and :math:`\delta=-42^\circ` is shown below:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ...
+
+
+Now you can run the :ref:`ctulimit` tool. Since the tool is normally tuned
+for Cherenkov Telescope data analysis, energies are by default given in TeV.
+To specify a reference energy of the differential flux limit of 1 GeV you
+need to provide the hidden parameter ``eref=0.001``. You can also set the
+flux interval for the intergal flux computation to 100 MeV - 100 GeV by
+specifying ``emin=0.0001 emax=0.1`` (all values are given in TeV):
+
+.. code-block:: bash
+
+ $ ctulimit eref=0.001 emin=0.0001 emax=0.1
+ Input event list, counts cube or observation definition XML file [events.fits] obs.xml
+ Source of interest [Crab] Test
+ Input model definition XML file [$CTOOLS/share/models/crab.xml] models_ulimit.xml
+
+The results of the upper limit computation can then be extracted from the
+``ctulimit.log`` file that is created by :ref:`ctulimit`:
+
+.. code-block:: bash
+
+ 2019-04-04T15:03:22: +=====================+
+ 2019-04-04T15:03:22: | Upper limit results |
+ 2019-04-04T15:03:22: +=====================+
+ 2019-04-04T15:03:22: Differential flux limit ...: 1.77270316013682e-13 ph/cm2/s/MeV at 0.001 TeV
+ 2019-04-04T15:03:22: Integral flux limit .......: 1.77093045697669e-09 ph/cm2/s within [0.0001-0.1] TeV
+ 2019-04-04T15:03:22: Energy flux limit .........: 1.96192914922622e-12 erg/cm2/s within [0.0001-0.1] TeV
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_butterfly.png b/doc/source/users/tutorials/fermi/howto_fermi_butterfly.png
deleted file mode 100644
index 80b8ef0..0000000
Binary files a/doc/source/users/tutorials/fermi/howto_fermi_butterfly.png and /dev/null differ
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_butterfly.rst b/doc/source/users/tutorials/fermi/howto_fermi_butterfly.rst
deleted file mode 100755
index c95381e..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_butterfly.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-.. _howto_fermi_butterfly:
-
-Generate a butterfly diagram for a model component
---------------------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctbutterfly` to create a butterfly diagram
- for a model component from Fermi-LAT data.
-
-A butterfly diagram shows the envelope of all spectral models that are
-statistically compatible with the data. You can create such a butterfly
-diagram for the Vela pulsar using the :ref:`ctbutterfly` tool by providing
-the
-:ref:`model definition file `
-output file from :ref:`ctlike` as input:
-
-.. code-block:: bash
-
- $ ctbutterfly
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Source of interest [Crab] Vela
- Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
- Start value for first energy bin in TeV [0.1] 0.0001
- Stop value for last energy bin in TeV [100.0] 0.1
- Output ASCII file [butterfly.txt]
-
-:ref:`ctbutterfly` produces the ASCII file ``butterfly.txt`` that contains
-the envelope of the butterfly diagram. The figure below gives a graphical
-representation of the envelope.
-
-.. figure:: howto_fermi_butterfly.png
- :width: 600px
- :align: center
-
- *Butterfly diagram of the fitted Vela pulsar spectrum*
-
-.. note::
- The figure was created using the ``show_butterfly.py`` script that is
- located in the ctools example folder. The example script requires the
- `matplotlib `_ Python module for display.
- You may reproduce the plot by typing
-
- .. code-block:: bash
-
- $ $CTOOLS/share/examples/python/show_butterfly.py butterfly.txt
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_data.jpg b/doc/source/users/tutorials/fermi/howto_fermi_data.jpg
deleted file mode 100755
index bd17969..0000000
Binary files a/doc/source/users/tutorials/fermi/howto_fermi_data.jpg and /dev/null differ
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_errors.rst b/doc/source/users/tutorials/fermi/howto_fermi_errors.rst
deleted file mode 100755
index a00f65e..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_errors.rst
+++ /dev/null
@@ -1,112 +0,0 @@
-.. _howto_fermi_errors:
-
-Determine asymmetric model parameter errors for a model component
------------------------------------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`cterror` to derive asymmetric model
- parameter errors from Fermi-LAT data using a likelihood profile method.
-
-The :ref:`ctlike` tool computes errors for each fitted parameter value based
-on the covariance matrix of the fit. This assumes a Gaussian approximation
-of the uncertainties around the best fitting values. Uncertainties may however
-by asymmetric.
-
-To test the symmetry of the uncertainties you can use the :ref:`cterror`
-tool. :ref:`cterror` will make use of the likelihood profile to determine
-the confidence interval for each fitted parameter, allowing thus also for
-asymmetric errors. You use :ref:`cterror` as follows:
-
-.. code-block:: bash
-
- $ cterror
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Source of interest [Crab] Vela
- Input model definiton XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
- Output model definiton XML file [results.xml] vela_errors.xml
-
-The confidence intervals can then be extracted from the ``cterror.log`` log file
-that was created by :ref:`cterror`. As you will see, the parameter errors
-are essentially symmetric and very close to the values determined using the
-covariance matrix.
-
-.. code-block:: none
-
- 2019-04-04T15:04:51: +================================================+
- 2019-04-04T15:04:51: | Compute error for source "Vela" parameter "RA" |
- 2019-04-04T15:04:51: +================================================+
- 2019-04-04T15:04:51: Confidence level ..........: 68 %
- 2019-04-04T15:04:51: Log-likelihood difference .: 0.494473
- 2019-04-04T15:04:51: Initial factor range ......: [128.819554251886, 128.851989886469]
- 2019-04-04T15:05:10: Lower parameter factor ....: 128.834
- 2019-04-04T15:05:10: Upper parameter factor ....: 128.837
- 2019-04-04T15:05:10: Error from curvature ......: 0.00162178172918532 deg
- 2019-04-04T15:05:10: Error from profile ........: 0.00169067577726878 deg
- 2019-04-04T15:05:10: Negative profile error ....: 0.00165900035287336 deg
- 2019-04-04T15:05:10: Positive profile error ....: 0.0017223512016642 deg
- 2019-04-04T15:05:10:
- 2019-04-04T15:05:10: +=================================================+
- 2019-04-04T15:05:10: | Compute error for source "Vela" parameter "DEC" |
- 2019-04-04T15:05:10: +=================================================+
- 2019-04-04T15:05:10: Confidence level ..........: 68 %
- 2019-04-04T15:05:10: Log-likelihood difference .: 0.494473
- 2019-04-04T15:05:10: Initial factor range ......: [-45.1949881925207, -45.1721741960936]
- 2019-04-04T15:05:31: Lower parameter factor ....: -45.1847
- 2019-04-04T15:05:31: Upper parameter factor ....: -45.1824
- 2019-04-04T15:05:31: Error from curvature ......: 0.00114069982135549 deg
- 2019-04-04T15:05:31: Error from profile ........: 0.0011654855352532 deg
- 2019-04-04T15:05:31: Negative profile error ....: 0.00115852325606625 deg
- 2019-04-04T15:05:31: Positive profile error ....: 0.00117244781444015 deg
- 2019-04-04T15:05:31:
- 2019-04-04T15:05:31: +=======================================================+
- 2019-04-04T15:05:31: | Compute error for source "Vela" parameter "Prefactor" |
- 2019-04-04T15:05:31: +=======================================================+
- 2019-04-04T15:05:31: Confidence level ..........: 68 %
- 2019-04-04T15:05:31: Log-likelihood difference .: 0.494473
- 2019-04-04T15:05:31: Initial factor range ......: [1e-07, 9.09784331943508]
- 2019-04-04T15:06:15: Lower parameter factor ....: 3.93674
- 2019-04-04T15:06:15: Upper parameter factor ....: 4.89558
- 2019-04-04T15:06:15: Error from curvature ......: 4.74564602405264e-10 ph/cm2/s/MeV
- 2019-04-04T15:06:15: Error from profile ........: 4.79421031332425e-10 ph/cm2/s/MeV
- 2019-04-04T15:06:15: Negative profile error ....: 4.15456324070932e-10 ph/cm2/s/MeV
- 2019-04-04T15:06:15: Positive profile error ....: 5.43385738593917e-10 ph/cm2/s/MeV
- 2019-04-04T15:06:15:
- 2019-04-04T15:06:15: +====================================================+
- 2019-04-04T15:06:15: | Compute error for source "Vela" parameter "Index1" |
- 2019-04-04T15:06:15: +====================================================+
- 2019-04-04T15:06:15: Confidence level ..........: 68 %
- 2019-04-04T15:06:15: Log-likelihood difference .: 0.494473
- 2019-04-04T15:06:15: Initial factor range ......: [1.03239332172832, 1.65461803910225]
- 2019-04-04T15:07:01: Lower parameter factor ....: 1.31084
- 2019-04-04T15:07:01: Upper parameter factor ....: 1.37275
- 2019-04-04T15:07:01: Error from curvature ......: 0.0311112358686962
- 2019-04-04T15:07:01: Error from profile ........: 0.0309517300207367
- 2019-04-04T15:07:01: Negative profile error ....: 0.0326607212488756
- 2019-04-04T15:07:01: Positive profile error ....: 0.0292427387925978
- 2019-04-04T15:07:01:
- 2019-04-04T15:07:01: +==========================================================+
- 2019-04-04T15:07:01: | Compute error for source "Vela" parameter "CutoffEnergy" |
- 2019-04-04T15:07:01: +==========================================================+
- 2019-04-04T15:07:01: Confidence level ..........: 68 %
- 2019-04-04T15:07:01: Log-likelihood difference .: 0.494473
- 2019-04-04T15:07:01: Initial factor range ......: [0.001, 2.80853448937906]
- 2019-04-04T15:07:45: Lower parameter factor ....: 0.81239
- 2019-04-04T15:07:45: Upper parameter factor ....: 1.17294
- 2019-04-04T15:07:45: Error from curvature ......: 181.899981373502 MeV
- 2019-04-04T15:07:45: Error from profile ........: 180.277267455479 MeV
- 2019-04-04T15:07:45: Negative profile error ....: 177.144641582696 MeV
- 2019-04-04T15:07:45: Positive profile error ....: 183.409893328263 MeV
- 2019-04-04T15:07:45:
- 2019-04-04T15:07:45: +====================================================+
- 2019-04-04T15:07:45: | Compute error for source "Vela" parameter "Index2" |
- 2019-04-04T15:07:45: +====================================================+
- 2019-04-04T15:07:45: Confidence level ..........: 68 %
- 2019-04-04T15:07:45: Log-likelihood difference .: 0.494473
- 2019-04-04T15:07:45: Initial factor range ......: [0.3080285257564, 0.866644263519715]
- 2019-04-04T15:08:32: Lower parameter factor ....: 0.559037
- 2019-04-04T15:08:32: Upper parameter factor ....: 0.615056
- 2019-04-04T15:08:32: Error from curvature ......: 0.0279307868881658
- 2019-04-04T15:08:32: Error from profile ........: 0.0280092058454933
- 2019-04-04T15:08:32: Negative profile error ....: 0.028299015035617
- 2019-04-04T15:08:32: Positive profile error ....: 0.0277193966553695
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_fitting.rst b/doc/source/users/tutorials/fermi/howto_fermi_fitting.rst
deleted file mode 100755
index cd54a7f..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_fitting.rst
+++ /dev/null
@@ -1,257 +0,0 @@
-.. _howto_fermi_fitting:
-
-Fit a model to the data
------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctlike` to fit a parametric model to
- Fermi-LAT data.
-
-Start with creating an
-:ref:`observation definition file `
-that defines the names of the counts map file, the exposure map file, the
-live time cube file and the name of the instrument response function that
-should be used for the analysis:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-This will be your input file to all tools.
-Then you also need a
-:ref:`model definition file `
-that describes the source and background model that you want to fit. In the
-example below, a point source with a super exponentially cut-off power law is
-fit at the position of the Vela pulsar on top of a Galactic diffuse and an
-extragalactic isotropic source component.
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-.. warning::
- The names of the diffuse model components have to be identical to the
- names used when preparing the ``srcmaps.fits`` file using ``gtsrcmap``.
-
-Now you are ready to fit the model using the :ref:`ctlike` model tool. You do
-this as follows:
-
-.. code-block:: bash
-
- $ ctlike
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models.xml
- Output model definition XML file [crab_results.xml] vela_results.xml
-
-:ref:`ctlike` creates on output the
-:ref:`model definition file `
-``vela_results.xml`` where the parameter values were updated by their
-fitted values, and where the statistical uncertainties were added using the
-``error`` attribute. To investigate how the fit went you should inspect the
-log file ``ctlike.log`` that was also created by :ref:`ctlike`:
-
-.. code-block:: none
-
- 2019-04-04T14:34:18: +=================================+
- 2019-04-04T14:34:18: | Maximum likelihood optimisation |
- 2019-04-04T14:34:18: +=================================+
- 2019-04-04T14:34:20: >Iteration 0: -logL=-177232.327, Lambda=1.0e-03
- 2019-04-04T14:34:20: >Iteration 1: -logL=-198931.136, Lambda=1.0e-03, delta=21698.809, step=1.0e+00, max(|grad|)=-22717.063466 [CutoffEnergy:4]
- 2019-04-04T14:34:21: >Iteration 2: -logL=-200269.888, Lambda=1.0e-04, delta=1338.753, step=1.0e+00, max(|grad|)=-67629.683813 [CutoffEnergy:4]
- 2019-04-04T14:34:21: >Iteration 3: -logL=-212351.965, Lambda=1.0e-05, delta=12082.076, step=1.0e+00, max(|grad|)=23026.802441 [Index2:6]
- 2019-04-04T14:34:22: >Iteration 4: -logL=-213954.259, Lambda=1.0e-06, delta=1602.294, step=1.0e+00, max(|grad|)=-8297.380921 [CutoffEnergy:4]
- 2019-04-04T14:34:22: >Iteration 5: -logL=-215347.973, Lambda=1.0e-07, delta=1393.714, step=1.0e+00, max(|grad|)=2746.754045 [Index2:6]
- 2019-04-04T14:34:23: >Iteration 6: -logL=-215497.807, Lambda=1.0e-08, delta=149.834, step=1.0e+00, max(|grad|)=699.848487 [Index2:6]
- 2019-04-04T14:34:23: Iteration 7: -logL=-215497.807, Lambda=1.0e-09, delta=-13.845, step=1.0e+00, max(|grad|)=-1201.982876 [Index1:3] (stalled)
- 2019-04-04T14:34:24: Iteration 8: -logL=-215497.807, Lambda=1.0e-08, delta=-13.844, step=1.0e+00, max(|grad|)=-1201.959648 [Index1:3] (stalled)
- 2019-04-04T14:34:24: Iteration 9: -logL=-215497.807, Lambda=1.0e-07, delta=-13.835, step=1.0e+00, max(|grad|)=-1201.727402 [Index1:3] (stalled)
- 2019-04-04T14:34:24: Iteration 10: -logL=-215497.807, Lambda=1.0e-06, delta=-13.744, step=1.0e+00, max(|grad|)=-1199.408718 [Index1:3] (stalled)
- 2019-04-04T14:34:25: Iteration 11: -logL=-215497.807, Lambda=1.0e-05, delta=-12.858, step=1.0e+00, max(|grad|)=-1176.594022 [Index1:3] (stalled)
- 2019-04-04T14:34:26: Iteration 12: -logL=-215497.807, Lambda=1.0e-04, delta=-6.126, step=1.0e+00, max(|grad|)=-980.833964 [Index1:3] (stalled)
- 2019-04-04T14:34:26: >Iteration 13: -logL=-215503.803, Lambda=1.0e-03, delta=5.995, step=1.0e+00, max(|grad|)=-285.964915 [Index1:3]
- 2019-04-04T14:34:27: Iteration 14: -logL=-215503.803, Lambda=1.0e-04, delta=-8.762, step=1.0e+00, max(|grad|)=-730.461327 [Index1:3] (stalled)
- 2019-04-04T14:34:27: >Iteration 15: -logL=-215504.976, Lambda=1.0e-03, delta=1.173, step=1.0e+00, max(|grad|)=-153.941337 [Index1:3]
- 2019-04-04T14:34:28: Iteration 16: -logL=-215503.593, Lambda=1.0e-04, delta=-1.383, step=1.0e+00, max(|grad|)=-327.368446 [Index1:3] (stalled)
- 2019-04-04T14:34:28: >Iteration 17: -logL=-215505.817, Lambda=1.0e-03, delta=2.225, step=1.0e+00, max(|grad|)=3.256215 [Index2:6]
- 2019-04-04T14:34:29: >Iteration 18: -logL=-215505.824, Lambda=1.0e-04, delta=0.007, step=1.0e+00, max(|grad|)=-8.190315 [CutoffEnergy:4]
- 2019-04-04T14:34:29: >Iteration 19: -logL=-215505.826, Lambda=1.0e-05, delta=0.002, step=1.0e+00, max(|grad|)=0.635264 [Index2:6]
- 2019-04-04T14:34:30:
- 2019-04-04T14:34:30: +=========================================+
- 2019-04-04T14:34:30: | Maximum likelihood optimisation results |
- 2019-04-04T14:34:30: +=========================================+
- 2019-04-04T14:34:30: === GOptimizerLM ===
- 2019-04-04T14:34:30: Optimized function value ..: -215505.826
- 2019-04-04T14:34:30: Absolute precision ........: 0.005
- 2019-04-04T14:34:30: Acceptable value decrease .: 2
- 2019-04-04T14:34:30: Optimization status .......: converged
- 2019-04-04T14:34:30: Number of parameters ......: 14
- 2019-04-04T14:34:30: Number of free parameters .: 7
- 2019-04-04T14:34:30: Number of iterations ......: 19
- 2019-04-04T14:34:30: Lambda ....................: 1e-06
- 2019-04-04T14:34:30: Maximum log likelihood ....: 215505.826
- 2019-04-04T14:34:30: Observed events (Nobs) ...: 202330.000
- 2019-04-04T14:34:30: Predicted events (Npred) ..: 202318.925 (Nobs - Npred = 11.0749567862367)
- 2019-04-04T14:34:30: === GModels ===
- 2019-04-04T14:34:30: Number of models ..........: 3
- 2019-04-04T14:34:30: Number of parameters ......: 14
- 2019-04-04T14:34:30: === GModelSky ===
- 2019-04-04T14:34:30: Name ......................: Vela
- 2019-04-04T14:34:30: Instruments ...............: all
- 2019-04-04T14:34:30: Observation identifiers ...: all
- 2019-04-04T14:34:30: Model type ................: PointSource
- 2019-04-04T14:34:30: Model components ..........: "PointSource" * "SuperExponentialCutoffPowerLaw" * "Constant"
- 2019-04-04T14:34:30: Number of parameters ......: 8
- 2019-04-04T14:34:30: Number of spatial par's ...: 2
- 2019-04-04T14:34:30: RA .......................: 128.835772118406 +/- 0.00162177814111823 [-360,360] deg (free,scale=1)
- 2019-04-04T14:34:30: DEC ......................: -45.1835812138759 +/- 0.00114069728372229 [-90,90] deg (free,scale=1)
- 2019-04-04T14:34:30: Number of spectral par's ..: 5
- 2019-04-04T14:34:30: Prefactor ................: 4.35032346843698e-09 +/- 4.73845090232622e-10 [1e-16,1e-06] ph/cm2/s/MeV (free,scale=1e-09,gradient)
- 2019-04-04T14:34:30: Index1 ...................: -1.34367731364905 +/- 0.0310888116010815 [-0,-5] (free,scale=-1,gradient)
- 2019-04-04T14:34:30: CutoffEnergy .............: 990.275379021926 +/- 181.814299577731 [1,1000000] MeV (free,scale=1000,gradient)
- 2019-04-04T14:34:30: PivotEnergy ..............: 1000 [10,1000000] MeV (fixed,scale=1000,gradient)
- 2019-04-04T14:34:30: Index2 ...................: 0.58755011716699 +/- 0.027919253961318 [0.1,5] (free,scale=1,gradient)
- 2019-04-04T14:34:30: Number of temporal par's ..: 1
- 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of scale par's .....: 0
- 2019-04-04T14:34:30: === GModelSky ===
- 2019-04-04T14:34:30: Name ......................: Galactic_diffuse
- 2019-04-04T14:34:30: Instruments ...............: all
- 2019-04-04T14:34:30: Observation identifiers ...: all
- 2019-04-04T14:34:30: Model type ................: DiffuseSource
- 2019-04-04T14:34:30: Model components ..........: "DiffuseMapCube" * "Constant" * "Constant"
- 2019-04-04T14:34:30: Number of parameters ......: 3
- 2019-04-04T14:34:30: Number of spatial par's ...: 1
- 2019-04-04T14:34:30: Normalization ............: 1 [0.1,10] (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of spectral par's ..: 1
- 2019-04-04T14:34:30: Normalization ............: 1.10941973066989 +/- 0.00503412002600817 [0.1,1000] (free,scale=1,gradient)
- 2019-04-04T14:34:30: Number of temporal par's ..: 1
- 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of scale par's .....: 0
- 2019-04-04T14:34:30: === GModelSky ===
- 2019-04-04T14:34:30: Name ......................: Extragalactic_diffuse
- 2019-04-04T14:34:30: Instruments ...............: all
- 2019-04-04T14:34:30: Observation identifiers ...: all
- 2019-04-04T14:34:30: Model type ................: DiffuseSource
- 2019-04-04T14:34:30: Model components ..........: "DiffuseIsotropic" * "FileFunction" * "Constant"
- 2019-04-04T14:34:30: Number of parameters ......: 3
- 2019-04-04T14:34:30: Number of spatial par's ...: 1
- 2019-04-04T14:34:30: Value ....................: 1 [0,10] (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of spectral par's ..: 1
- 2019-04-04T14:34:30: Normalization ............: 1 [0,1000] (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of temporal par's ..: 1
- 2019-04-04T14:34:30: Normalization ............: 1 (relative value) (fixed,scale=1,gradient)
- 2019-04-04T14:34:30: Number of scale par's .....: 0
-
-The fit converged after 19 iterations with spectral parameters that are
-reasonably close to those found in
-`Abdo et al. 2010, ApJ, 713, 154 `_
-using the Fermi-LAT Science Tools.
-
-.. note::
- The fit results can be compared to the corresponding output of gtlike
- when the tool is applied to the same test data. As you will see below,
- the fitted model parameters are basically identical.
-
- .. code-block:: none
-
- Extragalactic_diffuse:
- Normalization: 1
- Flux: 0.000149604 photons/cm^2/s
-
- Galactic_diffuse:
- Value: 1.11394 +/- 0.00508393
- Flux: 0.00054415 +/- 2.48325e-06 photons/cm^2/s
-
- Vela:
- Prefactor: 4.3344 +/- 0.65258
- Index1: 1.34634 +/- 0.0429336
- Scale: 1
- Cutoff: 1.00992 +/- 0.25512
- Index2: 0.595018 +/- 0.0398585
- TS value: 326648
- Flux: 1.0758e-05 +/- 4.33949e-08 photons/cm^2/s
-
- WARNING: Fit may be bad in range [100, 149.23] (MeV)
- WARNING: Fit may be bad in range [182.299, 405.972] (MeV)
- WARNING: Fit may be bad in range [6690.96, 8173.66] (MeV)
- WARNING: Fit may be bad in range [14900.5, 18202.4] (MeV)
- WARNING: Fit may be bad in range [33182.8, 40536] (MeV)
- WARNING: Fit may be bad in range [49518.7, 60491.9] (MeV)
-
- Total number of observed counts: 202330
- Total number of model events: 202327
-
- -log(Likelihood): -215606.3555
-
- Elapsed CPU time: 72.33
-
- You may also compute the Test Statistic value using :ref:`ctlike` by
- adding the ``tscalc="1"`` attribute to the
- :ref:`model definition file `:
-
- .. code-block:: xml
-
-
-
-
- ...
-
-
- This results in
-
- .. code-block:: none
-
- 2019-04-04T14:37:50: Name ......................: Vela
- 2019-04-04T14:37:50: Instruments ...............: all
- 2019-04-04T14:37:50: Test Statistic ............: 326341.43991719
-
- which is also close to the value determined by gtlike.
-
-.. note::
- Unlike gtlike, :ref:`ctlike` can also fit the source location. This has been
- done in the example above by setting the parameter attributes to ``free="1"``.
-
-.. warning::
- ctools supports for the moment only the fitting of point sources for
- Fermi-LAT data. Other spatial shapes need to be preconvolved with the
- instrument response functions and added to the ``srcmaps.fits`` file.
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_prepare.rst b/doc/source/users/tutorials/fermi/howto_fermi_prepare.rst
deleted file mode 100755
index 75d218b..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_prepare.rst
+++ /dev/null
@@ -1,222 +0,0 @@
-.. _howto_fermi_prepare:
-
-Prepare Fermi-LAT data
-----------------------
-
- .. admonition:: What you will learn
-
- You will learn how to prepare Fermi-LAT data for an analysis with
- ctools.
-
- You will find more information about the Fermi-LAT software and data
- analysis at the
- `Fermi Science Support Center (FSSC) `_
- web site.
-
-
-Prerequisits
-~~~~~~~~~~~~
-
-The following sections assume that you have properly installed the Fermi-LAT
-Science Tools. The Fermi-LAT Science Tools can be downloaded from the
-`Fermi Science Support Center (FSSC) `_.
-
-
-Get data from the Fermi-LAT data server
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Start with requesting the data you are interested in from the
-`Fermi-LAT Data server `_.
-As example the figure below shows a request for data around the Vela pulsar.
-
-.. figure:: howto_fermi_query.jpg
- :width: 600px
- :align: center
-
- *Fermi-LAT data server interface*
-
-After submitting the request you will get information of how to retrieve the
-data:
-
-.. figure:: howto_fermi_data.jpg
- :width: 600px
- :align: center
-
- *Fermi-LAT data retrieval information*
-
-Now you download the data using the ``wget`` tool. At the same time of
-downloading the data you should also download the input files for the diffuse
-galactic and extragalactic model components. In the current example the
-following files were downloaded:
-
-.. code-block:: bash
-
- $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_SC00.fits
- $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_PH00.fits
- $ wget http://fermi.gsfc.nasa.gov/FTP/fermi/data/lat/queries/L1708251631252315B1AD08_PH01.fits
- $ wget https://fermi.gsfc.nasa.gov/ssc/data/analysis/software/aux/gll_iem_v06.fits
- $ wget https://fermi.gsfc.nasa.gov/ssc/data/analysis/software/aux/iso_P8R2_SOURCE_V6_v06.txt
-
-.. warning::
- In the current example data within a radius of only 10 degrees around the
- source of interest were selected. This was mainly for getting a small
- data set. The
- `Fermi Science Support Center (FSSC) `_
- recommends to use larger regions for the Fermi-LAT data analysis.
-
-
-Data preparation
-~~~~~~~~~~~~~~~~
-
-First you need to combine the event lists into a single file. At the same
-time you will select the region of interest for the analysis. You do this
-using the ``gtselect`` tool:
-
-.. code-block:: bash
-
- $ ls *_PH* > events.txt
- $ gtselect evclass=128 evtype=3
- Input FT1 file[] @events.txt
- Output FT1 file[] events_fermi.fits
- RA for new search center (degrees) (0:360) [INDEF] 128.84
- Dec for new search center (degrees) (-90:90) [INDEF] -45.18
- radius of new search region (degrees) (0:180) [INDEF] 10.0
- start time (MET in s) (0:) [INDEF]
- end time (MET in s) (0:) [INDEF]
- lower energy limit (MeV) (0:) [30] 100.0
- upper energy limit (MeV) (0:) [300000] 300000.0
- maximum zenith angle value (degrees) (0:180) [180] 90.0
-
-Now you have to select from all events those which fall into periods where
-data quality is good, the telescope is configured for science, and the rocking
-angle is not too large. You do this using the ``gtmktime`` tool that defines
-the Good Time Intervals for your analysis:
-
-.. code-block:: bash
-
- $ gtmktime
- Spacecraft data file[] L1708251631252315B1AD08_SC00.fits
- Filter expression[DATA_QUAL>0 && LAT_CONFIG==1 && ABS(ROCK_ANGLE)<52]
- Apply ROI-based zenith angle cut[yes] no
- Event data file[] events_fermi.fits
- Output event file name[] events_fermi_gti.fits
-
-The events are now ready to be binned into a counts cube using the
-``gtbin`` tool:
-
-.. code-block:: bash
-
- $ gtbin
- This is gtbin version ScienceTools-10-01-01
- Type of output file (CCUBE|CMAP|LC|PHA1|PHA2|HEALPIX) [PHA2] CCUBE
- Event data file name[] events_fermi_gti.fits
- Output file name[] cntmap.fits
- Spacecraft data file name[NONE] L1708251631252315B1AD08_SC00.fits
- Size of the X axis in pixels[] 60
- Size of the Y axis in pixels[] 60
- Image scale (in degrees/pixel)[] 0.2
- Coordinate system (CEL - celestial, GAL -galactic) (CEL|GAL) [CEL]
- First coordinate of image center in degrees (RA or galactic l)[] 128.84
- Second coordinate of image center in degrees (DEC or galactic b)[] -45.18
- Rotation angle of image axis, in degrees[0.]
- Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN:[AIT] TAN
- Algorithm for defining energy bins (FILE|LIN|LOG) [LOG]
- Start value for first energy bin in MeV[30] 100.0
- Stop value for last energy bin in MeV[200000] 300000.0
- Number of logarithmically uniform energy bins[] 40
-
-As next step you need to compute a livetime cube which is a computational
-intensive task. You do this using the ``gtltcube`` tool:
-
-.. code-block:: bash
-
- $ gtltcube zmax=90
- Event data file[] events_fermi_gti.fits
- Spacecraft data file[] L1708251631252315B1AD08_SC00.fits
- Output file[expCube.fits] ltcube.fits
- Step size in cos(theta) (0.:1.) [0.025]
- Pixel size (degrees)[1]
- Working on file L1708251631252315B1AD08_SC00.fits
- .....................!
-
-The little dots indicate the progress while the tool is computing. Once
-finished you need to compute the binned exposure map using the ``gtexpcube2``
-tool:
-
-.. code-block:: bash
-
- $ gtexpcube2
- Livetime cube file[] ltcube.fits
- Counts map file[] none
- Output file name[] expmap.fits
- Response functions to use[CALDB] P8R2_SOURCE_V6
- Size of the X axis in pixels[INDEF] 200
- Size of the Y axis in pixels[INDEF] 200
- Image scale (in degrees/pixel)[INDEF] 0.2
- Coordinate system (CEL - celestial, GAL -galactic) (CEL|GAL) [GAL] CEL
- First coordinate of image center in degrees (RA or galactic l)[INDEF] 128.84
- Second coordinate of image center in degrees (DEC or galactic b)[INDEF] -45.18
- Rotation angle of image axis, in degrees[0]
- Projection method e.g. AIT|ARC|CAR|GLS|MER|NCP|SIN|STG|TAN[CAR] TAN
- Start energy (MeV) of first bin[INDEF] 100.0
- Stop energy (MeV) of last bin[INDEF] 300000.0
- Number of logarithmically-spaced energy bins[INDEF] 40
- Computing binned exposure map....................!
-
-
-Generate source maps
-~~~~~~~~~~~~~~~~~~~~
-
-Now you are ready to produce source maps for all diffuse model components.
-Start with putting the diffuse model components into a
-:ref:`model definition XML file `:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-.. warning::
- While ctools also implements the syntax used for Fermi-LAT Science Tools
- :ref:`model definition files `,
- the Fermi-LAT Science Tools naming conventions are not very homogenous,
- hence we usually advocate to use the more coherent ctools syntax. For the
- Fermi-LAT Science Tools you have to use however the Fermi-LAT syntax.
-
-Now you can generate the source maps using ``gtsrcmaps``:
-
-.. code-block:: bash
-
- $ gtsrcmaps ptsrc=no
- Exposure hypercube file[] ltcube.fits
- Counts map file[] cntmap.fits
- Source model file[] diffuse.xml
- Binned exposure map[none] expmap.fits
- Source maps output file[] srcmaps.fits
- Response functions[CALDB] P8R2_SOURCE_V6
- Generating SourceMap for Extragalactic_diffuse....................!
- Generating SourceMap for Galactic_diffuse....................!
-
-And you are done with the preparation of the Fermi-LAT data. You now have
-the following files in your working directory:
-
-* ``srcmaps.fits`` - Counts cube including source maps
-* ``ltcube.fits`` - Livetime cube
-* ``expmap.fits`` - Exposure map
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_query.jpg b/doc/source/users/tutorials/fermi/howto_fermi_query.jpg
deleted file mode 100755
index 077047d..0000000
Binary files a/doc/source/users/tutorials/fermi/howto_fermi_query.jpg and /dev/null differ
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_spectrum.png b/doc/source/users/tutorials/fermi/howto_fermi_spectrum.png
deleted file mode 100755
index 9e1aca0..0000000
Binary files a/doc/source/users/tutorials/fermi/howto_fermi_spectrum.png and /dev/null differ
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_spectrum.rst b/doc/source/users/tutorials/fermi/howto_fermi_spectrum.rst
deleted file mode 100755
index 3cdeb87..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_spectrum.rst
+++ /dev/null
@@ -1,48 +0,0 @@
-.. _howto_fermi_spectrum:
-
-Generate a spectral energy distribution for a source
-----------------------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`csspec` to derive the spectral energy
- density of a source from Fermi-LAT data.
-
-To determine a spectrum of the Vela pulsar you can use the :ref:`csspec`
-script. To do this, type
-
-.. code-block:: bash
-
- $ csspec
- Input event list, counts cube, or observation definition XML file [events.fits] obs.xml
- Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
- Source name [Crab] Vela
- Spectrum generation method (SLICE|NODES|AUTO) [AUTO]
- Algorithm for defining energy bins (FILE|LIN|LOG|POW) [LOG]
- Start value for first energy bin in TeV [0.1] 0.0001
- Stop value for last energy bin in TeV [100.0] 0.1
- Number of energy bins (1-200) [20] 10
- Output spectrum file [spectrum.fits]
-
-This will generate a logarithmically spaced spectrum composed of 10 energy bins
-comprised within 100 MeV and 100 GeV. The :ref:`csspec` tool is run in the ``AUTO``
-mode, which for Fermi-LAT data corresponds to the ``NODES`` method. :ref:`csspec`
-will convert the Vela spectrum in the input model into a node function and fit
-all intensity nodes using :ref:`ctlike`. The resulting node intensities are
-then interpreted as the spectral point, and are displayed graphically below:
-
-.. figure:: howto_fermi_spectrum.png
- :width: 600px
- :align: center
-
- *Spectrum of the Vela pulsar derived using csspec*
-
-.. note::
- The figure was created using the ``show_spectrum.py`` script that is
- located in the ctools example folder. The example script requires the
- `matplotlib `_ Python module for display.
- You may reproduce the plot by typing
-
- .. code-block:: bash
-
- $ $CTOOLS/share/examples/python/show_spectrum.py spectrum.fits
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_tsmap.png b/doc/source/users/tutorials/fermi/howto_fermi_tsmap.png
deleted file mode 100644
index 0ac75eb..0000000
Binary files a/doc/source/users/tutorials/fermi/howto_fermi_tsmap.png and /dev/null differ
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_tsmap.rst b/doc/source/users/tutorials/fermi/howto_fermi_tsmap.rst
deleted file mode 100644
index 853f373..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_tsmap.rst
+++ /dev/null
@@ -1,42 +0,0 @@
-.. _howto_fermi_tsmap:
-
-Generate a Test Statistic map
------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`cttsmap` to generate a Test Staristic
- map from Fermi-LAT data.
-
-The Test Statistic (or maximum likelihood ratio) is a measure of the detection
-significance of a gamma-ray source. By displacing the location of a test source
-on a grid of positions you can generate a Test Statistic map that helps in
-finding significant source and assessing the position uncertainty of a
-source. You do this by using the :ref:`cttsmap` tool as follows:
-
-.. code-block:: bash
-
- $ cttsmap
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Test source name [Crab] Vela
- Input model definition XML file [$CTOOLS/share/models/crab.xml] vela_results.xml
- Coordinate system (CEL - celestial, GAL - galactic) (CEL|GAL) [CEL]
- Projection method (AIT|AZP|CAR|GLS|MER|MOL|SFL|SIN|STG|TAN) [CAR]
- First coordinate of image center in degrees (RA or galactic l) (0-360) [83.63] 128.84
- Second coordinate of image center in degrees (DEC or galactic b) (-90-90) [22.01] -45.18
- Image scale (in degrees/pixel) [0.02] 0.3
- Size of the X axis in pixels [200] 10
- Size of the Y axis in pixels [200] 10
- Output Test Statistic map file [tsmap.fits]
-
-:ref:`cttsmap` created a 10 x 10 pixels map with a pixel size of 0.3 degrees
-around the location of the Vela pulsar and saved the result in the FITS file
-``tsmap.fits``. The file also contains the values of all fitted parameters
-at each grid position. The Test Statistics map is displayed using
-`ds9 `_ in the figure below:
-
-.. figure:: howto_fermi_tsmap.png
- :width: 400px
- :align: center
-
- *Test Statistic map for Fermi-LAT of the Vela pulsar*
diff --git a/doc/source/users/tutorials/fermi/howto_fermi_ulimit.rst b/doc/source/users/tutorials/fermi/howto_fermi_ulimit.rst
deleted file mode 100755
index 858a172..0000000
--- a/doc/source/users/tutorials/fermi/howto_fermi_ulimit.rst
+++ /dev/null
@@ -1,61 +0,0 @@
-.. _howto_fermi_ulimit:
-
-Derive upper flux limits for a source
--------------------------------------
-
- .. admonition:: What you will learn
-
- You will learn how to use :ref:`ctulimit` to determine upper flux limits
- from Fermi-LAT data using a likelihood profile method.
-
-Suppose there is another potential source in the field of view but you cannot
-see this source in a counts map, hence you want to derive an upper flux limit
-for the source. To do this you first have to add an additional source to the
-:ref:`model definition file `. An example for a source at
-:math:`\alpha=122^\circ` and :math:`\delta=-42^\circ` is shown below:
-
-.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ...
-
-
-Now you can run the :ref:`ctulimit` tool. Since the tool is normally tuned
-for Cherenkov Telescope data analysis, energies are by default given in TeV.
-To specify a reference energy of the differential flux limit of 1 GeV you
-need to provide the hidden parameter ``eref=0.001``. You can also set the
-flux interval for the intergal flux computation to 100 MeV - 100 GeV by
-specifying ``emin=0.0001 emax=0.1`` (all values are given in TeV):
-
-.. code-block:: bash
-
- $ ctulimit eref=0.001 emin=0.0001 emax=0.1
- Input event list, counts cube or observation definition XML file [events.fits] obs.xml
- Source of interest [Crab] Test
- Input model definition XML file [$CTOOLS/share/models/crab.xml] models_ulimit.xml
-
-The results of the upper limit computation can then be extracted from the
-``ctulimit.log`` file that is created by :ref:`ctulimit`:
-
-.. code-block:: bash
-
- 2019-04-04T15:03:22: +=====================+
- 2019-04-04T15:03:22: | Upper limit results |
- 2019-04-04T15:03:22: +=====================+
- 2019-04-04T15:03:22: Differential flux limit ...: 1.77270316013682e-13 ph/cm2/s/MeV at 0.001 TeV
- 2019-04-04T15:03:22: Integral flux limit .......: 1.77093045697669e-09 ph/cm2/s within [0.0001-0.1] TeV
- 2019-04-04T15:03:22: Energy flux limit .........: 1.96192914922622e-12 erg/cm2/s within [0.0001-0.1] TeV
diff --git a/doc/source/users/tutorials/fermi/index.rst b/doc/source/users/tutorials/fermi/index.rst
index 3bd885d..2bb7007 100755
--- a/doc/source/users/tutorials/fermi/index.rst
+++ b/doc/source/users/tutorials/fermi/index.rst
@@ -29,10 +29,10 @@ tutorial that is based on a simple analysis of the Vela pulsar.
.. toctree::
:maxdepth: 1
- howto_fermi_prepare
- howto_fermi_fitting
- howto_fermi_butterfly
- howto_fermi_spectrum
- howto_fermi_tsmap
- howto_fermi_ulimit
- howto_fermi_errors
+ fermi_prepare
+ fermi_fitting
+ fermi_butterfly
+ fermi_spectrum
+ fermi_tsmap
+ fermi_ulimit
+ fermi_errors
diff --git a/doc/source/users/tutorials/spi/index.rst b/doc/source/users/tutorials/spi/index.rst
index 7b84da5..0d58250 100755
--- a/doc/source/users/tutorials/spi/index.rst
+++ b/doc/source/users/tutorials/spi/index.rst
@@ -9,5 +9,7 @@ INTEGRAL/SPI
`INTEGRAL `_
satellite with ctools.
+A tutorial for SPI data analysis will be provided in future releases of ctools.
+
.. toctree::
:maxdepth: 1
diff --git a/doc/source/users/user_manual/classical.rst b/doc/source/users/user_manual/classical.rst
index 40a4869..e95763c 100755
--- a/doc/source/users/user_manual/classical.rst
+++ b/doc/source/users/user_manual/classical.rst
@@ -1,7 +1,7 @@
.. _um_classical:
-Classical On/Off analysis
--------------------------
+Classical IACT On/Off analysis
+------------------------------
The traditional technique that is widely used by the IACT community for spectral
analysis consists in selecting the source events from an On region and
diff --git a/doc/source/users/user_manual/irf.rst b/doc/source/users/user_manual/irf.rst
index 8fa2ae5..53a4df7 100755
--- a/doc/source/users/user_manual/irf.rst
+++ b/doc/source/users/user_manual/irf.rst
@@ -1,7 +1,7 @@
.. _um_irf:
-Instrument Response Functions
------------------------------
+IRFs
+----
.. toctree::
:maxdepth: 1
diff --git a/doc/source/users/user_manual/irf_intro.rst b/doc/source/users/user_manual/irf_intro.rst
index 0d62201..70a142c 100755
--- a/doc/source/users/user_manual/irf_intro.rst
+++ b/doc/source/users/user_manual/irf_intro.rst
@@ -1,9 +1,9 @@
.. _um_irf_intro:
-What are instrument response functions?
----------------------------------------
+What are IRFs?
+--------------
-The :ref:`instrument response functions ` provide a mathematical
+The :ref:`instrument response functions ` (IRFs) provide a mathematical
description that links the reconstructed photon arrival direction :math:`p'`,
energy :math:`E'` and trigger time :math:`t'` of an event to the true incident
direction :math:`p`, energy :math:`E` and time :math:`t` of a photon. The
diff --git a/doc/source/users/user_manual/models_bgd_comptel.rst b/doc/source/users/user_manual/models_bgd_comptel.rst
index 342e3fa..c9616b1 100644
--- a/doc/source/users/user_manual/models_bgd_comptel.rst
+++ b/doc/source/users/user_manual/models_bgd_comptel.rst
@@ -137,4 +137,4 @@ model.
corresponding layers. In the first example above, the first four layers are
fixed. In the second example, all layers with :math:`\bar{\varphi}`
values below 16 degrees were fixed, the first fitted normalisation
- is for :math:`\bar{\varphi}=17` degrees.
+ is for :math:`\bar{\varphi}` = 17 degrees.
diff --git a/doc/source/users/user_manual/observations.rst b/doc/source/users/user_manual/observations.rst
index ba7ac9c..d6c672c 100755
--- a/doc/source/users/user_manual/observations.rst
+++ b/doc/source/users/user_manual/observations.rst
@@ -149,12 +149,14 @@ Stacked data analysis
To speed-up the computations, binned observations can be stacked together,
requiring the computation of average response functions that properly weight
-the individual instrument response functions for each observation. Stacking
-of observations is possible for binned counts cubes and On/Off spectra.
+the individual instrument response functions for each observation. For IACT
+analysis, stacking of observations is possible for binned counts cubes and
+On/Off spectra. For COMPTEL data analysis, stacking is performed using the
+:ref:`comobsadd` script.
-Stacked counts cubes
-~~~~~~~~~~~~~~~~~~~~
+Stacked IACT counts cubes
+~~~~~~~~~~~~~~~~~~~~~~~~~
By default, :ref:`ctbin` stacks the events from multiple observations into
a single counts cube (to produce counts cubes for each individual observation,
@@ -217,8 +219,8 @@ The files for a stacked binned observation are specified as follows in an
(the ``EdispCube`` parameter is optional).
-Stacked On/Off spectra
-~~~~~~~~~~~~~~~~~~~~~~
+Stacked IACT On/Off spectra
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, :ref:`csphagen` creates On/Off spectra and response information
for each individual observation, but executing :ref:`csphagen` with the
@@ -271,3 +273,29 @@ On/Off observation has the same format as for a single On/Off observation:
+
+Stacked COMPTEL data space
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can stack binned COMPTEL observations using the :ref:`comobsadd` script.
+Binned event data are stacked using
+
+.. math::
+ {\tt DRE}(\chi, \psi, \bar{\varphi}|\{E\}) = \sum_i {\tt DRE}_i(\chi, \psi, \bar{\varphi}|\{E\})
+
+the background models are stacked using
+
+.. math::
+ {\tt DRB}(\chi, \psi, \bar{\varphi}|\{E\}) = \sum_i {\tt DRB}_i(\chi, \psi, \bar{\varphi}|\{E\})
+
+the exposures are stacked by determining the maximum of the sum of all exposures using
+
+.. math::
+ {\tt DRX}(\alpha, \delta) = \sum_i \max_{\alpha',\delta'} {\tt DRX}_i(\alpha', \delta')
+
+and the geometries are stacked by weighting with the respective exposure time for
+individual observations using
+
+.. math::
+ {\tt DRG}(\chi, \psi, \bar{\varphi}) = \frac{1}{T} \sum_i T_i \, {\tt DRG}_i(\chi, \psi, \bar{\varphi})
+
diff --git a/modules/comscripts/comlixfit.par b/modules/comscripts/comlixfit.par
index ef773a3..b4cc037 100644
--- a/modules/comscripts/comlixfit.par
+++ b/modules/comscripts/comlixfit.par
@@ -33,8 +33,8 @@ fix_spat_for_ts, b, h, no,,, "Fix spatial parameters for TS computation?"
fix_ext_for_initial, b, h, no,,, "Fix extension parameters for initial fit iteration?"
bkgmethod, s, a, BGDLIXE,PHINOR|BGDLIXA|BGDLIXE,, "Method for background computation"
nrunav, i, h, 3,,, "Number of Chi/Psi bins used for running average"
-navgr, i, h, 3,,, "Number of Chi/Psi bins used for averaging"
-nincl, i, h, 13,,, "Number of Phibar layers to include"
+navgr, i, h, 5,,, "Number of Chi/Psi bins used for averaging"
+nincl, i, h, 15,,, "Number of Phibar layers to include"
nexcl, i, h, 0,,, "Number of Phibar layers to exclude"
phi_first, i, h, -1,,, "First Phibar layer for fitting (starting from 0; -1: no selection)"
phi_last, i, h, -1,,, "Last Phibar layer for fitting (starting from 0;-1: no selection)"
diff --git a/modules/comscripts/comlixmap.par b/modules/comscripts/comlixmap.par
index 4c4499f..90caac8 100644
--- a/modules/comscripts/comlixmap.par
+++ b/modules/comscripts/comlixmap.par
@@ -41,8 +41,8 @@ accept_dec, r, h, 0.0,0.0,10.0, "Maximum accepted log-likelihood decrease"
fix_spat, b, h, yes,,, "Fix spatial parameters for TS map computation?"
bkgmethod, s, a, BGDLIXE,PHINOR|BGDLIXA|BGDLIXE,, "Method for background computation"
nrunav, i, h, 3,,, "Number of Chi/Psi bins used for running average"
-navgr, i, h, 3,,, "Number of Chi/Psi bins used for averaging"
-nincl, i, h, 13,,, "Number of Phibar layers to include"
+navgr, i, h, 5,,, "Number of Chi/Psi bins used for averaging"
+nincl, i, h, 15,,, "Number of Phibar layers to include"
nexcl, i, h, 0,,, "Number of Phibar layers to exclude"
phi_first, i, h, -1,,, "First Phibar layer for fitting (starting from 0; -1: no selection)"
phi_last, i, h, -1,,, "Last Phibar layer for fitting (starting from 0;-1: no selection)"
diff --git a/modules/comscripts/comobsback.par b/modules/comscripts/comobsback.par
index 1e7e9f9..57198b4 100644
--- a/modules/comscripts/comobsback.par
+++ b/modules/comscripts/comobsback.par
@@ -27,8 +27,8 @@ outobs, f, a, obs_back.xml,,, "Output observation definition file"
#==================
bkgmethod, s, a, BGDLIXE,PHINOR|BGDLIXA|BGDLIXE,, "Method for background computation"
nrunav, i, h, 3,,, "Number of Chi/Psi bins used for running average"
-navgr, i, h, 3,,, "Number of Chi/Psi bins used for averaging"
-nincl, i, h, 13,,, "Number of Phibar layers to include"
+navgr, i, h, 5,,, "Number of Chi/Psi bins used for averaging"
+nincl, i, h, 15,,, "Number of Phibar layers to include"
nexcl, i, h, 0,,, "Number of Phibar layers to exclude"
phinor, b, h, yes,,, "Normalise Phibar distribution?"
diff --git a/modules/comscripts/comobsmodel.par b/modules/comscripts/comobsmodel.par
index b5a25f6..72fecc3 100644
--- a/modules/comscripts/comobsmodel.par
+++ b/modules/comscripts/comobsmodel.par
@@ -23,7 +23,7 @@ outmodel, f, a, models.xml,,, "Output model definition file"
# Script parameters
#==================
ra, r, a, NONE,,, "Right Ascension of point source (deg)"
-dec, r, a, NONE,,, "Declinaison of point source (deg)"
+dec, r, a, NONE,,, "Declination of point source (deg)"
srcname, s, a, NONE,,, "Name of point source"
brems, s, a, NONE,NONE|MAP|CUBE,, "Bremsstrahlung component"
ic, s, a, NONE,NONE|MAP|CUBE,, "Inverse Compton component"
diff --git a/modules/comscripts/compulbin.par b/modules/comscripts/compulbin.par
index af90e45..e7c88d3 100644
--- a/modules/comscripts/compulbin.par
+++ b/modules/comscripts/compulbin.par
@@ -23,7 +23,7 @@ outfile, f, a, pulsar.fits,,, "Output pulsar phase bins file"
# Script parameters
#==================
psrname, s, a, PSR B0531+21,,, "Pulsar name"
-ephemerides, f, a, ephem_crab.psrtime,,, "Pulsar ephemerides file"
+ephemerides, f, a, $CTOOLS/share/models/ephem_xte.psrtime,,, "Pulsar ephemerides file"
emin, r, a, 0.75,0.05,50.0, "Minimum energy (MeV)"
emax, r, a, 30.0,0.05,50.0, "Maximum energy (MeV)"
pnumbins, i, a, 33,1,200, "Number of phase bins"
--
libgit2 0.21.4