test diff in exposure_reco
@@ -12,7 +12,7 @@ from gammapy.modeling.models import (
SkyModel,
)
from gammapy.utils.testing import requires_data
-
+from gammapy.estimators.utils import estimate_exposure_reco_energy
def image_to_cube(input_map, energy_min, energy_max):
energy_min = u.Quantity(energy_min)
@@ -233,18 +233,20 @@ def test_significance_map_estimator_map_dataset_on_off_with_correlation(
assert_allclose(result_mod["flux"].data[0, 10, 10], 1.486806e-08, rtol=1e-3)
assert_allclose(result_mod["flux"].data.sum(), 5.254442192077636e-06, rtol=1e-8)
+ spectral_model=PowerLawSpectralModel(index=15)
estimator_mod = ExcessMapEstimator(
0.11 * u.deg,
apply_mask_fit=False,
correlate_off=True,
- spectral_model=PowerLawSpectralModel(index=10),
+ spectral_model=spectral_model,
)
result_mod = estimator_mod.run(simple_dataset_on_off)
assert result_mod["flux"].unit == "cm-2s-1"
assert_allclose(result_mod["flux"].data.sum(), 5.254442192077636e-06, rtol=1e-8)
- # TODO: find a test where we can actually see a difference with the default case
+ reco_exposure=estimate_exposure_reco_energy(simple_dataset_on_off, spectral_model=spectral_model)
+ assert_allclose(reco_exposure.data.sum(), 7.977796e+12, rtol=0.001)
def test_incorrect_selection():
with pytest.raises(ValueError):
