changed Observation.read test to read events and IRF components from two different files
@@ -231,9 +231,10 @@ def test_observation():
@requires_data()
def test_observation_read():
+ """read event list and irf components from different DL3 files"""
obs = Observation.read(
event_file="$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_020136.fits.gz",
- irf_file="$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_020136.fits.gz"
+ irf_file="$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_020137.fits.gz"
)
energy = Quantity(1, "TeV")
@@ -243,18 +244,26 @@ def test_observation_read():
assert obs.obs_id == 20136
assert len(obs.events.energy) == 11243
assert obs.available_irfs == ["aeff", "edisp", "psf", "bkg"]
- assert_allclose(val.value, 273372.44851054, rtol=1e-5)
+ assert_allclose(val.value, 278000.54120855, rtol=1e-5)
assert val.unit == "m2"
@requires_data()
def test_observation_read_single_file():
+ """read event list and irf components from the same DL3 files"""
obs = Observation.read(
"$GAMMAPY_DATA/hess-dl3-dr1/data/hess_dl3_dr1_obs_id_020136.fits.gz"
)
+ energy = Quantity(1, "TeV")
+ offset = Quantity(0.5, "deg")
+ val = obs.aeff.evaluate(energy_true=energy, offset=offset)
+
assert obs.obs_id == 20136
+ assert len(obs.events.energy) == 11243
assert obs.available_irfs == ["aeff", "edisp", "psf", "bkg"]
+ assert_allclose(val.value, 273372.44851054, rtol=1e-5)
+ assert val.unit == "m2"
@requires_data()
