Skip to content

Commit 432fe45

Browse files
author
Claudio Galelli
authored
Merge branch 'gammapy:main' into fitresults
2 parents ebef3c4 + 619dad0 commit 432fe45

File tree

35 files changed

+268
-169
lines changed

35 files changed

+268
-169
lines changed

docs/_templates/custom-footer.html

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% block extrafooter %}
2+
{{super}}
3+
<a href="https://gammapy.org/DataPrivacy.html">Data Privacy.</a>
4+
{% endblock %}

docs/conf.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def setup(app):
116116

117117
# List of patterns, relative to source directory, that match files and
118118
# directories to ignore when looking for source files.
119-
exclude_patterns.append("_templates")
119+
#exclude_patterns.append("_templates")
120120
exclude_patterns.append("**.ipynb_checkpoints")
121121
exclude_patterns.append("user-guide/model-gallery/*/*.ipynb")
122122
exclude_patterns.append("user-guide/model-gallery/*/*.md5")
@@ -186,6 +186,11 @@ def setup(app):
186186

187187
# Static files to copy after template files
188188
html_static_path = ["_static"]
189+
html_css_files = ["custom.css"]
190+
html_js_files = ["matomo.js"]
191+
192+
templates_path = ["_templates"]
193+
189194

190195
# The name of an image file (within the static path) to use as favicon of the
191196
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -237,10 +242,10 @@ def setup(app):
237242
"json_url": "https://docs.gammapy.org/stable/switcher.json",
238243
"version_match": switch_version,
239244
},
240-
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
245+
"navbar_end": ["version-switcher", "navbar-icon-links"],
241246
"navigation_with_keys": True,
242247
# footers
243-
"footer_start": ["copyright"],
248+
"footer_start": ["copyright","custom-footer.html"],
244249
"footer_center": ["last-updated"],
245250
"footer_end": ["sphinx-version", "theme-version"]
246251
}
@@ -336,13 +341,7 @@ def setup(app):
336341
},
337342
}
338343

339-
html_static_path = ["_static"]
340-
html_css_files = ["custom.css"]
341-
html_js_files = ["matomo.js"]
342-
343344
html_context = {
344345
"default_mode": "light",
345346
}
346347

347-
# Add-on to insert the Matomo tracker
348-
templates_path = ['_templates']

docs/user-guide/astro/darkmatter/index.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ module `DarkBit`_. DarkBit can be used for directly computing observables and
8989
likelihoods, for any combination of parameter values in some underlying
9090
particle model.
9191

92-
Gammapy tutorial
93-
================
92+
Using gammapy.astro.darkmatter
93+
------------------------------
94+
95+
.. minigallery:: gammapy.astro.darkmatter
9496

95-
.. minigallery:: `gammapy.astro.darkmatter.DarkMatterAnnihilationSpectralModel`
96-
:add-heading:
9797

9898

9999
.. _Cirelli et al. 2011: http://iopscience.iop.org/article/10.1088/1475-7516/2011/03/051/pdf

docs/user-guide/astro/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This module contains utility functions for some astrophysical scenarios:
99
* `~gammapy.astro.population` for astrophysical population models
1010
* `~gammapy.astro.darkmatter` for dark matter spatial and spectral models
1111

12-
The ``gammapy.astro`` sub-package is in a prototyping phase and its scope and future
12+
The `gammapy.astro` sub-package is in a prototyping phase and its scope and future
1313
are currently being discussed. It is likely that some functionality will
1414
be removed or split out into a separate package at some point.
1515

1616
Getting started
1717
---------------
1818

19-
The ``gammapy.astro`` namespace is empty. Use these import statements:
19+
The `gammapy.astro` namespace is empty. Use these import statements:
2020

2121
.. testcode::
2222

docs/user-guide/catalog.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Source catalogs
55

66
`gammapy.catalog` provides convenient access to common gamma-ray source catalogs.
77

