Remove ObservationsSummary tests
# Licensed under a 3-clause BSD style license - see LICENSE.rst
-import pytest
from numpy.testing import assert_allclose
-import astropy.units as u
from astropy.coordinates import SkyCoord
-from regions import CircleSkyRegion
from gammapy.data import (
DataStore,
- ObservationStats,
- ObservationSummary,
ObservationTableSummary,
)
-from gammapy.spectrum import ReflectedRegionsBackgroundEstimator
from gammapy.utils.testing import mpl_plot_check, requires_data, requires_dependency
@@ -43,67 +37,3 @@ class TestObservationSummaryTable:
def test_plot_offset(self):
with mpl_plot_check():
self.table_summary.plot_offset_distribution()
-
-
-@requires_data()
-class TestObservationSummary:
- """
- Test observation summary.
- """
-
- @classmethod
- def setup_class(cls):
- datastore = DataStore.from_dir("$GAMMAPY_DATA/hess-dl3-dr1/")
- obs_ids = [23523, 23526]
-
- on_region = CircleSkyRegion(
- SkyCoord(83.63 * u.deg, 22.01 * u.deg, frame="icrs"), 0.3 * u.deg
- )
-
- obs_stats_list = []
- for obs_id in obs_ids:
- obs = datastore.obs(obs_id)
- bkg = ReflectedRegionsBackgroundEstimator(
- on_region=on_region, observations=[obs]
- )
- bkg.run()
- bg_estimate = bkg.result[0]
-
- obs_stats = ObservationStats.from_observation(obs, bg_estimate)
- obs_stats_list.append(obs_stats)
-
- cls.obs_summary = ObservationSummary(obs_stats_list)
-
- @pytest.mark.xfail
- def test_results(self):
- # TODO: add test with assert on result numbers yet!!!
- assert 0
-
- def test_obs_str(self):
- text = str(self.obs_summary)
- assert "Observation summary" in text
-
- @requires_dependency("matplotlib")
- def test_plot_significance(self):
- with mpl_plot_check():
- self.obs_summary.plot_significance_vs_livetime()
-
- @requires_dependency("matplotlib")
- def test_plot_excess(self):
- with mpl_plot_check():
- self.obs_summary.plot_excess_vs_livetime()
-
- @requires_dependency("matplotlib")
- def test_plot_background(self):
- with mpl_plot_check():
- self.obs_summary.plot_background_vs_livetime()
-
- @requires_dependency("matplotlib")
- def test_plot_gamma_rate(self):
- with mpl_plot_check():
- self.obs_summary.plot_gamma_rate()
-
- @requires_dependency("matplotlib")
- def test_plot_background_rate(self):
- with mpl_plot_check():
- self.obs_summary.plot_background_rate()
