compute_npred_cube

gammapy.cube.compute_npred_cube(flux_cube, exposure_cube, ebounds, integral_resolution=10)[source]

Compute predicted counts cube.

Parameters:

flux_cube : SkyCube

Flux cube, really differential surface brightness in ‘cm-2 s-1 TeV-1 sr-1’

exposure_cube : SkyCube

Exposure cube

ebounds : Quantity

Energy bounds for the output cube

integral_resolution : int (optional)

Number of integration steps in energy bin when computing integral flux.

Returns:

npred_cube : SkyCube

Predicted counts cube with energy bounds as given by the input ebounds.

Examples

Load an example dataset:

from gammapy.datasets import FermiGalacticCenter
from gammapy.utils.energy import EnergyBounds
from gammapy.irf import EnergyDependentTablePSF
from gammapy.cube import SkyCube, compute_npred_cube

filenames = FermiGalacticCenter.filenames()
flux_cube = SkyCube.read(filenames['diffuse_model'], format='fermi-background')
exposure_cube = SkyCube.read(filenames['exposure_cube'], format='fermi-exposure')
psf = EnergyDependentTablePSF.read(filenames['psf'])

Compute an npred cube and a PSF-convolved version:

flux_cube = flux_cube.reproject(exposure_cube)
ebounds = EnergyBounds([10, 30, 100, 500], 'GeV')
npred_cube = compute_npred_cube(flux_cube, exposure_cube, ebounds)

kernels = psf.kernels(npred_cube)
npred_cube_convolved = npred_cube.convolve(kernels)