def test_calculate_trajectory( pos_vec, vel_vec, time, M, a, start_lambda, end_lambda, OdeMethodKwargs ): _scr = schwarzschild_radius(M).value obj = Kerr.from_BL(pos_vec, vel_vec, time, M, a) ans = obj.calculate_trajectory( start_lambda=start_lambda, end_lambda=end_lambda, OdeMethodKwargs=OdeMethodKwargs, ) ans = ans[1] testarray = list() for ansi in ans: g = kerr_utils.metric(_c, ansi[1], ansi[2], _scr, a) tmp = ( g[0][0] * (ansi[4] ** 2) + g[1][1] * (ansi[5] ** 2) + g[2][2] * (ansi[6] ** 2) + g[3][3] * (ansi[7] ** 2) + 2 * g[0][3] * ansi[4] * ansi[7] ) testarray.append(tmp) testarray = np.array(testarray, dtype=float) comparearray = np.ones(shape=ans[:, 4].shape, dtype=float) assert_allclose(testarray, comparearray, 1e-4)
def test_compare_kerr_and_schwarzschild_metric(): r = 99.9 theta = 5 * np.pi / 6 Rs = 9e-3 # Kerr metric would reduce to Schwarzschild metric under limits a=0 mk = kerr_utils.metric(_c, r, theta, Rs, 0.0) ms = schwarzschild_utils.metric(_c, r, theta, Rs) assert_allclose(mk, ms, rtol=1e-8)
def test_compare_kerr_and_schwarzschild_metric(): r = 99.9 theta = 5 * np.pi / 6 M = 6.73317655e26 # Kerr metric would reduce to Schwarzschild metric under limits a=0 mk = kerr_utils.metric(r, theta, M, 0.0) ms = schwarzschild_utils.metric(r, theta, M) assert_allclose(mk, ms, rtol=1e-8)
def test_calculate_trajectory(coords, time, M, start_lambda, end_lambda, OdeMethodKwargs): _scr = schwarzschild_radius_dimensionless(M) obj = Kerr.from_BL(coords, M, time) ans = obj.calculate_trajectory( start_lambda=start_lambda, end_lambda=end_lambda, OdeMethodKwargs=OdeMethodKwargs, ) ans = ans[1] testarray = list() for i in ans: g = kerr_utils.metric(i[1], i[2], M.value, coords.a.to(u.m).value) testarray.append(g[0][0] * (i[4]**2) + g[1][1] * (i[5]**2) + g[2][2] * (i[6]**2) + g[3][3] * (i[7]**2) + 2 * g[0][3] * i[4] * i[7]) testarray = np.array(testarray, dtype=float) comparearray = np.ones(shape=ans[:, 4].shape, dtype=float) assert_allclose(testarray, comparearray, 1e-4)