open-space-toolkit-astrodynamics 12.0.1__py39-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.
Files changed (100) hide show
  1. open_space_toolkit_astrodynamics-12.0.1.dist-info/METADATA +30 -0
  2. open_space_toolkit_astrodynamics-12.0.1.dist-info/RECORD +100 -0
  3. open_space_toolkit_astrodynamics-12.0.1.dist-info/WHEEL +5 -0
  4. open_space_toolkit_astrodynamics-12.0.1.dist-info/top_level.txt +1 -0
  5. open_space_toolkit_astrodynamics-12.0.1.dist-info/zip-safe +1 -0
  6. ostk/__init__.py +1 -0
  7. ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-39-x86_64-linux-gnu.so +0 -0
  8. ostk/astrodynamics/__init__.py +11 -0
  9. ostk/astrodynamics/converters.py +128 -0
  10. ostk/astrodynamics/dataframe.py +477 -0
  11. ostk/astrodynamics/display.py +220 -0
  12. ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.12 +0 -0
  13. ostk/astrodynamics/pytrajectory/__init__.py +1 -0
  14. ostk/astrodynamics/pytrajectory/pystate.py +196 -0
  15. ostk/astrodynamics/test/__init__.py +1 -0
  16. ostk/astrodynamics/test/access/__init__.py +1 -0
  17. ostk/astrodynamics/test/access/test_generator.py +248 -0
  18. ostk/astrodynamics/test/conftest.py +119 -0
  19. ostk/astrodynamics/test/conjunction/message/ccsds/__init__.py +1 -0
  20. ostk/astrodynamics/test/conjunction/message/ccsds/conftest.py +325 -0
  21. ostk/astrodynamics/test/conjunction/message/ccsds/data/cdm.json +303 -0
  22. ostk/astrodynamics/test/conjunction/message/ccsds/test_cdm.py +416 -0
  23. ostk/astrodynamics/test/dynamics/__init__.py +1 -0
  24. ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity.csv +565 -0
  25. ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity_Truth.csv +100 -0
  26. ostk/astrodynamics/test/dynamics/test_atmospheric_drag.py +128 -0
  27. ostk/astrodynamics/test/dynamics/test_central_body_gravity.py +58 -0
  28. ostk/astrodynamics/test/dynamics/test_dynamics.py +50 -0
  29. ostk/astrodynamics/test/dynamics/test_position_derivative.py +51 -0
  30. ostk/astrodynamics/test/dynamics/test_tabulated.py +138 -0
  31. ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
  32. ostk/astrodynamics/test/dynamics/test_thruster.py +142 -0
  33. ostk/astrodynamics/test/event_condition/test_angular_condition.py +113 -0
  34. ostk/astrodynamics/test/event_condition/test_boolean_condition.py +55 -0
  35. ostk/astrodynamics/test/event_condition/test_coe_condition.py +87 -0
  36. ostk/astrodynamics/test/event_condition/test_instant_condition.py +48 -0
  37. ostk/astrodynamics/test/event_condition/test_logical_condition.py +120 -0
  38. ostk/astrodynamics/test/event_condition/test_real_condition.py +50 -0
  39. ostk/astrodynamics/test/flight/__init__.py +1 -0
  40. ostk/astrodynamics/test/flight/system/__init__.py +1 -0
  41. ostk/astrodynamics/test/flight/system/test_propulsion_system.py +73 -0
  42. ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
  43. ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
  44. ostk/astrodynamics/test/flight/test_maneuver.py +212 -0
  45. ostk/astrodynamics/test/flight/test_profile.py +242 -0
  46. ostk/astrodynamics/test/flight/test_system.py +55 -0
  47. ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
  48. ostk/astrodynamics/test/guidance_law/test_qlaw.py +138 -0
  49. ostk/astrodynamics/test/solvers/__init__.py +1 -0
  50. ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
  51. ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
  52. ostk/astrodynamics/test/test_access.py +128 -0
  53. ostk/astrodynamics/test/test_converters.py +290 -0
  54. ostk/astrodynamics/test/test_dataframe.py +875 -0
  55. ostk/astrodynamics/test/test_display.py +114 -0
  56. ostk/astrodynamics/test/test_event_condition.py +58 -0
  57. ostk/astrodynamics/test/test_import.py +26 -0
  58. ostk/astrodynamics/test/test_root_solver.py +70 -0
  59. ostk/astrodynamics/test/test_trajectory.py +40 -0
  60. ostk/astrodynamics/test/test_utilities.py +106 -0
  61. ostk/astrodynamics/test/test_viewer.py +129 -0
  62. ostk/astrodynamics/test/trajectory/__init__.py +1 -0
  63. ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
  64. ostk/astrodynamics/test/trajectory/orbit/message/__init__.py +1 -0
  65. ostk/astrodynamics/test/trajectory/orbit/message/spacex/__init__.py +1 -0
  66. ostk/astrodynamics/test/trajectory/orbit/message/spacex/conftest.py +18 -0
  67. ostk/astrodynamics/test/trajectory/orbit/message/spacex/data/opm_1.yaml +44 -0
  68. ostk/astrodynamics/test/trajectory/orbit/message/spacex/test_opm.py +108 -0
  69. ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +1 -0
  70. ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +1 -0
  71. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean.py +65 -0
  72. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_long.py +102 -0
  73. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_short.py +102 -0
  74. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +167 -0
  75. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
  76. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
  77. ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
  78. ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +234 -0
  79. ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +1 -0
  80. ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +380 -0
  81. ostk/astrodynamics/test/trajectory/orbit/test_model.py +1 -0
  82. ostk/astrodynamics/test/trajectory/orbit/test_pass.py +75 -0
  83. ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_angular_velocity.py +30 -0
  84. ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_attitude_quaternion.py +18 -0
  85. ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_position.py +107 -0
  86. ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_velocity.py +115 -0
  87. ostk/astrodynamics/test/trajectory/state/test_coordinate_broker.py +84 -0
  88. ostk/astrodynamics/test/trajectory/state/test_coordinate_subset.py +46 -0
  89. ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
  90. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
  91. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +108 -0
  92. ostk/astrodynamics/test/trajectory/test_model.py +1 -0
  93. ostk/astrodynamics/test/trajectory/test_orbit.py +196 -0
  94. ostk/astrodynamics/test/trajectory/test_propagator.py +458 -0
  95. ostk/astrodynamics/test/trajectory/test_segment.py +305 -0
  96. ostk/astrodynamics/test/trajectory/test_sequence.py +477 -0
  97. ostk/astrodynamics/test/trajectory/test_state.py +375 -0
  98. ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
  99. ostk/astrodynamics/utilities.py +245 -0
  100. ostk/astrodynamics/viewer.py +392 -0
