Skip to main content

CI codecov Ruff pre-commit.ci status Docs

Gammapy Plugin

A gammapy plugin for threeML

threeML plugin to use gammapy datasets in your threeML analysis.

Docs

You can find the docs containg also example notebooks either on readthedocs or on the github pages.

Installation

The following should be sufficient and install all the relevant dependencies.

pip install gammapy-plugin

You can test the installation using pytest. To get all the dependencies it is recommeneded to run

# install test dependenices
pip install gammapy-plugin[tests]

# equivalent to gammapy download datasets
export GAMMAPY_DATA=/path/to/gammapy_datasets/
git clone https://github.com/gammapy/gammapy-data.git $GAMMAPY_DATA

# run pytests
python -m pytest -n auto --dist worksteal gammapy_plugin

The first part is equivalent to running gammapy download datasets (see the gammapy installation instructions).

These data are required by the pytest tests.

Requirements

Python 3.12 or 3.13 together with gammapy>=v2.0.0

Usage and Examples

The basic procedure after creating a gammapy dataset is

gl = GammapyLike(name="name_of_the_plugin")  # initializing the plugin
gl.set_datasets(datasets, mode="individual")  # adding the gammapy dataset
gl.set_sources("name_of_the_source")  # setting the source
gl.set_model(model)  # setting the astromodels model

When using MapDataset with FoVBackgroundModel you can also include them in a fit. The parameters of the background models are currently treated as nuisance parameters during the fitting/sampling.

This might then look like this for example:

datasets = Datasets()
gls = []
for o in observations:
    dataset = MapDataset.create(
        geom=geom, energy_axis_true=energy_axis_true, name=f"HESS_{o.obs_id}"
    )
    dataset = maker.run(dataset, o)
    dataset = safe_mask_maker.run(dataset, o)
    bkg_model = FoVBackgroundModel(name=f"{o.obs_id}_bkg", dataset_name=dataset.name)
    dataset.models = [bkg_model]
    dataset = fov_bkg_maker.run(dataset)
    datasets.append(dataset)
    gl = GammapyLike(dataset.name, frame="galactic")
    gl.set_datasets(dataset)
    gl.set_background_models(bkg_model)
    gls.append(gl)

Notes

This current version is based on previous work by J. Michael Burgess, Sajan Kumar and AnjanaTel.

Metadata

Release files for gammapy-plugin 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gammapy-plugin 0.0.2
File Size Uploaded Provenance Actions
gammapy_plugin-0.0.2.tar.gz 52.2 kB With provenance Details for gammapy_plugin-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gammapy-plugin 0.0.2
File Interpreter ABI Platform Actions
gammapy_plugin-0.0.2-py3-none-any.whl Python 3 none any Details for gammapy_plugin-0.0.2-py3-none-any.whl

Total release size: 94.5 kB

Release files / gammapy_plugin-0.0.2.tar.gz

Download URL gammapy_plugin-0.0.2.tar.gz
Size 52.2 kB
Tags Source
SHA-256 checksum
How to use checksums
acaa82d0b58d972637f47f8a898761f8c7b5737fa22ec9a9c95fbe550a420322
BLAKE2b-256 checksum
How to use checksums
ecb018de46088fe2c5888f81c17f4e169a7814d743c75f32f8001c2067214c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / gammapy_plugin-0.0.2-py3-none-any.whl

Download URL gammapy_plugin-0.0.2-py3-none-any.whl
Size 42.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fc00965d6d2756940ebeeb287c3bcff4d4330ef9b0cbab8cb9b48ef6c51912f
BLAKE2b-256 checksum
How to use checksums
5cc17b885e0d1b86ee1db8aaf9aba6c7d0c3d31b22cd5532d2be65706ec7b67d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for gammapy-plugin 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gammapy_plugin-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page