open-space-toolkit-astrodynamics 13.1.0__py313-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_space_toolkit_astrodynamics-13.1.0.dist-info/METADATA +30 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/RECORD +100 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/WHEEL +5 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_astrodynamics-13.1.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-313-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +11 -0
- ostk/astrodynamics/converters.py +130 -0
- ostk/astrodynamics/dataframe.py +479 -0
- ostk/astrodynamics/display.py +222 -0
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.13 +0 -0
- ostk/astrodynamics/pytrajectory/__init__.py +1 -0
- ostk/astrodynamics/pytrajectory/pystate.py +251 -0
- ostk/astrodynamics/test/__init__.py +1 -0
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +248 -0
- ostk/astrodynamics/test/conftest.py +119 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/__init__.py +1 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/conftest.py +325 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/data/cdm.json +303 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/test_cdm.py +416 -0
- ostk/astrodynamics/test/dynamics/__init__.py +1 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity.csv +565 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity_Truth.csv +100 -0
- ostk/astrodynamics/test/dynamics/test_atmospheric_drag.py +128 -0
- ostk/astrodynamics/test/dynamics/test_central_body_gravity.py +58 -0
- ostk/astrodynamics/test/dynamics/test_dynamics.py +50 -0
- ostk/astrodynamics/test/dynamics/test_position_derivative.py +51 -0
- ostk/astrodynamics/test/dynamics/test_tabulated.py +138 -0
- ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
- ostk/astrodynamics/test/dynamics/test_thruster.py +142 -0
- ostk/astrodynamics/test/event_condition/test_angular_condition.py +113 -0
- ostk/astrodynamics/test/event_condition/test_boolean_condition.py +55 -0
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +87 -0
- ostk/astrodynamics/test/event_condition/test_instant_condition.py +48 -0
- ostk/astrodynamics/test/event_condition/test_logical_condition.py +120 -0
- ostk/astrodynamics/test/event_condition/test_real_condition.py +50 -0
- ostk/astrodynamics/test/flight/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +73 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_maneuver.py +212 -0
- ostk/astrodynamics/test/flight/test_profile.py +253 -0
- ostk/astrodynamics/test/flight/test_system.py +55 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +138 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
- ostk/astrodynamics/test/test_access.py +128 -0
- ostk/astrodynamics/test/test_converters.py +290 -0
- ostk/astrodynamics/test/test_dataframe.py +875 -0
- ostk/astrodynamics/test/test_display.py +114 -0
- ostk/astrodynamics/test/test_event_condition.py +78 -0
- ostk/astrodynamics/test/test_import.py +26 -0
- ostk/astrodynamics/test/test_root_solver.py +70 -0
- ostk/astrodynamics/test/test_trajectory.py +118 -0
- ostk/astrodynamics/test/test_utilities.py +106 -0
- ostk/astrodynamics/test/test_viewer.py +129 -0
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/conftest.py +18 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/data/opm_1.yaml +44 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/test_opm.py +108 -0
- ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean.py +65 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_long.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_short.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +201 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +234 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +380 -0
- ostk/astrodynamics/test/trajectory/orbit/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/test_pass.py +75 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_angular_velocity.py +30 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_attitude_quaternion.py +18 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_position.py +107 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_velocity.py +115 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_broker.py +84 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_subset.py +46 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +108 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +205 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +458 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +403 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +530 -0
- ostk/astrodynamics/test/trajectory/test_state.py +543 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
- ostk/astrodynamics/utilities.py +247 -0
- ostk/astrodynamics/viewer.py +392 -0
@@ -0,0 +1,403 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from ostk.physics import Environment
|
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 Frame
|
12
|
+
from ostk.physics.environment.object.celestial import Earth
|
13
|
+
|
14
|
+
from ostk.astrodynamics.flight.system import SatelliteSystem
|
15
|
+
from ostk.astrodynamics import Dynamics
|
16
|
+
from ostk.astrodynamics.dynamics import CentralBodyGravity
|
17
|
+
from ostk.astrodynamics.dynamics import PositionDerivative
|
18
|
+
from ostk.astrodynamics.dynamics import Thruster
|
19
|
+
from ostk.astrodynamics.guidance_law import ConstantThrust
|
20
|
+
from ostk.astrodynamics.trajectory import State
|
21
|
+
from ostk.astrodynamics.trajectory import Segment
|
22
|
+
from ostk.astrodynamics.event_condition import InstantCondition
|
23
|
+
from ostk.astrodynamics.trajectory.state import CoordinateSubset
|
24
|
+
from ostk.astrodynamics.trajectory.state import CoordinateBroker
|
25
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianPosition
|
26
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianVelocity
|
27
|
+
from ostk.astrodynamics.trajectory.state import NumericalSolver
|
28
|
+
|
29
|
+
|
30
|
+
@pytest.fixture
|
31
|
+
def environment() -> Environment:
|
32
|
+
return Environment.default()
|
33
|
+
|
34
|
+
|
35
|
+
@pytest.fixture
|
36
|
+
def state() -> State:
|
37
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
38
|
+
coordinates: list[float] = [
|
39
|
+
7500000.0,
|
40
|
+
0.0,
|
41
|
+
0.0,
|
42
|
+
0.0,
|
43
|
+
5335.865450622126,
|
44
|
+
5335.865450622126,
|
45
|
+
300.0,
|
46
|
+
]
|
47
|
+
frame: Frame = Frame.GCRF()
|
48
|
+
coordinate_broker: CoordinateBroker = CoordinateBroker(
|
49
|
+
[
|
50
|
+
CartesianPosition.default(),
|
51
|
+
CartesianVelocity.default(),
|
52
|
+
CoordinateSubset.mass(),
|
53
|
+
]
|
54
|
+
)
|
55
|
+
return State(instant, coordinates, frame, coordinate_broker)
|
56
|
+
|
57
|
+
|
58
|
+
@pytest.fixture
|
59
|
+
def central_body_gravity() -> CentralBodyGravity:
|
60
|
+
return CentralBodyGravity(Earth.spherical())
|
61
|
+
|
62
|
+
|
63
|
+
@pytest.fixture
|
64
|
+
def position_derivative() -> PositionDerivative:
|
65
|
+
return PositionDerivative()
|
66
|
+
|
67
|
+
|
68
|
+
@pytest.fixture
|
69
|
+
def dynamics(
|
70
|
+
position_derivative: PositionDerivative, central_body_gravity: CentralBodyGravity
|
71
|
+
) -> list:
|
72
|
+
return [
|
73
|
+
position_derivative,
|
74
|
+
central_body_gravity,
|
75
|
+
]
|
76
|
+
|
77
|
+
|
78
|
+
@pytest.fixture
|
79
|
+
def numerical_solver() -> NumericalSolver:
|
80
|
+
return NumericalSolver.default_conditional()
|
81
|
+
|
82
|
+
|
83
|
+
@pytest.fixture
|
84
|
+
def end_instant(state: State) -> Instant:
|
85
|
+
return state.get_instant() + Duration.minutes(15.0)
|
86
|
+
|
87
|
+
|
88
|
+
@pytest.fixture
|
89
|
+
def instant_condition(end_instant: Instant) -> InstantCondition:
|
90
|
+
return InstantCondition(InstantCondition.Criterion.AnyCrossing, end_instant)
|
91
|
+
|
92
|
+
|
93
|
+
@pytest.fixture
|
94
|
+
def name() -> str:
|
95
|
+
return "A Segment"
|
96
|
+
|
97
|
+
|
98
|
+
@pytest.fixture
|
99
|
+
def coast_duration_segment(
|
100
|
+
name: str,
|
101
|
+
instant_condition: InstantCondition,
|
102
|
+
dynamics: list,
|
103
|
+
numerical_solver: NumericalSolver,
|
104
|
+
) -> Segment:
|
105
|
+
return Segment.coast(name, instant_condition, dynamics, numerical_solver)
|
106
|
+
|
107
|
+
|
108
|
+
@pytest.fixture
|
109
|
+
def maneuver_segment(
|
110
|
+
name: str,
|
111
|
+
instant_condition: InstantCondition,
|
112
|
+
dynamics: list,
|
113
|
+
numerical_solver: NumericalSolver,
|
114
|
+
thruster_dynamics: Thruster,
|
115
|
+
) -> Segment:
|
116
|
+
return Segment.maneuver(
|
117
|
+
name=name,
|
118
|
+
event_condition=instant_condition,
|
119
|
+
thruster_dynamics=thruster_dynamics,
|
120
|
+
dynamics=dynamics,
|
121
|
+
numerical_solver=numerical_solver,
|
122
|
+
)
|
123
|
+
|
124
|
+
|
125
|
+
@pytest.fixture
|
126
|
+
def instants(state: State) -> list[Instant]:
|
127
|
+
return [state.get_instant(), state.get_instant() + Duration.minutes(1.0)]
|
128
|
+
|
129
|
+
|
130
|
+
@pytest.fixture
|
131
|
+
def thruster_dynamics() -> Thruster:
|
132
|
+
return Thruster(
|
133
|
+
satellite_system=SatelliteSystem.default(),
|
134
|
+
guidance_law=ConstantThrust.intrack(),
|
135
|
+
)
|
136
|
+
|
137
|
+
|
138
|
+
@pytest.fixture
|
139
|
+
def segment_solution(dynamics: list[Dynamics], state: State) -> Segment.Solution:
|
140
|
+
return Segment.Solution(
|
141
|
+
name="A Segment",
|
142
|
+
dynamics=dynamics,
|
143
|
+
states=[
|
144
|
+
state,
|
145
|
+
],
|
146
|
+
condition_is_satisfied=True,
|
147
|
+
segment_type=Segment.Type.Coast,
|
148
|
+
)
|
149
|
+
|
150
|
+
|
151
|
+
class TestSegmentSolution:
|
152
|
+
def test_constructors(
|
153
|
+
self,
|
154
|
+
segment_solution: Segment.Solution,
|
155
|
+
):
|
156
|
+
assert segment_solution is not None
|
157
|
+
assert segment_solution.name is not None
|
158
|
+
assert segment_solution.dynamics is not None
|
159
|
+
assert segment_solution.states is not None
|
160
|
+
assert segment_solution.condition_is_satisfied is not None
|
161
|
+
assert segment_solution.segment_type is not None
|
162
|
+
|
163
|
+
def test_getters_and_accessors(
|
164
|
+
self,
|
165
|
+
segment_solution: Segment.Solution,
|
166
|
+
):
|
167
|
+
assert segment_solution.access_start_instant() is not None
|
168
|
+
assert segment_solution.access_end_instant() is not None
|
169
|
+
assert segment_solution.get_interval() is not None
|
170
|
+
assert segment_solution.get_initial_mass() is not None
|
171
|
+
assert segment_solution.get_final_mass() is not None
|
172
|
+
assert segment_solution.get_propagation_duration() is not None
|
173
|
+
|
174
|
+
def test_compute_delta_v(
|
175
|
+
self,
|
176
|
+
segment_solution: Segment.Solution,
|
177
|
+
):
|
178
|
+
assert segment_solution.compute_delta_v(1500.0) is not None
|
179
|
+
|
180
|
+
def test_compute_delta_mass(
|
181
|
+
self,
|
182
|
+
segment_solution: Segment.Solution,
|
183
|
+
):
|
184
|
+
assert segment_solution.compute_delta_mass() is not None
|
185
|
+
|
186
|
+
@pytest.mark.skip(reason="Not implemented yet")
|
187
|
+
def test_extract_maneuvers(
|
188
|
+
self,
|
189
|
+
segment_solution: Segment.Solution,
|
190
|
+
):
|
191
|
+
assert segment_solution.extract_maneuvers(Frame.GCRF()) is not None
|
192
|
+
|
193
|
+
def test_calculate_states_at(
|
194
|
+
self,
|
195
|
+
segment_solution: Segment.Solution,
|
196
|
+
):
|
197
|
+
assert (
|
198
|
+
segment_solution.calculate_states_at(
|
199
|
+
[
|
200
|
+
segment_solution.states[0].get_instant(),
|
201
|
+
],
|
202
|
+
NumericalSolver.default_conditional(),
|
203
|
+
)
|
204
|
+
is not None
|
205
|
+
)
|
206
|
+
|
207
|
+
def get_dynamics_contribution(
|
208
|
+
self,
|
209
|
+
segment_solution: Segment.Solution,
|
210
|
+
):
|
211
|
+
assert (
|
212
|
+
segment_solution.get_dynamics_contribution(
|
213
|
+
segment_solution.dynamics[0], Frame.GCRF()
|
214
|
+
)
|
215
|
+
is not None
|
216
|
+
)
|
217
|
+
|
218
|
+
def get_dynamics_acceleration_contribution(
|
219
|
+
self,
|
220
|
+
segment_solution: Segment.Solution,
|
221
|
+
):
|
222
|
+
assert (
|
223
|
+
segment_solution.get_dynamics_acceleration_contribution(
|
224
|
+
segment_solution.dynamics[0], Frame.GCRF()
|
225
|
+
)
|
226
|
+
is not None
|
227
|
+
)
|
228
|
+
|
229
|
+
def get_all_dynamics_contributions(
|
230
|
+
self,
|
231
|
+
segment_solution: Segment.Solution,
|
232
|
+
):
|
233
|
+
assert segment_solution.get_all_dynamics_contributions(Frame.GCRF()) is not None
|
234
|
+
|
235
|
+
|
236
|
+
class TestSegment:
|
237
|
+
def test_get_name(self, coast_duration_segment: Segment, name: str):
|
238
|
+
assert coast_duration_segment.get_name() == name
|
239
|
+
|
240
|
+
def test_get_event_condition(
|
241
|
+
self,
|
242
|
+
instant_condition: InstantCondition,
|
243
|
+
coast_duration_segment: Segment,
|
244
|
+
):
|
245
|
+
assert coast_duration_segment.get_event_condition() == instant_condition
|
246
|
+
|
247
|
+
def test_get_dynamics(
|
248
|
+
self,
|
249
|
+
dynamics: list,
|
250
|
+
coast_duration_segment: Segment,
|
251
|
+
):
|
252
|
+
assert len(coast_duration_segment.get_dynamics()) == len(dynamics)
|
253
|
+
|
254
|
+
def test_get_numerical_solver(
|
255
|
+
self,
|
256
|
+
numerical_solver: NumericalSolver,
|
257
|
+
coast_duration_segment: Segment,
|
258
|
+
):
|
259
|
+
assert coast_duration_segment.get_numerical_solver() == numerical_solver
|
260
|
+
|
261
|
+
def test_get_type(
|
262
|
+
self,
|
263
|
+
coast_duration_segment: Segment,
|
264
|
+
):
|
265
|
+
assert coast_duration_segment.get_type() == Segment.Type.Coast
|
266
|
+
|
267
|
+
def test_coast(
|
268
|
+
self,
|
269
|
+
name: str,
|
270
|
+
instant_condition: InstantCondition,
|
271
|
+
dynamics: list,
|
272
|
+
numerical_solver: NumericalSolver,
|
273
|
+
):
|
274
|
+
assert (
|
275
|
+
Segment.coast(name, instant_condition, dynamics, numerical_solver) is not None
|
276
|
+
)
|
277
|
+
|
278
|
+
def test_maneuver(
|
279
|
+
self,
|
280
|
+
name: str,
|
281
|
+
instant_condition: InstantCondition,
|
282
|
+
thruster_dynamics: ConstantThrust,
|
283
|
+
dynamics: list,
|
284
|
+
numerical_solver: NumericalSolver,
|
285
|
+
):
|
286
|
+
assert (
|
287
|
+
Segment.maneuver(
|
288
|
+
name=name,
|
289
|
+
event_condition=instant_condition,
|
290
|
+
thruster_dynamics=thruster_dynamics,
|
291
|
+
dynamics=dynamics,
|
292
|
+
numerical_solver=numerical_solver,
|
293
|
+
)
|
294
|
+
is not None
|
295
|
+
)
|
296
|
+
|
297
|
+
def test_create_solution(
|
298
|
+
self,
|
299
|
+
dynamics: list,
|
300
|
+
state: State,
|
301
|
+
):
|
302
|
+
segment_solution: Segment.Solution = Segment.Solution(
|
303
|
+
name="A Segment",
|
304
|
+
dynamics=dynamics,
|
305
|
+
states=[
|
306
|
+
state,
|
307
|
+
],
|
308
|
+
condition_is_satisfied=True,
|
309
|
+
segment_type=Segment.Type.Coast,
|
310
|
+
)
|
311
|
+
|
312
|
+
assert segment_solution is not None
|
313
|
+
|
314
|
+
def test_solve(
|
315
|
+
self,
|
316
|
+
state: State,
|
317
|
+
end_instant: Instant,
|
318
|
+
maneuver_segment: Segment,
|
319
|
+
instants: list[Instant],
|
320
|
+
numerical_solver: NumericalSolver,
|
321
|
+
):
|
322
|
+
solution = maneuver_segment.solve(state)
|
323
|
+
|
324
|
+
assert (
|
325
|
+
pytest.approx(
|
326
|
+
float((solution.states[-1].get_instant() - end_instant).in_seconds()),
|
327
|
+
abs=1e-7,
|
328
|
+
)
|
329
|
+
== 0.0
|
330
|
+
)
|
331
|
+
|
332
|
+
assert solution.name is not None
|
333
|
+
assert solution.dynamics is not None
|
334
|
+
assert len(solution.states) > 0
|
335
|
+
assert solution.condition_is_satisfied is True
|
336
|
+
assert solution.segment_type is not None
|
337
|
+
|
338
|
+
assert solution.access_start_instant() is not None
|
339
|
+
assert solution.access_end_instant() is not None
|
340
|
+
|
341
|
+
assert solution.get_initial_mass() is not None
|
342
|
+
assert solution.get_final_mass() is not None
|
343
|
+
assert solution.get_propagation_duration() is not None
|
344
|
+
|
345
|
+
assert solution.compute_delta_v(1500.0) is not None
|
346
|
+
assert solution.compute_delta_mass() is not None
|
347
|
+
|
348
|
+
assert solution.extract_maneuvers(state.get_frame()) is not None
|
349
|
+
assert len(solution.extract_maneuvers(state.get_frame())) == 1
|
350
|
+
|
351
|
+
propagated_states = solution.calculate_states_at(
|
352
|
+
instants,
|
353
|
+
numerical_solver,
|
354
|
+
)
|
355
|
+
|
356
|
+
assert propagated_states is not None
|
357
|
+
assert len(propagated_states) == len(instants)
|
358
|
+
|
359
|
+
first_dynamics_contribution = solution.get_dynamics_contribution(
|
360
|
+
solution.dynamics[0], state.get_frame()
|
361
|
+
)
|
362
|
+
|
363
|
+
second_dynamics_contribution = solution.get_dynamics_contribution(
|
364
|
+
solution.dynamics[1], state.get_frame()
|
365
|
+
)
|
366
|
+
|
367
|
+
third_dynamics_contribution = solution.get_dynamics_contribution(
|
368
|
+
solution.dynamics[2], state.get_frame()
|
369
|
+
)
|
370
|
+
|
371
|
+
assert first_dynamics_contribution is not None
|
372
|
+
assert second_dynamics_contribution is not None
|
373
|
+
assert third_dynamics_contribution is not None
|
374
|
+
assert first_dynamics_contribution.shape == (len(solution.states), 3)
|
375
|
+
assert second_dynamics_contribution.shape == (len(solution.states), 3)
|
376
|
+
assert third_dynamics_contribution.shape == (len(solution.states), 4)
|
377
|
+
|
378
|
+
all_contributions = solution.get_all_dynamics_contributions(state.get_frame())
|
379
|
+
assert len(all_contributions) == len(solution.dynamics)
|
380
|
+
|
381
|
+
assert all_contributions is not None
|
382
|
+
assert isinstance(all_contributions, dict)
|
383
|
+
assert np.array_equal(
|
384
|
+
all_contributions[solution.dynamics[0]], first_dynamics_contribution
|
385
|
+
)
|
386
|
+
assert np.array_equal(
|
387
|
+
all_contributions[solution.dynamics[1]], second_dynamics_contribution
|
388
|
+
)
|
389
|
+
assert np.array_equal(
|
390
|
+
all_contributions[solution.dynamics[2]], third_dynamics_contribution
|
391
|
+
)
|
392
|
+
|
393
|
+
acceleration_contribution = solution.get_dynamics_acceleration_contribution(
|
394
|
+
solution.dynamics[1], state.get_frame()
|
395
|
+
)
|
396
|
+
assert acceleration_contribution is not None
|
397
|
+
assert acceleration_contribution.shape == (len(solution.states), 3)
|
398
|
+
assert isinstance(acceleration_contribution, np.ndarray)
|
399
|
+
|
400
|
+
with pytest.raises(Exception):
|
401
|
+
solution.get_dynamics_acceleration_contribution(
|
402
|
+
solution.dynamics[0], state.get_frame()
|
403
|
+
)
|