Skip to content

Commit

Permalink
Simulate HESS Crab observation using ctobssim
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeil committed Aug 31, 2015
1 parent 4455e75 commit e7b55b3
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 13 deletions.
9 changes: 4 additions & 5 deletions docs/background/make_models.rst
Expand Up @@ -76,17 +76,16 @@ Datasets for testing
~~~~~~~~~~~~~~~~~~~~

In order to test the background model generation tools, real
data from existing experiments such as H.E.S.S. can be used. Since
the data of current experiments is not public, tools to
prepare a dummy dataset have been placed in Gammapy:
:ref:`datasets_make_datasets_for_testing`.
data from existing experiments such as H.E.S.S. can be used.
Since the data of current experiments is not public, tools to
simulate datasets are described in :ref:`datasets_obssim`.

There is also a tool in Gammapy to simulate background cube models:
`~gammapy.datasets.make_test_bg_cube_model`.
It can be used to produce true background cube models to use to
compare to the reconstructed ones produced with the machinery
described above, using a simulated dataset using the tools from
:ref:`datasets_make_datasets_for_testing`. If using the same model
:ref:`datasets_obssim`. If using the same model
for producing the simulated dataset and the true background cube
models, the reconstructed ones produced with
``gammapy-make-bg-cube-models`` should match the true ones.
48 changes: 43 additions & 5 deletions docs/datasets/make_datasets.rst
@@ -1,7 +1,44 @@
.. _datasets_make_datasets_for_testing:
.. include:: ../references.txt

Make datasets for testing
=========================
.. _datasets_obssim:

Simulate event lists
====================

Here we describe how to simulate event lists for a given
observation list, source model and instrument.

Gammapy is mostly an analysis package for binned analysis,
and so far we haven't implemented general tools to sample
arbitrary spatial and spectral density distributions.

An excellent tool `ctobssim`_ is available within the ctools
package, so here we'll describe how to use that first and then
mention the existing functionality in Gammapy.

.. _datasets_obssim_ctobssim:

Using ctobssim
++++++++++++++

Let's say we want to simulate an event list for observation 23523
with `H.E.S.S.`_ containing events from the Crab nebula and hadronic background.

That is a real Crab nebula observation that took place in 2004, but the data
(i.e. the event list) is only available for H.E.S.S. collaboration members.
For testing the open-source tools, the IRFs for that observation have been made available
at `here (https://github.com/gammapy/gammapy-extra/tree/master/test_datasets/irf/hess/pa>`__.



https://github.com/ctools/ctools/blob/devel/cscripts/cshessobs.py
and we will describe how to use them together with the


.. _datasets_obssim_gammapy:

Using Gammapy
+++++++++++++

In order to test some of the tools from Gammapy, such as the
background generation tools
Expand All @@ -27,7 +64,7 @@ addition, the effective area files produced, are empty except fot
the low energy threshold header entry.

The tools are very easy to use. A H.E.S.S.-like test dataset can be
produced with a few lines of python code:
produced with a few lines of Python code:

.. code-block:: python
Expand All @@ -42,7 +79,8 @@ produced with a few lines of python code:
random_state=random_state)
Then the data can be read back using the `~gammapy.obs.DataStore`
class, and eg. print the observation table and the names of the filescreated with a few extra lines of python code:
class, and eg. print the observation table and the names of the files
created with a few extra lines of Python code:

.. code-block:: python
Expand Down
4 changes: 3 additions & 1 deletion docs/references.txt
Expand Up @@ -62,4 +62,6 @@
.. _Gammapy page on PyPI: https://pypi.python.org/pypi/gammapy
.. _Gammapy contributors page on Github: https://github.com/gammapy/gammapy/graphs/contributors

.. _scientific Python stack: http://www.scipy.org/about.html
.. _scientific Python stack: http://www.scipy.org/about.html

.. _ctobssim: http://cta.irap.omp.eu/ctools-devel/reference_manual/ctobssim.html
4 changes: 2 additions & 2 deletions gammapy/datasets/make.py
Expand Up @@ -411,7 +411,7 @@ def make_test_dataset(fits_path, overwrite=False,
This method is useful for instance to produce samples in order
to test the machinery for reconstructing background (cube) models.
See also :ref:`datasets_make_datasets_for_testing`.
See also :ref:`datasets_obssim`.
Parameters
----------
Expand Down Expand Up @@ -515,7 +515,7 @@ def make_test_eventlist(observation_table,
In addition, an effective area table is produced. For the moment
only the low energy threshold is filled.
See also :ref:`datasets_make_datasets_for_testing`.
See also :ref:`datasets_obssim`.
Parameters
----------
Expand Down

0 comments on commit e7b55b3

Please sign in to comment.