8-
* ``hgps`` / `SourceCatalogHGPS` - H.E.S.S. Galactic plane survey (HGPS)
9-
* ``gamma-cat`` / `SourceCatalogGammaCat` - An open catalog of gamma-ray sources
10-
* ``3fgl`` / `SourceCatalog3FGL` - LAT 4-year point source catalog
11-
* ``4fgl`` / `SourceCatalog4FGL` - LAT 8-year point source catalog
12-
* ``2fhl`` / `SourceCatalog2FHL` - LAT second high-energy source catalog
13-
* ``3fhl`` / `SourceCatalog3FHL` - LAT third high-energy source catalog
14-
* ``2hwc`` / `SourceCatalog2HWC` - 2HWC catalog from the HAWC observatory
15-
* ``3hwc`` / `SourceCatalog3HWC` - 3HWC catalog from the HAWC observatory
16-
17-
For each catalog, a `SourceCatalog` class is provided to represent the catalog table,
18-
and a matching `SourceCatalogObject` class to represent one catalog source and table row.
8+
* ``hgps`` / `~gammapy.catalog.SourceCatalogHGPS` - H.E.S.S. Galactic plane survey (HGPS)
9+
* ``gamma-cat`` / `~gammapy.catalog.SourceCatalogGammaCat` - An open catalog of gamma-ray sources
10+
* ``3fgl`` / `~gammapy.catalog.SourceCatalog3FGL` - LAT 4-year point source catalog
11+
* ``4fgl`` / `~gammapy.catalog.SourceCatalog4FGL` - LAT 8-year point source catalog
12+
* ``2fhl`` / `~gammapy.catalog.SourceCatalog2FHL` - LAT second high-energy source catalog
13+
* ``3fhl`` / `~gammapy.catalog.SourceCatalog3FHL` - LAT third high-energy source catalog
14+
* ``2hwc`` / `~gammapy.catalog.SourceCatalog2HWC` - 2HWC catalog from the HAWC observatory
15+
* ``3hwc`` / `~gammapy.catalog.SourceCatalog3HWC` - 3HWC catalog from the HAWC observatory
16+
17+
For each catalog, a `~gammapy.catalog.SourceCatalog` class is provided to represent the catalog table,
18+
and a matching `~gammapy.catalog.SourceCatalogObject` class to represent one catalog source and table row.
1919

2020
The main functionality provided is methods that map catalog information to
2121
`~gammapy.modeling.models.SkyModel`, `~gammapy.modeling.models.SpectralModel`,
@@ -29,9 +29,9 @@ or to create initial source models for certain energy bands and sky regions.
2929
Using gammapy.catalog
3030
---------------------
3131

32-
.. minigallery:: gammapy.catalog.SourceCatalog3FHL
32+
.. minigallery:: `~gammapy.catalog.SourceCatalog3FHL`
3333
:add-heading:
3434

3535

36-
.. minigallery:: gammapy.catalog.SourceCatalogGammaCat
36+
.. minigallery:: `~gammapy.catalog.SourceCatalogGammaCat`
3737
:add-heading:

docs/user-guide/datasets/index.rst

+10-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Datasets (DL4)
88
The `gammapy.datasets` sub-package contains classes to handle reduced
99
gamma-ray data for modeling and fitting.
1010

11-
The `Dataset` class bundles reduced data, IRFs and model to perform
11+
The `~gammapy.datasets.Dataset` class bundles reduced data, IRFs and model to perform
1212
likelihood fitting and joint-likelihood fitting.
1313
All datasets contain a `~gammapy.modeling.models.Models` container with one or more
1414
`~gammapy.modeling.models.SkyModel` objects that represent additive emission
@@ -96,7 +96,7 @@ a joint fit across multiple datasets.
9696
Predicted counts
9797
----------------
9898

99-
The total number of predicted counts from a `MapDataset` are computed per bin like:
99+
The total number of predicted counts from a `~gammapy.datasets.MapDataset` are computed per bin like:
100100

101101
.. math::
102102
@@ -174,7 +174,7 @@ Here, :math:`k` denotes a bin in reconstructed energy,
174174

175175
For the model evaluation, an important factor that needs to be accounted for is
176176
that the energy threshold changes between observations.
177-
With the above implementation using a `~gammapy.irf.EDispersionMap`,
177+
With the above implementation using a `~gammapy.irf.EDispMap`,
178178
the `npred` is conserved,
179179
ie, the predicted number of counts on the stacked
180180
dataset is the sum expected by stacking the `npred` of the individual runs,
@@ -220,11 +220,13 @@ stack runs taken under similar conditions and then do a joint fit on the stacked
220220
Serialisation of datasets
221221
-------------------------
222222

