From 8295c8c90376ed5074343eda75b3c0c0aad555b1 Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Sun, 19 Dec 2021 03:20:04 +0100 Subject: [PATCH] Add test for parametrized muon range function --- km3buu/tests/test_physics.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/km3buu/tests/test_physics.py b/km3buu/tests/test_physics.py index 644b810..dc3dc7e 100644 --- a/km3buu/tests/test_physics.py +++ b/km3buu/tests/test_physics.py @@ -24,6 +24,18 @@ FUNCTIONS_TESTFILE = join(dirname(__file__), "data/visible_energy_weight_functions.txt") PARTICLE_TESTFILE = join(dirname(__file__), "data/visible_energy_particle_frac.txt") +MUON_TESTFILE = join(dirname(__file__), "data/muon_range_seawater.txt") + + +class TestMuonRangeSeaWater(unittest.TestCase): + def setUp(self): + self.ref_values = np.loadtxt(MUON_TESTFILE).T + + def test_particles(self): + assert np.allclose(muon_range_seawater(self.ref_values[0, :], + self.ref_values[1, :]), + self.ref_values[2, :], + rtol=0.01) class TestVisEnergyParticle(unittest.TestCase): -- GitLab