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

geom True energy map geometry (Geom)
needs_update Check whether the model component has drifted away from its support.

Methods Summary

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

Attributes Documentation

geom

True energy map geometry (Geom)

needs_update

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

Methods Documentation

apply_edisp(self, 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(self, flux)[source]

Compute npred cube

For now just divide flux cube by exposure

apply_psf(self, npred)[source]

Convolve npred cube with PSF

compute_dnde(self)[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(self)[source]

Compute model integral flux over map pixel volumes.

For now, we simply multiply dnde with bin volume.

compute_npred(self)[source]

Evaluate model predicted counts.

Returns:
npred : Map

Predicted counts on the map (in reco energy bins)

update(self, 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.Geom

Reference geometry of the data.