open-space-toolkit-astrodynamics 13.1.0__py313-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-13.1.0.dist-info/METADATA +30 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/RECORD +100 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/WHEEL +5 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-313-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +11 -0
- ostk/astrodynamics/converters.py +130 -0
- ostk/astrodynamics/dataframe.py +479 -0
- ostk/astrodynamics/display.py +222 -0
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.13 +0 -0
- ostk/astrodynamics/pytrajectory/__init__.py +1 -0
- ostk/astrodynamics/pytrajectory/pystate.py +251 -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 +253 -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 +290 -0
- ostk/astrodynamics/test/test_dataframe.py +875 -0
- ostk/astrodynamics/test/test_display.py +114 -0
- ostk/astrodynamics/test/test_event_condition.py +78 -0
- ostk/astrodynamics/test/test_import.py +26 -0
- ostk/astrodynamics/test/test_root_solver.py +70 -0
- ostk/astrodynamics/test/test_trajectory.py +118 -0
- ostk/astrodynamics/test/test_utilities.py +106 -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 +201 -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 +75 -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 +108 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +205 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +458 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +403 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +530 -0
- ostk/astrodynamics/test/trajectory/test_state.py +543 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
- ostk/astrodynamics/utilities.py +247 -0
- ostk/astrodynamics/viewer.py +392 -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
|
+
)
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import ostk.physics as physics
|
4
|
+
|
5
|
+
import ostk.astrodynamics as astrodynamics
|
6
|
+
|
7
|
+
Length = physics.unit.Length
|
8
|
+
Angle = physics.unit.Angle
|
9
|
+
Scale = physics.time.Scale
|
10
|
+
Instant = physics.time.Instant
|
11
|
+
Interval = physics.time.Interval
|
12
|
+
DateTime = physics.time.DateTime
|
13
|
+
Position = physics.coordinate.Position
|
14
|
+
Velocity = physics.coordinate.Velocity
|
15
|
+
Frame = physics.coordinate.Frame
|
16
|
+
Environment = physics.Environment
|
17
|
+
|
18
|
+
Trajectory = astrodynamics.Trajectory
|
19
|
+
Model = astrodynamics.trajectory.Model
|
20
|
+
Orbit = astrodynamics.trajectory.Orbit
|
21
|
+
Pass = astrodynamics.trajectory.orbit.Pass
|
22
|
+
Kepler = astrodynamics.trajectory.orbit.model.Kepler
|
23
|
+
COE = astrodynamics.trajectory.orbit.model.kepler.COE
|
24
|
+
SGP4 = astrodynamics.trajectory.orbit.model.SGP4
|
25
|
+
TLE = astrodynamics.trajectory.orbit.model.sgp4.TLE
|
26
|
+
State = astrodynamics.trajectory.State
|
27
|
+
Access = astrodynamics.Access
|
28
|
+
|
29
|
+
earth = Environment.default().access_celestial_object_with_name("Earth")
|
30
|
+
|
31
|
+
|
32
|
+
def construct_kepler():
|
33
|
+
a = Length.kilometers(7000.0)
|
34
|
+
e = 0.1
|
35
|
+
i = Angle.degrees(35.0)
|
36
|
+
raan = Angle.degrees(40.0)
|
37
|
+
aop = Angle.degrees(50.0)
|
38
|
+
nu = Angle.degrees(60.0)
|
39
|
+
|
40
|
+
coe = COE(a, e, i, raan, aop, nu)
|
41
|
+
|
42
|
+
assert coe is not None
|
43
|
+
assert isinstance(coe, COE)
|
44
|
+
|
45
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
46
|
+
|
47
|
+
kepler = Kepler(coe, epoch, earth, Kepler.PerturbationType.No)
|
48
|
+
|
49
|
+
return kepler
|
50
|
+
|
51
|
+
|
52
|
+
def test_trajectory_orbit_models_kepler_constructors():
|
53
|
+
a = Length.kilometers(7000.0)
|
54
|
+
e = 0.1
|
55
|
+
i = Angle.degrees(35.0)
|
56
|
+
raan = Angle.degrees(40.0)
|
57
|
+
aop = Angle.degrees(50.0)
|
58
|
+
nu = Angle.degrees(60.0)
|
59
|
+
|
60
|
+
coe = COE(a, e, i, raan, aop, nu)
|
61
|
+
|
62
|
+
assert coe is not None
|
63
|
+
assert isinstance(coe, COE)
|
64
|
+
|
65
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
66
|
+
|
67
|
+
kepler = Kepler(coe, epoch, earth, Kepler.PerturbationType.No)
|
68
|
+
|
69
|
+
assert kepler is not None
|
70
|
+
assert isinstance(kepler, Kepler)
|
71
|
+
assert kepler.is_defined()
|
72
|
+
|
73
|
+
|
74
|
+
def test_trajectory_orbit_models_kepler_comparators():
|
75
|
+
kepler: Kepler = construct_kepler()
|
76
|
+
|
77
|
+
assert kepler == kepler
|
78
|
+
assert (kepler != kepler) is False
|
79
|
+
|
80
|
+
|
81
|
+
def test_trajectory_orbit_models_kepler_getters():
|
82
|
+
kepler: Kepler = construct_kepler()
|
83
|
+
|
84
|
+
# get_classical_orbital_elements
|
85
|
+
|
86
|
+
assert kepler.get_classical_orbital_elements() is not None
|
87
|
+
|
88
|
+
# get_epoch
|
89
|
+
|
90
|
+
assert kepler.get_epoch() is not None
|
91
|
+
|
92
|
+
# get_revolution_number_at_epoch()
|
93
|
+
|
94
|
+
assert kepler.get_revolution_number_at_epoch() is not None
|
95
|
+
|
96
|
+
# get_gravitational_parameter()
|
97
|
+
|
98
|
+
assert kepler.get_gravitational_parameter() is not None
|
99
|
+
|
100
|
+
# get_equatorial_radius()
|
101
|
+
|
102
|
+
assert kepler.get_equatorial_radius() is not None
|
103
|
+
|
104
|
+
# get_j2()
|
105
|
+
|
106
|
+
assert kepler.get_j2() is not None
|
107
|
+
|
108
|
+
# get_j4()
|
109
|
+
|
110
|
+
assert kepler.get_j4() is not None
|
111
|
+
|
112
|
+
# get_perturbation_type()
|
113
|
+
|
114
|
+
assert kepler.get_perturbation_type() is not None
|
115
|
+
|
116
|
+
|
117
|
+
def test_trajectory_orbit_models_kepler_calculate_state_at_epoch():
|
118
|
+
kepler: Kepler = construct_kepler()
|
119
|
+
|
120
|
+
epoch: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
121
|
+
|
122
|
+
assert kepler.calculate_state_at(epoch) is not None
|
123
|
+
|
124
|
+
|
125
|
+
def test_trajectory_orbit_models_kepler_calculate_rev_number_at_epoch():
|
126
|
+
kepler: Kepler = construct_kepler()
|
127
|
+
|
128
|
+
epoch: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
129
|
+
|
130
|
+
assert kepler.calculate_revolution_number_at(epoch) is not None
|
@@ -0,0 +1,234 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
from ostk.physics.time import Instant
|
8
|
+
from ostk.physics.time import DateTime
|
9
|
+
from ostk.physics.time import Scale
|
10
|
+
from ostk.physics.coordinate import Position
|
11
|
+
from ostk.physics.coordinate import Velocity
|
12
|
+
from ostk.physics.coordinate import Frame
|
13
|
+
from ostk.physics.environment.object.celestial import Earth
|
14
|
+
|
15
|
+
from ostk.astrodynamics.trajectory.state import NumericalSolver
|
16
|
+
from ostk.astrodynamics.trajectory import State
|
17
|
+
from ostk.astrodynamics.trajectory import Orbit
|
18
|
+
from ostk.astrodynamics.trajectory import Propagator
|
19
|
+
from ostk.astrodynamics import Dynamics
|
20
|
+
from ostk.astrodynamics.dynamics import CentralBodyGravity
|
21
|
+
from ostk.astrodynamics.dynamics import PositionDerivative
|
22
|
+
from ostk.astrodynamics.trajectory.orbit.model import Propagated
|
23
|
+
|
24
|
+
|
25
|
+
@pytest.fixture
|
26
|
+
def state() -> State:
|
27
|
+
frame: Frame = Frame.GCRF()
|
28
|
+
position: Position = Position.meters([7500000.0, 0.0, 0.0], frame)
|
29
|
+
velocity: Velocity = Velocity.meters_per_second(
|
30
|
+
[0.0, 5335.865450622126, 5335.865450622126], frame
|
31
|
+
)
|
32
|
+
|
33
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
34
|
+
return State(instant, position, velocity)
|
35
|
+
|
36
|
+
|
37
|
+
@pytest.fixture
|
38
|
+
def central_body_dynamics() -> CentralBodyGravity:
|
39
|
+
return CentralBodyGravity(Earth.WGS84(20, 0))
|
40
|
+
|
41
|
+
|
42
|
+
@pytest.fixture
|
43
|
+
def position_derivative() -> PositionDerivative:
|
44
|
+
return PositionDerivative()
|
45
|
+
|
46
|
+
|
47
|
+
@pytest.fixture
|
48
|
+
def dynamics(
|
49
|
+
position_derivative: PositionDerivative, central_body_dynamics: CentralBodyGravity
|
50
|
+
) -> list:
|
51
|
+
return [position_derivative, central_body_dynamics]
|
52
|
+
|
53
|
+
|
54
|
+
@pytest.fixture
|
55
|
+
def numerical_solver() -> NumericalSolver:
|
56
|
+
return NumericalSolver(
|
57
|
+
NumericalSolver.LogType.NoLog,
|
58
|
+
NumericalSolver.StepperType.RungeKuttaFehlberg78,
|
59
|
+
5.0,
|
60
|
+
1.0e-15,
|
61
|
+
1.0e-15,
|
62
|
+
)
|
63
|
+
|
64
|
+
|
65
|
+
@pytest.fixture
|
66
|
+
def propagator(numerical_solver: NumericalSolver, dynamics: list[Dynamics]) -> Propagator:
|
67
|
+
return Propagator(numerical_solver, dynamics)
|
68
|
+
|
69
|
+
|
70
|
+
@pytest.fixture
|
71
|
+
def revolution_number() -> int:
|
72
|
+
return 5
|
73
|
+
|
74
|
+
|
75
|
+
@pytest.fixture
|
76
|
+
def propagated(
|
77
|
+
propagator: Propagator, state: State, revolution_number: int
|
78
|
+
) -> Propagated:
|
79
|
+
return Propagated(propagator, state, revolution_number)
|
80
|
+
|
81
|
+
|
82
|
+
@pytest.fixture
|
83
|
+
def earth() -> Earth:
|
84
|
+
return Earth.spherical()
|
85
|
+
|
86
|
+
|
87
|
+
@pytest.fixture
|
88
|
+
def orbit(propagated: Propagated, earth: Earth) -> Orbit:
|
89
|
+
return Orbit(propagated, earth)
|
90
|
+
|
91
|
+
|
92
|
+
class TestPropagated:
|
93
|
+
def test_constructors(
|
94
|
+
self,
|
95
|
+
propagated: Propagated,
|
96
|
+
earth: Earth,
|
97
|
+
dynamics: list,
|
98
|
+
numerical_solver: NumericalSolver,
|
99
|
+
state: State,
|
100
|
+
):
|
101
|
+
assert propagated is not None
|
102
|
+
assert isinstance(propagated, Propagated)
|
103
|
+
assert propagated.is_defined()
|
104
|
+
|
105
|
+
orbit = Orbit(propagated, earth)
|
106
|
+
|
107
|
+
assert orbit is not None
|
108
|
+
assert isinstance(orbit, Orbit)
|
109
|
+
assert orbit.is_defined()
|
110
|
+
|
111
|
+
state_array = [state, state]
|
112
|
+
propagated_with_state_array = Propagated(
|
113
|
+
Propagator(numerical_solver, dynamics), state_array
|
114
|
+
)
|
115
|
+
|
116
|
+
assert propagated_with_state_array is not None
|
117
|
+
assert isinstance(propagated_with_state_array, Propagated)
|
118
|
+
assert propagated_with_state_array.is_defined()
|
119
|
+
|
120
|
+
def test_comparators(
|
121
|
+
self,
|
122
|
+
propagated: Propagated,
|
123
|
+
):
|
124
|
+
assert (propagated == propagated) is True
|
125
|
+
assert (propagated != propagated) is False
|
126
|
+
|
127
|
+
def test_getters(
|
128
|
+
self,
|
129
|
+
propagated: Propagated,
|
130
|
+
state: State,
|
131
|
+
revolution_number: int,
|
132
|
+
):
|
133
|
+
assert propagated.get_epoch() == state.get_instant()
|
134
|
+
|
135
|
+
assert propagated.get_revolution_number_at_epoch() == revolution_number
|
136
|
+
|
137
|
+
assert propagated.access_cached_state_array() == [state]
|
138
|
+
|
139
|
+
def test_calculate_state_at(
|
140
|
+
self,
|
141
|
+
propagated: Propagated,
|
142
|
+
orbit: Orbit,
|
143
|
+
):
|
144
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC)
|
145
|
+
|
146
|
+
propagated_state = propagated.calculate_state_at(instant)
|
147
|
+
propagated_state_orbit = orbit.get_state_at(instant)
|
148
|
+
|
149
|
+
assert propagated_state == propagated_state_orbit
|
150
|
+
|
151
|
+
propagated_state_position_ref = np.array(
|
152
|
+
[6265892.25765909, 3024770.94961259, 3024359.72137468]
|
153
|
+
)
|
154
|
+
propagated_state_velocity_ref = np.array(
|
155
|
+
[-3974.49168221, 4468.16996776, 4466.19232746]
|
156
|
+
)
|
157
|
+
|
158
|
+
propagated_state_position = propagated_state.get_position().get_coordinates()
|
159
|
+
propagated_state_velocity = propagated_state.get_velocity().get_coordinates()
|
160
|
+
|
161
|
+
assert all(
|
162
|
+
[
|
163
|
+
round(propagated_state_position[i], 8)
|
164
|
+
== round(propagated_state_position_ref[i], 8)
|
165
|
+
for i in range(0, len(propagated_state_position_ref))
|
166
|
+
]
|
167
|
+
)
|
168
|
+
assert all(
|
169
|
+
[
|
170
|
+
round(propagated_state_velocity[i], 8)
|
171
|
+
== round(propagated_state_velocity_ref[i], 8)
|
172
|
+
for i in range(0, len(propagated_state_velocity_ref))
|
173
|
+
]
|
174
|
+
)
|
175
|
+
assert propagated_state.get_instant() == instant
|
176
|
+
|
177
|
+
def test_calculate_states_at(
|
178
|
+
self,
|
179
|
+
propagated: Propagated,
|
180
|
+
orbit: Orbit,
|
181
|
+
):
|
182
|
+
instant_array = [
|
183
|
+
Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC),
|
184
|
+
Instant.date_time(DateTime(2018, 1, 1, 0, 20, 0), Scale.UTC),
|
185
|
+
]
|
186
|
+
|
187
|
+
propagated_state_array = propagated.calculate_states_at(instant_array)
|
188
|
+
propagated_state_array_orbit = orbit.get_states_at(instant_array)
|
189
|
+
|
190
|
+
assert propagated_state_array_orbit == propagated_state_array
|
191
|
+
|
192
|
+
assert propagated_state_array_orbit[0].get_instant() == instant_array[0]
|
193
|
+
assert propagated_state_array_orbit[1].get_instant() == instant_array[1]
|
194
|
+
|
195
|
+
def test_calculate_revolution_number_at(
|
196
|
+
self,
|
197
|
+
propagated: Propagated,
|
198
|
+
orbit: Orbit,
|
199
|
+
revolution_number: int,
|
200
|
+
):
|
201
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 40, 0), Scale.UTC)
|
202
|
+
|
203
|
+
assert propagated.calculate_revolution_number_at(instant) == revolution_number + 1
|
204
|
+
assert orbit.get_revolution_number_at(instant) == revolution_number + 1
|
205
|
+
|
206
|
+
def test_access_cached_state_array(
|
207
|
+
self,
|
208
|
+
propagated: Propagated,
|
209
|
+
state: State,
|
210
|
+
):
|
211
|
+
assert len(propagated.access_cached_state_array()) == 1
|
212
|
+
assert propagated.access_cached_state_array()[0] == state
|
213
|
+
|
214
|
+
def test_access_propagator(
|
215
|
+
self,
|
216
|
+
propagated: Propagated,
|
217
|
+
):
|
218
|
+
assert propagated.access_propagator() is not None
|
219
|
+
assert isinstance(propagated.access_propagator(), Propagator)
|
220
|
+
|
221
|
+
def test_set_cached_state_array(
|
222
|
+
self,
|
223
|
+
propagated: Propagated,
|
224
|
+
state: State,
|
225
|
+
):
|
226
|
+
assert len(propagated.access_cached_state_array()) == 1
|
227
|
+
|
228
|
+
propagated.set_cached_state_array([state, state, state])
|
229
|
+
|
230
|
+
assert len(propagated.access_cached_state_array()) == 1
|
231
|
+
assert propagated.access_cached_state_array()[0] == state
|
232
|
+
|
233
|
+
with pytest.raises(Exception) as e:
|
234
|
+
propagated.set_cached_state_array([])
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|