blob: 56c30317555a5774d14ea7d4efefdecbdcfb1d73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
|