2.2 (27th November, 2026)#

  • Released: 27th November, 2026

  • New contributors: 7 (Marked with * in the list)

  • Total contributors: 30

  • Total merged PRs: 200

Summary#

Gammapy v2.2 is a new feature release with a number of performance improvements, new features and bug fixes. The main themes include new tools for Bayesian inference, a broad overhaul of the dark matter module, and ASDF serialization of the core data structures.

Python 3.14 and 3.15 are now supported, and issues encountered with regions in the previous versions are now resolved. Three new notebooks have been added and the CTAO notebook significantly updated.

A security vulnerability was found (CVE-2026-134694). When reading a WCS map from a FITS file (e.g. with gammapy.maps.Map.read), Gammapy (<=2.1) evaluates the content of the WCSSHAPE GADF header keyword as Python code. A maliciously crafted FITS file could therefore execute arbitrary code as user on your computer when opened. All Gammapy versions up to 2.1 are affected. This has been adjusted in this version. We thank Dilanka Kaushal Hewage (@r3vpwnx) for reporting the issue.

Dark matter module#

The dark matter module has been substantially refactored and extended in this release. The spectral model classes have been unified into a single class handling both annihilation and decay, with improved parameter validation and an overall cleaner code structure. CosmiXs is now the default source for dark matter spectra, replacing PPPC4DMID; note that this changes the results of analyses that relied on the previous default. Users can also provide their own custom spectra from a file.

The computation of astrophysical factors has been improved, with corrections for extragalactic sources, the line-of-sight geometry and the treatment of the central pixel. Notably, uncertainties on the astrophysical factor can now be included as a nuisance parameter profiled in the likelihood fit, so that limits on the annihilation cross-section or decay lifetime account for the uncertainty on the target’s dark matter distribution, yielding more realistic and typically more conservative constraints. The documentation and tutorials have been updated accordingly, with new and improved tutorials covering both a basic introduction and a complete analysis.

ASDF serialization#

Maps, geometries (WCS, HEALPix, region), map axes, GTIs, IRF maps, Datasets and Models can now be written to and read from ASDF. This is the groundwork for storing a complete analysis state in a single, self-describing file, and is a part of an overhaul of the I/O code in Gammapy. An associated entry in the HowTo is added as an explanation for ASDF serialisation.

Estimators and flux upper limits#

Significant additions have been made to our estimator package. Previously, hidden failures sometimes used to occur at low statistics, causing very low upper limits. This has now been corrected. If a failure is detected during the fit for upper limit computation, the method internally switches to upper limit computation using likelihood profiles. The upper limit tutorial has been updated with more information.

A preliminary implementation of a new RegularizedFluxPointsEstimator is introduced for flux point computation in true-energy space with a given regularisation, and will be documented in future releases.

Other#

The 4FGL catalog is updated, with support for the FL16Y list. A new OnOffBackgroundMaker with an associated tutorial is provided for background estimation with paired off runs. The nautilus is now available as a Sampler backend, which is better suited for higher dimensionality problems, and LogNormalPrior and SamplesKDEPrior are introduced. A new tutorial is added explaining the details of Bayesian model selection.

API changes#

