open-space-toolkit-astrodynamics 2.2.0__py311-none-any.whl → 5.0.0__py311-none-any.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 (71) hide show
  1. {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/METADATA +2 -2
  2. open_space_toolkit_astrodynamics-5.0.0.dist-info/RECORD +25 -0
  3. ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-311-x86_64-linux-gnu.so +0 -0
  4. ostk/astrodynamics/__init__.py +6 -0
  5. ostk/astrodynamics/converters.py +1 -1
  6. ostk/astrodynamics/{libopen-space-toolkit-astrodynamics.so.2 → libopen-space-toolkit-astrodynamics.so.5} +0 -0
  7. ostk/astrodynamics/pytrajectory/pystate.py +36 -0
  8. ostk/astrodynamics/test/test_access.py +1 -1
  9. ostk/astrodynamics/test/test_converters.py +1 -1
  10. ostk/astrodynamics/test/test_event_condition.py +27 -2
  11. ostk/astrodynamics/test/test_import.py +2 -2
  12. ostk/astrodynamics/test/test_trajectory.py +1 -1
  13. ostk/astrodynamics/viewer.py +1 -1
  14. open_space_toolkit_astrodynamics-2.2.0.dist-info/RECORD +0 -77
  15. ostk/astrodynamics/test/access/__init__.py +0 -1
  16. ostk/astrodynamics/test/access/test_generator.py +0 -248
  17. ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +0 -1
  18. ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +0 -325
  19. ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +0 -303
  20. ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +0 -416
  21. ostk/astrodynamics/test/event_condition/test_boolean_condition.py +0 -55
  22. ostk/astrodynamics/test/event_condition/test_coe_condition.py +0 -126
  23. ostk/astrodynamics/test/event_condition/test_instant_condition.py +0 -48
  24. ostk/astrodynamics/test/event_condition/test_logical_condition.py +0 -120
  25. ostk/astrodynamics/test/event_condition/test_real_condition.py +0 -53
  26. ostk/astrodynamics/test/flight/__init__.py +0 -1
  27. ostk/astrodynamics/test/flight/profile/__init__.py +0 -1
  28. ostk/astrodynamics/test/flight/profile/test_state.py +0 -144
  29. ostk/astrodynamics/test/flight/system/__init__.py +0 -1
  30. ostk/astrodynamics/test/flight/system/dynamics/__init__.py +0 -1
  31. ostk/astrodynamics/test/flight/system/dynamics/test_atmospheric_drag.py +0 -89
  32. ostk/astrodynamics/test/flight/system/dynamics/test_central_body_gravity.py +0 -58
  33. ostk/astrodynamics/test/flight/system/dynamics/test_dynamics.py +0 -37
  34. ostk/astrodynamics/test/flight/system/dynamics/test_position_derivative.py +0 -51
  35. ostk/astrodynamics/test/flight/system/dynamics/test_third_body_gravity.py +0 -67
  36. ostk/astrodynamics/test/flight/system/test_satellite_system.py +0 -77
  37. ostk/astrodynamics/test/flight/test_profile.py +0 -153
  38. ostk/astrodynamics/test/flight/test_system.py +0 -55
  39. ostk/astrodynamics/test/solvers/__init__.py +0 -1
  40. ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +0 -153
  41. ostk/astrodynamics/test/trajectory/__init__.py +0 -1
  42. ostk/astrodynamics/test/trajectory/orbit/__init__.py +0 -1
  43. ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +0 -1
  44. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +0 -1
  45. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +0 -18
  46. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +0 -44
  47. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +0 -108
  48. ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +0 -1
  49. ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +0 -1
  50. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +0 -112
  51. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +0 -1
  52. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +0 -331
  53. ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +0 -130
  54. ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +0 -195
  55. ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +0 -1
  56. ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +0 -380
  57. ostk/astrodynamics/test/trajectory/orbit/test_model.py +0 -1
  58. ostk/astrodynamics/test/trajectory/orbit/test_pass.py +0 -55
  59. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +0 -103
  60. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +0 -113
  61. ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +0 -71
  62. ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +0 -43
  63. ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +0 -242
  64. ostk/astrodynamics/test/trajectory/test_model.py +0 -1
  65. ostk/astrodynamics/test/trajectory/test_orbit.py +0 -92
  66. ostk/astrodynamics/test/trajectory/test_propagator.py +0 -234
  67. ostk/astrodynamics/test/trajectory/test_state.py +0 -121
  68. {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/WHEEL +0 -0
  69. {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/top_level.txt +0 -0
  70. {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/zip-safe +0 -0
  71. /ostk/{__init__.py → astrodynamics/pytrajectory/__init__.py} +0 -0
@@ -1,416 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from datetime import datetime
6
-
7
- from ostk.core.containers import Dictionary
8
- from ostk.core.filesystem import File
9
-
10
- from ostk.physics.units import Length
11
- from ostk.physics.units import Mass
12
- from ostk.physics.time import Instant
13
- from ostk.physics.time import Scale
14
- from ostk.physics.time import Duration
15
- from ostk.physics.coordinate import Frame
16
- from ostk.physics.coordinate import Position
17
- from ostk.physics.coordinate import Velocity
18
-
19
- from ostk.astrodynamics.trajectory import State
20
- from ostk.astrodynamics.conjunction.messages.ccsds import CDM
21
-
22
-
23
- @pytest.fixture
24
- def cdm() -> CDM:
25
- return CDM(
26
- header=CDM.Header(
27
- ccsds_cdm_version="1.0",
28
- creation_date=Instant.date_time(datetime(2010, 3, 12, 22, 31, 12), Scale.UTC),
29
- originator="JSPOC",
30
- message_for="SATELLITE A",
31
- message_id="201113719185",
32
- ),
33
- relative_metadata=CDM.RelativeMetadata(
34
- comment="",
35
- time_of_closest_approach=Instant.date_time(
36
- datetime(2010, 3, 13, 22, 37, 52, 618), Scale.UTC
37
- ),
38
- miss_distance=Length.meters(715.0),
39
- start_screen_period=Instant.date_time(
40
- datetime(2010, 3, 12, 18, 29, 32, 212), Scale.UTC
41
- ),
42
- end_screen_period=Instant.date_time(
43
- datetime(2010, 3, 15, 18, 29, 32, 212), Scale.UTC
44
- ),
45
- screen_volume_frame="RTN",
46
- screen_volume_shape="ELLIPSOID",
47
- screen_volume_x=200.0,
48
- screen_volume_y=1000.0,
49
- screen_volume_z=1000.0,
50
- screen_entry_time=Instant.date_time(
51
- datetime(2010, 3, 13, 22, 37, 52, 222), Scale.UTC
52
- ),
53
- screen_exit_time=Instant.date_time(
54
- datetime(2010, 3, 13, 22, 37, 52, 824), Scale.UTC
55
- ),
56
- collision_probability=0.0000435,
57
- collision_probability_method="FOSTER-1992",
58
- ),
59
- objects_metadata_array=[
60
- CDM.Metadata(
61
- comment="",
62
- object="OBJECT1",
63
- object_designator=12345,
64
- catalog_name="SATCAT",
65
- object_name="SATELLITE A",
66
- international_designator="1997−030E",
67
- object_type=CDM.ObjectType.Payload,
68
- operator_contact_position="OSA",
69
- operator_organization="EUTMETSAT",
70
- operator_phone="+49615130312",
71
- operator_email="JOHN.DOE@SOMEWHERE.NET",
72
- ephemeris_name="EPHEMERIS SATELLITE A",
73
- covariance_method="CALCULATED",
74
- maneuverable="YES",
75
- orbit_center="",
76
- reference_frame="EME2000",
77
- gravity_model="EGM-96: 36D 36O",
78
- atmospheric_model="JACCHIA 70 DCA",
79
- n_body_perturbations="MOON, SUN",
80
- solar_radiation_pressure=False,
81
- earth_tides=False,
82
- in_track_thrust=False,
83
- ),
84
- CDM.Metadata(
85
- object="OBJECT2",
86
- object_designator=12346,
87
- catalog_name="SATCAT",
88
- object_name="SATELLITE B",
89
- international_designator="1997−030F",
90
- object_type=CDM.ObjectType.Payload,
91
- ephemeris_name="EPHEMERIS SATELLITE B",
92
- covariance_method="CALCULATED",
93
- maneuverable="YES",
94
- reference_frame="EME2000",
95
- ),
96
- ],
97
- objects_data_array=[
98
- CDM.Data(
99
- time_last_observation_start=Instant.date_time(
100
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
101
- ),
102
- time_last_observation_end=Instant.date_time(
103
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
104
- ),
105
- recommended_od_span=Duration.days(7.88),
106
- actual_od_span=Duration.days(5.50),
107
- observations_available=592,
108
- observations_used=579,
109
- tracks_available=123,
110
- tracks_used=119,
111
- residuals_accepted=97.8,
112
- weighted_rms=0.864,
113
- area_pc=5.2,
114
- area_drag=0.0,
115
- area_srp=0.0,
116
- mass=Mass.kilograms(251.6),
117
- cd_area_over_mass=0.0,
118
- cr_area_over_mass=0.0,
119
- thrust_acceleration=0.0,
120
- sedr=0.0,
121
- ),
122
- CDM.Data(
123
- time_last_observation_start=Instant.date_time(
124
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
125
- ),
126
- time_last_observation_end=Instant.date_time(
127
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
128
- ),
129
- recommended_od_span=Duration.days(7.88),
130
- actual_od_span=Duration.days(5.50),
131
- observations_available=592,
132
- observations_used=579,
133
- tracks_available=123,
134
- tracks_used=119,
135
- residuals_accepted=97.8,
136
- weighted_rms=0.864,
137
- area_pc=5.2,
138
- area_drag=0.0,
139
- area_srp=0.0,
140
- mass=Mass.kilograms(251.6),
141
- cd_area_over_mass=0.0,
142
- cr_area_over_mass=0.0,
143
- thrust_acceleration=0.0,
144
- sedr=0.0,
145
- ),
146
- ],
147
- )
148
-
149
-
150
- class TestCDM:
151
- def test_constructor(self, cdm: CDM):
152
- assert cdm is not None
153
-
154
- def test_get_header(self, cdm: CDM):
155
- cdm_header: CDM.Header = cdm.get_header()
156
-
157
- assert cdm_header is not None
158
- assert cdm_header.ccsds_cdm_version == "1.0"
159
- assert cdm_header.creation_date == Instant.date_time(
160
- datetime(2010, 3, 12, 22, 31, 12), Scale.UTC
161
- )
162
- assert cdm_header.originator == "JSPOC"
163
- assert cdm_header.message_for == "SATELLITE A"
164
- assert cdm_header.message_id == "201113719185"
165
-
166
- def test_get_relative_metadata(self, cdm: CDM):
167
- cdm_relative_metadata: CDM.RelativeMetadata = cdm.get_relative_metadata()
168
-
169
- assert cdm_relative_metadata is not None
170
- assert cdm_relative_metadata.comment == ""
171
- assert cdm_relative_metadata.time_of_closest_approach == Instant.date_time(
172
- datetime(2010, 3, 13, 22, 37, 52, 618), Scale.UTC
173
- )
174
- assert cdm_relative_metadata.miss_distance == Length.meters(715.0)
175
- assert cdm_relative_metadata.start_screen_period == Instant.date_time(
176
- datetime(2010, 3, 12, 18, 29, 32, 212), Scale.UTC
177
- )
178
- assert cdm_relative_metadata.end_screen_period == Instant.date_time(
179
- datetime(2010, 3, 15, 18, 29, 32, 212), Scale.UTC
180
- )
181
- assert cdm_relative_metadata.screen_volume_frame == "RTN"
182
- assert cdm_relative_metadata.screen_volume_shape == "ELLIPSOID"
183
- assert cdm_relative_metadata.screen_volume_x == 200.0
184
- assert cdm_relative_metadata.screen_volume_y == 1000.0
185
- assert cdm_relative_metadata.screen_volume_z == 1000.0
186
- assert cdm_relative_metadata.screen_entry_time == Instant.date_time(
187
- datetime(2010, 3, 13, 22, 37, 52, 222), Scale.UTC
188
- )
189
- assert cdm_relative_metadata.screen_exit_time == Instant.date_time(
190
- datetime(2010, 3, 13, 22, 37, 52, 824), Scale.UTC
191
- )
192
- assert cdm_relative_metadata.collision_probability == 0.0000435
193
- assert cdm_relative_metadata.collision_probability_method == "FOSTER-1992"
194
-
195
- def test_get_metadata_array(self, cdm: CDM):
196
- assert cdm.get_metadata_array() is not None
197
- assert len(cdm.get_metadata_array()) == 2
198
-
199
- def test_get_data_array(self, cdm: CDM):
200
- assert cdm.get_data_array() is not None
201
- assert len(cdm.get_data_array()) == 2
202
-
203
- def test_get_object_metadata_at(self, cdm: CDM):
204
- assert cdm.get_object_metadata_at(0) is not None
205
- assert cdm.get_object_metadata_at(1) is not None
206
-
207
- cdm_object_1_metadata: CDM.Metadata = cdm.get_object_metadata_at(0)
208
-
209
- assert cdm_object_1_metadata.comment == ""
210
- assert cdm_object_1_metadata.object == "OBJECT1"
211
- assert cdm_object_1_metadata.object_designator == 12345
212
- assert cdm_object_1_metadata.catalog_name == "SATCAT"
213
- assert cdm_object_1_metadata.object_name == "SATELLITE A"
214
- assert cdm_object_1_metadata.international_designator == "1997−030E"
215
- assert cdm_object_1_metadata.object_type == CDM.ObjectType.Payload
216
- assert cdm_object_1_metadata.operator_contact_position == "OSA"
217
- assert cdm_object_1_metadata.operator_organization == "EUTMETSAT"
218
- assert cdm_object_1_metadata.operator_phone == "+49615130312"
219
- assert cdm_object_1_metadata.operator_email == "JOHN.DOE@SOMEWHERE.NET"
220
- assert cdm_object_1_metadata.ephemeris_name == "EPHEMERIS SATELLITE A"
221
- assert cdm_object_1_metadata.covariance_method == "CALCULATED"
222
- assert cdm_object_1_metadata.maneuverable == "YES"
223
- assert cdm_object_1_metadata.orbit_center == ""
224
- assert cdm_object_1_metadata.reference_frame == "EME2000"
225
- assert cdm_object_1_metadata.gravity_model == "EGM-96: 36D 36O"
226
- assert cdm_object_1_metadata.atmospheric_model == "JACCHIA 70 DCA"
227
- assert cdm_object_1_metadata.n_body_perturbations == "MOON, SUN"
228
- assert cdm_object_1_metadata.solar_radiation_pressure == False
229
- assert cdm_object_1_metadata.earth_tides == False
230
- assert cdm_object_1_metadata.in_track_thrust == False
231
-
232
- cdm_object_2_metadata: CDM.Metadata = cdm.get_object_metadata_at(1)
233
-
234
- assert cdm_object_2_metadata.comment == ""
235
- assert cdm_object_2_metadata.object == "OBJECT2"
236
- assert cdm_object_2_metadata.object_designator == 12346
237
- assert cdm_object_2_metadata.catalog_name == "SATCAT"
238
- assert cdm_object_2_metadata.object_name == "SATELLITE B"
239
- assert cdm_object_2_metadata.international_designator == "1997−030F"
240
- assert cdm_object_2_metadata.object_type == CDM.ObjectType.Payload
241
- assert cdm_object_2_metadata.operator_contact_position == ""
242
- assert cdm_object_2_metadata.operator_organization == ""
243
- assert cdm_object_2_metadata.operator_phone == ""
244
- assert cdm_object_2_metadata.operator_email == ""
245
- assert cdm_object_2_metadata.ephemeris_name == "EPHEMERIS SATELLITE B"
246
- assert cdm_object_2_metadata.covariance_method == "CALCULATED"
247
- assert cdm_object_2_metadata.maneuverable == "YES"
248
- assert cdm_object_2_metadata.orbit_center == ""
249
- assert cdm_object_2_metadata.reference_frame == "EME2000"
250
- assert cdm_object_2_metadata.gravity_model == ""
251
- assert cdm_object_2_metadata.atmospheric_model == ""
252
- assert cdm_object_2_metadata.n_body_perturbations == ""
253
- assert cdm_object_2_metadata.solar_radiation_pressure == False
254
- assert cdm_object_2_metadata.earth_tides == False
255
- assert cdm_object_2_metadata.in_track_thrust == False
256
-
257
- with pytest.raises(Exception) as e:
258
- cdm.get_object_metadata_at(2)
259
-
260
- def test_get_object_data_at(self, cdm: CDM):
261
- assert cdm.get_object_data_at(0) is not None
262
- assert cdm.get_object_data_at(1) is not None
263
-
264
- cdm_object_1_data: CDM.Data = cdm.get_object_data_at(0)
265
-
266
- assert cdm_object_1_data.time_last_observation_start == Instant.date_time(
267
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
268
- )
269
- assert cdm_object_1_data.time_last_observation_end == Instant.date_time(
270
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
271
- )
272
- assert cdm_object_1_data.recommended_od_span == Duration.days(7.88)
273
- assert cdm_object_1_data.actual_od_span == Duration.days(5.50)
274
- assert cdm_object_1_data.observations_available == 592
275
- assert cdm_object_1_data.observations_used == 579
276
- assert cdm_object_1_data.tracks_available == 123
277
- assert cdm_object_1_data.tracks_used == 119
278
- assert cdm_object_1_data.residuals_accepted == 97.8
279
- assert cdm_object_1_data.weighted_rms == 0.864
280
- assert cdm_object_1_data.area_pc == 5.2
281
- assert cdm_object_1_data.area_drag == 0.0
282
- assert cdm_object_1_data.area_srp == 0.0
283
- assert cdm_object_1_data.mass == Mass.kilograms(251.6)
284
- assert cdm_object_1_data.cd_area_over_mass == 0.0
285
- assert cdm_object_1_data.cr_area_over_mass == 0.0
286
- assert cdm_object_1_data.thrust_acceleration == 0.0
287
- assert cdm_object_1_data.sedr == 0.0
288
-
289
- cdm_object_2_data: CDM.Data = cdm.get_object_data_at(1)
290
-
291
- assert cdm_object_2_data.time_last_observation_start == Instant.date_time(
292
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
293
- )
294
- assert cdm_object_2_data.time_last_observation_end == Instant.date_time(
295
- datetime(2010, 3, 12, 2, 14, 12, 746), Scale.UTC
296
- )
297
- assert cdm_object_2_data.recommended_od_span == Duration.days(7.88)
298
- assert cdm_object_2_data.actual_od_span == Duration.days(5.50)
299
- assert cdm_object_2_data.observations_available == 592
300
- assert cdm_object_2_data.observations_used == 579
301
- assert cdm_object_2_data.tracks_available == 123
302
- assert cdm_object_2_data.tracks_used == 119
303
- assert cdm_object_2_data.residuals_accepted == 97.8
304
- assert cdm_object_2_data.weighted_rms == 0.864
305
- assert cdm_object_2_data.area_pc == 5.2
306
- assert cdm_object_2_data.area_drag == 0.0
307
- assert cdm_object_2_data.area_srp == 0.0
308
- assert cdm_object_2_data.mass == Mass.kilograms(251.6)
309
- assert cdm_object_2_data.cd_area_over_mass == 0.0
310
- assert cdm_object_2_data.cr_area_over_mass == 0.0
311
- assert cdm_object_2_data.thrust_acceleration == 0.0
312
- assert cdm_object_2_data.sedr == 0.0
313
-
314
- with pytest.raises(Exception) as e:
315
- cdm.get_object_data_at(2)
316
-
317
- def test_get_ccsds_cdm_version(self, cdm: CDM):
318
- assert cdm.get_ccsds_cdm_version() == "1.0"
319
-
320
- def test_get_creation_instant(self, cdm: CDM):
321
- assert cdm.get_creation_instant() == Instant.date_time(
322
- datetime(2010, 3, 12, 22, 31, 12), Scale.UTC
323
- )
324
-
325
- def test_get_originator(self, cdm: CDM):
326
- assert cdm.get_originator() == "JSPOC"
327
-
328
- def test_get_message_for(self, cdm: CDM):
329
- assert cdm.get_message_for() == "SATELLITE A"
330
-
331
- def test_get_message_id(self, cdm: CDM):
332
- assert cdm.get_message_id() == "201113719185"
333
-
334
- def test_get_time_of_closest_approach(self, cdm: CDM):
335
- assert cdm.get_time_of_closest_approach() == Instant.date_time(
336
- datetime(2010, 3, 13, 22, 37, 52, 618), Scale.UTC
337
- )
338
-
339
- def test_get_miss_distance(self, cdm: CDM):
340
- assert cdm.get_miss_distance() == Length.meters(715.0)
341
-
342
- def test_get_relative_position(self, cdm: CDM):
343
- assert cdm.get_relative_position().is_defined() is False
344
-
345
- def test_get_relative_velocity(self, cdm: CDM):
346
- assert cdm.get_relative_velocity().is_defined() is False
347
-
348
- def test_get_collision_probability(self, cdm: CDM):
349
- assert cdm.get_collision_probability() == 0.0000435
350
-
351
- def test_get_collision_probability_method(self, cdm: CDM):
352
- assert cdm.get_collision_probability_method() == "FOSTER-1992"
353
-
354
- def test_undefined(self):
355
- assert CDM.undefined().is_defined() is False
356
-
357
- def test_dictionary(self, cdm_spacetrack_dictionary: dict):
358
- dictionary = Dictionary(cdm_spacetrack_dictionary)
359
-
360
- cdm: CDM = CDM.dictionary(dictionary)
361
-
362
- assert cdm is not None
363
- assert cdm.get_header() is not None
364
- assert cdm.get_ccsds_cdm_version() == "1.0"
365
- assert cdm.get_creation_instant() == Instant.date_time(
366
- datetime(2022, 12, 25, 0, 33, 16), Scale.UTC
367
- )
368
- assert cdm.get_originator() == "CSpOC"
369
- assert cdm.get_message_for() == "YAM-2"
370
- assert cdm.get_message_id() == "406320986"
371
- assert cdm.get_time_of_closest_approach() == Instant.date_time(
372
- datetime(2022, 12, 27, 13, 28, 59, 516000), Scale.UTC
373
- )
374
- assert cdm.get_miss_distance() == Length.meters(974.0)
375
- assert cdm.get_relative_position().is_defined() is False
376
- assert cdm.get_relative_velocity().is_defined() is False
377
- assert cdm.get_collision_probability() == 5.162516e-16
378
- assert cdm.get_collision_probability_method() == "FOSTER-1992"
379
-
380
- object_1_metadata: CDM.Metadata = cdm.get_object_metadata_at(0)
381
-
382
- assert object_1_metadata.object == "OBJECT1"
383
- assert object_1_metadata.object_designator == 48911
384
- assert object_1_metadata.catalog_name == "SATCAT"
385
- assert object_1_metadata.object_name == "YAM-2"
386
- assert object_1_metadata.international_designator == "2021-059AJ"
387
- assert object_1_metadata.object_type == CDM.ObjectType.Payload
388
- assert object_1_metadata.ephemeris_name == "NONE"
389
- assert object_1_metadata.covariance_method == "CALCULATED"
390
- assert object_1_metadata.maneuverable == "N/A"
391
- assert object_1_metadata.reference_frame == "ITRF"
392
-
393
- # object_1_data: CDM.Data = cdm.get_object_data_at(0)
394
-
395
- # assert object_1_data.state == State(
396
- # Instant.date_time(datetime(2022, 12, 27, 13, 28, 59, 516000), Scale.UTC),
397
- # Position.meters([-4988150.231999999844, -1691825.955000000075, -4469421.481999999844], Frame.ITRF()),
398
- # Velocity.meters_per_second([-5122.248844000000, 54.300816000000, 5699.434412000000], Frame.ITRF())
399
- # )
400
-
401
- def test_parse(self, cdm_file: File):
402
- with open(str(cdm_file.get_path().to_string()), "r") as stream:
403
- assert CDM.parse(string=stream.read()) is not None
404
-
405
- def test_load(self, cdm_file: File):
406
- assert CDM.load(file=cdm_file) is not None
407
-
408
- def test_object_type_from_string(self):
409
- assert CDM.object_type_from_string("PAYLOAD") == CDM.ObjectType.Payload
410
- assert CDM.object_type_from_string("ROCKET BODY") == CDM.ObjectType.RocketBody
411
- assert CDM.object_type_from_string("DEBRIS") == CDM.ObjectType.Debris
412
- assert CDM.object_type_from_string("UNKNOWN") == CDM.ObjectType.Unknown
413
- assert CDM.object_type_from_string("OTHER") == CDM.ObjectType.Other
414
-
415
- with pytest.raises(Exception) as e:
416
- CDM.object_type_from_string("ANOTHERSUPPORTEDTYPE")
@@ -1,55 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from ostk.physics.time import Instant, DateTime, Scale
6
- from ostk.physics.coordinate import Frame, Position, Velocity
7
-
8
- from ostk.astrodynamics.trajectory import State
9
- from ostk.astrodynamics.event_condition import BooleanCondition
10
-
11
-
12
- @pytest.fixture
13
- def state() -> State:
14
- frame: Frame = Frame.GCRF()
15
- position: Position = Position.meters([7500000.0, 0.0, 0.0], frame)
16
- velocity: Velocity = Velocity.meters_per_second(
17
- [0.0, 5335.865450622126, 5335.865450622126], frame
18
- )
19
-
20
- instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
21
- return State(instant, position, velocity)
22
-
23
-
24
- @pytest.fixture
25
- def evaluator():
26
- return lambda state: state.get_coordinates()[0]
27
-
28
-
29
- @pytest.fixture
30
- def is_inversed() -> bool:
31
- return False
32
-
33
-
34
- @pytest.fixture
35
- def event_condition(evaluator, is_inversed: bool) -> BooleanCondition:
36
- return BooleanCondition(
37
- "My Condition",
38
- BooleanCondition.Criterion.StrictlyPositive,
39
- evaluator,
40
- is_inversed,
41
- )
42
-
43
-
44
- class TestBooleanCondition:
45
- def test_is_inversed(self, event_condition: BooleanCondition, is_inversed: bool):
46
- assert event_condition.is_inversed() == is_inversed
47
-
48
- def test_evaluate(self, state: State, event_condition: BooleanCondition):
49
- assert event_condition.evaluate(state) is not None
50
-
51
- def test_is_satisfied(self, state: State, event_condition: BooleanCondition):
52
- assert (
53
- event_condition.is_satisfied(previous_state=state, current_state=state)
54
- is not None
55
- )
@@ -1,126 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from ostk.physics.environment.gravitational import Earth
6
- from ostk.physics.units import Derived, Length, Angle
7
- from ostk.physics.time import Instant, DateTime, Scale
8
- from ostk.physics.coordinate import Frame, Position, Velocity
9
-
10
- from ostk.astrodynamics.trajectory import State
11
- from ostk.astrodynamics.event_condition import COECondition
12
- from ostk.astrodynamics.trajectory.orbit.models.kepler import COE
13
-
14
-
15
- @pytest.fixture
16
- def criterion() -> COECondition.Criterion:
17
- return COECondition.Criterion.AnyCrossing
18
-
19
-
20
- @pytest.fixture
21
- def gravitational_parameter() -> Derived:
22
- return Earth.spherical.gravitational_parameter
23
-
24
-
25
- @pytest.fixture
26
- def element() -> COE.Element:
27
- return COE.Element.SemiMajorAxis
28
-
29
-
30
- @pytest.fixture
31
- def target() -> float:
32
- return 7e6
33
-
34
-
35
- @pytest.fixture
36
- def frame() -> Frame:
37
- return Frame.GCRF()
38
-
39
-
40
- @pytest.fixture
41
- def condition(
42
- criterion: COECondition.Criterion,
43
- element: COE.Element,
44
- frame: Frame,
45
- target: float,
46
- gravitational_parameter: Derived,
47
- ) -> COECondition:
48
- return COECondition(
49
- "Test COECondition", criterion, element, frame, target, gravitational_parameter
50
- )
51
-
52
-
53
- @pytest.fixture
54
- def state() -> State:
55
- frame: Frame = Frame.GCRF()
56
- position: Position = Position.meters(
57
- [717094.039086306, -6872433.2241124, 46175.9696673281], frame
58
- )
59
- velocity: Velocity = Velocity.meters_per_second(
60
- [-970.650826004612, -45.4598114773158, 7529.82424886455], frame
61
- )
62
-
63
- instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
64
- return State(instant, position, velocity)
65
-
66
-
67
- class TestCOECondition:
68
- def test_constructor(
69
- self,
70
- criterion: COECondition.Criterion,
71
- element: COE.Element,
72
- frame: Frame,
73
- target: float,
74
- gravitational_parameter: Derived,
75
- ):
76
- name = "Test COECondition"
77
- condition = COECondition(
78
- name, criterion, element, frame, target, gravitational_parameter
79
- )
80
-
81
- assert condition is not None
82
-
83
- def test_getters(
84
- self,
85
- condition: COECondition,
86
- element: COE.Element,
87
- frame: Frame,
88
- target: float,
89
- gravitational_parameter: Derived,
90
- ):
91
- assert condition.get_element() == element
92
- assert condition.get_target() == target
93
- assert condition.get_frame() == frame
94
- assert condition.get_gravitational_parameter() == gravitational_parameter
95
-
96
- @pytest.mark.parametrize(
97
- "static_constructor,target",
98
- (
99
- (COECondition.semi_major_axis, Length.meters(7e6)),
100
- (COECondition.eccentricity, 0.1),
101
- (COECondition.inclination, Angle.degrees(0.0)),
102
- (COECondition.aop, Angle.degrees(0.0)),
103
- (COECondition.raan, Angle.degrees(0.0)),
104
- (COECondition.true_anomaly, Angle.degrees(0.0)),
105
- (COECondition.mean_anomaly, Angle.degrees(0.0)),
106
- (COECondition.eccentric_anomaly, Angle.degrees(0.0)),
107
- ),
108
- )
109
- def test_static_constructors(
110
- self,
111
- static_constructor,
112
- frame: Frame,
113
- target: float,
114
- criterion: COECondition.Criterion,
115
- gravitational_parameter: Derived,
116
- state: State,
117
- ):
118
- condition = static_constructor(criterion, frame, target, gravitational_parameter)
119
- assert condition is not None
120
-
121
- assert condition.evaluate(state) is not None
122
-
123
- def test_evaluate(self, condition: COECondition, state: State, target: float):
124
- assert condition.evaluate(state) == pytest.approx(
125
- 6904757.8910061345 - target, abs=1e-9
126
- )
@@ -1,48 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from ostk.physics.coordinate import Frame, Position, Velocity
6
- from ostk.physics.time import DateTime, Instant, Scale
7
-
8
- from ostk.astrodynamics.event_condition import InstantCondition
9
- from ostk.astrodynamics.trajectory import State
10
-
11
-
12
- @pytest.fixture
13
- def instant() -> Instant:
14
- return Instant.date_time(DateTime(2023, 1, 1, 0, 0, 0), Scale.UTC)
15
-
16
-
17
- @pytest.fixture
18
- def criterion() -> InstantCondition.Criterion:
19
- return InstantCondition.Criterion.StrictlyPositive
20
-
21
-
22
- @pytest.fixture
23
- def instant_condition(
24
- criterion: InstantCondition.Criterion, instant: Instant
25
- ) -> InstantCondition:
26
- return InstantCondition(criterion, instant)
27
-
28
-
29
- @pytest.fixture
30
- def state() -> State:
31
- frame: Frame = Frame.GCRF()
32
- position: Position = Position.meters(
33
- [717094.039086306, -6872433.2241124, 46175.9696673281], frame
34
- )
35
- velocity: Velocity = Velocity.meters_per_second(
36
- [-970.650826004612, -45.4598114773158, 7529.82424886455], frame
37
- )
38
-
39
- instant: Instant = Instant.date_time(DateTime(2023, 1, 1, 0, 1, 0), Scale.UTC)
40
- return State(instant, position, velocity)
41
-
42
-
43
- class TestInstantCondition:
44
- def test_get_instant(self, instant_condition: InstantCondition, instant: Instant):
45
- assert instant_condition.get_instant() == instant
46
-
47
- def test_evaluate(self, instant_condition: InstantCondition, state: State):
48
- assert instant_condition.evaluate(state) == 60.0