223-
The various `Map` objects contained in `~gammapy.datasets.MapDataset` and `~gammapy.datasets.MapDatasetOnOff` are serialised according to `GADF Sky Maps <https://gamma-astro-data-formats.readthedocs.io/en/v0.2/skymaps/index.html>`__.
223+
The various `~gammapy.maps.Map` objects contained in `~gammapy.datasets.MapDataset` and
224+
`~gammapy.datasets.MapDatasetOnOff` are serialised according to
225+
`GADF Sky Maps <https://gamma-astro-data-formats.readthedocs.io/en/v0.2/skymaps/index.html>`__.
224226
A hdulist is created with the different attributes, and each of these are written with the data
225-
contained in a `BinTableHDU` with a `WcsGeom` and a `BANDS HDU` specifying the non-spatial dimensions.
226-
Optionally, a `meta_table` is also written as an `astropy.table.Table` containing various information
227-
about the observations which created the dataset. While the `meta_table` can contain useful information for
227+
contained in a ``BinTableHDU`` with a `~gammapy.maps.WcsGeom` and a ``BANDS HDU`` specifying the non-spatial dimensions.
228+
Optionally, a ``meta_table`` is also written as an `astropy.table.Table` containing various information
229+
about the observations which created the dataset. While the ``meta_table`` can contain useful information for
228230
later stage analysis, it is not used anywhere internally within gammapy.
229231

230232
`~gammapy.datasets.SpectrumDataset` follows a similar convention as for `~gammapy.datasets.MapDataset`, but uses a
@@ -233,7 +235,7 @@ later stage analysis, it is not used anywhere internally within gammapy.
233235
either according to the above specification, or (by default), according to the
234236
`OGIP standards <https://gamma-astro-data-formats.readthedocs.io/en/v0.1/ogip/index.html>`__.
235237

236-
`~gammapy.datasets.FluxPointsDatasets` are serialised as `gammapy.estimators.FluxPoints` objects, which contains
238+
`~gammapy.datasets.FluxPointsDataset` are serialised as `gammapy.estimators.FluxPoints` objects, which contains
237239
a set of `gammapy.maps.Map` objects storing the estimated flux as function of energy, and some optional quantities like
238240
typically errors, upper limits, etc. It also contains a reference model,
239241
serialised as a `~gammapy.modeling.models.TemplateSpectralModel`.

docs/user-guide/dl3.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can use the `~gammapy.data.EventList` class to load IACT gamma-ray event lis
3232
filename = '$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_023523.fits.gz'
3333
events = EventList.read(filename)
3434

35-
To load Fermi-LAT event lists, use the `~gammapy.data.EventListLAT` class:
35+
To load Fermi-LAT event lists, you can also use the `~gammapy.data.EventList` class:
3636

3737
.. testcode::
3838

@@ -139,7 +139,7 @@ Writing event lists and GTIs to file
139139

140140
To write the events or GTIs separately, one can just save the underlying
141141
`astropy.table.Table`. To have an event file written in a correct DL3 format, it is
142-
necessary to utilise the ``write`` method available for`~gammapy.data.Observation`.
142+
necessary to utilise the ``write`` method available for `~gammapy.data.Observation`.
143143
It will write the `~gammapy.data.EventList` and their associated GTIs together in the
144144
same FITS file according to the format specifications. To avoid writing IRFs along the
145145
``EventList`` one has to set ``include_irfs`` to ``False``. See the example below:

docs/user-guide/estimators.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In general the flux can be estimated using two methods:
3535
not re-optimising other parameters, one can estimate the significance based on the
3636
analytical solution by [LiMa1983]. In this case the "best fit" flux and significance
3737
are given by the excess over the null hypothesis. This method is also named
38-
**backward folding**. This method is currently only exposed in the `ExcessMapEstimator`
38+
**backward folding**. This method is currently only exposed in the `~gammapy.estimators.ExcessMapEstimator`
3939

4040

4141
Energy edges
@@ -91,7 +91,7 @@ arguments are translated into a TS difference assuming ``ts = n_sigma ** 2``.
9191
.. _sedtypes:
9292

9393
SED types
94-
~~~~~~~~~
94+
^^^^^^^^^
9595

9696
In addition to the norm values a reference spectral model and energy ranges
9797
are given. Using this reference spectral model the norm values can be converted
@@ -112,7 +112,7 @@ e2dnde Differential energy flux at ``e_ref``
112112
The same can be applied for the error and upper limit information.
113113
More information can be found on the `likelihood SED type page`_.
114114

115-
The `FluxPoints` and `FluxMaps` objects can optionally define meta
115+
The `~gammapy.estimators.FluxPoints` and `~gammapy.estimators.FluxMaps` objects can optionally define meta
116116
data with the following valid keywords:
117117

118118
================= =================================================
@@ -141,7 +141,7 @@ A note on negative flux and upper limit values:
141141
Flux maps
142142
---------
143143

144-
This how to compute flux maps with the `ExcessMapEstimator`:
144+
This how to compute flux maps with the `~gammapy.estimators.ExcessMapEstimator`:
145145

