open-space-toolkit-astrodynamics 16.2.0__py312-none-manylinux2014_x86_64.whl → 16.4.0__py312-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 (21) hide show
  1. {open_space_toolkit_astrodynamics-16.2.0.dist-info → open_space_toolkit_astrodynamics-16.4.0.dist-info}/METADATA +1 -1
  2. {open_space_toolkit_astrodynamics-16.2.0.dist-info → open_space_toolkit_astrodynamics-16.4.0.dist-info}/RECORD +21 -16
  3. ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-312-x86_64-linux-gnu.so +0 -0
  4. ostk/astrodynamics/__init__.pyi +4 -4
  5. ostk/astrodynamics/flight/__init__.pyi +18 -9
  6. ostk/astrodynamics/flight/profile/model.pyi +19 -0
  7. ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.16 +0 -0
  8. ostk/astrodynamics/test/flight/profile/model/test_tabulated_profile.py +115 -0
  9. ostk/astrodynamics/test/flight/test_profile.py +4 -0
  10. ostk/astrodynamics/test/test_display.py +0 -2
  11. ostk/astrodynamics/test/test_trajectory.py +28 -7
  12. ostk/astrodynamics/test/test_viewer.py +56 -0
  13. ostk/astrodynamics/test/trajectory/model/test_nadir_trajectory.py +87 -0
  14. ostk/astrodynamics/test/trajectory/model/test_tabulated_trajectory.py +303 -0
  15. ostk/astrodynamics/test/trajectory/model/test_target_scan_trajectory.py +126 -0
  16. ostk/astrodynamics/trajectory/__init__.pyi +10 -9
  17. ostk/astrodynamics/trajectory/model.pyi +259 -0
  18. ostk/astrodynamics/viewer.py +316 -14
  19. {open_space_toolkit_astrodynamics-16.2.0.dist-info → open_space_toolkit_astrodynamics-16.4.0.dist-info}/WHEEL +0 -0
  20. {open_space_toolkit_astrodynamics-16.2.0.dist-info → open_space_toolkit_astrodynamics-16.4.0.dist-info}/top_level.txt +0 -0
  21. {open_space_toolkit_astrodynamics-16.2.0.dist-info → open_space_toolkit_astrodynamics-16.4.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,303 @@
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.coordinate import Position
13
+ from ostk.physics.coordinate import Velocity
14
+ from ostk.physics.coordinate import Frame
15
+
16
+ from ostk.astrodynamics.trajectory import State
17
+ from ostk.astrodynamics.trajectory.model import Tabulated
18
+
19
+
20
+ @pytest.fixture
21
+ def reference_states() -> list[State]:
22
+ data = [
23
+ [
24
+ "2023-04-18T08:28:32.744064",
25
+ -3310024.847608758,
26
+ -6052528.239971979,
27
+ 7626.534641683145,
28
+ -855.2088930507367,
29
+ 495.9541573743367,
30
+ 7536.520188134902,
31
+ ],
32
+ [
33
+ "2023-04-18T08:28:33.744064",
34
+ -3310878.047628086,
35
+ -6052028.610429457,
36
+ 15163.0493833017,
37
+ -851.1838953959017,
38
+ 503.31279367207185,
39
+ 7536.506322816037,
40
+ ],
41
+ [
42
+ "2023-04-18T08:28:34.744064",
43
+ -3311727.222133691,
44
+ -6051521.622540367,
45
+ 22699.545682944226,
46
+ -847.1578341126227,
47
+ 510.67087060642456,
48
+ 7536.483268627912,
49
+ ],
50
+ [
51
+ "2023-04-18T08:28:35.744064",
52
+ -3312572.370064364,
53
+ -6051007.276868478,
54
+ 30236.014351773065,
55
+ -843.1307141262514,
56
+ 518.0283791399937,
57
+ 7536.451025467619,
58
+ ],
59
+ [
60
+ "2023-04-18T08:28:36.744064",
61
+ -3313413.490363804,
62
+ -6050485.573986613,
63
+ 37772.44620082258,
64
+ -839.1025403636198,
65
+ 525.3853102358,
66
+ 7536.40959324377,
67
+ ],
68
+ [
69
+ "2023-04-18T08:28:37.744064",
70
+ -3314250.5819806806,
71
+ -6049956.514476612,
72
+ 45308.83204108345,
73
+ -835.0733177529921,
74
+ 532.7416548573802,
75
+ 7536.358971876497,
76
+ ],
77
+ [
78
+ "2023-04-18T08:28:38.744064",
79
+ -3315083.6438685474,
80
+ -6049420.098929363,
81
+ 52845.16268340493,
82
+ -831.0430512241197,
83
+ 540.0974039686765,
84
+ 7536.299161297429,
85
+ ],
86
+ [
87
+ "2023-04-18T08:28:39.744064",
88
+ -3315912.6749859042,
89
+ -6048876.327944793,
90
+ 60381.42893867038,
91
+ -827.0117457081434,
92
+ 547.4525485342174,
93
+ 7536.23016144972,
94
+ ],
95
+ [
96
+ "2023-04-18T08:28:40.744064",
97
+ -3316737.6742961914,
98
+ -6048325.2021318525,
99
+ 67917.62161760827,
100
+ -822.9794061376964,
101
+ 554.8070795189376,
102
+ 7536.1519722880375,
103
+ ],
104
+ [
105
+ "2023-04-18T08:28:41.744064",
106
+ -3317558.640767768,
107
+ -6047766.722108539,
108
+ 75453.73153099201,
109
+ -818.9460374467976,
110
+ 562.1609878883643,
111
+ 7536.064593778564,
112
+ ],
113
+ [
114
+ "2023-04-18T08:28:42.744064",
115
+ -3318375.5733739412,
116
+ -6047200.888501875,
117
+ 82989.7494894997,
118
+ -814.9116445709234,
119
+ 569.5142646084902,
120
+ 7535.968025898996,
121
+ ],
122
+ [
123
+ "2023-04-18T08:28:43.744064",
124
+ -3319188.471092942,
125
+ -6046627.7019479135,
126
+ 90525.66630384693,
127
+ -810.8762324469382,
128
+ 576.866900645898,
129
+ 7535.862268638544,
130
+ ],
131
+ [
132
+ "2023-04-18T08:28:44.744064",
133
+ -3319997.332907958,
134
+ -6046047.163091751,
135
+ 98061.47278470133,
136
+ -806.8398060131411,
137
+ 584.2188869676824,
138
+ 7535.747321997941,
139
+ ],
140
+ [
141
+ "2023-04-18T08:28:45.744064",
142
+ -3320802.157807084,
143
+ -6045459.272587514,
144
+ 105597.15974279115,
145
+ -802.8023702092072,
146
+ 591.5702145415504,
147
+ 7535.62318598943,
148
+ ],
149
+ [
150
+ "2023-04-18T08:28:46.744064",
151
+ -3321602.9447833803,
152
+ -6044864.0310983565,
153
+ 113132.71798877101,
154
+ -798.7639299762548,
155
+ 598.9208743356983,
156
+ 7535.48986063679,
157
+ ],
158
+ [
159
+ "2023-04-18T08:28:47.744064",
160
+ -3322399.692834845,
161
+ -6044261.439296465,
162
+ 120668.13833342775,
163
+ -794.7244902567405,
164
+ 606.2708573190106,
165
+ 7535.347345975296,
166
+ ],
167
+ [
168
+ "2023-04-18T08:28:48.744064",
169
+ -3323192.400964402,
170
+ -6043651.497863061,
171
+ 128203.41158748553,
172
+ -790.6840559945587,
173
+ 613.6201544608678,
174
+ 7535.195642051765,
175
+ ],
176
+ [
177
+ "2023-04-18T08:28:49.744064",
178
+ -3323981.068179951,
179
+ -6043034.207488383,
180
+ 135738.52856182377,
181
+ -786.6426321349277,
182
+ 620.9687567313651,
183
+ 7535.034748924513,
184
+ ],
185
+ [
186
+ "2023-04-18T08:28:50.744064",
187
+ -3324765.6934943097,
188
+ -6042409.568871722,
189
+ 143273.48006733102,
190
+ -782.6002236244674,
191
+ 628.3166551011666,
192
+ 7534.864666663388,
193
+ ],
194
+ [
195
+ "2023-04-18T08:28:51.744064",
196
+ -3325546.2759252544,
197
+ -6041777.582721372,
198
+ 150808.25691495842,
199
+ -778.5568354111685,
200
+ 635.6638405415614,
201
+ 7534.68539534976,
202
+ ],
203
+ ]
204
+ return [
205
+ State(
206
+ instant=Instant.date_time(DateTime.parse(row[0]), Scale.UTC),
207
+ position=Position.meters(
208
+ [float(row[1]), float(row[2]), float(row[3])], Frame.GCRF()
209
+ ),
210
+ velocity=Velocity.meters_per_second(
211
+ [float(row[4]), float(row[5]), float(row[6])], Frame.GCRF()
212
+ ),
213
+ )
214
+ for row in data
215
+ ]
216
+
217
+
218
+ @pytest.fixture
219
+ def test_states(reference_states: list[State]) -> list[State]:
220
+ return reference_states[::4]
221
+
222
+
223
+ @pytest.fixture
224
+ def interpolation_type() -> Interpolator.Type:
225
+ return Interpolator.Type.CubicSpline
226
+
227
+
228
+ @pytest.fixture
229
+ def tabulated(
230
+ test_states: list[State],
231
+ interpolation_type: Interpolator.Type,
232
+ ) -> Tabulated:
233
+ return Tabulated(
234
+ states=test_states,
235
+ interpolation_type=interpolation_type,
236
+ )
237
+
238
+
239
+ class TestTabulatedTrajectory:
240
+ @pytest.mark.parametrize(
241
+ "interpolation_type",
242
+ (
243
+ (Interpolator.Type.Linear),
244
+ (Interpolator.Type.CubicSpline),
245
+ (Interpolator.Type.BarycentricRational),
246
+ ),
247
+ )
248
+ def test_constructor(
249
+ self,
250
+ test_states: list[State],
251
+ interpolation_type: Interpolator.Type,
252
+ ):
253
+ assert (
254
+ Tabulated(
255
+ states=test_states,
256
+ interpolation_type=interpolation_type,
257
+ )
258
+ is not None
259
+ )
260
+
261
+ def test_get_interpolation_type(
262
+ self,
263
+ test_states: list[State],
264
+ tabulated: Tabulated,
265
+ interpolation_type: Interpolator.Type,
266
+ ):
267
+ assert tabulated.get_interpolation_type() == Interpolator.Type.CubicSpline
268
+
269
+ @pytest.mark.parametrize(
270
+ "interpolation_type,error_tolerance",
271
+ (
272
+ (Interpolator.Type.Linear, 420.0),
273
+ (Interpolator.Type.CubicSpline, 5e-3),
274
+ (Interpolator.Type.BarycentricRational, 5e-2),
275
+ ),
276
+ )
277
+ def test_calculate_state_at(
278
+ self,
279
+ test_states: list[State],
280
+ reference_states: list[State],
281
+ interpolation_type: Interpolator.Type,
282
+ error_tolerance: float,
283
+ ):
284
+ tabulated: Tabulated = Tabulated(
285
+ states=test_states,
286
+ interpolation_type=interpolation_type,
287
+ )
288
+
289
+ for reference_state in reference_states:
290
+ if not tabulated.get_interval().contains_instant(
291
+ reference_state.get_instant()
292
+ ):
293
+ continue
294
+
295
+ calculated_state: State = tabulated.calculate_state_at(
296
+ reference_state.get_instant()
297
+ )
298
+ assert np.all(
299
+ np.abs(
300
+ calculated_state.get_coordinates() - reference_state.get_coordinates()
301
+ )
302
+ < error_tolerance
303
+ )
@@ -0,0 +1,126 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ from ostk.physics.coordinate.spherical import LLA
6
+ from ostk.physics.environment.object.celestial import Earth
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.unit import Derived
12
+ from ostk.astrodynamics.trajectory.model import TargetScan
13
+ from ostk.astrodynamics.trajectory import State
14
+
15
+
16
+ @pytest.fixture
17
+ def earth() -> Earth:
18
+ return Earth.WGS84()
19
+
20
+
21
+ @pytest.fixture
22
+ def start_lla() -> LLA:
23
+ return LLA.vector([0.0, 0.0, 0.0])
24
+
25
+
26
+ @pytest.fixture
27
+ def end_lla() -> LLA:
28
+ return LLA.vector([0.0, 1.0, 0.0])
29
+
30
+
31
+ @pytest.fixture
32
+ def start_instant() -> Instant:
33
+ return Instant.date_time(DateTime(2023, 1, 1, 0, 0, 0), Scale.UTC)
34
+
35
+
36
+ @pytest.fixture
37
+ def end_instant() -> Instant:
38
+ return Instant.date_time(DateTime(2023, 1, 1, 0, 10, 0), Scale.UTC)
39
+
40
+
41
+ @pytest.fixture
42
+ def target_scan(
43
+ earth: Earth,
44
+ start_lla: LLA,
45
+ end_lla: LLA,
46
+ start_instant: Instant,
47
+ end_instant: Instant,
48
+ ) -> TargetScan:
49
+ return TargetScan(
50
+ start_lla=start_lla,
51
+ end_lla=end_lla,
52
+ start_instant=start_instant,
53
+ end_instant=end_instant,
54
+ celestial=earth,
55
+ )
56
+
57
+
58
+ class TestTargetScan:
59
+ def test_constructor(
60
+ self,
61
+ target_scan: TargetScan,
62
+ ):
63
+ assert target_scan.is_defined()
64
+
65
+ def test_calculate_state_at(
66
+ self,
67
+ target_scan: TargetScan,
68
+ ):
69
+ instant: Instant = Instant.date_time(DateTime(2023, 1, 1, 0, 5, 0), Scale.UTC)
70
+ state: State = target_scan.calculate_state_at(instant)
71
+ assert state is not None
72
+
73
+ def test_equality_operator(
74
+ self,
75
+ target_scan: TargetScan,
76
+ ):
77
+ assert target_scan == target_scan
78
+
79
+ def test_inequality_operator(
80
+ self,
81
+ target_scan: TargetScan,
82
+ start_lla: LLA,
83
+ end_lla: LLA,
84
+ start_instant: Instant,
85
+ earth: Earth,
86
+ ):
87
+ target_scan2 = TargetScan(
88
+ start_lla=start_lla,
89
+ end_lla=end_lla,
90
+ start_instant=start_instant,
91
+ end_instant=Instant.undefined(),
92
+ celestial=earth,
93
+ )
94
+ assert target_scan != target_scan2
95
+
96
+ def test_getters(
97
+ self,
98
+ target_scan: TargetScan,
99
+ ):
100
+ assert target_scan.get_start_lla() is not None
101
+ assert target_scan.get_end_lla() is not None
102
+ assert target_scan.get_start_instant() is not None
103
+ assert target_scan.get_end_instant() is not None
104
+ assert target_scan.get_celestial() is not None
105
+ assert target_scan.get_step_size() is not None
106
+
107
+ def test_from_ground_speed(
108
+ self,
109
+ start_lla: LLA,
110
+ end_lla: LLA,
111
+ start_instant: Instant,
112
+ earth: Earth,
113
+ ):
114
+ ground_speed: Derived = Derived(100.0, Derived.Unit.meter_per_second())
115
+ step_size: Duration = Duration.seconds(1.0)
116
+
117
+ target_scan = TargetScan.from_ground_speed(
118
+ start_lla=start_lla,
119
+ end_lla=end_lla,
120
+ ground_speed=ground_speed,
121
+ start_instant=start_instant,
122
+ celestial=earth,
123
+ step_size=step_size,
124
+ )
125
+
126
+ assert target_scan.is_defined()
@@ -10,9 +10,10 @@ import ostk.physics.environment.object
10
10
  import ostk.physics.time
11
11
  import ostk.physics.unit
12
12
  import typing
13
+ from . import model
13
14
  from . import orbit
14
15
  from . import state
15
- __all__ = ['LocalOrbitalFrameDirection', 'LocalOrbitalFrameFactory', 'LocalOrbitalFrameTransformProvider', 'Model', 'Orbit', 'Propagator', 'Segment', 'Sequence', 'State', 'StateBuilder', 'orbit', 'state']
16
+ __all__ = ['LocalOrbitalFrameDirection', 'LocalOrbitalFrameFactory', 'LocalOrbitalFrameTransformProvider', 'Model', 'Orbit', 'Propagator', 'Segment', 'Sequence', 'State', 'StateBuilder', 'model', 'orbit', 'state']
16
17
  class LocalOrbitalFrameDirection:
17
18
  """
18
19
 
@@ -323,7 +324,7 @@ class LocalOrbitalFrameTransformProvider:
323
324
  class Model:
324
325
  """
325
326
 
326
- Orbital model.
327
+ Trajectory model.
327
328
 
328
329
 
329
330
  """
@@ -1658,7 +1659,7 @@ class StateBuilder:
1658
1659
  coordinate_subsets list[CoordinateSubset]: The coordinate subsets.
1659
1660
 
1660
1661
  Returns:
1661
- StateBuilder
1662
+ StateBuilder: The new `StateBuilder` object.
1662
1663
  """
1663
1664
  @typing.overload
1664
1665
  def __init__(self, frame: ostk.physics.coordinate.Frame, coordinate_broker: state.CoordinateBroker) -> None:
@@ -1720,18 +1721,18 @@ class StateBuilder:
1720
1721
  coordinates (VectorXd): The coordinates of the state.
1721
1722
 
1722
1723
  Returns:
1723
- State: The `State` object built from the `StateBuilder`.
1724
+ State: A `State` object built from the `StateBuilder`.
1724
1725
  """
1725
1726
  def expand(self, state: State, default_state: State) -> State:
1726
1727
  """
1727
- Expand a `State` object to the `StateBuilder`.
1728
+ Expand a `State` object to the coordinate subsets of the `StateBuilder`.
1728
1729
 
1729
1730
  Arguments:
1730
1731
  state (State): The `State` object to expand.
1731
- default_state (State): The default `State` object.
1732
+ default_state (State): The `State` object used to supply any additional coordinates.
1732
1733
 
1733
1734
  Returns:
1734
- StateBuilder: The `StateBuilder` object expanded from the `State`.
1735
+ State: A `State` object with the coordinate subsets of the `StateBuilder`.
1735
1736
  """
1736
1737
  def get_coordinate_subsets(self) -> list[state.CoordinateSubset]:
1737
1738
  """
@@ -1763,11 +1764,11 @@ class StateBuilder:
1763
1764
  """
1764
1765
  def reduce(self, state: State) -> State:
1765
1766
  """
1766
- Reduce a `State` object to the `StateBuilder`.
1767
+ Reduce a `State` object to the coordinate subsets of the `StateBuilder`.
1767
1768
 
1768
1769
  Arguments:
1769
1770
  state (State): The `State` object to reduce.
1770
1771
 
1771
1772
  Returns:
1772
- StateBuilder: The `StateBuilder` object reduced from the `State`.
1773
+ State: A `State` object with the coordinate subsets of the `StateBuilder`.
1773
1774
  """