@@ -0,0 +1,380 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ from ostk.mathematics.curve_fitting import Interpolator
8
+
9
+ from ostk.physics.time import Instant
10
+ from ostk.physics.time import DateTime
11
+ from ostk.physics.time import Scale
12
+ from ostk.physics.time import Duration
13
+ from ostk.physics.coordinate import Position
14
+ from ostk.physics.coordinate import Velocity
15
+ from ostk.physics.coordinate import Frame
16
+ from ostk.physics import Environment
17
+
18
+ from ostk.astrodynamics.trajectory import State
19
+ from ostk.astrodynamics.trajectory import Orbit
20
+ from ostk.astrodynamics.trajectory.orbit.model import Tabulated
21
+
22
+
23
+ @pytest.fixture
24
+ def earth():
25
+ return Environment.default().access_celestial_object_with_name("Earth")
26
+
27
+
28
+ @pytest.fixture
29
+ def reference_states() -> list[State]:
30
+ data = [
31
+ [
32
+ "2023-04-18T08:28:32.744064",
33
+ -3310024.847608758,
34
+ -6052528.239971979,
35
+ 7626.534641683145,
36
+ -855.2088930507367,
37
+ 495.9541573743367,
38
+ 7536.520188134902,
39
+ ],
40
+ [
41
+ "2023-04-18T08:28:33.744064",
42
+ -3310878.047628086,
43
+ -6052028.610429457,
44
+ 15163.0493833017,
45
+ -851.1838953959017,
46
+ 503.31279367207185,
47
+ 7536.506322816037,
48
+ ],
49
+ [
50
+ "2023-04-18T08:28:34.744064",
51
+ -3311727.222133691,
52
+ -6051521.622540367,
53
+ 22699.545682944226,
54
+ -847.1578341126227,
55
+ 510.67087060642456,
56
+ 7536.483268627912,
57
+ ],
58
+ [
59
+ "2023-04-18T08:28:35.744064",
60
+ -3312572.370064364,
61
+ -6051007.276868478,
62
+ 30236.014351773065,
63
+ -843.1307141262514,
64
+ 518.0283791399937,
65
+ 7536.451025467619,
66
+ ],
67
+ [
68
+ "2023-04-18T08:28:36.744064",
69
+ -3313413.490363804,
70
+ -6050485.573986613,
71
+ 37772.44620082258,
72
+ -839.1025403636198,
73
+ 525.3853102358,
74
+ 7536.40959324377,
75
+ ],
76
+ [
77
+ "2023-04-18T08:28:37.744064",
78
+ -3314250.5819806806,
79
+ -6049956.514476612,
80
+ 45308.83204108345,
81
+ -835.0733177529921,
82
+ 532.7416548573802,
83
+ 7536.358971876497,
84
+ ],
85
+ [
86
+ "2023-04-18T08:28:38.744064",
87
+ -3315083.6438685474,
88
+ -6049420.098929363,
89
+ 52845.16268340493,
90
+ -831.0430512241197,
91
+ 540.0974039686765,
92
+ 7536.299161297429,
93
+ ],
94
+ [
95
+ "2023-04-18T08:28:39.744064",
96
+ -3315912.6749859042,
97
+ -6048876.327944793,
98
+ 60381.42893867038,
99
+ -827.0117457081434,
100
+ 547.4525485342174,
101
+ 7536.23016144972,
102
+ ],
103
+ [
104
+ "2023-04-18T08:28:40.744064",
105
+ -3316737.6742961914,
106
+ -6048325.2021318525,
107
+ 67917.62161760827,
108
+ -822.9794061376964,
109
+ 554.8070795189376,
110
+ 7536.1519722880375,
111
+ ],
112
+ [
113
+ "2023-04-18T08:28:41.744064",
114
+ -3317558.640767768,
115
+ -6047766.722108539,
116
+ 75453.73153099201,
117
+ -818.9460374467976,
118
+ 562.1609878883643,
119
+ 7536.064593778564,
120
+ ],
121
+ [
122
+ "2023-04-18T08:28:42.744064",
123
+ -3318375.5733739412,
124
+ -6047200.888501875,
125
+ 82989.7494894997,
126
+ -814.9116445709234,
127
+ 569.5142646084902,
128
+ 7535.968025898996,
129
+ ],
130
+ [
131
+ "2023-04-18T08:28:43.744064",
132
+ -3319188.471092942,
133
+ -6046627.7019479135,
134
+ 90525.66630384693,
135
+ -810.8762324469382,
136
+ 576.866900645898,
137
+ 7535.862268638544,
138
+ ],
139
+ [
140
+ "2023-04-18T08:28:44.744064",
141
+ -3319997.332907958,
142
+ -6046047.163091751,
143
+ 98061.47278470133,
144
+ -806.8398060131411,
145
+ 584.2188869676824,
146
+ 7535.747321997941,
147
+ ],
148
+ [
149
+ "2023-04-18T08:28:45.744064",
150
+ -3320802.157807084,
151
+ -6045459.272587514,
152
+ 105597.15974279115,
153
+ -802.8023702092072,
154
+ 591.5702145415504,
155
+ 7535.62318598943,
156
+ ],
157
+ [
158
+ "2023-04-18T08:28:46.744064",
159
+ -3321602.9447833803,
160
+ -6044864.0310983565,
161
+ 113132.71798877101,
162
+ -798.7639299762548,
163
+ 598.9208743356983,
164
+ 7535.48986063679,
165
+ ],
166
+ [
167
+ "2023-04-18T08:28:47.744064",
168
+ -3322399.692834845,
169
+ -6044261.439296465,
170
+ 120668.13833342775,
171
+ -794.7244902567405,
172
+ 606.2708573190106,
173
+ 7535.347345975296,
174
+ ],
175
+ [
176
+ "2023-04-18T08:28:48.744064",
177
+ -3323192.400964402,
178
+ -6043651.497863061,
179
+ 128203.41158748553,
180
+ -790.6840559945587,
181
+ 613.6201544608678,
182
+ 7535.195642051765,
183
+ ],
184
+ [
185
+ "2023-04-18T08:28:49.744064",
186
+ -3323981.068179951,
187
+ -6043034.207488383,
188
+ 135738.52856182377,
189
+ -786.6426321349277,
190
+ 620.9687567313651,
191
+ 7535.034748924513,
192
+ ],
193
+ [
194
+ "2023-04-18T08:28:50.744064",
195
+ -3324765.6934943097,
196
+ -6042409.568871722,
197
+ 143273.48006733102,
198
+ -782.6002236244674,
199
+ 628.3166551011666,
200
+ 7534.864666663388,
201
+ ],
202
+ [
203
+ "2023-04-18T08:28:51.744064",
204
+ -3325546.2759252544,
205
+ -6041777.582721372,
206
+ 150808.25691495842,
207
+ -778.5568354111685,
208
+ 635.6638405415614,
209
+ 7534.68539534976,
210
+ ],
211
+ ]
212
+ return [
213
+ State(
214
+ instant=Instant.date_time(DateTime.parse(row[0]), Scale.UTC),
215
+ position=Position.meters(
216
+ [float(row[1]), float(row[2]), float(row[3])], Frame.GCRF()
217
+ ),
218
+ velocity=Velocity.meters_per_second(
219
+ [float(row[4]), float(row[5]), float(row[6])], Frame.GCRF()
220
+ ),
221
+ )
222
+ for row in data
223
+ ]
224
+
225
+
226
+ @pytest.fixture
227
+ def test_states(reference_states: list[State]) -> list[State]:
228
+ return reference_states[::4]
229
+
230
+
231
+ class TestTabulated:
232
+ @pytest.mark.parametrize(
233
+ "interpolation_type",
234
+ (
235
+ (Interpolator.Type.Linear),
236
+ (Interpolator.Type.CubicSpline),
237
+ (Interpolator.Type.BarycentricRational),
238
+ ),
239
+ )
240
+ def test_constructor(
241
+ self, test_states: list[State], interpolation_type: Interpolator.Type
242
+ ):
243
+ assert (
244
+ Tabulated(
245
+ states=test_states,
246
+ initial_revolution_number=1,
247
+ interpolation_type=interpolation_type,
248
+ )
249
+ is not None
250
+ )
251
+
252
+ def test_constructor_orbit_tabulated_sucess(
253
+ self,
254
+ test_states: list[State],
255
+ earth,
256
+ ):
257
+ tabulated = Tabulated(
258
+ states=test_states,
259
+ initial_revolution_number=1,
260
+ interpolation_type=Interpolator.Type.CubicSpline,
261
+ )
262
+
263
+ orbit: Orbit = Orbit(tabulated, earth)
264
+
265
+ assert orbit is not None
266
+ assert isinstance(orbit, Orbit)
267
+
268
+ def test_get_interpolation_type(self, test_states: list[State]):
269
+ tabulated = Tabulated(
270
+ states=test_states,
271
+ initial_revolution_number=1,
272
+ interpolation_type=Interpolator.Type.CubicSpline,
273
+ )
274
+
275
+ assert tabulated.get_interpolation_type() == Interpolator.Type.CubicSpline
276
+
277
+ @pytest.mark.parametrize(
278
+ "interpolation_type,error_tolerance",
279
+ (
280
+ (Interpolator.Type.Linear, 420.0),
281
+ (Interpolator.Type.CubicSpline, 5e-3),
282
+ (Interpolator.Type.BarycentricRational, 5e-2),
283
+ ),
284
+ )
285
+ def test_calculate_state_at_success(
286
+ self,
287
+ test_states: list[State],
288
+ reference_states: list[State],
289
+ interpolation_type: Interpolator.Type,
290
+ error_tolerance: float,
291
+ ):
292
+ tabulated = Tabulated(
293
+ states=test_states,
294
+ initial_revolution_number=1,
295
+ interpolation_type=interpolation_type,
296
+ )
297
+
298
+ for reference_state in reference_states:
299
+ if not tabulated.get_interval().contains_instant(
300
+ reference_state.get_instant()
301
+ ):
302
+ continue
303
+
304
+ calculated_state: State = tabulated.calculate_state_at(
305
+ reference_state.get_instant()
306
+ )
307
+ assert np.all(
308
+ np.abs(
309
+ calculated_state.get_coordinates() - reference_state.get_coordinates()
310
+ )
311
+ < error_tolerance
312
+ )
313
+
314
+ @pytest.mark.parametrize(
315
+ "interpolation_type,error_tolerance",
316
+ (
317
+ (Interpolator.Type.Linear, 420.0),
318
+ (Interpolator.Type.CubicSpline, 5e-3),
319
+ (Interpolator.Type.BarycentricRational, 5e-2),
320
+ ),
321
+ )
322
+ def test_calculate_states_at_success(
323
+ self,
324
+ test_states: list[State],
325
+ reference_states: list[State],
326
+ interpolation_type: Interpolator.Type,
327
+ error_tolerance: float,
328
+ ):
329
+ tabulated = Tabulated(
330
+ states=test_states,
331
+ initial_revolution_number=1,
332
+ interpolation_type=interpolation_type,
333
+ )
334
+
335
+ states_within_interval: list[State] = [
336
+ state
337
+ for state in reference_states
338
+ if tabulated.get_interval().contains_instant(state.get_instant())
339
+ ]
340
+
341
+ calculated_states: list[State] = tabulated.calculate_states_at(
342
+ [state.get_instant() for state in states_within_interval]
343
+ )
344
+
345
+ for calculated_state, reference_state in zip(
346
+ calculated_states, states_within_interval
347
+ ):
348
+ assert np.all(
349
+ np.abs(
350
+ calculated_state.get_coordinates() - reference_state.get_coordinates()
351
+ )
352
+ < error_tolerance
353
+ )
354
+
355
+ @pytest.mark.parametrize(
356
+ "interpolation_type",
357
+ (
358
+ (Interpolator.Type.Linear),
359
+ (Interpolator.Type.CubicSpline),
360
+ (Interpolator.Type.BarycentricRational),
361
+ ),
362
+ )
363
+ def test_calculate_state_at_failure(
364
+ self, test_states: list[State], interpolation_type: Interpolator.Type
365
+ ):
366
+ tabulated = Tabulated(
367
+ states=test_states,
368
+ initial_revolution_number=1,
369
+ interpolation_type=interpolation_type,
370
+ )
371
+
372
+ with pytest.raises(Exception):
373
+ tabulated.calculate_state_at(
374
+ test_states[0].get_instant() - Duration.seconds(1)
375
+ )
376
+
377
+ with pytest.raises(Exception):
378
+ tabulated.calculate_state_at(
379
+ test_states[-1].get_instant() + Duration.seconds(1)
380
+ )
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,75 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.physics.time import Scale
6
+ from ostk.physics.time import Instant
7
+ from ostk.physics.time import Interval
8
+ from ostk.physics.time import DateTime
9
+ from ostk.physics import Environment
10
+
11
+ from ostk.astrodynamics.trajectory.orbit import Pass
12
+
13
+ earth = Environment.default().access_celestial_object_with_name("Earth")
14
+
15
+
16
+ @pytest.fixture
17
+ def pass_() -> Pass:
18
+ return Pass(
19
+ 123,
20
+ Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC),
21
+ Instant.date_time(DateTime(2018, 1, 1, 0, 15, 0), Scale.UTC),
22
+ Instant.date_time(DateTime(2018, 1, 1, 0, 30, 0), Scale.UTC),
23
+ Instant.date_time(DateTime(2018, 1, 1, 0, 45, 0), Scale.UTC),
24
+ Instant.date_time(DateTime(2018, 1, 1, 1, 0, 0), Scale.UTC),
25
+ )
26
+
27
+
28
+ class TestPass:
29
+ def test_is_defined(self, pass_: Pass):
30
+ assert pass_.is_defined()
31
+
32
+ def test_is_complete(self, pass_: Pass):
33
+ assert pass_.is_complete() is not None
34
+
35
+ def test_get_type(self, pass_: Pass):
36
+ assert pass_.get_type() is not None
37
+
38
+ def test_get_revolution_number(self, pass_: Pass):
39
+ assert pass_.get_revolution_number() is not None
40
+
41
+ def test_get_duration(self, pass_: Pass):
42
+ assert pass_.get_duration() is not None
43
+
44
+ def test_get_start_instant(self, pass_: Pass):
45
+ assert pass_.get_start_instant() is not None
46
+
47
+ def test_get_end_instant(self, pass_: Pass):
48
+ assert pass_.get_end_instant() is not None
49
+
50
+ def test_get_interval(self, pass_: Pass):
51
+ assert pass_.get_interval() is not None
52
+
53
+ def test_get_instant_at_ascending_node(self, pass_: Pass):
54
+ assert pass_.get_instant_at_ascending_node() is not None
55
+
56
+ def test_get_instant_at_north_point(self, pass_: Pass):
57
+ assert pass_.get_instant_at_north_point() is not None
58
+
59
+ def test_get_instant_at_descending_node(self, pass_: Pass):
60
+ assert pass_.get_instant_at_descending_node() is not None
61
+
62
+ def test_get_instant_at_south_point(self, pass_: Pass):
63
+ assert pass_.get_instant_at_south_point() is not None
64
+
65
+ def test_get_instant_at_pass_break(self, pass_: Pass):
66
+ assert pass_.get_instant_at_pass_break() is not None
67
+
68
+ def test_undefined(self):
69
+ assert Pass.undefined().is_defined() is False
70
+
71
+ def test_string_from_type(self):
72
+ assert Pass.string_from_type(Pass.Type.Complete) is not None
73
+
74
+ def test_string_from_phase(self):
75
+ assert Pass.string_from_phase(Pass.Phase.Ascending) is not None
@@ -0,0 +1,30 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.astrodynamics.trajectory.state.coordinate_subset import (
6
+ AngularVelocity,
7
+ AttitudeQuaternion,
8
+ )
9
+
10
+
11
+ @pytest.fixture
12
+ def attitude_quaternion() -> AttitudeQuaternion:
13
+ return AttitudeQuaternion.default()
14
+
15
+
16
+ @pytest.fixture
17
+ def name() -> str:
18
+ return "Angular Velocity"
19
+
20
+
21
+ class TestAngularVelocity:
22
+ def test_constructor(
23
+ self,
24
+ attitude_quaternion: AttitudeQuaternion,
25
+ name: str,
26
+ ):
27
+ assert AngularVelocity(attitude_quaternion, name) is not None
28
+
29
+ def test_default(self):
30
+ assert AttitudeQuaternion.default() is not None
@@ -0,0 +1,18 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.astrodynamics.trajectory.state.coordinate_subset import AttitudeQuaternion
6
+
7
+
8
+ @pytest.fixture
9
+ def name() -> str:
10
+ return "Attitude"
11
+
12
+
13
+ class TestAttitudeQuaternion:
14
+ def test_constructor(self, name: str):
15
+ assert AttitudeQuaternion(name) is not None
16
+
17
+ def test_default(self):
18
+ assert AttitudeQuaternion.default() is not None
@@ -0,0 +1,107 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.physics.time import Instant
6
+ from ostk.physics.coordinate import Frame
7
+
8
+ from ostk.astrodynamics.trajectory.state import CoordinateBroker, CoordinateSubset
9
+ from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianPosition
10
+
11
+
12
+ @pytest.fixture
13
+ def name() -> str:
14
+ return "Position"
15
+
16
+
17
+ @pytest.fixture
18
+ def cartesian_position() -> CartesianPosition:
19
+ return CartesianPosition.default()
20
+
21
+
22
+ @pytest.fixture
23
+ def coordinate_subsets(
24
+ cartesian_position: CartesianPosition,
25
+ ) -> list[CoordinateSubset]:
26
+ return [cartesian_position]
27
+
28
+
29
+ @pytest.fixture
30
+ def instant() -> Instant:
31
+ return Instant.J2000()
32
+
33
+
34
+ @pytest.fixture
35
+ def frame() -> Frame:
36
+ return Frame.GCRF()
37
+
38
+
39
+ @pytest.fixture
40
+ def coordinate_broker(
41
+ coordinate_subsets: list[CoordinateSubset],
42
+ ) -> CoordinateBroker:
43
+ return CoordinateBroker(coordinate_subsets)
44
+
45
+
46
+ @pytest.fixture
47
+ def coordinates() -> list[float]:
48
+ return [7000000.0, 0.0, 0.0]
49
+
50
+
51
+ @pytest.fixture
52
+ def another_coordinates() -> list[float]:
53
+ return [0.0, 7000000.0, 0.0]
54
+
55
+
56
+ class TestCartesianPosition:
57
+ def test_constructor(self, name: str):
58
+ assert CartesianPosition(name) is not None
59
+
60
+ def test_add(
61
+ self,
62
+ cartesian_position: CartesianPosition,
63
+ instant: Instant,
64
+ frame: Frame,
65
+ coordinates: list[float],
66
+ another_coordinates: list[float],
67
+ coordinate_broker: CoordinateBroker,
68
+ ):
69
+ assert all(
70
+ cartesian_position.add(
71
+ instant, coordinates, another_coordinates, frame, coordinate_broker
72
+ )
73
+ == [7000000.0, 7000000.0, 0.0]
74
+ )
75
+
76
+ def test_subtract(
77
+ self,
78
+ cartesian_position: CartesianPosition,
79
+ instant: Instant,
80
+ frame: Frame,
81
+ coordinates: list[float],
82
+ another_coordinates: list[float],
83
+ coordinate_broker: CoordinateBroker,
84
+ ):
85
+ assert all(
86
+ cartesian_position.subtract(
87
+ instant, coordinates, another_coordinates, frame, coordinate_broker
88
+ )
89
+ == [7000000.0, -7000000.0, 0.0]
90
+ )
91
+
92
+ def test_in_frame(
93
+ self,
94
+ cartesian_position: CartesianPosition,
95
+ instant: Instant,
96
+ frame: Frame,
97
+ coordinates: list[float],
98
+ another_coordinates: list[float],
99
+ coordinate_broker: CoordinateBroker,
100
+ ):
101
+ for value, expected in zip(
102
+ cartesian_position.in_frame(
103
+ instant, coordinates, frame, Frame.ITRF(), coordinate_broker
104
+ ),
105
+ [1238864.12746338, 6889500.39136482, -176.262107699686],
106
+ ):
107
+ assert value == pytest.approx(expected, rel=1e-14)