Skip to content

Commit

Permalink
Adding tests for weighted effective area, also covering the ValueErro…
Browse files Browse the repository at this point in the history
…r of invalid flux argument and the TypeError of a valid flux argument that is not supported yet
  • Loading branch information
jsaffer committed Dec 18, 2024
1 parent 0056dd0 commit 3f99af3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_weighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,23 @@ def test_effective_area(self):
self.weighter1.effective_area(np.linspace(5e5, 5e6, self.N1 + 1), [0, 1]),
[np.full(self.N1, self.c1.etendue / 2e4 / np.pi)],
)
self.assertAlmostEqual(
self.weighter1.effective_area([5e5, 5e6], [0, 1], flux=TIG1996())[0][0],
149998.97822505102,
6,
)
self.assertAlmostEqual(
self.weighter1.effective_area([5e5, 5e6], [0, 1], np.ones(self.N1, dtype=bool), flux=TIG1996())[0][0],
149998.97822505102,
6,
)

with self.assertRaises(ValueError):
self.weighter1.effective_area([5e5, 5e6], [0, 1], flux="flux")

with self.assertRaises(TypeError):
self.weighter1.effective_area([5e5, 5e6], [0, 1], flux=list(range(self.N1)))


def test_weighter_addition(self):
weighter_sum = self.weighter1 + self.weighter1
Expand Down

0 comments on commit 3f99af3

Please sign in to comment.