summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-06-28 19:11:10 +0200
committerAnton Khirnov <anton@khirnov.net>2023-06-28 19:11:10 +0200
commite48368e02fa618e8db5eb384bb487fd3c740660f (patch)
treed566e383d3822e56883f080312102df8beb46746
parent9c1cc48ff9fbfd789b5031c772a40b5bb413f9d8 (diff)
null: add a test for null_geodesics()
-rw-r--r--test/test_null.npzbin0 -> 24506 bytes
-rw-r--r--test/test_null.py26
2 files changed, 26 insertions, 0 deletions
diff --git a/test/test_null.npz b/test/test_null.npz
new file mode 100644
index 0000000..d970af4
--- /dev/null
+++ b/test/test_null.npz
Binary files 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)