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,195 +0,0 @@
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.objects.celestial_bodies 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.flight.system import Dynamics
20
- from ostk.astrodynamics.flight.system.dynamics import CentralBodyGravity
21
- from ostk.astrodynamics.flight.system.dynamics import PositionDerivative
22
- from ostk.astrodynamics.trajectory.orbit.models 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 propagated(propagator: Propagator, state: State) -> Propagated:
72
- return Propagated(propagator, state)
73
-
74
-
75
- @pytest.fixture
76
- def earth() -> Earth:
77
- return Earth.spherical()
78
-
79
-
80
- @pytest.fixture
81
- def orbit(propagated: Propagated, earth: Earth) -> Orbit:
82
- return Orbit(propagated, earth)
83
-
84
-
85
- class TestPropagated:
86
- def test_constructors(
87
- self,
88
- propagated: Propagated,
89
- earth: Earth,
90
- dynamics: list,
91
- numerical_solver: NumericalSolver,
92
- state: State,
93
- ):
94
- assert propagated is not None
95
- assert isinstance(propagated, Propagated)
96
- assert propagated.is_defined()
97
-
98
- orbit = Orbit(propagated, earth)
99
-
100
- assert orbit is not None
101
- assert isinstance(orbit, Orbit)
102
- assert orbit.is_defined()
103
-
104
- state_array = [state, state]
105
- propagated_with_state_array = Propagated(
106
- Propagator(numerical_solver, dynamics), state_array
107
- )
108
-
109
- assert propagated_with_state_array is not None
110
- assert isinstance(propagated_with_state_array, Propagated)
111
- assert propagated_with_state_array.is_defined()
112
-
113
- def test_comparators(self, propagated: Propagated):
114
- assert (propagated == propagated) is True
115
- assert (propagated != propagated) is False
116
-
117
- def test_getters(self, propagated: Propagated, state: State):
118
- assert propagated.get_epoch() == state.get_instant()
119
-
120
- assert propagated.get_revolution_number_at_epoch() == 1
121
-
122
- assert propagated.access_cached_state_array() == [state]
123
-
124
- def test_calculate_state_at(self, propagated: Propagated, orbit: Orbit):
125
- instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC)
126
-
127
- propagated_state = propagated.calculate_state_at(instant)
128
- propagated_state_orbit = orbit.get_state_at(instant)
129
-
130
- assert propagated_state == propagated_state_orbit
131
-
132
- propagated_state_position_ref = np.array(
133
- [6265892.25765909, 3024770.94961259, 3024359.72137468]
134
- )
135
- propagated_state_velocity_ref = np.array(
136
- [-3974.49168221, 4468.16996776, 4466.19232746]
137
- )
138
-
139
- propagated_state_position = propagated_state.get_position().get_coordinates()
140
- propagated_state_velocity = propagated_state.get_velocity().get_coordinates()
141
-
142
- assert all(
143
- [
144
- round(propagated_state_position[i], 8)
145
- == round(propagated_state_position_ref[i], 8)
146
- for i in range(0, len(propagated_state_position_ref))
147
- ]
148
- )
149
- assert all(
150
- [
151
- round(propagated_state_velocity[i], 8)
152
- == round(propagated_state_velocity_ref[i], 8)
153
- for i in range(0, len(propagated_state_velocity_ref))
154
- ]
155
- )
156
- assert propagated_state.get_instant() == instant
157
-
158
- def test_calculate_states_at(self, propagated: Propagated, orbit: Orbit):
159
- instant_array = [
160
- Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC),
161
- Instant.date_time(DateTime(2018, 1, 1, 0, 20, 0), Scale.UTC),
162
- ]
163
-
164
- propagated_state_array = propagated.calculate_states_at(instant_array)
165
- propagated_state_array_orbit = orbit.get_states_at(instant_array)
166
-
167
- assert propagated_state_array_orbit == propagated_state_array
168
-
169
- assert propagated_state_array_orbit[0].get_instant() == instant_array[0]
170
- assert propagated_state_array_orbit[1].get_instant() == instant_array[1]
171
-
172
- def test_calculate_rev_number_at(self, propagated: Propagated, orbit: Orbit):
173
- instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 40, 0), Scale.UTC)
174
-
175
- assert propagated.calculate_revolution_number_at(instant) == 1
176
- assert orbit.get_revolution_number_at(instant) == 1
177
-
178
- def test_access_cached_state_array(self, propagated: Propagated, state: State):
179
- assert len(propagated.access_cached_state_array()) == 1
180
- assert propagated.access_cached_state_array()[0] == state
181
-
182
- def test_access_propagator(self, propagated: Propagated):
183
- assert propagated.access_propagator() is not None
184
- assert isinstance(propagated.access_propagator(), Propagator)
185
-
186
- def test_set_cached_state_array(self, propagated: Propagated, state: State):
187
- assert len(propagated.access_cached_state_array()) == 1
188
-
189
- propagated.set_cached_state_array([state, state, state])
190
-
191
- assert len(propagated.access_cached_state_array()) == 1
192
- assert propagated.access_cached_state_array()[0] == state
193
-
194
- with pytest.raises(Exception) as e:
195
- propagated.set_cached_state_array([])
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,380 +0,0 @@
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.time import Duration
11
- from ostk.physics.coordinate import Position
12
- from ostk.physics.coordinate import Velocity
13
- from ostk.physics.coordinate import Frame
14
- from ostk.physics import Environment
15
-
16
- from ostk.astrodynamics.trajectory import State
17
- from ostk.astrodynamics.trajectory import Orbit
18
- from ostk.astrodynamics.trajectory.orbit.models import Tabulated
19
-
20
-
21
- @pytest.fixture
22
- def earth():
23
- return Environment.default().access_celestial_object_with_name("Earth")
24
-
25
-
26
- @pytest.fixture
27
- def reference_states() -> list[State]:
28
- data = [
29
- [
30
- "2023-04-18T08:28:32.744064",
31
- -3310024.847608758,
32
- -6052528.239971979,
33
- 7626.534641683145,
34
- -855.2088930507367,
35
- 495.9541573743367,
36
- 7536.520188134902,
37
- ],
38
- [
39
- "2023-04-18T08:28:33.744064",
40
- -3310878.047628086,
41
- -6052028.610429457,
42
- 15163.0493833017,
43
- -851.1838953959017,
44
- 503.31279367207185,
45
- 7536.506322816037,
46
- ],
47
- [
48
- "2023-04-18T08:28:34.744064",
49
- -3311727.222133691,
50
- -6051521.622540367,
51
- 22699.545682944226,
52
- -847.1578341126227,
53
- 510.67087060642456,
54
- 7536.483268627912,
55
- ],
56
- [
57
- "2023-04-18T08:28:35.744064",
58
- -3312572.370064364,
59
- -6051007.276868478,
60
- 30236.014351773065,
61
- -843.1307141262514,
62
- 518.0283791399937,
63
- 7536.451025467619,
64
- ],
65
- [
66
- "2023-04-18T08:28:36.744064",
67
- -3313413.490363804,
68
- -6050485.573986613,
69
- 37772.44620082258,
70
- -839.1025403636198,
71
- 525.3853102358,
72
- 7536.40959324377,
73
- ],
74
- [
75
- "2023-04-18T08:28:37.744064",
76
- -3314250.5819806806,
77
- -6049956.514476612,
78
- 45308.83204108345,
79
- -835.0733177529921,
80
- 532.7416548573802,
81
- 7536.358971876497,
82
- ],
83
- [
84
- "2023-04-18T08:28:38.744064",
85
- -3315083.6438685474,
86
- -6049420.098929363,
87
- 52845.16268340493,
88
- -831.0430512241197,
89
- 540.0974039686765,
90
- 7536.299161297429,
91
- ],
92
- [
93
- "2023-04-18T08:28:39.744064",
94
- -3315912.6749859042,
95
- -6048876.327944793,
96
- 60381.42893867038,
97
- -827.0117457081434,
98
- 547.4525485342174,
99
- 7536.23016144972,
100
- ],
101
- [
102
- "2023-04-18T08:28:40.744064",
103
- -3316737.6742961914,
104
- -6048325.2021318525,
105
- 67917.62161760827,
106
- -822.9794061376964,
107
- 554.8070795189376,
108
- 7536.1519722880375,
109
- ],
110
- [
111
- "2023-04-18T08:28:41.744064",
112
- -3317558.640767768,
113
- -6047766.722108539,
114
- 75453.73153099201,
115
- -818.9460374467976,
116
- 562.1609878883643,
117
- 7536.064593778564,
118
- ],
119
- [
120
- "2023-04-18T08:28:42.744064",
121
- -3318375.5733739412,
122
- -6047200.888501875,
123
- 82989.7494894997,
124
- -814.9116445709234,
125
- 569.5142646084902,
126
- 7535.968025898996,
127
- ],
128
- [
129
- "2023-04-18T08:28:43.744064",
130
- -3319188.471092942,
131
- -6046627.7019479135,
132
- 90525.66630384693,
133
- -810.8762324469382,
134
- 576.866900645898,
135
- 7535.862268638544,
136
- ],
137
- [
138
- "2023-04-18T08:28:44.744064",
139
- -3319997.332907958,
140
- -6046047.163091751,
141
- 98061.47278470133,
142
- -806.8398060131411,
143
- 584.2188869676824,
144
- 7535.747321997941,
145
- ],
146
- [
147
- "2023-04-18T08:28:45.744064",
148
- -3320802.157807084,
149
- -6045459.272587514,
150
- 105597.15974279115,
151
- -802.8023702092072,
152
- 591.5702145415504,
153
- 7535.62318598943,
154
- ],
155
- [
156
- "2023-04-18T08:28:46.744064",
157
- -3321602.9447833803,
158
- -6044864.0310983565,
159
- 113132.71798877101,
160
- -798.7639299762548,
161
- 598.9208743356983,
162
- 7535.48986063679,
163
- ],
164
- [
165
- "2023-04-18T08:28:47.744064",
166
- -3322399.692834845,
167
- -6044261.439296465,
168
- 120668.13833342775,
169
- -794.7244902567405,
170
- 606.2708573190106,
171
- 7535.347345975296,
172
- ],
173
- [
174
- "2023-04-18T08:28:48.744064",
175
- -3323192.400964402,
176
- -6043651.497863061,
177
- 128203.41158748553,
178
- -790.6840559945587,
179
- 613.6201544608678,
180
- 7535.195642051765,
181
- ],
182
- [
183
- "2023-04-18T08:28:49.744064",
184
- -3323981.068179951,
185
- -6043034.207488383,
186
- 135738.52856182377,
187
- -786.6426321349277,
188
- 620.9687567313651,
189
- 7535.034748924513,
190
- ],
191
- [
192
- "2023-04-18T08:28:50.744064",
193
- -3324765.6934943097,
194
- -6042409.568871722,
195
- 143273.48006733102,
196
- -782.6002236244674,
197
- 628.3166551011666,
198
- 7534.864666663388,
199
- ],
200
- [
201
- "2023-04-18T08:28:51.744064",
202
- -3325546.2759252544,
203
- -6041777.582721372,
204
- 150808.25691495842,
205
- -778.5568354111685,
206
- 635.6638405415614,
207
- 7534.68539534976,
208
- ],
209
- ]
210
- return [
211
- State(
212
- instant=Instant.date_time(DateTime.parse(row[0]), Scale.UTC),
213
- position=Position.meters(
214
- [float(row[1]), float(row[2]), float(row[3])], Frame.GCRF()
215
- ),
216
- velocity=Velocity.meters_per_second(
217
- [float(row[4]), float(row[5]), float(row[6])], Frame.GCRF()
218
- ),
219
- )
220
- for row in data
221
- ]
222
-
223
-
224
- @pytest.fixture
225
- def test_states(reference_states: list[State]) -> list[State]:
226
- return reference_states[::4]
227
-
228
-
229
- class TestTabulated:
230
- @pytest.mark.parametrize(
231
- "interpolation_type",
232
- (
233
- (Tabulated.InterpolationType.Linear),
234
- (Tabulated.InterpolationType.CubicSpline),
235
- (Tabulated.InterpolationType.BarycentricRational),
236
- ),
237
- )
238
- def test_constructor(
239
- self, test_states: list[State], interpolation_type: Tabulated.InterpolationType
240
- ):
241
- assert (
242
- Tabulated(
243
- states=test_states,
244
- initial_revolution_number=1,
245
- interpolation_type=interpolation_type,
246
- )
247
- is not None
248
- )
249
-
250
- def test_constructor_orbit_tabulated_sucess(
251
- self,
252
- test_states: list[State],
253
- earth,
254
- ):
255
- tabulated = Tabulated(
256
- states=test_states,
257
- initial_revolution_number=1,
258
- interpolation_type=Tabulated.InterpolationType.CubicSpline,
259
- )
260
-
261
- orbit: Orbit = Orbit(tabulated, earth)
262
-
263
- assert orbit is not None
264
- assert isinstance(orbit, Orbit)
265
-
266
- def test_get_interpolation_type(self, test_states: list[State]):
267
- tabulated = Tabulated(
268
- states=test_states,
269
- initial_revolution_number=1,
270
- interpolation_type=Tabulated.InterpolationType.CubicSpline,
271
- )
272
-
273
- assert (
274
- tabulated.get_interpolation_type() == Tabulated.InterpolationType.CubicSpline
275
- )
276
-
277
- @pytest.mark.parametrize(
278
- "interpolation_type,error_tolerance",
279
- (
280
- (Tabulated.InterpolationType.Linear, 420.0),
281
- (Tabulated.InterpolationType.CubicSpline, 5e-3),
282
- (Tabulated.InterpolationType.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: Tabulated.InterpolationType,
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
- (Tabulated.InterpolationType.Linear, 420.0),
318
- (Tabulated.InterpolationType.CubicSpline, 5e-3),
319
- (Tabulated.InterpolationType.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: Tabulated.InterpolationType,
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
- (Tabulated.InterpolationType.Linear),
359
- (Tabulated.InterpolationType.CubicSpline),
360
- (Tabulated.InterpolationType.BarycentricRational),
361
- ),
362
- )
363
- def test_calculate_state_at_failure(
364
- self, test_states: list[State], interpolation_type: Tabulated.InterpolationType
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
- )
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,55 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- import ostk.physics as physics
6
-
7
- import ostk.astrodynamics as astrodynamics
8
-
9
- Length = physics.units.Length
10
- Angle = physics.units.Angle
11
- Scale = physics.time.Scale
12
- Instant = physics.time.Instant
13
- Interval = physics.time.Interval
14
- DateTime = physics.time.DateTime
15
- Position = physics.coordinate.Position
16
- Velocity = physics.coordinate.Velocity
17
- Frame = physics.coordinate.Frame
18
- Environment = physics.Environment
19
-
20
- Trajectory = astrodynamics.Trajectory
21
- Model = astrodynamics.trajectory.Model
22
- Orbit = astrodynamics.trajectory.Orbit
23
- Pass = astrodynamics.trajectory.orbit.Pass
24
- Kepler = astrodynamics.trajectory.orbit.models.Kepler
25
- COE = astrodynamics.trajectory.orbit.models.kepler.COE
26
- SGP4 = astrodynamics.trajectory.orbit.models.SGP4
27
- TLE = astrodynamics.trajectory.orbit.models.sgp4.TLE
28
- State = astrodynamics.trajectory.State
29
- Access = astrodynamics.Access
30
-
31
- earth = Environment.default().access_celestial_object_with_name("Earth")
32
-
33
-
34
- def test_trajectory_orbit_pass():
35
- pass_type = Pass.Type.Partial
36
- pass_revolution_number = 123
37
- pass_start_instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
38
- pass_end_instant = Instant.date_time(DateTime(2018, 1, 1, 1, 0, 0), Scale.UTC)
39
- pass_interval = Interval.closed(pass_start_instant, pass_end_instant)
40
-
41
- pass_ = Pass(pass_type, pass_revolution_number, pass_interval)
42
-
43
- assert pass_ is not None
44
- assert isinstance(pass_, Pass)
45
-
46
- assert pass_.is_defined()
47
- assert pass_.is_complete() is not None
48
- assert pass_.get_type() is not None
49
- assert pass_.get_revolution_number() is not None
50
- # Interval conversion to Python type of issue
51
- # assert pass_.get_interval() is not None
52
-
53
- assert Pass.string_from_type(Pass.Type.Complete) is not None
54
- assert Pass.string_from_phase(Pass.Phase.Ascending) is not None
55
- assert Pass.string_from_quarter(Pass.Quarter.First) is not None