open-space-toolkit-astrodynamics 9.4.1__py38-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_space_toolkit_astrodynamics-9.4.1.dist-info/METADATA +30 -0
- open_space_toolkit_astrodynamics-9.4.1.dist-info/RECORD +98 -0
- open_space_toolkit_astrodynamics-9.4.1.dist-info/WHEEL +5 -0
- open_space_toolkit_astrodynamics-9.4.1.dist-info/top_level.txt +1 -0
- open_space_toolkit_astrodynamics-9.4.1.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-38-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +11 -0
- ostk/astrodynamics/converters.py +185 -0
- ostk/astrodynamics/display.py +220 -0
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.9 +0 -0
- ostk/astrodynamics/pytrajectory/__init__.py +1 -0
- ostk/astrodynamics/pytrajectory/pystate.py +36 -0
- ostk/astrodynamics/test/__init__.py +1 -0
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +248 -0
- ostk/astrodynamics/test/conftest.py +119 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/__init__.py +1 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/conftest.py +325 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/data/cdm.json +303 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/test_cdm.py +416 -0
- ostk/astrodynamics/test/dynamics/__init__.py +1 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity.csv +565 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity_Truth.csv +100 -0
- ostk/astrodynamics/test/dynamics/test_atmospheric_drag.py +128 -0
- ostk/astrodynamics/test/dynamics/test_central_body_gravity.py +58 -0
- ostk/astrodynamics/test/dynamics/test_dynamics.py +50 -0
- ostk/astrodynamics/test/dynamics/test_position_derivative.py +51 -0
- ostk/astrodynamics/test/dynamics/test_tabulated.py +138 -0
- ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
- ostk/astrodynamics/test/dynamics/test_thruster.py +142 -0
- ostk/astrodynamics/test/event_condition/test_angular_condition.py +113 -0
- ostk/astrodynamics/test/event_condition/test_boolean_condition.py +55 -0
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +87 -0
- ostk/astrodynamics/test/event_condition/test_instant_condition.py +48 -0
- ostk/astrodynamics/test/event_condition/test_logical_condition.py +120 -0
- ostk/astrodynamics/test/event_condition/test_real_condition.py +50 -0
- ostk/astrodynamics/test/flight/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +73 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_maneuver.py +212 -0
- ostk/astrodynamics/test/flight/test_profile.py +153 -0
- ostk/astrodynamics/test/flight/test_system.py +55 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +138 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
- ostk/astrodynamics/test/test_access.py +128 -0
- ostk/astrodynamics/test/test_converters.py +387 -0
- ostk/astrodynamics/test/test_display.py +115 -0
- ostk/astrodynamics/test/test_event_condition.py +58 -0
- ostk/astrodynamics/test/test_import.py +26 -0
- ostk/astrodynamics/test/test_root_solver.py +70 -0
- ostk/astrodynamics/test/test_trajectory.py +40 -0
- ostk/astrodynamics/test/test_utilities.py +121 -0
- ostk/astrodynamics/test/test_viewer.py +129 -0
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/conftest.py +18 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/data/opm_1.yaml +44 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/test_opm.py +108 -0
- ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean.py +65 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_long.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_short.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +167 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +234 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +380 -0
- ostk/astrodynamics/test/trajectory/orbit/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/test_pass.py +72 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_angular_velocity.py +30 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_attitude_quaternion.py +18 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_position.py +107 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_velocity.py +115 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_broker.py +84 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_subset.py +46 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +76 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +174 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +458 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +305 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +477 -0
- ostk/astrodynamics/test/trajectory/test_state.py +237 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
- ostk/astrodynamics/utilities.py +158 -0
- ostk/astrodynamics/viewer.py +392 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics.unit import Length
|
6
|
+
from ostk.physics.unit import Angle
|
7
|
+
from ostk.physics.environment.gravitational import Earth
|
8
|
+
|
9
|
+
from ostk.physics.coordinate import Frame
|
10
|
+
from ostk.physics.coordinate import Position
|
11
|
+
from ostk.physics.coordinate import Velocity
|
12
|
+
|
13
|
+
from ostk.astrodynamics.trajectory.orbit.model.kepler import COE
|
14
|
+
from ostk.astrodynamics.trajectory.orbit.model.brouwerLyddaneMean import (
|
15
|
+
BrouwerLyddaneMeanShort,
|
16
|
+
)
|
17
|
+
|
18
|
+
|
19
|
+
@pytest.fixture
|
20
|
+
def semi_major_axis() -> Length:
|
21
|
+
return Length.kilometers(7000.0)
|
22
|
+
|
23
|
+
|
24
|
+
@pytest.fixture
|
25
|
+
def eccentricity() -> float:
|
26
|
+
return 1e-3
|
27
|
+
|
28
|
+
|
29
|
+
@pytest.fixture
|
30
|
+
def inclination() -> Angle:
|
31
|
+
return Angle.degrees(35.0)
|
32
|
+
|
33
|
+
|
34
|
+
@pytest.fixture
|
35
|
+
def raan() -> Angle:
|
36
|
+
return Angle.degrees(40.0)
|
37
|
+
|
38
|
+
|
39
|
+
@pytest.fixture
|
40
|
+
def aop() -> Angle:
|
41
|
+
return Angle.degrees(50.0)
|
42
|
+
|
43
|
+
|
44
|
+
@pytest.fixture
|
45
|
+
def mean_anomaly() -> Angle:
|
46
|
+
return Angle.degrees(60.0)
|
47
|
+
|
48
|
+
|
49
|
+
@pytest.fixture
|
50
|
+
def coe(
|
51
|
+
semi_major_axis: Length,
|
52
|
+
eccentricity: float,
|
53
|
+
inclination: Angle,
|
54
|
+
raan: Angle,
|
55
|
+
aop: Angle,
|
56
|
+
mean_anomaly: Angle,
|
57
|
+
) -> COE:
|
58
|
+
return COE(semi_major_axis, eccentricity, inclination, raan, aop, mean_anomaly)
|
59
|
+
|
60
|
+
|
61
|
+
@pytest.fixture
|
62
|
+
def cartesian_state() -> tuple[Position, Velocity]:
|
63
|
+
return (
|
64
|
+
Position.meters(
|
65
|
+
[6596407.223662058, 2281266.582975321, -10540.61521486086], Frame.GCRF()
|
66
|
+
),
|
67
|
+
Velocity.meters_per_second(
|
68
|
+
[337.7269674273224, -969.7192552349448, 7488.702816619139], Frame.GCRF()
|
69
|
+
),
|
70
|
+
)
|
71
|
+
|
72
|
+
|
73
|
+
@pytest.fixture
|
74
|
+
def gravitational_parameter():
|
75
|
+
return Earth.EGM2008.gravitational_parameter
|
76
|
+
|
77
|
+
|
78
|
+
@pytest.fixture
|
79
|
+
def brouwer_lyddane_mean_short(
|
80
|
+
semi_major_axis, eccentricity, inclination, raan, aop, mean_anomaly
|
81
|
+
):
|
82
|
+
return BrouwerLyddaneMeanShort(
|
83
|
+
semi_major_axis, eccentricity, inclination, raan, aop, mean_anomaly
|
84
|
+
)
|
85
|
+
|
86
|
+
|
87
|
+
class TestBrouwerLyddaneMeanShort:
|
88
|
+
def test_to_coe(self, brouwer_lyddane_mean_short: BrouwerLyddaneMeanShort):
|
89
|
+
assert brouwer_lyddane_mean_short.to_coe().is_defined()
|
90
|
+
|
91
|
+
def test_coe(self, coe: COE) -> COE:
|
92
|
+
assert BrouwerLyddaneMeanShort.COE(coe).is_defined()
|
93
|
+
|
94
|
+
def test_cartesian(
|
95
|
+
self, cartesian_state: tuple[Position, Velocity], gravitational_parameter
|
96
|
+
):
|
97
|
+
assert BrouwerLyddaneMeanShort.cartesian(
|
98
|
+
cartesian_state, gravitational_parameter
|
99
|
+
).is_defined()
|
100
|
+
|
101
|
+
def test_undefined(self):
|
102
|
+
assert BrouwerLyddaneMeanShort.undefined().is_defined() is False
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics.unit import Length
|
6
|
+
from ostk.physics.unit import Angle
|
7
|
+
from ostk.physics.environment.gravitational import Earth
|
8
|
+
|
9
|
+
from ostk.astrodynamics.trajectory.orbit.model.kepler import COE
|
10
|
+
|
11
|
+
|
12
|
+
@pytest.fixture
|
13
|
+
def semi_major_axis() -> Length:
|
14
|
+
return Length.kilometers(7000.0)
|
15
|
+
|
16
|
+
|
17
|
+
@pytest.fixture
|
18
|
+
def eccentricity() -> float:
|
19
|
+
return 0.1
|
20
|
+
|
21
|
+
|
22
|
+
@pytest.fixture
|
23
|
+
def inclination() -> Angle:
|
24
|
+
return Angle.degrees(35.0)
|
25
|
+
|
26
|
+
|
27
|
+
@pytest.fixture
|
28
|
+
def raan() -> Angle:
|
29
|
+
return Angle.degrees(40.0)
|
30
|
+
|
31
|
+
|
32
|
+
@pytest.fixture
|
33
|
+
def aop() -> Angle:
|
34
|
+
return Angle.degrees(50.0)
|
35
|
+
|
36
|
+
|
37
|
+
@pytest.fixture
|
38
|
+
def true_anomaly() -> Angle:
|
39
|
+
return Angle.degrees(60.0)
|
40
|
+
|
41
|
+
|
42
|
+
@pytest.fixture
|
43
|
+
def coe(
|
44
|
+
semi_major_axis: Length,
|
45
|
+
eccentricity: float,
|
46
|
+
inclination: Angle,
|
47
|
+
raan: Angle,
|
48
|
+
aop: Angle,
|
49
|
+
true_anomaly: Angle,
|
50
|
+
) -> COE:
|
51
|
+
return COE(semi_major_axis, eccentricity, inclination, raan, aop, true_anomaly)
|
52
|
+
|
53
|
+
|
54
|
+
class TestCOE:
|
55
|
+
def test_constructors(self):
|
56
|
+
a = Length.kilometers(7000.0)
|
57
|
+
e = 0.1
|
58
|
+
i = Angle.degrees(35.0)
|
59
|
+
raan = Angle.degrees(40.0)
|
60
|
+
aop = Angle.degrees(50.0)
|
61
|
+
nu = Angle.degrees(60.0)
|
62
|
+
|
63
|
+
coe: COE = COE(a, e, i, raan, aop, nu)
|
64
|
+
|
65
|
+
assert coe is not None
|
66
|
+
assert isinstance(coe, COE)
|
67
|
+
assert coe.is_defined()
|
68
|
+
|
69
|
+
coe: COE = COE.undefined()
|
70
|
+
|
71
|
+
assert coe is not None
|
72
|
+
assert isinstance(coe, COE)
|
73
|
+
assert coe.is_defined() is False
|
74
|
+
|
75
|
+
def test_comparators(
|
76
|
+
self,
|
77
|
+
coe: COE,
|
78
|
+
):
|
79
|
+
assert coe == coe
|
80
|
+
assert (coe != coe) is False
|
81
|
+
|
82
|
+
def test_getters(
|
83
|
+
self,
|
84
|
+
coe: COE,
|
85
|
+
semi_major_axis: Length,
|
86
|
+
eccentricity: float,
|
87
|
+
inclination: Angle,
|
88
|
+
raan: Angle,
|
89
|
+
aop: Angle,
|
90
|
+
true_anomaly: Angle,
|
91
|
+
):
|
92
|
+
assert coe.get_semi_major_axis() == semi_major_axis
|
93
|
+
assert coe.get_eccentricity() == eccentricity
|
94
|
+
assert coe.get_inclination() == inclination
|
95
|
+
assert coe.get_raan() == raan
|
96
|
+
assert coe.get_aop() == aop
|
97
|
+
assert coe.get_true_anomaly() == true_anomaly
|
98
|
+
assert coe.get_mean_anomaly() is not None
|
99
|
+
assert coe.get_eccentric_anomaly() is not None
|
100
|
+
assert coe.get_mean_motion(Earth.EGM2008.gravitational_parameter) is not None
|
101
|
+
assert coe.get_orbital_period(Earth.EGM2008.gravitational_parameter) is not None
|
102
|
+
assert coe.get_periapsis_radius() is not None
|
103
|
+
assert coe.get_apoapsis_radius() is not None
|
104
|
+
assert coe.get_semi_latus_rectum() is not None
|
105
|
+
assert coe.get_radial_distance() is not None
|
106
|
+
assert coe.get_angular_momentum(Earth.EGM2008.gravitational_parameter) is not None
|
107
|
+
assert coe.get_SI_vector(COE.AnomalyType.TrueAnomaly) is not None
|
108
|
+
assert coe.get_SI_vector(COE.AnomalyType.MeanAnomaly) is not None
|
109
|
+
assert coe.get_SI_vector(COE.AnomalyType.EccentricAnomaly) is not None
|
110
|
+
|
111
|
+
def test_anomaly_conversions(self):
|
112
|
+
assert (
|
113
|
+
COE.eccentric_anomaly_from_true_anomaly(Angle.degrees(0.0), 0.0) is not None
|
114
|
+
)
|
115
|
+
assert (
|
116
|
+
COE.true_anomaly_from_eccentric_anomaly(Angle.degrees(0.0), 0.0) is not None
|
117
|
+
)
|
118
|
+
assert (
|
119
|
+
COE.mean_anomaly_from_eccentric_anomaly(Angle.degrees(0.0), 0.0) is not None
|
120
|
+
)
|
121
|
+
assert (
|
122
|
+
COE.eccentric_anomaly_from_mean_anomaly(Angle.degrees(0.0), 0.0, 0.0)
|
123
|
+
is not None
|
124
|
+
)
|
125
|
+
|
126
|
+
def test_compute_methods(self):
|
127
|
+
semi_latus_rectum: float = COE.compute_semi_latus_rectum(7000.0e3, 0.0)
|
128
|
+
assert semi_latus_rectum is not None
|
129
|
+
assert (
|
130
|
+
COE.compute_angular_momentum(
|
131
|
+
7000.0e3, 0.0, Earth.EGM2008.gravitational_parameter
|
132
|
+
)
|
133
|
+
is not None
|
134
|
+
)
|
135
|
+
assert (
|
136
|
+
COE.compute_angular_momentum(
|
137
|
+
semi_latus_rectum, Earth.EGM2008.gravitational_parameter
|
138
|
+
)
|
139
|
+
is not None
|
140
|
+
)
|
141
|
+
assert COE.compute_radial_distance(7000.0e3, 0.0, 0.0) is not None
|
142
|
+
|
143
|
+
def test_from_SI_vector(
|
144
|
+
self,
|
145
|
+
coe: COE,
|
146
|
+
semi_major_axis: Length,
|
147
|
+
eccentricity: float,
|
148
|
+
inclination: Angle,
|
149
|
+
raan: Angle,
|
150
|
+
aop: Angle,
|
151
|
+
true_anomaly: Angle,
|
152
|
+
):
|
153
|
+
assert coe == COE.from_SI_vector(
|
154
|
+
[
|
155
|
+
semi_major_axis.in_meters(),
|
156
|
+
eccentricity,
|
157
|
+
inclination.in_radians(),
|
158
|
+
raan.in_radians(),
|
159
|
+
aop.in_radians(),
|
160
|
+
true_anomaly.in_radians(),
|
161
|
+
],
|
162
|
+
COE.AnomalyType.TrueAnomaly,
|
163
|
+
)
|
164
|
+
|
165
|
+
def test_string_from_element(self):
|
166
|
+
element_str = COE.string_from_element(COE.Element.SemiMajorAxis)
|
167
|
+
assert element_str == "SemiMajorAxis"
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import tempfile
|
6
|
+
|
7
|
+
from ostk.core.filesystem import Path
|
8
|
+
from ostk.core.filesystem import File
|
9
|
+
|
10
|
+
from ostk.physics.unit import Time
|
11
|
+
from ostk.physics.unit import Angle
|
12
|
+
from ostk.physics.unit import Derived
|
13
|
+
from ostk.physics.time import Instant
|
14
|
+
from ostk.physics.time import Scale
|
15
|
+
from ostk.physics.time import DateTime
|
16
|
+
|
17
|
+
from ostk.astrodynamics.trajectory.orbit.model.sgp4 import TLE
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.fixture
|
21
|
+
def tle() -> TLE:
|
22
|
+
return TLE(
|
23
|
+
satellite_name="Satellite",
|
24
|
+
first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
|
25
|
+
second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
|
26
|
+
)
|
27
|
+
|
28
|
+
|
29
|
+
class TestTLE:
|
30
|
+
def test_constructor(self):
|
31
|
+
tle = TLE(
|
32
|
+
first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
|
33
|
+
second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
|
34
|
+
)
|
35
|
+
|
36
|
+
assert isinstance(tle, TLE)
|
37
|
+
|
38
|
+
def test_constructor_with_satellite_name(self):
|
39
|
+
tle = TLE(
|
40
|
+
satellite_name="Satellite",
|
41
|
+
first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
|
42
|
+
second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
|
43
|
+
)
|
44
|
+
|
45
|
+
assert isinstance(tle, TLE)
|
46
|
+
|
47
|
+
def test_comparators(self, tle: TLE):
|
48
|
+
assert (tle == tle) is True
|
49
|
+
assert (tle != tle) is False
|
50
|
+
|
51
|
+
def test_is_defined(self, tle: TLE):
|
52
|
+
assert tle.is_defined()
|
53
|
+
|
54
|
+
def test_get_satellite_name(self, tle: TLE):
|
55
|
+
assert tle.get_satellite_name() == "Satellite"
|
56
|
+
|
57
|
+
def test_get_first_line(self, tle: TLE):
|
58
|
+
assert (
|
59
|
+
tle.get_first_line()
|
60
|
+
== "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
|
61
|
+
)
|
62
|
+
|
63
|
+
def test_get_second_line(self, tle: TLE):
|
64
|
+
assert (
|
65
|
+
tle.get_second_line()
|
66
|
+
== "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316"
|
67
|
+
)
|
68
|
+
|
69
|
+
def test_get_satellite_number(self, tle: TLE):
|
70
|
+
assert tle.get_satellite_number() == 25544
|
71
|
+
|
72
|
+
def test_get_classification(self, tle: TLE):
|
73
|
+
assert tle.get_classification() == "U"
|
74
|
+
|
75
|
+
def test_get_international_designator(self, tle: TLE):
|
76
|
+
assert tle.get_international_designator() == "98067A"
|
77
|
+
|
78
|
+
def test_get_epoch(self, tle: TLE):
|
79
|
+
assert tle.get_epoch() == Instant.date_time(
|
80
|
+
DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
|
81
|
+
)
|
82
|
+
|
83
|
+
def test_get_mean_motion_first_time_derivative_divided_by_two(self, tle: TLE):
|
84
|
+
assert (
|
85
|
+
tle.get_mean_motion_first_time_derivative_divided_by_two()
|
86
|
+
== 1.8700000000000001e-06
|
87
|
+
)
|
88
|
+
|
89
|
+
def test_get_mean_motion_second_time_derivative_divided_by_six(self, tle: TLE):
|
90
|
+
assert tle.get_mean_motion_second_time_derivative_divided_by_six() == 0.0
|
91
|
+
|
92
|
+
def test_get_b_star_drag_term(self, tle: TLE):
|
93
|
+
assert tle.get_b_star_drag_term() == 1.0196e-05
|
94
|
+
|
95
|
+
def test_get_ephemeris_type(self, tle: TLE):
|
96
|
+
assert tle.get_ephemeris_type() == 0
|
97
|
+
|
98
|
+
def test_get_element_set_number(self, tle: TLE):
|
99
|
+
assert tle.get_element_set_number() == 999
|
100
|
+
|
101
|
+
def test_get_first_line_checksum(self, tle: TLE):
|
102
|
+
assert tle.get_first_line_checksum() == 4
|
103
|
+
|
104
|
+
def test_get_inclination(self, tle: TLE):
|
105
|
+
assert tle.get_inclination().in_degrees() == 51.6447
|
106
|
+
|
107
|
+
def test_get_raan(self, tle: TLE):
|
108
|
+
assert tle.get_raan().in_degrees() == 64.782399999999996
|
109
|
+
|
110
|
+
def test_get_eccentricity(self, tle: TLE):
|
111
|
+
assert tle.get_eccentricity() == 0.00059710000000000004
|
112
|
+
|
113
|
+
def test_get_aop(self, tle: TLE):
|
114
|
+
assert tle.get_aop().in_degrees() == 73.146699999999996
|
115
|
+
|
116
|
+
def test_get_mean_anomaly(self, tle: TLE):
|
117
|
+
assert tle.get_mean_anomaly().in_degrees() == 36.436599999999999
|
118
|
+
|
119
|
+
def test_get_mean_motion(self, tle: TLE):
|
120
|
+
assert (
|
121
|
+
tle.get_mean_motion().in_unit(
|
122
|
+
Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day)
|
123
|
+
)
|
124
|
+
== 15.53848234
|
125
|
+
)
|
126
|
+
|
127
|
+
def test_get_revolution_number_at_epoch(self, tle: TLE):
|
128
|
+
assert tle.get_revolution_number_at_epoch() == 12831
|
129
|
+
|
130
|
+
def test_get_second_line_checksum(self, tle: TLE):
|
131
|
+
assert tle.get_second_line_checksum() == 6
|
132
|
+
|
133
|
+
def test_set_satellite_number(self, tle: TLE):
|
134
|
+
tle.set_satellite_number(99959)
|
135
|
+
|
136
|
+
assert tle.get_satellite_number() == 99959
|
137
|
+
|
138
|
+
tle.set_satellite_number(25544)
|
139
|
+
|
140
|
+
assert tle.get_satellite_number() == 25544
|
141
|
+
|
142
|
+
def test_set_epoch(self, tle: TLE):
|
143
|
+
tle.set_epoch(
|
144
|
+
Instant.date_time(DateTime(2019, 9, 20, 5, 18, 28, 232, 361, 0), Scale.UTC)
|
145
|
+
)
|
146
|
+
|
147
|
+
assert tle.get_epoch() == Instant.date_time(
|
148
|
+
DateTime(2019, 9, 20, 5, 18, 28, 231, 776, 0), Scale.UTC
|
149
|
+
)
|
150
|
+
|
151
|
+
tle.set_epoch(
|
152
|
+
Instant.date_time(DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC)
|
153
|
+
)
|
154
|
+
|
155
|
+
assert tle.get_epoch() == Instant.date_time(
|
156
|
+
DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
|
157
|
+
)
|
158
|
+
|
159
|
+
def test_set_revolution_number_at_epoch(self, tle: TLE):
|
160
|
+
tle.set_revolution_number_at_epoch(2345)
|
161
|
+
|
162
|
+
assert tle.get_revolution_number_at_epoch() == 2345
|
163
|
+
assert (
|
164
|
+
tle.get_first_line()
|
165
|
+
== "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
|
166
|
+
)
|
167
|
+
assert (
|
168
|
+
tle.get_second_line()
|
169
|
+
== "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234 23455"
|
170
|
+
)
|
171
|
+
|
172
|
+
tle.set_revolution_number_at_epoch(6)
|
173
|
+
|
174
|
+
assert tle.get_revolution_number_at_epoch() == 6
|
175
|
+
assert (
|
176
|
+
tle.get_first_line()
|
177
|
+
== "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
|
178
|
+
)
|
179
|
+
assert (
|
180
|
+
tle.get_second_line()
|
181
|
+
== "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234 67"
|
182
|
+
)
|
183
|
+
|
184
|
+
other_tle = TLE(
|
185
|
+
"1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995",
|
186
|
+
"2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975009992",
|
187
|
+
)
|
188
|
+
|
189
|
+
assert other_tle.get_revolution_number_at_epoch() == 999
|
190
|
+
|
191
|
+
other_tle.set_revolution_number_at_epoch(999)
|
192
|
+
|
193
|
+
assert other_tle.get_revolution_number_at_epoch() == 999
|
194
|
+
assert (
|
195
|
+
other_tle.get_first_line()
|
196
|
+
== "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
|
197
|
+
)
|
198
|
+
assert (
|
199
|
+
other_tle.get_second_line()
|
200
|
+
== "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 9992"
|
201
|
+
)
|
202
|
+
|
203
|
+
other_tle.set_revolution_number_at_epoch(9909)
|
204
|
+
|
205
|
+
assert other_tle.get_revolution_number_at_epoch() == 9909
|
206
|
+
assert (
|
207
|
+
other_tle.get_first_line()
|
208
|
+
== "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
|
209
|
+
)
|
210
|
+
assert (
|
211
|
+
other_tle.get_second_line()
|
212
|
+
== "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 99092"
|
213
|
+
)
|
214
|
+
|
215
|
+
other_tle.set_revolution_number_at_epoch(99)
|
216
|
+
|
217
|
+
assert other_tle.get_revolution_number_at_epoch() == 99
|
218
|
+
assert (
|
219
|
+
other_tle.get_first_line()
|
220
|
+
== "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
|
221
|
+
)
|
222
|
+
assert (
|
223
|
+
other_tle.get_second_line()
|
224
|
+
== "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 993"
|
225
|
+
)
|
226
|
+
|
227
|
+
def test_can_parse(self, tle: TLE):
|
228
|
+
assert TLE.can_parse(tle.get_first_line(), tle.get_second_line())
|
229
|
+
|
230
|
+
def test_parse(self, tle: TLE):
|
231
|
+
tle_lines: str = "\n".join(
|
232
|
+
[
|
233
|
+
str(tle.get_satellite_name()),
|
234
|
+
str(tle.get_first_line()),
|
235
|
+
str(tle.get_second_line()),
|
236
|
+
]
|
237
|
+
)
|
238
|
+
|
239
|
+
assert TLE.parse(tle_lines) == tle
|
240
|
+
|
241
|
+
def test_load(self, tle: TLE):
|
242
|
+
tle_lines: str = "\n".join(
|
243
|
+
[
|
244
|
+
str(tle.get_satellite_name()),
|
245
|
+
str(tle.get_first_line()),
|
246
|
+
str(tle.get_second_line()),
|
247
|
+
]
|
248
|
+
)
|
249
|
+
|
250
|
+
tle_file = tempfile.NamedTemporaryFile(suffix=".tle", delete=False)
|
251
|
+
tle_file.write(tle_lines.encode())
|
252
|
+
tle_file.close()
|
253
|
+
|
254
|
+
try:
|
255
|
+
assert TLE.load(File.path(Path.parse(tle_file.name))) == tle
|
256
|
+
|
257
|
+
finally:
|
258
|
+
File.path(Path.parse(tle_file.name)).remove()
|
259
|
+
|
260
|
+
def test_construct_with_satellite_name(self, tle: TLE):
|
261
|
+
constructed_tle = TLE.construct(
|
262
|
+
satellite_name="Satellite",
|
263
|
+
satellite_number=25544,
|
264
|
+
classification="U",
|
265
|
+
international_designator="98067A",
|
266
|
+
epoch=Instant.date_time(
|
267
|
+
DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
|
268
|
+
),
|
269
|
+
mean_motion_first_time_derivative_divided_by_two=1.8700000000000001e-06,
|
270
|
+
mean_motion_second_time_derivative_divided_by_six=0.0,
|
271
|
+
b_star_drag_term=1.0196e-05,
|
272
|
+
ephemeris_type=0,
|
273
|
+
element_set_number=999,
|
274
|
+
inclination=Angle.degrees(51.6447),
|
275
|
+
raan=Angle.degrees(64.782399999999996),
|
276
|
+
eccentricity=0.00059710000000000004,
|
277
|
+
aop=Angle.degrees(73.146699999999996),
|
278
|
+
mean_anomaly=Angle.degrees(36.436599999999999),
|
279
|
+
mean_motion=Derived(
|
280
|
+
15.53848234,
|
281
|
+
Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day),
|
282
|
+
),
|
283
|
+
revolution_number_at_epoch=12831,
|
284
|
+
)
|
285
|
+
|
286
|
+
assert constructed_tle == tle
|
287
|
+
|
288
|
+
def test_construct_without_satellite_name(self, tle: TLE):
|
289
|
+
constructed_tle = TLE.construct(
|
290
|
+
satellite_number=25544,
|
291
|
+
classification="U",
|
292
|
+
international_designator="98067A",
|
293
|
+
epoch=Instant.date_time(
|
294
|
+
DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
|
295
|
+
),
|
296
|
+
mean_motion_first_time_derivative_divided_by_two=1.8700000000000001e-06,
|
297
|
+
mean_motion_second_time_derivative_divided_by_six=0.0,
|
298
|
+
b_star_drag_term=1.0196e-05,
|
299
|
+
ephemeris_type=0,
|
300
|
+
element_set_number=999,
|
301
|
+
inclination=Angle.degrees(51.6447),
|
302
|
+
raan=Angle.degrees(64.782399999999996),
|
303
|
+
eccentricity=0.00059710000000000004,
|
304
|
+
aop=Angle.degrees(73.146699999999996),
|
305
|
+
mean_anomaly=Angle.degrees(36.436599999999999),
|
306
|
+
mean_motion=Derived(
|
307
|
+
15.53848234,
|
308
|
+
Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day),
|
309
|
+
),
|
310
|
+
revolution_number_at_epoch=12831,
|
311
|
+
)
|
312
|
+
|
313
|
+
assert constructed_tle.get_first_line() == tle.get_first_line()
|
314
|
+
assert constructed_tle.get_second_line() == tle.get_second_line()
|
315
|
+
|
316
|
+
def test_generate_checksum(self, tle: TLE):
|
317
|
+
assert (
|
318
|
+
TLE.generate_checksum(tle.get_first_line()) == tle.get_first_line_checksum()
|
319
|
+
)
|
320
|
+
assert (
|
321
|
+
TLE.generate_checksum(tle.get_second_line()) == tle.get_second_line_checksum()
|
322
|
+
)
|
323
|
+
|
324
|
+
assert (
|
325
|
+
TLE.generate_checksum(f"{str(tle.get_first_line())[:-1]}0")
|
326
|
+
== tle.get_first_line_checksum()
|
327
|
+
)
|
328
|
+
assert (
|
329
|
+
TLE.generate_checksum(f"{str(tle.get_second_line())[:-1]}9")
|
330
|
+
== tle.get_second_line_checksum()
|
331
|
+
)
|