146146
.. testcode::
147147

docs/user-guide/hli.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ the functionality that is available in the sub-packages to support
1414
standard analysis use case in a convenient way.
1515

1616

17-
Using gammapy.datasets
17+
Using gammapy.analysis
1818
----------------------
1919

2020
.. minigallery:: gammapy.analysis.Analysis

docs/user-guide/howto.rst

+12
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,18 @@ warning like so:
278278

279279
.. accordion-footer::
280280

281+
.. accordion-header::
282+
:id: HowToAvoidNaninFp
283+
:title: Avoid NaN results in Flux Point estimation
284+
:link: ../tutorials/api/estimators.html#a-fully-configured-flux-points-estimation
285+
286+
Sometimes, upper limit values may show as ``nan`` while running a `~gammapy.estimators.FluxPointsEstimator`
287+
or a `~gammapy.estimators.LightCurveEstimator`. This often arises because the range of the norm parameter
288+
being scanned over is not sufficient. Increasing this range usually solves the problem. In some cases,
289+
you can also consider configuring the estimator with a different `~gammapy.modeling.Fit` backend.
290+
291+
.. accordion-footer::
292+
281293
.. accordion-header::
282294
:id: HowToProgressBar
283295
:title: Display a progress bar

docs/user-guide/makers/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Background estimation
2424
Safe data range definition
2525
--------------------------
2626

27-
The definition of a safe data range is done using the `SafeMaskMaker` or manually.
27+
The definition of a safe data range is done using the `~gammapy.makers.SafeMaskMaker` or manually.
2828

2929

3030
Using gammapy.makers

docs/user-guide/maps/index.rst

+19-19
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ non-spatial dimensions and can represent images (2D), cubes (3D), or hypercubes
2020

2121

2222
`gammapy.maps` is organized around two data structures: *geometry* classes
23-
inheriting from `~Geom` and *map* classes inheriting from `~Map`. A geometry
24-
defines the map boundaries, pixelization scheme, and provides methods for
25-
converting to/from map and pixel coordinates. A map owns a `~Geom` instance
23+
inheriting from `~gammapy.maps.Geom` and *map* classes inheriting from `~gammapy.maps.Map`. A geometry
24+
defines the map boundaries, pixelisation scheme, and provides methods for
25+
converting to/from map and pixel coordinates. A map owns a `~gammapy.maps.Geom` instance
2626
as well as a data array containing map values. Where possible it is recommended
27-
to use the abstract `~Map` interface for accessing or updating the contents of a
27+
to use the abstract `~gammapy.maps.Map` interface for accessing or updating the contents of a
2828
map as this allows algorithms to be used interchangeably with different map
2929
representations. The following reviews methods of the abstract map interface.
3030

@@ -33,11 +33,11 @@ Getting started with maps
3333
-------------------------
3434

3535
All map objects have an abstract interface provided through the methods of the
36-
`~Map`. These methods can be used for accessing and manipulating the contents of
36+
`~gammapy.maps.Map`. These methods can be used for accessing and manipulating the contents of
3737
a map without reference to the underlying data representation (e.g. whether a
38-
map uses WCS or HEALPix pixelization). For applications which do depend on the
38+
map uses WCS or HEALPix pixelisation). For applications which do depend on the
3939
specific representation one can also work directly with the classes derived from
40-
`~Map`. In the following we review some of the basic methods for working with
40+
`~gammapy.maps.Map`. In the following we review some of the basic methods for working with
4141
map objects, more details are given in the :doc:`/tutorials/api/maps`
4242
tutorial.
4343

@@ -47,20 +47,20 @@ Accessor methods
4747
----------------
4848

4949
All map objects have a set of accessor methods provided through the abstract
50-
`~Map` class. These methods can be used to access or update the contents of the
50+
`~gammapy.maps.Map` class. These methods can be used to access or update the contents of the
5151
map irrespective of its underlying representation. Four types of accessor
5252
methods are provided:
5353

