def test_read(): model = SkyDiffuseCube.read( "$GAMMAPY_DATA/tests/unbundled/fermi/gll_iem_v02_cutout.fits") assert model.map.unit == "cm-2 s-1 MeV-1 sr-1" # Check pixel inside map val = model.evaluate(0 * u.deg, 0 * u.deg, 100 * u.GeV) assert val.unit == "cm-2 s-1 MeV-1 sr-1" assert val.shape == (1, ) assert_allclose(val.value, 1.396424e-12, rtol=1e-5)
covariance = result.parameters.covariance spec.parameters.covariance = covariance[2:5, 2:5] energy_range = [0.3, 10] * u.TeV spec.plot(energy_range=energy_range, energy_power=2) ax = spec.plot_error(energy_range=energy_range, energy_power=2) # Apparently our model should be improved by adding a component for diffuse Galactic emission and at least one second point source. # ### Add Galactic diffuse emission to model # We use both models at the same time, our diffuse model (the same from the Fermi file used before) and our model for the central source. This time, in order to make it more realistic, we will consider an exponential cut off power law spectral model for the source. We will fit again the normalisation and tilt of the background. # In[ ]: diffuse_model = SkyDiffuseCube.read( "$GAMMAPY_DATA/fermi-3fhl-gc/gll_iem_v06_gc.fits.gz") background_diffuse = BackgroundModel.from_skymodel(diffuse_model, exposure=maps["exposure"], psf=psf_kernel) # In[ ]: background_irf = BackgroundModel(maps["background"], norm=1.0, tilt=0.0) background_total = background_irf + background_diffuse # In[ ]: spatial_model = SkyPointSource(lon_0="-0.05 deg", lat_0="-0.05 deg") spectral_model = ExponentialCutoffPowerLaw( index=2 * u.Unit(""),