11from assay import assert_raises
2+ from collections import namedtuple
23from numpy import abs , arange , sqrt
34
45from skyfield import constants
@@ -266,8 +267,10 @@ def test_deprecated_position_subpoint_method(ts, angle):
266267def test_intersection_from_pole (ts ):
267268 t = ts .utc (2018 , 1 , 19 , 14 , 37 , 55 )
268269 p = wgs84 .latlon (90.0 , 0.0 , 1234.0 ).at (t )
269- attitude = - p .xyz .au / length_of (p .xyz .au )
270- earth_point = wgs84 .intersection_of (p , attitude )
270+ direction = - p .xyz .au / length_of (p .xyz .au )
271+ Vector = namedtuple ("Vector" , "center, target, t" )
272+ vector = Vector (p , direction , t )
273+ earth_point = wgs84 .intersection_of (vector )
271274
272275 error_degrees = abs (earth_point .latitude .degrees - 90.0 )
273276 error_mas = 60.0 * 60.0 * 1000.0 * error_degrees
@@ -277,8 +280,10 @@ def test_intersection_from_pole(ts):
277280def test_intersection_from_equator (ts ):
278281 t = ts .utc (2018 , 1 , 19 , 14 , 37 , 55 )
279282 p = wgs84 .latlon (0.0 , 0.0 , 1234.0 ).at (t )
280- attitude = - p .xyz .au / length_of (p .xyz .au )
281- earth_point = wgs84 .intersection_of (p , attitude )
283+ direction = - p .xyz .au / length_of (p .xyz .au )
284+ Vector = namedtuple ("Vector" , "center, target, t" )
285+ vector = Vector (p , direction , t )
286+ earth_point = wgs84 .intersection_of (vector )
282287
283288 error_degrees = abs (earth_point .latitude .degrees - 0.0 )
284289 error_mas = 60.0 * 60.0 * 1000.0 * error_degrees
@@ -294,22 +299,26 @@ def test_limb_intersection_points(ts):
294299 d = 100.0
295300 a = wgs84 .radius .au
296301 c = a * (1.0 - 1.0 / wgs84 .inverse_flattening )
302+ pos = ICRF (position_au = [d , 0.0 , 0.0 ], t = t , center = 399 )
297303
298- # Attitude vectors pointing to the polar and equatorial limbs of the Earth
299- attitude_bottom_tangent = [- d , 0.0 , - c ] / sqrt (d ** 2 + c ** 2 )
300- attitude_top_tangent = [- d , 0.0 , c ] / sqrt (d ** 2 + c ** 2 )
301- attitude_left_tangent = [- d , - a , 0.0 ] / sqrt (d ** 2 + c ** 2 )
302- attitude_right_tangent = [- d , a , 0.0 ] / sqrt (d ** 2 + c ** 2 )
304+ # Vectors pointing to the polar and equatorial limbs of the Earth
305+ direction_bottom_tangent = [- d , 0.0 , - c ] / sqrt (d ** 2 + c ** 2 )
306+ direction_top_tangent = [- d , 0.0 , c ] / sqrt (d ** 2 + c ** 2 )
307+ direction_left_tangent = [- d , - a , 0.0 ] / sqrt (d ** 2 + c ** 2 )
308+ direction_right_tangent = [- d , a , 0.0 ] / sqrt (d ** 2 + c ** 2 )
309+ Vector = namedtuple ("Vector" , "center, target, t" )
310+ bottom_tangent = Vector (pos , direction_bottom_tangent , t )
311+ top_tangent = Vector (pos , direction_top_tangent , t )
312+ left_tangent = Vector (pos , direction_left_tangent , t )
313+ right_tangent = Vector (pos , direction_right_tangent , t )
303314 # Attitude vector pointing straight down
304- attitude_zenith = [- 1.0 , 0.0 , 0.0 ]
305-
306- pos = ICRF (position_au = [d , 0.0 , 0.0 ], t = t , center = 399 )
315+ zenith = Vector (pos , [- 1.0 , 0.0 , 0.0 ], t )
307316
308- intersection_bottom = wgs84 .intersection_of (pos , attitude_bottom_tangent )
309- intersection_top = wgs84 .intersection_of (pos , attitude_top_tangent )
310- intersection_left = wgs84 .intersection_of (pos , attitude_left_tangent )
311- intersection_right = wgs84 .intersection_of (pos , attitude_right_tangent )
312- intersection_zenith = wgs84 .intersection_of (pos , attitude_zenith )
317+ intersection_bottom = wgs84 .intersection_of (bottom_tangent )
318+ intersection_top = wgs84 .intersection_of (top_tangent )
319+ intersection_left = wgs84 .intersection_of (left_tangent )
320+ intersection_right = wgs84 .intersection_of (right_tangent )
321+ intersection_zenith = wgs84 .intersection_of (zenith )
313322
314323 # Viewed from sufficient distance, points of intersection should be nearly
315324 # tangent to the north and south poles, and the zenith longitude +/- 90.0
0 commit comments