5454
* ``get`` : Return the value of the map at the pixel containing the
55-
given coordinate (`~Map.get_by_idx`, `~Map.get_by_pix`, `~Map.get_by_coord`).
55+
given coordinate (`~gammapy.maps.Map.get_by_idx`, `~gammapy.maps.Map.get_by_pix`, `~gammapy.maps.Map.get_by_coord`).
5656
* ``interp`` : Interpolate or extrapolate the value of the map at an arbitrary
5757
coordinate.
5858
* ``set`` : Set the value of the map at the pixel containing the
59-
given coordinate (`~Map.set_by_idx`, `~Map.set_by_pix`, `~Map.set_by_coord`).
59+
given coordinate (`~gammapy.maps.Map.set_by_idx`, `~gammapy.maps.Map.set_by_pix`, `~gammapy.maps.Map.set_by_coord`).
6060
* ``fill`` : Increment the value of the map at the pixel containing
6161
the given coordinate with a unit weight or the value in the optional
62-
``weights`` argument (`~Map.fill_by_idx`, `~Map.fill_by_pix`,
63-
`~Map.fill_by_coord`).
62+
``weights`` argument (`~gammapy.maps.Map.fill_by_idx`, `~gammapy.maps.Map.fill_by_pix`,
63+
`~gammapy.maps.Map.fill_by_coord`).
6464

6565
Accessor methods accept as their first argument a coordinate tuple containing
6666
scalars, lists, or numpy arrays with one tuple element for each dimension of the
@@ -84,7 +84,7 @@ coordinates can be expressed in one of three coordinate systems:
8484
array for each non-spatial dimension.
8585

8686
The coordinate system accepted by a given accessor method can be inferred from
87-
the suffix of the method name (e.g. `~Map.get_by_idx`). The following
87+
the suffix of the method name (e.g. `~gammapy.maps.Map.get_by_idx`). The following
8888
demonstrates how one can access the same pixels of a WCS map using each of the
8989
three coordinate systems:
9090

@@ -141,7 +141,7 @@ following demonstrates how one can set pixel values:
141141
Interface with MapCoord and SkyCoord
142142
------------------------------------
143143

144-
The ``coord`` accessor methods accept `dict`, `~gammapy.maps.MapCoord`, and
144+
The ``coord`` accessor methods accept ``dict``, `~gammapy.maps.MapCoord`, and
145145
`~astropy.coordinates.SkyCoord` arguments in addition to the standard `tuple` of
146146
`~numpy.ndarray` argument. When using a `tuple` argument a
147147
`~astropy.coordinates.SkyCoord` can be used instead of longitude and latitude
@@ -166,7 +166,7 @@ transformed to match the coordinate system of the map.
166166
m.set_by_coord((skycoord, energy), [0.5, 1.5])
167167
m.get_by_coord((skycoord, energy))
168168

169-
A `~gammapy.maps.MapCoord` or `dict` argument can be used to interact with a map object
169+
A `~gammapy.maps.MapCoord` or ``dict`` argument can be used to interact with a map object
170170
without reference to the axis ordering of the map geometry:
171171

172172
.. testcode::
@@ -188,9 +188,9 @@ MapCoord
188188

189189
`~gammapy.maps.MapCoord` is an N-dimensional coordinate object that stores both spatial and
190190
non-spatial coordinates and is accepted by all ``coord`` methods. A `~gammapy.maps.MapCoord`
191-
can be created with or without explicitly named axes with `MapCoord.create`.
191+
can be created with or without explicitly named axes with `~gammapy.maps.MapCoord.create`.
192192
Axes of a `~gammapy.maps.MapCoord` can be accessed by index, name, or attribute. A `~gammapy.maps.MapCoord`
193-
without explicit axis names can be created by calling `MapCoord.create` with a
193+
without explicit axis names can be created by calling `~gammapy.maps.MapCoord.create` with a
194194
`tuple` argument:
195195

196196
.. testcode::
@@ -231,8 +231,8 @@ latitude. Non-spatial axes are assigned a default name ``axis{I}`` where
231231
``{I}`` is the index of the non-spatial dimension. `~gammapy.maps.MapCoord` objects created
232232
without named axes must have the same axis ordering as the map geometry.
233233

234-
A `~gammapy.maps.MapCoord` with named axes can be created by calling `MapCoord.create`
235-
with a `dict`:
234+
A `~gammapy.maps.MapCoord` with named axes can be created by calling `~gammapy.maps.MapCoord.create`
235+
with a ``dict``:
236236

237237
.. testcode::
238238

docs/user-guide/scripts/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Write your own CLI
150150
This section explains how to write your own command line interface (CLI).
151151

152152
We will focus on the command line aspect, and use a very simple example where we
153-
just call `gammapy.stats.CashCountsStatistics.sqrt_ts`.
153+
just call `gammapy.stats.CashCountsStatistic.sqrt_ts`.
154154

155155
From the interactive Python or IPython prompt or from a Jupyter notebook you
156156
just import the functionality you need and call it, like this:

0 commit comments

Comments
 (0)