1
1
import jax .numpy as jnp
2
2
3
- from jax_gw .detector .orbits import create_cartwheel_orbit , create_cartwheel_arm_lengths
3
+ from jax_gw .detector .orbits import (
4
+ create_cartwheel_orbit ,
5
+ create_cartwheel_arm_lengths ,
6
+ create_circular_orbit_xy ,
7
+ get_vertex_angle ,
8
+ earthbound_ifo_pipeline ,
9
+ )
4
10
import pytest
5
11
6
12
@@ -20,6 +26,109 @@ def test_create_cartwheel_orbit_output_shape(N, len_times, test_output_shape):
20
26
assert orbit .shape == test_output_shape
21
27
22
28
29
+ def test_get_vertex_angle_ifo ():
30
+ detector_lat = 0
31
+ detector_lon = 0
32
+ times = jnp .linspace (0 , 1 , 100 )
33
+ r = 1.0
34
+ L_arm = 4.0
35
+ psi = 0.0
36
+ beta_arm = jnp .pi / 2
37
+ orbits = earthbound_ifo_pipeline (
38
+ lat = detector_lat ,
39
+ lon = detector_lon ,
40
+ times = times ,
41
+ r = r ,
42
+ L_arm = L_arm ,
43
+ psi = psi ,
44
+ beta_arm = beta_arm ,
45
+ )
46
+ vertex_angle = get_vertex_angle (orbits ) * 180 / jnp .pi
47
+ print (vertex_angle )
48
+ assert jnp .allclose (vertex_angle , 90 , atol = 1e-4 )
49
+
50
+
51
+ def test_create_circular_orbit_xy_center_loc ():
52
+ times = jnp .linspace (0 , 1 , 10000 )
53
+ r = 3.4
54
+ orbit = create_circular_orbit_xy (r = r , f_orb = 1 , times = times )
55
+ center_x = jnp .mean (orbit , axis = 1 )
56
+ assert jnp .allclose (center_x , 0 , atol = 1e-3 )
57
+
58
+
59
+ def test_earthbound_ifo_pipeline_arm_lengths ():
60
+ detector_lat = 0
61
+ detector_lon = 0
62
+ times = jnp .linspace (0 , 1 , 100 )
63
+ r = 1.0
64
+ L_arm = 4.0
65
+ psi = 0.0
66
+ beta_arm = jnp .pi / 2
67
+ orbits = earthbound_ifo_pipeline (
68
+ lat = detector_lat ,
69
+ lon = detector_lon ,
70
+ times = times ,
71
+ r = r ,
72
+ L_arm = L_arm ,
73
+ psi = psi ,
74
+ beta_arm = beta_arm ,
75
+ )
76
+ km_in_AU = 149.597871 * 1e6
77
+ distances_01 = jnp .linalg .norm (orbits [0 ] - orbits [1 ], axis = 0 )
78
+ distances_01 = distances_01 * km_in_AU
79
+ distances_02 = jnp .linalg .norm (orbits [0 ] - orbits [2 ], axis = 0 )
80
+ distances_02 = distances_02 * km_in_AU
81
+ assert jnp .allclose (distances_01 , L_arm , rtol = 1e-3 )
82
+ assert jnp .allclose (distances_02 , L_arm , rtol = 1e-3 )
83
+
84
+
85
+ def test_earthbound_ifo_pipeline_orbit_AU ():
86
+ detector_lat = 0
87
+ detector_lon = 0
88
+ times = jnp .linspace (0 , 1 , 100 )
89
+ r = 1.0
90
+ L_arm = 4.0
91
+ psi = 0.0
92
+ beta_arm = jnp .pi / 2
93
+ orbits_in_AU = earthbound_ifo_pipeline (
94
+ lat = detector_lat ,
95
+ lon = detector_lon ,
96
+ times = times ,
97
+ r = r ,
98
+ L_arm = L_arm ,
99
+ psi = psi ,
100
+ beta_arm = beta_arm ,
101
+ )
102
+ distances_center = jnp .linalg .norm (orbits_in_AU , axis = 1 )
103
+ assert jnp .allclose (distances_center , r , rtol = 1e-3 )
104
+
105
+
106
+ def test_earthbound_ifo_pipeline_planet_radius ():
107
+ detector_lat = 0
108
+ detector_lon = 0
109
+ times = jnp .linspace (0 , 1 , 100 )
110
+ r = 1.0
111
+ L_arm = 4.0
112
+ psi = 0.0
113
+ beta_arm = jnp .pi / 2
114
+ orbits = earthbound_ifo_pipeline (
115
+ lat = detector_lat ,
116
+ lon = detector_lon ,
117
+ times = times ,
118
+ r = r ,
119
+ L_arm = L_arm ,
120
+ psi = psi ,
121
+ beta_arm = beta_arm ,
122
+ )
123
+ initial_orbits = orbits [:, :, 0 ]
124
+ planet_center = jnp .array ([1 , 0 , 0 ])
125
+ delta_r = initial_orbits - planet_center
126
+ distances_center = jnp .linalg .norm (delta_r , axis = 1 )
127
+ r_Earth_km = 6371.0
128
+ km_in_AU = 149.597871 * 1e6
129
+ assert jnp .allclose (distances_center , r_Earth_km / km_in_AU , rtol = 1e-3 )
130
+
131
+
23
132
def test_create_cartwheel_orbit_center_loc ():
24
133
times = jnp .linspace (0 , 1 , 10 )
25
134
r = 3.4
0 commit comments