From e48368e02fa618e8db5eb384bb487fd3c740660f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 28 Jun 2023 19:11:10 +0200 Subject: null: add a test for null_geodesics() --- test/test_null.npz | Bin 0 -> 24506 bytes test/test_null.py | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/test_null.npz create mode 100644 test/test_null.py diff --git a/test/test_null.npz b/test/test_null.npz new file mode 100644 index 0000000..d970af4 Binary files /dev/null and b/test/test_null.npz differ diff --git a/test/test_null.py b/test/test_null.py new file mode 100644 index 0000000..56c3031 --- /dev/null +++ b/test/test_null.py @@ -0,0 +1,26 @@ +import os +from unittest import TestCase + +import numpy as np +from numpy.testing import assert_allclose + +from math_utils.array_utils import array_reflect as ar +from nr_analysis_axi import null, invars + +class TestNull(TestCase): + + def setUp(self): + datafile = os.path.splitext(__file__)[0] + '.npz' + + self.data = np.load(datafile) + self.t = ar(self.data['t'], -1) + self.x = ar(self.data['x'], -1) + self.gxx = ar(ar(self.data['gxx'], axis = 1), axis = 0) + self.gtt = ar(ar(self.data['gtt'], axis = 1), axis = 0) + + def test_null_geodesics(self): + g = null.null_geodesics(self.t, self.x, self.gxx, self.gtt, integrate_times = [0.1])[0] + + l = self.data['l'] + + assert_allclose(g(l), self.data['g'], 1e-12) -- cgit v1.2.3