MapEvaluator

class gammapy.cube.MapEvaluator(model=None, exposure=None, psf=None, edisp=None, evaluation_mode='local')[source]

Bases: object

Sky model evaluation on maps.

This evaluates a sky model on a 3D map and convolves with the IRFs, and returns a map of the predicted counts. Note that background counts are not added.

For now, we only make it work for 3D WCS maps with an energy axis. No HPX, no other axes, those can be added later here or via new separate model evaluator classes.

Parameters:
model : SkyModel

Sky model

exposure : Map

Exposure map

psf : PSFKernel

PSF kernel

edisp : EnergyDispersion

Energy dispersion

evaluation_mode : {“local”, “global”}

Model evaluation mode.

Attributes Summary

bin_volume Map pixel bin volume (solid angle times energy bin width).
coords Return evaluator coords
energy_bin_width Energy axis bin widths (astropy.units.Quantity)
energy_center True energy axis bin centers (Quantity)
energy_edges True energy axis bin edges (Quantity)
geom True energy map geometry (MapGeom)
geom_image Image map geometry (MapGeom)
geom_reco Reco energy map geometry (MapGeom)
lat
lon
lon_lat Spatial coordinate pixel centers (lon, lat tuple of Quantity).
needs_update Check whether the model component has drifted away from its support.
solid_angle Solid angle per pixel

Methods Summary

apply_edisp(npred) Convolve map data with energy dispersion.
apply_exposure(flux) Compute npred cube
apply_psf(npred) Convolve npred cube with PSF
compute_dnde() Compute model differential flux at map pixel centers.
compute_flux() Compute model integral flux over map pixel volumes.
compute_npred() Evaluate model predicted counts.
update(exposure, psf, edisp, geom) Update MapEvaluator, based on the current position of the model component.

Attributes Documentation

bin_volume

Map pixel bin volume (solid angle times energy bin width).

coords

Return evaluator coords

energy_bin_width

Energy axis bin widths (astropy.units.Quantity)

energy_center

True energy axis bin centers (Quantity)

energy_edges

True energy axis bin edges (Quantity)

geom

True energy map geometry (MapGeom)

geom_image

Image map geometry (MapGeom)

geom_reco

Reco energy map geometry (MapGeom)

lat
lon
lon_lat

Spatial coordinate pixel centers (lon, lat tuple of Quantity).

needs_update

Check whether the model component has drifted away from its support.

solid_angle

Solid angle per pixel

Methods Documentation

apply_edisp(npred)[source]

Convolve map data with energy dispersion.

Parameters:
npred : Map

Predicted counts in true energy bins

Returns:
npred_reco : Map

Predicted counts in reco energy bins

apply_exposure(flux)[source]

Compute npred cube

For now just divide flux cube by exposure

apply_psf(npred)[source]

Convolve npred cube with PSF

compute_dnde()[source]

Compute model differential flux at map pixel centers.

Returns:
model_map : Map

Sky cube with data filled with evaluated model values. Units: cm-2 s-1 TeV-1 deg-2

compute_flux()[source]

Compute model integral flux over map pixel volumes.

For now, we simply multiply dnde with bin volume.

compute_npred()[source]

Evaluate model predicted counts.

Returns:
npred : Map

Predicted counts on the map (in reco energy bins)

update(exposure, psf, edisp, geom)[source]

Update MapEvaluator, based on the current position of the model component.

Parameters:
exposure : Map

Exposure map.

psf : gammapy.cube.PSFMap

PSF map.

edisp : gammapy.cube.EDispMap

Edisp map.

geom : gammapy.maps.MapGeom

Reference geometry of the data.