diff --git a/km3buu/tests/test_propagation.py b/km3buu/tests/test_propagation.py index cca16021d167577f83fb79103aee3f7f2eccb5fc..17f82ff0551a08414740f753ea29632d89ed4f84 100644 --- a/km3buu/tests/test_propagation.py +++ b/km3buu/tests/test_propagation.py @@ -21,59 +21,49 @@ from thepipe.logger import get_logger import proposal as pp import awkward as ak -from km3buu.propagation import propagate_lepton + +from km3buu.geometry import * +from km3buu.propagation import * pp.RandomGenerator.get().set_seed(1234) +np.random.seed(1234) class TestTauPropagation(unittest.TestCase): def setUp(self): - data = ak.Array({ - "lepOut_E": [ - 17.45830624434573, 3.1180989952362594, 21.270059768902005, - 5.262659790136034, 23.52185741888274 - ], - "lepOut_Px": [ - -0.42224402086330426, -1.0232258668453014, -0.5801431899058521, - -0.9038349288874724, 0.9022573877437422 - ], - "lepOut_Py": [ - 0.3644190693190108, -0.24542303987320932, 0.24499631087268617, - -1.1060562370375715, -3.982173292871768 - ], - "lepOut_Pz": [ - 17.35867612031871, 2.336148261778657, 21.186342871282157, - 4.743161507744377, 23.096499191566885 - ] - }) - self.sec = propagate_lepton(data, 15) + prop = Propagator([15, -15], CANVolume().make_proposal_geometries()) + self.position = np.array([10.0, 10.0, 100.0]) + self.direction = np.array([1., 1., 0]) + self.energy = 10.0 + self.sec = prop.propagate(15, self.energy, self.position, + self.direction) def test_secondary_momenta(self): - np.testing.assert_array_almost_equal(np.array(self.sec[0].E), - [2.182, 13.348, 1.928], + np.testing.assert_array_almost_equal(np.array(self.sec.E), + [4.141, 5.761, 0.098], decimal=3) - np.testing.assert_array_almost_equal(np.array(self.sec[0].Px), - [0.295, -0.48, -0.237], + np.testing.assert_array_almost_equal(np.array(self.sec.Px), + [3.271, 3.696, -0.009], decimal=3) - np.testing.assert_array_almost_equal(np.array(self.sec[0].Py), - [-0.375, 0.784, -0.044], + np.testing.assert_array_almost_equal(np.array(self.sec.Py), + [2.48 , 4.382, 0.097], decimal=3) - np.testing.assert_array_almost_equal(np.array(self.sec[0].Pz), - [2.129, 13.316, 1.913], + np.testing.assert_array_almost_equal(np.array(self.sec.Pz), + [-0.549, 0.564, -0.015], decimal=3) def test_secondary_types(self): - np.testing.assert_array_equal(np.array(self.sec[0].barcode), - [13, 16, -14]) + np.testing.assert_array_equal(np.array(self.sec.barcode), + [11, 16, -12]) def test_secondary_positions(self): - np.testing.assert_array_almost_equal(np.array(self.sec[0].x), - [-1.4e-05, -1.4e-05, -1.4e-05], + np.testing.assert_array_almost_equal(np.array(self.sec.x), + [10.0,10.0,10.0], decimal=1) - np.testing.assert_array_almost_equal(np.array(self.sec[0].y), - [1.2e-05, 1.2e-05, 1.2e-05], + np.testing.assert_array_almost_equal(np.array(self.sec.y), + [10.0,10.0,10.0], decimal=1) - np.testing.assert_array_almost_equal(np.array(self.sec[0].z), - [0., 0., 0.], + np.testing.assert_array_almost_equal(np.array(self.sec.z), + [100., 100., 100.], decimal=1)