|
1 | 1 | import numpy as np |
2 | 2 | import unittest |
3 | 3 |
|
| 4 | +from datetime import datetime |
4 | 5 | from laika.ephemeris import EphemerisType, read_prn_data |
5 | 6 | from laika.gps_time import GPSTime |
| 7 | +from laika.constants import SECS_IN_DAY |
6 | 8 | from laika import AstroDog |
7 | 9 |
|
8 | | -gps_times_list = [[1999, 415621.0], |
9 | | - [2045, 455457.0], |
10 | | - [1985, 443787.0]] |
| 10 | +gps_times_list = [[2100, 415621.0], |
| 11 | + [2200, 455457.0], |
| 12 | + [2300, 443787.0]] |
11 | 13 |
|
12 | | -svIds = ['G01', 'G31', 'R08'] |
| 14 | +svIds = ['G07', 'G31', 'R08'] |
13 | 15 | gps_times = [GPSTime(*gps_time_list) for gps_time_list in gps_times_list] |
14 | 16 |
|
15 | 17 |
|
16 | 18 | class TestAstroDog(unittest.TestCase): |
17 | | - ''' |
18 | 19 | def test_nav_vs_orbit_now(self): |
19 | | - dog_orbit = AstroDog(valid_ephem_types=EphemerisType.orbits()) |
| 20 | + dog_orbit = AstroDog(valid_ephem_types=EphemerisType.all_orbits()) |
20 | 21 | dog_nav = AstroDog(valid_ephem_types=EphemerisType.NAV) |
21 | 22 | gps_time = GPSTime.from_datetime(datetime.utcnow()) - SECS_IN_DAY*2 |
22 | 23 | for svId in svIds: |
23 | 24 | sat_info_nav = dog_nav.get_sat_info(svId, gps_time) |
24 | 25 | sat_info_orbit = dog_orbit.get_sat_info(svId, gps_time) |
25 | | - np.testing.assert_allclose(sat_info_nav[0], sat_info_orbit[0], rtol=0, atol=5) |
26 | | - np.testing.assert_allclose(sat_info_nav[1], sat_info_orbit[1], rtol=0, atol=.1) |
| 26 | + np.testing.assert_allclose(sat_info_nav[0], sat_info_orbit[0], rtol=0, atol=5e2) |
| 27 | + np.testing.assert_allclose(sat_info_nav[1], sat_info_orbit[1], rtol=0, atol=1e0) |
27 | 28 | np.testing.assert_allclose(sat_info_nav[2], sat_info_orbit[2], rtol=0, atol=1e-7) |
28 | | - np.testing.assert_allclose(sat_info_nav[3], sat_info_orbit[3], rtol=0, atol=1e-11) |
29 | | - ''' |
| 29 | + np.testing.assert_allclose(sat_info_nav[3], sat_info_orbit[3], rtol=0, atol=1e-10) |
30 | 30 |
|
31 | 31 | def test_nav_vs_orbit_old(self): |
32 | 32 | dog_orbit = AstroDog(valid_ephem_types=EphemerisType.all_orbits()) |
33 | 33 | dog_nav = AstroDog(valid_ephem_types=EphemerisType.NAV) |
34 | 34 | for gps_time in gps_times: |
35 | 35 | for svId in svIds: |
36 | | - print(svId, gps_time) |
37 | 36 | sat_info_nav = dog_nav.get_sat_info(svId, gps_time) |
38 | 37 | assert sat_info_nav is not None |
39 | 38 | sat_info_orbit = dog_orbit.get_sat_info(svId, gps_time) |
|
0 commit comments