Infrastructure#

  • Add support for Python 3.14. Update tox and CI configurations accordingly. [#6225]

  • Fix the gammapy-dev conda environment for compiling sherpa from source and adding all documentation dependencies. [#6930]

Documentation improvements#

  • Add PIG for introducing new plotter classes [#5726]

  • Improves the documentation in the user guide on fit statistics. [#6623]

  • Fix issue in Fermi-LAT tutorial where dimmest sources are used for fitting rather than brightest. [#6750]

  • Add a new tutorial showing detailed Dark Matter analysis [#6774]

  • Update of the Dark Matter module main documentation. [#6777]

  • Add tutorial for on-off analysis using paired off runs. [#6835]

  • Add PIG for data format validation. [#6886]

  • Add How-To entry to document ASDF [#6981]

  • Update the Upper Limit tutorial. [#6997]

  • Add a tutorial about Bayesian model selection using arviz package. [#7018]

New features#

Bug Fixes#

  • Correct plot_residuals() x-axis unit, remove ax_spectrum and ax_residuals parameter in plot_fit() and adjust documentation. [#6615]

  • stack(other) now skips stacking if other mask_safe is invalid. This prevents stacking gti of invalid dataset. [#6621]

  • Fixes integrate_spectrum to allow integration of spectral models without a closed analytical form (e.g. BrokenPowerLawSpectralModel) with energy bounds given as arrays of length 1. [#6622]

  • Fixes bug to return ax object for TemplateSpatialModel.plot(). [#6636]

  • Fixes a bug in the EnergyDependentMorphologyEstimator to allow for multiple datasets to be handled correctly. [#6640]

  • Corrects make_effective_livetime_map to use observation pointing to compute livetime map. [#6643]

  • Fixes plot_offset_dependence() to remove area being divided twice. [#6666]

  • Fix default behavior of sum_over_energy_groups=False case in gammapy.estimators.ExcessMapEstimator. [#6685]

  • Remove dependency to regions deprecated function pixel_scale_angle_at_skycoord in SkyPolygonRegion. [#6705]

  • Add configuration of interpolation options for LightCurveTemplateTemporalModel, now default is to return zero when evaluating outside the times in the template. [#6712]

  • Fixes incorrect calling of dataset for frozen models in FluxCollectionEstimator. [#6721]

  • Add unit support to the violins plot from plot_samples_violin_vs_energy used with the FluxCollectionEstimator [#6756]

  • Fixes compute_differential_jfactor to use the physical impact parameter in the line-of-sight integration and avoid evaluating the integrable closest-approach singularity directly. [#6757]

  • Fix Asimov dataset computation for MapDatasetOnOff: use alpha * N_OFF as expected background. [#6762]

  • Fix the FluxCollectionEstimator to support computation over datasets with different spatial geometries, and single flux point. [#6785]

  • Fix RegionGeom ASDF roundtrip for DS9-formatted regions to clear meta and visual on write. [#6801]

  • Fix parsing of the scale parameter when read from a dictionary in TemplatePhaseCurveTemporalModel. [#6807]

  • Fix broadcasting in integral [#6813]

  • Fixes the line-of-sight integration geometry in JFactory to account for observers inside or outside the radial integration region. [#6819]

  • Fixes JFactory when a map pixel center coincides exactly with the dark-matter halo center. [#6828]

  • format_plot_xaxis no longer produces overlapping scientific-notation minor tick labels on a log x-axis spanning less than one decade. [#6847]

  • Makes sure FoV offsets in _get_fov_coord are calculated in the correct coordinate frame. [#6861]

  • Fix nan in sensitivity computation using Asimov dataset. [#6862]

  • Add gammapy.stats.utils.ts_to_sigma_sensitivity and gammapy.stats.utils.sigma_to_ts_sensitivity as separate functions and fix computation with more than one degree of freedom [#6864]

  • Fixes an out-of-memory error when computing the covariance of models with a large number of parameters (e.g. a full source catalogue) by building diagonal covariances lazily in Covariance. [#6867]

  • Fixes e_peak value for the case where the energy scale E_s is different from the reference energy E_0. [#6884]

  • Fixes containment when rad is larger than the last bin of the PSF rad axis. [#6887]

  • Recompute upper limits using likelihood profiles if the default method using fit confidence fails in ParameterEstimator. [#6900]

  • Fixes error in getting the pivot_energy for a CompoundSpectralModel or model which does not contain a reference. [#6916]

  • Fix error in gammapy.data.ivoa.make_hdu_table. [#6920]

  • Fix to_dict() of TemplateSpectralModel, PiecewiseNormSpectralModel, EBLAbsorptionNormSpectralModel and PiecewiseNormSpatialModel failing on big-endian arrays. [#6952]

  • Fix the normalisation of compute_fpp to match Edelson et al. (2002), also when the light curve has NaN values. [#7014]

  • Correct location of HEGRA array in ~gammapy.utils.observers.py [#7068]

  • Modify handling of GADF keyword WCSSHAPE in WcsGeom to validate its content. [#7087]

  • Default energy was a single Quantity instead of a list of Quantity, causing Background2D.plot_at_energy() and Background3D.plot_at_energy() to fail when using the default. [#7101]

Contributors#

  • Fabio Acero

  • Nicki R. Bond *

  • Tomas Bylund

  • Marie-Sophie Carrasco

    1. Alexander Cerviño-Cortínez

  • Axel Donath

  • Katharina Egg

  • Gabriel Emery

  • Kirsty Feijen

  • Júlia Gouvêa Mamprim *

  • Karthik Koundinya Gowrawaram *

  • Lea Heckmann

  • Basmala Hekal

  • Bruno Khélifi

  • Ahmed Mahmoud *

  • Esther Michelle *

  • Daniel Morcuende

  • Laura Olivera-Nieto

  • Michele Peresano

  • Natthan Pigoux

  • Fabio Pintore

  • Tobias Preis

  • Syed Ahnaf Raza *

  • Maxime Regeard

  • Quentin Remy

  • Atreyee Sinha

  • Régis Terrier

  • Tim Unbehaun

  • Thomas Vuillaume

  • Ziheng Wang *