Skip to content

Commit

Permalink
Merge branch 'main' into format
Browse files Browse the repository at this point in the history
  • Loading branch information
cgalelli authored Oct 14, 2024
2 parents ad98c64 + d644ef6 commit 2eda16c
Show file tree
Hide file tree
Showing 91 changed files with 1,078 additions and 705 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ gammapy/gammapy.cfg
docs/_generated
docs/gen_modules
docs/api
docs/sg_execution_times.rst
.coverage

dev/crab
Expand Down
34 changes: 20 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
.. image:: https://anaconda.org/conda-forge/gammapy/badges/license.svg
:target: https://github.com/gammapy/gammapy/blob/master/LICENSE.rst
:alt: Licence
:target: https://github.com/gammapy/gammapy/blob/master/LICENSE.rst
:alt: Licence

.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
:target: http://www.astropy.org/

:target: http://www.astropy.org/
|
.. image:: https://anaconda.org/conda-forge/gammapy/badges/platforms.svg
:target: https://anaconda.org/conda-forge/gammapy

:target: https://anaconda.org/conda-forge/gammapy
|
.. image:: http://img.shields.io/pypi/v/gammapy.svg?text=version
:target: https://pypi.org/project/gammapy/
:alt: Latest release
:target: https://pypi.org/project/gammapy/
:alt: Latest release

.. image:: https://img.shields.io/pypi/dm/gammapy?label=downloads%20%7C%20pip&logo=PyPI
:alt: PyPI - Downloads

.. image:: https://anaconda.org/conda-forge/gammapy/badges/version.svg
:target: https://anaconda.org/conda-forge/gammapy
:target: https://anaconda.org/conda-forge/gammapy

.. image:: https://img.shields.io/conda/dn/conda-forge/gammapy?label=downloads%20%7C%20conda&logo=Conda-Forge
:target: https://anaconda.org/conda-forge/gammapy
:target: https://anaconda.org/conda-forge/gammapy

.. image:: https://img.shields.io/badge/launch-binder-579aca.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr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k1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC
:target: mybinder.org

|
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4701488.svg?style=flat
:target: https://doi.org/10.5281/zenodo.4701488
:target: https://doi.org/10.5281/zenodo.4701488

.. image:: https://archive.softwareheritage.org/badge/origin/https://github.com/gammapy/gammapy/
:target: https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/gammapy/gammapy
:target: https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/gammapy/gammapy

.. image:: https://archive.softwareheritage.org/badge/swh:1:snp:11e81660a96c3252c4afa4d48b58d1d2f78ea80a/
:target: https://archive.softwareheritage.org/swh:1:snp:11e81660a96c3252c4afa4d48b58d1d2f78ea80a;origin=https://github.com/gammapy/gammapy
|
.. image:: https://img.shields.io/badge/A&A-Published-Green.svg
:target: https://doi.org/10.1051/0004-6361/202346488
:target: https://doi.org/10.1051/0004-6361/202346488
|
.. image:: https://img.shields.io/badge/Matomo-3152A0?style=for-the-badge&logo=Matomo&logoColor=white
:target: https://matomo.org/

