Skip to content

Commit b532dfa

Browse files
author
Claudio Galelli
authored
Merge branch 'main' into sf
2 parents 792b272 + 637ecec commit b532dfa

File tree

125 files changed

+782
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+782
-417
lines changed

.github/workflows/ci.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v4
1010
- uses: psf/black@stable
1111
with:
12-
version: "22.6.0"
12+
version: "24.2.0"
1313
ci-runs:
1414
name: ${{ matrix.os }}, ${{ matrix.tox_env }}
1515
runs-on: ${{ matrix.os }}
@@ -44,6 +44,11 @@ jobs:
4444
tox_env: 'py311-test-alldeps_noray'
4545
gammapy_data_path: /home/runner/work/gammapy/gammapy/gammapy-datasets/dev
4646
allowed_fail: false
47+
- os: ubuntu-latest
48+
python: '3.12'
49+
tox_env: 'py312-test-alldeps_noray'
50+
gammapy_data_path: /home/runner/work/gammapy/gammapy/gammapy-datasets/dev
51+
allowed_fail: false
4752
- os: ubuntu-latest
4853
python: '3.10'
4954
tox_env: 'py310-test'

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: isort
77
args: ["--profile", "black", "--filter-files"]
88
- repo: https://github.com/psf/black
9-
rev: 22.6.0
9+
rev: 24.2.0
1010
hooks:
1111
- id: black
1212
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8
@@ -15,4 +15,4 @@ repos:
1515
hooks:
1616
- id: flake8
1717
exclude: examples
18-
args: ["--count", "--max-line-length=100", "--extend-ignore=E203,E712,W503"]
18+
args: ["--count", "--max-line-length=100", "--extend-ignore=E203,E712,W503"]

CITATION.cff

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ abstract: 'Gammapy analyzes gamma-ray data and creates sky images, spectra and l
88
type: software
99
message: "If you use this software, please cite it using the metadata from this file."
1010
url: "https://gammapy.org/"
11-
date-released: 2024-02-19
11+
date-released: 2024-02-29
1212
keywords:
1313
- Astronomy
1414
- "Gamma-rays"
1515
- "Data analysis"
16-
version: v1.2rc1
16+
version: v1.2
1717
repository-code: "https://github.com/gammapy/gammapy"
1818
license: BSD-3-Clause
1919
contact:

