Add running test for Fermi dataset
@@ -55,14 +55,19 @@ def fermi_dataset():
counts = Map.read(
"$GAMMAPY_DATA/fermi-3fhl-gc/fermi-3fhl-gc-counts-cube.fits.gz"
)
+ counts = counts.cutout(counts.geom.center_skydir, '3 deg')
+
background = Map.read(
"$GAMMAPY_DATA/fermi-3fhl-gc/fermi-3fhl-gc-background-cube.fits.gz"
)
+ background = background.cutout(background.geom.center_skydir, '3 deg')
background = BackgroundModel(background, datasets_names=["fermi-3fhl-gc"])
exposure = Map.read(
"$GAMMAPY_DATA/fermi-3fhl-gc/fermi-3fhl-gc-exposure-cube.fits.gz"
)
+ exposure = exposure.cutout(exposure.geom.center_skydir, '3 deg')
+ exposure.unit ="cm2s"
mask_safe = counts.copy(data=np.ones_like(counts.data).astype("bool"))
psf = EnergyDependentTablePSF.read(
@@ -106,11 +111,19 @@ def test_compute_ts_map(input_dataset):
assert np.isnan(result["ts"].data[30, 40])
@requires_data()
-def test_compute_ts_map_psf_kernel(fermi_dataset):
+def test_compute_ts_map_psf(fermi_dataset):
estimator = TSMapEstimator(fermi_dataset)
result = estimator.run()
- assert False
+ assert "root brentq" in repr(estimator)
+ assert_allclose(result["ts"].data[29, 29], 836.147, rtol=1e-2)
+ assert_allclose(result["niter"].data[29, 29], 7)
+ assert_allclose(result["flux"].data[29, 29], 1.2835e-09, rtol=1e-2)
+ assert_allclose(result["flux_err"].data[29, 29], 7.544e-11, rtol=1e-2)
+ assert_allclose(result["flux_ul"].data[29, 29], 1.434e-09, rtol=1e-2)
+ assert result["flux"].unit == u.Unit("cm-2s-1")
+ assert result["flux_err"].unit == u.Unit("cm-2s-1")
+ assert result["flux_ul"].unit == u.Unit("cm-2s-1")
@requires_data()
def test_compute_ts_map_newton(input_dataset):