Gammapy
=======
Expand Down
17 changes: 15 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,31 @@
}
],
"codeRepository": "https://github.com/gammapy/gammapy",
"datePublished": "2024-02-29",
"dateCreated": "2013-08-19",
"datePublished": "2014-08-25",
"dateModified": "2024-02-29",
"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).",
"identifier": "https://doi.org/10.5281/zenodo.4701488",
"keywords": [
"Astronomy",
"Gamma-rays",
"Data analysis"
"Data analysis",
"Scientific/Engineering"
],
"license": "https://spdx.org/licenses/BSD-3-Clause",
"name": "Gammapy: Python toolbox for gamma-ray astronomy",
"url": "https://gammapy.org/",
"softwareVersion": "v1.2",
"applicationCategory": "Astronomy",
"applicationSubCategory": "Very-high-energy gamma rays",
"programmingLanguage": "Python 3",
"operatingSystem": "Linux, Mac OS, Windows",
"referencePublication": "https://doi.org/10.1051/0004-6361/202346488",
"audience": {
"@id": "/audience/science-research",
"@type": "Audience",
"audienceType": "Science/Research"
},
"maintainer": {
"@id": "https://orcid.org/0000-0003-4568-7005",
"@type": "Person",
Expand Down
5 changes: 5 additions & 0 deletions dev/codemeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
from configparser import ConfigParser
import click
from datetime import date

log = logging.getLogger(__name__)

Expand All @@ -24,6 +25,10 @@ def update_codemeta(maintainer, filename, setup_file=None):
data["developmentStatus"] = ("active",)
data["email"] = "[email protected]"

modified_date = str(date.today())
data["dateModified"] = modified_date


if setup_file:
# complete with software requirements from setup.cfg
cf = ConfigParser()
Expand Down
2 changes: 1 addition & 1 deletion dev/github_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def list_merged_PRs(filename, milestones, from_backports):
table = Table.read(filename)

# Keep only merged PRs
table = table[table["is_merged"] is True]
table = table[table["is_merged"] == True]

# Keep the requested milestones
valid = np.zeros((len(table)), dtype="bool")
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ p {
color: white;
}

#navbar-icon-links i.fa-twitter-square::before {
#navbar-icon-links i.fa-square-x-twitter::before {
color: white;
}

Expand Down
15 changes: 15 additions & 0 deletions docs/_static/matomo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Licensed under a 3-clause BSD style license - see LICENSE.rst

// Matomo Tracking Code
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://apcstatview.in2p3.fr/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '3']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();

26 changes: 18 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# be accessible, and the documentation will not build correctly.

import datetime
import sys
import os

# Get configuration information from setup.cfg
from configparser import ConfigParser
Expand All @@ -35,7 +37,7 @@
from sphinx_astropy.conf import *

# Sphinx-gallery config
from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey
from sphinx_gallery.sorting import ExplicitOrder

# Load utils docs functions
from gammapy.utils.docs import SubstitutionCodeBlock, gammapy_sphinx_ext_activate
Expand All @@ -56,6 +58,8 @@ def setup(app):
conf.read([os.path.join(os.path.dirname(__file__), "..", "setup.cfg")])
setup_cfg = dict(conf.items("metadata"))

sys.path.insert(0, os.path.dirname(__file__))

linkcheck_anchors_ignore = []
linkcheck_ignore = [
"http://gamma-sky.net/#",
Expand All @@ -70,6 +74,8 @@ def setup(app):
"https://www.hawc-observatory.org/", # invalid certificate
"https://ipython.org", # invalid certificate
"https://jupyter.org", # invalid certificate
"https://hess-confluence.desy.de/confluence/display/HESS/HESS+FITS+data", # private page
"https://hess-confluence.desy.de/"
]

# the buttons link to html pages which are auto-generated...
Expand Down Expand Up @@ -111,7 +117,6 @@ def setup(app):
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns.append("_templates")
exclude_patterns.append("_static")
exclude_patterns.append("**.ipynb_checkpoints")
exclude_patterns.append("user-guide/model-gallery/*/*.ipynb")
exclude_patterns.append("user-guide/model-gallery/*/*.md5")
Expand Down Expand Up @@ -220,7 +225,7 @@ def setup(app):
{
"name": "Twitter",
"url": "https://twitter.com/gammapyST",
"icon": "fab fa-twitter-square",
"icon": "fab fa-square-x-twitter",
},
{
"name": "Slack",
Expand All @@ -234,6 +239,10 @@ def setup(app):
},
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
"navigation_with_keys": True,
# footers
"footer_start": ["copyright"],
"footer_center": ["last-updated"],
"footer_end": ["sphinx-version", "theme-version"]
}


Expand Down Expand Up @@ -314,7 +323,7 @@ def setup(app):
"exclude_implicit_doc": {},
"filename_pattern": r"\.py",
"reset_modules": ("matplotlib",),
"within_subsection_order": FileNameSortKey,
"within_subsection_order": "sphinxext.TutorialExplicitOrder",
"download_all_examples": True,
"capture_repr": ("_repr_html_", "__repr__"),
"nested_sections": False,
Expand All @@ -328,11 +337,12 @@ def setup(app):
}

html_static_path = ["_static"]

html_css_files = [
"custom.css",
]
html_css_files = ["custom.css"]
html_js_files = ["matomo.js"]

