1
1
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2
2
3
- import random
4
-
5
3
from numpy .ma import is_masked
6
4
import numpy as np
7
5
import pytest
@@ -415,27 +413,11 @@ def test_geodetic_queries(self):
415
413
black-box test for observer and vectors queries with geodetic
416
414
coordinates. checks spatial sensibility.
417
415
"""
418
- phobos = {
419
- 'body' : 401 ,
420
- 'lon' : random .randint (- 150 , - 1 ),
421
- 'lat' : random .randint (- 80 , 80 ),
422
- 'elevation' : 0
423
- }
424
- deimos = {
425
- 'body' : 402 ,
426
- 'lon' : random .randint (- 150 , - 1 ),
427
- 'lat' : random .randint (- 80 , 80 ),
428
- 'elevation' : 0
429
- }
430
- epochs = [random .randint (int (2.3e6 ), int (2.5e6 ))]
431
- deimos_phobos = jplhorizons .Horizons (
432
- phobos , location = deimos , epochs = epochs
433
- )
434
- phobos_deimos = jplhorizons .Horizons (
435
- deimos , location = phobos , epochs = epochs
436
- )
437
- pd_eph = phobos_deimos .ephemerides ()
438
- dp_eph = deimos_phobos .ephemerides ()
416
+ phobos = {'body' : 401 , 'lon' : - 30 , 'lat' : - 20 , 'elevation' : 0 }
417
+ deimos = {'body' : 402 , 'lon' : - 10 , 'lat' : - 40 , 'elevation' : 0 }
418
+ deimos_phobos = jplhorizons .Horizons (phobos , location = deimos , epochs = 2.4e6 )
419
+ phobos_deimos = jplhorizons .Horizons (deimos , location = phobos , epochs = 2.4e6 )
420
+ pd_eph , dp_eph = phobos_deimos .ephemerides (), deimos_phobos .ephemerides ()
439
421
dp_xyz = spherical_to_cartesian (
440
422
dp_eph ['delta' ], dp_eph ['DEC' ], dp_eph ['RA' ]
441
423
)
@@ -446,7 +428,7 @@ def test_geodetic_queries(self):
446
428
eph_offset = (sum ([off ** 2 for off in elementwise ]) ** 0.5 ).to (u .km )
447
429
# horizons can do better than this, but we'd have to go to a little
448
430
# more trouble than is necessary for a software test...
449
- assert eph_offset < 10 * u . km
431
+ assert np . isclose ( eph_offset . value , 2.558895 )
450
432
# ...and vectors queries are really what you're meant to use for
451
433
# this sort of thing.
452
434
pd_vec , dp_vec = phobos_deimos .vectors (), deimos_phobos .vectors ()
@@ -456,4 +438,4 @@ def test_geodetic_queries(self):
456
438
+ dp_vec .as_array (names = ('x' , 'y' , 'z' )).view ('f8' )
457
439
) ** 2
458
440
)
459
- assert (vec_offset * u . au . to ( u . km )) < 1
441
+ assert np . isclose (vec_offset , 0 )
0 commit comments