codemeta.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
}
254254
],
255255
"codeRepository": "https://github.com/gammapy/gammapy",
256-
"datePublished": "2024-02-19",
256+
"datePublished": "2024-02-29",
257257
"description": "Gammapy analyzes gamma-ray data and creates sky images, spectra and lightcurves, from event lists and instrument response information; it can also determine the position, morphology and spectra of gamma-ray sources. It is used to analyze data from H.E.S.S., Fermi-LAT, HAWC, and the Cherenkov Telescope Array (CTA).",
258258
"identifier": "https://doi.org/10.5281/zenodo.4701488",
259259
"keywords": [
@@ -264,7 +264,7 @@
264264
"license": "https://spdx.org/licenses/BSD-3-Clause",
265265
"name": "Gammapy: Python toolbox for gamma-ray astronomy",
266266
"url": "https://gammapy.org/",
267-
"softwareVersion": "v1.2rc1",
267+
"softwareVersion": "v1.2",
268268
"maintainer": {
269269
"@id": "https://orcid.org/0000-0003-4568-7005",
270270
"@type": "Person",
@@ -284,7 +284,7 @@
284284
"softwareRequirements": [
285285
"numpy>=1.21,<2.0",
286286
"scipy>=1.5,!=1.10",
287-
"astropy>=5.0",
287+
"astropy>=5.0,<6.1",
288288
"regions>=0.5.0",
289289
"pyyaml>=5.3",
290290
"click>=7.0",

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
# flake8: noqa
4545

46+
4647
# Add our custom directives to Sphinx
4748
def setup(app):
4849
"""

docs/development/doc_howto.rst

+26
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,32 @@ the code as well as the output value produced.
111111
(10., 20.)>
112112
radius: 3.0 deg
113113
114+
To allow the code block to be placed correctly over multiple lines utilise the "...":
115+
116+
.. code-block:: text
117+
118+
Examples
119+
--------
120+
>>> from gammapy.maps import WcsGeom, MapAxis
121+
>>> energy_axis_true = MapAxis.from_energy_bounds(
122+
... 0.5, 20, 10, unit="TeV", name="energy_true"
123+
... )
124+
125+
126+
For a larger code block it is also possible to utilise the following syntax.
127+
128+
.. code-block:: text
129+
130+
Examples
131+
--------
132+
::
133+
134+
from gammapy.maps import MapAxis
135+
from gammapy.irf import EnergyDispersion2D
136+
filename = '$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_020136.fits.gz'
137+
edisp2d = EnergyDispersion2D.read(filename, hdu="EDISP")
138+
139+
114140
In order to perform tests of these snippets of code present in the docstrings of the Python files, you may run the
115141
following command.
116142

docs/getting-started/environments.rst

+28-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,36 @@ We recommend to create an isolated virtual environment for each version of Gamma
88
control over additional packages that you may use in your analysis. This will also help you on improving
99
reproducibility within the user community.
1010

11+
1112
Conda Environments
1213
------------------
13-
For convenience we also provide, for each stable release of Gammapy,
14-
a YAML file that allows you to easily create a specific conda execution environment.
15-
See :ref:`start installation quick instructions <quickstart-setup>` section. To create a new custom
16-
environment for your analysis with conda you can use:
14+
15+
For convenience we provide, for each stable release of Gammapy,
16+
a pre-defined conda environment file, so you can
17+
get additional useful packages together with Gammapy in a virtual isolated
18+
environment. First install `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`__
19+
and then just execute the following commands in the terminal:
20+
21+
.. substitution-code-block:: bash
22+
23+
$ curl -O https://gammapy.org/download/install/gammapy-|release|-environment.yml
24+
$ conda env create -f gammapy-|release|-environment.yml
25+
26+
.. note::
27+
28+
On Windows, you have to open up the conda environment file and delete the
29+
lines with ``sherpa`` and ``healpy``. Those are optional dependencies that
30+
currently aren't available on Windows.
31+
32+
Once the environment has been created you can activate it using:
33+
34+
.. substitution-code-block:: bash
35+
36+
$ conda activate gammapy-|release|
37+
38+
39+
40+
To create a new custom environment for your analysis with conda you can use:
1741

1842
.. code-block:: bash
1943

docs/getting-started/index.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ Getting started
1717
Installation
1818
------------
1919

20+
There are various ways for users to install Gammapy. **We recommend setting up a virtual
21+
environment using either conda or mamba.** Here are two methods to quickly install Gammapy.
22+
2023
.. panels::
2124
:column: col-lg-6 col-md-6 col-sm-12 col-xs-12 p-3
2225

2326
Working with conda?
2427
^^^^^^^^^^^^^^^^^^^
2528

26-
Gammapy can be installed with `Anaconda <https://docs.continuum.io/anaconda/>`__ or Miniconda:
29+
Gammapy can be installed with `Anaconda <https://docs.continuum.io/anaconda/>`__:
2730

2831
.. code-block:: bash
2932

docs/getting-started/install.rst

+20-27
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
Installation
66
============
77

8-
There are many ways to install Python and Gammapy as a user. On this page we list the most common ones.
9-
In general **we recommend to use virtual environments** when using Gammapy. This ways you have full
10-
control over additional packages that you may use in your analysis and you work with
11-
well defined computing environments, that you can share and allow **reproducibility of your
12-
scientific analysis results**. If you want to learn about using virtual environments see :ref:`virtual-envs`.
13-
You can also :ref:`install Gammapy for development <dev_setup>`.
8+
There are numerous ways to install Python and Gammapy as a user. On this page, we list the most common ones.
9+
In general, **we recommend using** :ref:`virtual environments <virtual-envs>` when using Gammapy. This
10+
way you have complete control over the additional packages that you may use in your analysis and you work with
11+
well defined computing environments. This enables you to easily share your work and ensure **reproducibility of your
12+
scientific analysis results**. You can also :ref:`install Gammapy for development <dev_setup>`.
13+
1414

1515
.. _anaconda:
1616

@@ -35,28 +35,28 @@ To install a specific version of Gammapy just execute:
3535

3636
.. code-block:: bash
3737
38-
$ conda install -c conda-forge gammapy=0.19
38+
$ conda install -c conda-forge gammapy=1.0
3939
40-
If you encountered any issues you can check the :ref:`troubleshoot` guide.
40+
If you encounter any issues you can check the :ref:`troubleshoot` guide.
4141

4242
Using Mamba
4343
-----------
4444
Alternatively, you can use `Mamba <https://mamba.readthedocs.io/>`__ for the installation.
45-
Mamba is an alternative package manager that support most of conda’s command but offers higher installation
45+
Mamba is an alternative package manager that supports most of conda’s commands but offers higher installation
4646
speed and more reliable environment solutions. To install ``mamba`` in the Conda base environment:
4747

4848
.. code-block:: bash
4949
5050
$ conda install mamba -n base -c conda-forge
5151
52-
then:
52+
Then install Gammapy through:
5353

5454
.. code-block:: bash
5555
5656
$ mamba install gammapy
5757
58-
Mamba supports of the commands that are available for conda. So updating and installing specific versions
59-
works the same way as above except for replacing the ``conda`` with the ``mamba`` command.
58+
Mamba supports the same commands available in conda. Therefore, updating and installing specific versions
59+
follows the same process as above, just simply replace the ``conda`` command with the ``mamba`` command.
6060

6161
.. _install-pip:
6262

@@ -71,13 +71,6 @@ using `pip`_:
7171
$ python -m pip install gammapy
7272
7373
This will install Gammapy with the required dependencies only.
74-
75-
.. note::
76-
77-
For Apple silicon M1 (`arm64`) architectures you also have to open the
78-
environment file and delete the `sherpa` entry, as currently there are
79-
no conda packages available. However you can later install `sherpa`
80-
in the environment using `python -m pip install sherpa`.
8174

8275
To install Gammapy with all optional dependencies, you can specify:
8376

@@ -86,33 +79,33 @@ To install Gammapy with all optional dependencies, you can specify:
8679
$ python -m pip install gammapy[all]
8780
8881
89-
To update an existing installation you can use:
82+
To update an existing installation use:
9083

9184
.. code-block:: bash
9285
9386
$ python -m pip install gammapy --upgrade
9487
95-
To install a specific version of Gammapy you can use:
88+
To install a specific version of Gammapy use:
9689

9790
.. code-block:: bash
9891
99-
$ python -m pip install gammapy==0.19
92+
$ python -m pip install gammapy==1.0
10093
101-
To install the current Gammapy **development** version using `pip`_ you can use:
94+
To install the current Gammapy **development** version with `pip`_ use:
10295

10396
.. code-block:: bash
10497
10598
$ python -m pip install git+https://github.com/gammapy/gammapy.git#egg=gammapy
10699
107-
Or like this, if you want to study or edit the code locally:
100+
If you want to study or edit the code locally, use the following:
108101

109102
.. code-block:: bash
110103
111104
$ git clone https://github.com/gammapy/gammapy.git
112105
$ cd gammapy
113106
$ python -m pip install .
114107
115-
If you encountered any issues you can check the :ref:`troubleshoot` guide.
108+
If you encounter any issues you can check the :ref:`troubleshoot` guide.
116109

117110
.. _install-other:
118111

@@ -138,8 +131,8 @@ Example:
138131
python3-pip python3-matplotlib \
139132
ipython3-notebook python3-gammapy
140133
141-
$ python3 -m pip install antigravity
134+
$ python3 -m pip install gammapy
142135
143136
Note that the Linux package managers typically have release cycles of 6 months,
144137
or yearly or longer, meaning that you'll typically get an older version of
145-
Gammapy. But you can always get a recent version via `pip` or `conda` (see above).
138+
Gammapy. However, you can always get the recent version via `pip` or `conda` (see above).

docs/getting-started/quickstart.rst

+14-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
.. _quickstart-setup:
22

3-
Quickstart Setup
4-
----------------
3+
Recommended Setup
4+
-----------------
55

6-
The best way to get started and learn Gammapy are the :ref:`tutorials`. For
7-
convenience we provide a pre-defined conda environment file, so you can
8-
get additional useful packages together with Gammapy in a virtual isolated
9-
environment. First install `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`__
10-
and then just execute the following commands in the terminal:
6+
We recommend using :ref:`virtual environments <virtual-envs>`, to do so
7+
execute the following commands in the terminal:
118

129
.. substitution-code-block:: bash
1310

@@ -22,23 +19,21 @@ and then just execute the following commands in the terminal:
2219

2320
.. note::
2421

25-
For Apple silicon M1 (`arm64`) architectures you also have to open the
26-
environment file and delete the `sherpa` entry, as currently there are
27-
no conda packages available. However you can later install `sherpa`
22+
For gammapy versions **prior to v1.2**, if you're using
23+
Apple silicon M1 (`arm64`) architectures you have to open the
24+
environment file and delete the `sherpa` entry. Currently there are
25+
no conda packages available. You can then install `sherpa`
2826
in the environment using `python -m pip install sherpa`.
2927

30-
Once the environment has been created you can activate it using:
3128

32-
.. substitution-code-block:: bash
33-
34-
$ conda activate gammapy-|release|
35-
36-
You can now proceed to download the Gammapy tutorial notebooks and the example
29+
The best way to get started and learn Gammapy are the :ref:`tutorials`.
30+
You can download the Gammapy tutorial notebooks and the example
3731
datasets. The total size to download is ~180 MB. Select the location where you
3832
want to install the datasets and proceed with the following commands:
3933

4034
.. substitution-code-block:: bash
4135

36+
$ conda activate gammapy-|release|
4237
$ gammapy download notebooks
4338
$ gammapy download datasets
4439
$ conda env config vars set GAMMAPY_DATA=$PWD/gammapy-datasets/|release|
@@ -60,7 +55,7 @@ variable directly in your shell with:
6055
else instead of ``export``, and also the profile setup file will be different.
6156
On Windows, you should set the ``GAMMAPY_DATA`` environment variable in the
6257
"Environment Variables" settings dialog, as explained e.g.
63-
`here <https://docs.python.org/3/using/windows.html#excursus-setting-environment-variables>`__
58+
`here <https://docs.python.org/3/using/windows.html#excursus-setting-environment-variables>`__.
6459

6560
Finally start a notebook server by executing:
6661

@@ -69,5 +64,5 @@ Finally start a notebook server by executing:
6964
$ cd notebooks
7065
$ jupyter notebook
7166
72-
If you are new to conda, Python and Jupyter, maybe also read the :ref:`using-gammapy` guide.
73-
If you encountered any issues you can check the :ref:`troubleshoot` guide.
67+
If you are new to conda, Python and Jupyter, it is recommended to also read the :ref:`using-gammapy` guide.
68+
If you encounter any issues you can check the :ref:`troubleshoot` guide.

0 commit comments

Comments
 (0)