html_context = {
"default_mode": "light",
}

# Add-on to insert the Matomo tracker
templates_path = ['_templates']
9 changes: 6 additions & 3 deletions docs/development/dev_howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ Notes:
Gammapy names defined here, to the names used in the formats.
Of course, where formats are not set in stone yet, we advocate and encourage
the use of the names chosen here.
* Finally, we realise that eventually probably CTA will define this, and Gammapy
is only a prototype. So if CTA chooses something else, probably we will follow
suite and do one more backward-incompatible change at some point to align with CTA.
* Finally, CTAO has proposed a full data model associated to the needed quantities. And
the community is working to create a data format for very-high-energy data produced by gamma-ray
and neutrino experiments within the open initiative `Very-high-energy Open Data Format`_. This format
aims to respect the CTAO data model, to respect the `FAIR principles`_ and to follow as much as
possible the `IVOA`_ recommendations. In order to handle past, current and old formats,
Gammapy should follow the `FAIR4RS principles`_ by proposing a user-friendly interface.

Clobber or overwrite?
+++++++++++++++++++++
Expand Down
11 changes: 6 additions & 5 deletions docs/development/doc_howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ following command.
pytest --doctest-modules --ignore-glob=*/tests gammapy
If you get a zsh error try using putting to ignore block inside quotes
If you get a zsh error try using putting to ignore block inside quotes

.. code-block:: bash
Expand All @@ -157,6 +157,7 @@ The documentation built-in process uses the `sphinx-gallery <https://sphinx-gall
extension to build galleries of illustrated examples on how to use Gammapy (i.e.
:ref:`model-gallery`). The Python scripts used to produce the model gallery are placed in
``examples/models`` and ``examples/tutorials``. The configuration of the ``sphinx-gallery`` module is done in ``docs/conf.py``.
The tutorials are order using a python dictionary stored in ``docs/sphinxext.py``.


Choose a thumbnail and tooltip for the tutorial gallery
Expand All @@ -179,9 +180,9 @@ choose the thumbnail for the tutorial by adding a comment before the plot:
plt.show()
The example is taken from the `sphinx-gallery documentation <https://sphinx-gallery.github.io/stable/auto_examples/plot_4_choose_thumbnail.html>`__,
please refer to it for more details.
please refer to it for more details.

The tooltip is the text that appears when you hover over the thumbnail. It is taken from the first line
The tooltip is the text that appears when you hover over the thumbnail. It is taken from the first line
of the docstring of the tutorial. You can change it by editing the docstring. See e.g.
`Analysis 1 Tutorial <https://github.com/gammapy/gammapy/blob/main/examples/tutorials/starting/analysis_1.py#L5>`__.

Expand All @@ -194,7 +195,7 @@ Links in tutorials are just handled via normal RST syntax.
Links to other tutorials
++++++++++++++++++++++++

From docstrings and RST documentation files in Gammapy you can link to other tutorials
From docstrings and RST documentation files in Gammapy you can link to other tutorials
and gallery examples by using RST syntax like this:

.. code-block:: rst
Expand All @@ -217,7 +218,7 @@ To make a reference to a heading within an RST file, first you need to define an
==============
The reference is the rendered as ``datasets``.
The reference is the rendered as ``datasets``.
To link to this in the documentation you can use:

