summaryrefslogtreecommitdiff
path: root/doublenull.py
diff options
context:
space:
mode:
Diffstat (limited to 'doublenull.py')
-rw-r--r--doublenull.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/doublenull.py b/doublenull.py
index 241a3a5..622f156 100644
--- a/doublenull.py
+++ b/doublenull.py
@@ -17,7 +17,7 @@ def _photon_dXdt(t, coord, sign, gXX, gtt, gXt):
return ((-gXt_val + sign * np.sqrt((gXt_val ** 2) - gtt_val * gXX_val)) / gXX_val).flatten()[0]
# terminate integration on reaching the outer boundaries
-def _events_bnd_null_curves(spatial_coords):
+def _events_bnd(spatial_coords):
def event_x_bound_upper(t, x, sign, *args):
return x[0] - spatial_coords[-1]
event_x_bound_upper.terminal = True
@@ -30,7 +30,7 @@ def _events_bnd_null_curves(spatial_coords):
return [event_x_bound_upper, event_x_bound_lower]
-def _calc_null_kernel_time(times, origin, sign, gXX, gXt, gtt, events):
+def _kernel_time(times, origin, sign, gXX, gXt, gtt, events):
idx = np.where(times == origin)[0][0]
t_fwd = times[idx:]
@@ -58,7 +58,7 @@ def _calc_null_kernel_time(times, origin, sign, gXX, gXt, gtt, events):
return np.concatenate((ray_back[::-1][:-1], ray_fwd))
-def _calc_null_kernel_space(times, origin, sign, gXX, gXt, gtt, events):
+def _kernel_space(times, origin, sign, gXX, gXt, gtt, events):
sol = solve_ivp(_photon_dXdt, (times[0], times[-1]), (origin,),
method = 'RK45', t_eval = times, args = (sign, gXX, gtt, gXt),
dense_output = True, events = events, rtol = 1e-6, atol = 1e-8)
@@ -88,8 +88,8 @@ class Curves(Enum):
to form the resulting curve
"""
-def calc_null_curves(times, spatial_coords, gXX, gXt, gtt,
- kind = Curves.SPATIAL_FORWARD):
+def null_curves(times, spatial_coords, gXX, gXt, gtt,
+ kind = Curves.SPATIAL_FORWARD):
"""
Compute null curves along a given axis.
@@ -117,14 +117,14 @@ def calc_null_curves(times, spatial_coords, gXX, gXt, gtt,
gtt_interp = RectBivariateSpline(times, spatial_coords, gtt)
if kind == Curves.TEMPORAL:
- kernel = _calc_null_kernel_time
+ kernel = _kernel_time
origins = times
else:
- kernel = _calc_null_kernel_space
+ kernel = _kernel_space
origins = spatial_coords
ray_times = times[::-1] if kind == Curves.SPATIAL_BACK else times
- events = _events_bnd_null_curves(spatial_coords)
+ events = _events_bnd(spatial_coords)
rays_pos = np.empty((origins.shape[0], times.shape[0]))
rays_neg = np.empty_like(rays_pos)
@@ -136,8 +136,8 @@ def calc_null_curves(times, spatial_coords, gXX, gXt, gtt,
return (ray_times, rays_pos, rays_neg)
-def calc_null_coordinates(times, spatial_coords, u_rays, v_rays,
- gXX, gXt, gtt, kind = Curves.SPATIAL_FORWARD):
+def null_coordinates(times, spatial_coords, u_rays, v_rays,
+ gXX, gXt, gtt, kind = Curves.SPATIAL_FORWARD):
"""
Compute double-null coordinates (u, v) as functions of
position and time.
@@ -160,7 +160,7 @@ def calc_null_coordinates(times, spatial_coords, u_rays, v_rays,
v as functions of t and X. u/v[i, j] is the value of u/v at
t=times[i], X=spatial_coords[j].
"""
- _, X_of_ut, X_of_vt = calc_null_curves(times, spatial_coords, gXX, gXt, gtt, kind = kind)
+ _, X_of_ut, X_of_vt = null_curves(times, spatial_coords, gXX, gXt, gtt, kind = kind)
u_of_tx = np.empty((times.shape[0], spatial_coords.shape[0]))
v_of_tx = np.empty_like(u_of_tx)