compute_npred_cube¶
-
gammapy.cube.compute_npred_cube(flux_cube, exposure_cube, ebounds, integral_resolution=10)[source]¶ Compute predicted counts cube.
Parameters: flux_cube :
SkyCubeFlux cube, really differential surface brightness in ‘cm-2 s-1 TeV-1 sr-1’
exposure_cube :
SkyCubeExposure cube
ebounds :
QuantityEnergy bounds for the output cube
integral_resolution : int (optional)
Number of integration steps in energy bin when computing integral flux.
Returns: npred_cube :
SkyCubePredicted counts cube with energy bounds as given by the input
ebounds.See also
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
npredcube 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)