image - Map image analysis


gammapy.image contains functions and classes for image based analysis. gammapy.image.models contains image models that can be evaluated and fitted.

Getting Started

The functions and classes in gammapy.image take gammapy.maps objects as input and output. Currently they only work on WCS-based 2D images. For some, we will improve them to also work on HPX-based images and on maps with extra axes, such as e.g. an energy axis.

from gammapy.maps import Map
filename = '$GAMMAPY_EXTRA/datasets/fermi_2fhl/fermi_2fhl_vela.fits.gz'
image =, hdu=2)

(png, hires.png, pdf)


TODO: Show some gammapy.image functionality, e.g. evaluating a model image or making a profile.

Using gammapy.image

Tutorial notebooks that contain use of maps:

Documentation pages with more detailed information:


gammapy.image Package

Sky images (2-dimensional: lon, lat).


colormap_hess([transition, width]) Colormap often used in H.E.S.S.
colormap_milagro([transition, width, huestart]) Colormap often used in Milagro collaboration publications.
grayify_colormap(cmap[, mode]) Return a grayscale version a the colormap.
illustrate_colormap(cmap, **kwargs) Illustrate color distribution and perceived luminance of a colormap.
measure_containment(image, position, radius) Measure containment in a given circle around the source position.
measure_containment_fraction(data, radius, …) Measure containment fraction.
measure_containment_radius(image, position) Measure containment radius of a source.
measure_curve_of_growth(image, position[, …]) Measure the curve of growth for a given source position.
measure_image_moments(image) Compute 0th, 1st and 2nd moments of an image.
scale_cube(data, kernels[, parallel]) Compute scale space cube.


ASmooth([kernel, method, threshold, scales]) Adaptively smooth counts image.
ImageProfile(table) Image profile class.
ImageProfileEstimator([x_edges, method, …]) Estimate profile from image.
MapPanelPlotter(figure, xlim, ylim[, npanels]) Mape panel plotter class.

gammapy.image.models Package

Spatial 2D image models.


SkyDiffuseConstant([value]) Spatially constant (isotropic) spatial model.
SkyDiffuseMap(map[, norm, meta, normalize, …]) Spatial sky map template model (2D).
SkyDisk(lon_0, lat_0, r_0) Constant radial disk model.
SkyGaussian(lon_0, lat_0, sigma) Two-dimensional symmetric Gaussian model.
SkyPointSource(lon_0, lat_0) Point Source.
SkyShell(lon_0, lat_0, radius, width) Shell model
SkySpatialModel SkySpatial model base class.