Add regression test for 1FHL flux point ul
@@ -155,10 +155,10 @@ class TestSourceCatalog1FHL:
@requires_data('gammapy-extra')
class TestFermi1FHLObject:
def setup(self):
- cat = SourceCatalog1FHL()
+ self.cat = SourceCatalog1FHL()
# Use 1FHL J0534.5+2201 (Crab) as a test source
self.source_name = '1FHL J0534.5+2201'
- self.source = cat[self.source_name]
+ self.source = self.cat[self.source_name]
def test_name(self):
assert self.source.name == self.source_name
@@ -169,6 +169,18 @@ class TestFermi1FHLObject:
desired = u.Quantity(4.7717464131e-12, 'cm-2 GeV-1 s-1')
assert_quantity_allclose(model(energy), desired)
+ def test_flux_points(self):
+ # test flux point on PKS 2155-304
+ src = self.cat['1FHL J0153.1+7515']
+ flux_points = src.flux_points
+ actual = flux_points.table['flux']
+ desired = [5.523017e-11, np.nan, np.nan] * u.Unit('cm-2 s-1')
+ assert_quantity_allclose(actual, desired)
+
+ actual = flux_points.table['flux_ul']
+ desired = [np.nan, 2.081589e-11, 1.299698e-11] * u.Unit('cm-2 s-1')
+ assert_quantity_allclose(actual, desired, rtol=1E-5)
+
@requires_dependency('uncertainties')
def test_spectrum(self):
spectrum = self.source.spectrum