.. code-block:: rst
Expand Down
5 changes: 2 additions & 3 deletions docs/development/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ Steps for the day to announce the release:
(decide on a case by case basis, if it's relevant to the group of people):

* https://groups.google.com/forum/#!forum/astropy-dev
* https://lists.nasa.gov/mailman/listinfo/open-gamma-ray-astro
* CTA DATA list ([email protected])
* hess-analysis
* CTAO AS WG list (cta-wg-as [at] cta-observatory [dot] org)
* hess-forum list (hess-forum [at] lsw.uni-heidelberg [dot] de)
#. Make sure the release milestone and issue is closed on GitHub
#. Update these release notes with any useful infos / steps that you learned
while making the release (ideally try to script / automate the task or check,
Expand Down
8 changes: 5 additions & 3 deletions docs/getting-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ environment using either conda or mamba.** Here are two methods to quickly insta
Update existing version? Working with virtual environments? Installing a specific version? Check the advanced
installation page.

.. button-ref:: install
+++

.. button-ref:: installation
:ref-type: ref
:click-parent:
:color: secondary
Expand All @@ -66,15 +68,15 @@ Tutorials Overview
:link: ../tutorials/data/cta.html

Gammapy can read and access data from multiple gamma-ray instruments. Data from
Imaging Atmospheric Cherenkov Telescopes, such as `CTA`_, `H.E.S.S.`_, `MAGIC`_
Imaging Atmospheric Cherenkov Telescopes, such as `CTAO`_, `H.E.S.S.`_, `MAGIC`_
and `VERITAS`_, is typically accessed from the **event list data level**, called "DL3".
This is most easily done using the `~gammapy.data.DataStore` class. In addition data
can also be accessed from the **level of binned events and pre-reduced instrument response functions**,
so called "DL4". This is typically the case for `Fermi-LAT`_ data or data from
Water Cherenkov Observatories. This data can be read directly using the
`~gammapy.maps.Map` and `~gammapy.irf.core.IRFMap` classes.

:bdg-link-primary:`CTA data tutorial <../tutorials/data/cta.html>`
:bdg-link-primary:`CTAO data tutorial <../tutorials/data/cta.html>`
:bdg-link-primary:`HESS data tutorial <../tutorials/data/hess.html>`
:bdg-link-primary:`Fermi-LAT data tutorial <../tutorials/data/fermi_lat.html>`

Expand Down
3 changes: 1 addition & 2 deletions docs/getting-started/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ Gammapy is a Python package, so you can of course import and use it from Python:
Type "help", "copyright", "credits" or "license" for more information.
>>> from gammapy.stats import CashCountsStatistic
>>> CashCountsStatistic(n_on=10, mu_bkg=4.2).sqrt_ts
2.397918129147546
np.float64(2.397918129147546)
IPython
-------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gammapy


Gammapy is a community-developed, open-source Python package for gamma-ray
astronomy built on Numpy, Scipy and Astropy. **It is the core library for the** `CTA`_ **Science Tools**
astronomy built on Numpy, Scipy and Astropy. **It is the core library for the** `CTAO`_ **Science Tools**
but can also be used to analyse data from existing imaging atmospheric Cherenkov telescopes
(IACTs), such as `H.E.S.S.`_, `MAGIC`_ and `VERITAS`_. It also provides some support
for `Fermi-LAT`_ and `HAWC`_ data analysis.
Expand Down
7 changes: 6 additions & 1 deletion docs/references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

.. _Python for gamma-ray astronomy 2015: http://gammapy.github.io/PyGamma15/

.. _CTA: https://www.cta-observatory.org/
.. _CTAO: https://www.ctao.org/
.. _H.E.S.S.: https://www.mpi-hd.mpg.de/hfm/HESS/
.. _HAWC: https://www.hawc-observatory.org/
.. _VERITAS: https://veritas.sao.arizona.edu/
Expand All @@ -69,6 +69,7 @@
.. _FermiPy: https://github.com/fermiPy/fermipy
.. _gadf: https://gamma-astro-data-formats.readthedocs.io/
.. _Gamma Astro Data Formats: https://gamma-astro-data-formats.readthedocs.io/
.. _Very-high-energy Open Data Format: https://vodf.readthedocs.io/en/latest/index.html

.. _April 2016 IACT data meeting: https://github.com/open-gamma-ray-astro/2016-04_IACT_DL3_Meeting/

Expand Down Expand Up @@ -135,3 +136,7 @@
.. _A Whirlwind tour of Python: https://nbviewer.org/github/jakevdp/WhirlwindTourOfPython/blob/master/Index.ipynb
.. _Python data science handbook: https://jakevdp.github.io/PythonDataScienceHandbook/
.. _Astropy Hands-On Tutorial: https://github.com/Asterics2020-Obelics/School2019/tree/master/astropy

.. _FAIR principles: https://www.go-fair.org/fair-principles/
.. _FAIR4RS principles: https://www.rd-alliance.org/group_output/fair-principles-for-research-software-fair4rs-principles/
.. _IVOA: https://ivoa.net/
Loading

0 comments on commit 2eda16c

Please sign in to comment.