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_DATA/fermi-3fhl-gc/fermi-3fhl-gc-counts.fits.gz"
image =
image.smooth("0.1 deg").plot()

(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]) Map 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[, edge, frame]) Constant radial disk model.
SkyEllipse(lon_0, lat_0, semi_major, e, theta) Constant elliptical model.
SkyGaussian(lon_0, lat_0, sigma[, frame]) Two-dimensional symmetric Gaussian model
SkyPointSource(lon_0, lat_0[, frame]) Point Source.
SkyShell(lon_0, lat_0, radius, width[, frame]) Shell model.
SkySpatialModel([params]) Sky spatial model base class.