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,120 +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 RealCondition, LogicalCondition
9
- from ostk.astrodynamics.trajectory import State
10
-
11
-
12
- @pytest.fixture
13
- def always_true() -> RealCondition:
14
- return RealCondition(
15
- "Always True Condition",
16
- RealCondition.Criterion.StrictlyPositive,
17
- lambda state: 1.0,
18
- 0.0,
19
- )
20
-
21
-
22
- @pytest.fixture
23
- def always_false() -> RealCondition:
24
- return RealCondition(
25
- "Always False Condition",
26
- RealCondition.Criterion.StrictlyPositive,
27
- lambda state: -1.0,
28
- 0.0,
29
- )
30
-
31
-
32
- @pytest.fixture
33
- def event_conditions(
34
- always_true: RealCondition, always_false: RealCondition
35
- ) -> list[RealCondition]:
36
- return [always_true, always_false]
37
-
38
-
39
- @pytest.fixture
40
- def logical_condition_type() -> LogicalCondition.Type:
41
- return LogicalCondition.Type.And
42
-
43
-
44
- @pytest.fixture
45
- def state() -> State:
46
- frame: Frame = Frame.GCRF()
47
- position: Position = Position.meters(
48
- [717094.039086306, -6872433.2241124, 46175.9696673281], frame
49
- )
50
- velocity: Velocity = Velocity.meters_per_second(
51
- [-970.650826004612, -45.4598114773158, 7529.82424886455], frame
52
- )
53
-
54
- instant: Instant = Instant.date_time(DateTime(2023, 1, 1, 0, 1, 0), Scale.UTC)
55
- return State(instant, position, velocity)
56
-
57
-
58
- @pytest.fixture
59
- def logical_condition(
60
- logical_condition_type: LogicalCondition.Type, event_conditions: list[RealCondition]
61
- ) -> LogicalCondition:
62
- return LogicalCondition("Logical", logical_condition_type, event_conditions)
63
-
64
-
65
- class TestLogicalCondition:
66
- @pytest.mark.parametrize(
67
- "logical_condition_type",
68
- (
69
- LogicalCondition.Type.And,
70
- LogicalCondition.Type.Or,
71
- ),
72
- )
73
- def test_constructor(
74
- self,
75
- logical_condition_type: LogicalCondition.Type,
76
- event_conditions: list[RealCondition],
77
- ):
78
- assert (
79
- LogicalCondition(
80
- "Logical Condition", logical_condition_type, event_conditions
81
- )
82
- is not None
83
- )
84
-
85
- def test_get_event_conditions(
86
- self,
87
- logical_condition: LogicalCondition,
88
- event_conditions: list[RealCondition],
89
- ):
90
- assert logical_condition.get_event_conditions() == event_conditions
91
-
92
- def test_get_type(
93
- self,
94
- logical_condition: LogicalCondition,
95
- logical_condition_type: LogicalCondition.Type,
96
- ):
97
- assert logical_condition.get_type() == logical_condition_type
98
-
99
- @pytest.mark.parametrize(
100
- "logical_condition_type,expected_result",
101
- (
102
- (LogicalCondition.Type.And, False),
103
- (LogicalCondition.Type.Or, True),
104
- ),
105
- )
106
- def test_is_satisfied(
107
- self,
108
- logical_condition_type: LogicalCondition.Type,
109
- expected_result: bool,
110
- event_conditions: list[RealCondition],
111
- state: State,
112
- ):
113
- logical_condition: LogicalCondition = LogicalCondition(
114
- "Logical Condition", logical_condition_type, event_conditions
115
- )
116
-
117
- assert (
118
- logical_condition.is_satisfied(previous_state=state, current_state=state)
119
- == expected_result
120
- )
@@ -1,53 +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
-
10
- from ostk.astrodynamics.event_condition import RealCondition
11
-
12
-
13
- @pytest.fixture
14
- def state() -> State:
15
- frame: Frame = Frame.GCRF()
16
- position: Position = Position.meters([7500000.0, 0.0, 0.0], frame)
17
- velocity: Velocity = Velocity.meters_per_second(
18
- [0.0, 5335.865450622126, 5335.865450622126], frame
19
- )
20
-
21
- instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
22
- return State(instant, position, velocity)
23
-
24
-
25
- @pytest.fixture
26
- def evaluator():
27
- return lambda state: state.get_coordinates()[0]
28
-
29
-
30
- @pytest.fixture
31
- def target() -> float:
32
- return 10.0
33
-
34
-
35
- @pytest.fixture
36
- def event_condition(evaluator, target: float) -> RealCondition:
37
- return RealCondition(
38
- "My Condition", RealCondition.Criterion.PositiveCrossing, evaluator, target
39
- )
40
-
41
-
42
- class TestRealCondition:
43
- def test_get_target(self, event_condition: RealCondition, target: float):
44
- assert event_condition.get_target() == target
45
-
46
- def test_evaluate(self, state: State, event_condition: RealCondition):
47
- assert event_condition.evaluate(state) is not None
48
-
49
- def test_is_satisfied(self, state: State, event_condition: RealCondition):
50
- assert (
51
- event_condition.is_satisfied(previous_state=state, current_state=state)
52
- is not None
53
- )
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,144 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- import numpy as np
6
-
7
- import ostk.mathematics as mathematics
8
-
9
- import ostk.physics as physics
10
-
11
- import ostk.astrodynamics as astrodynamics
12
-
13
- Quaternion = mathematics.geometry.d3.transformations.rotations.Quaternion
14
- DateTime = physics.time.DateTime
15
- Instant = physics.time.Instant
16
- Scale = physics.time.Scale
17
- Position = physics.coordinate.Position
18
- Velocity = physics.coordinate.Velocity
19
- Frame = physics.coordinate.Frame
20
- State = astrodynamics.flight.profile.State
21
-
22
-
23
- @pytest.fixture
24
- def instant() -> Instant:
25
- return Instant.date_time(DateTime(2020, 1, 3, 0, 0, 0), Scale.UTC)
26
-
27
-
28
- @pytest.fixture
29
- def frame() -> Frame:
30
- return Frame.GCRF()
31
-
32
-
33
- @pytest.fixture
34
- def position(frame: Frame) -> Position:
35
- return Position.meters([0.0, 3.2, 3000.0], frame)
36
-
37
-
38
- @pytest.fixture
39
- def velocity(frame: Frame) -> Velocity:
40
- return Velocity.meters_per_second([1.0, 3.0, 0.0], frame)
41
-
42
-
43
- @pytest.fixture
44
- def quaternion() -> Quaternion:
45
- return Quaternion([0.0, 0.0, 0.0, 1.0], Quaternion.Format.XYZS)
46
-
47
-
48
- @pytest.fixture
49
- def angular_velocity() -> np.array:
50
- return np.array((0.01, 0.01, 0.0))
51
-
52
-
53
- @pytest.fixture
54
- def state(
55
- instant: Instant,
56
- position: Position,
57
- velocity: Velocity,
58
- quaternion: Quaternion,
59
- angular_velocity: np.array,
60
- frame: Frame,
61
- ) -> State:
62
- return State(
63
- instant,
64
- position,
65
- velocity,
66
- quaternion,
67
- angular_velocity,
68
- frame,
69
- )
70
-
71
-
72
- class TestState:
73
- def test_constructors_list(
74
- self, instant: Instant, quaternion: Quaternion, frame: Frame
75
- ):
76
- position = Position.meters([0.0, 3.2, 3000.0], frame)
77
- velocity = Velocity.meters_per_second([1.0, 3.0, 0.0], frame)
78
- angular_velocity = [0.01, 0.01, 0.0]
79
-
80
- assert isinstance(
81
- State(instant, position, velocity, quaternion, angular_velocity, frame),
82
- State,
83
- )
84
-
85
- def test_constructors_tuples(
86
- self, instant: Instant, quaternion: Quaternion, frame: Frame
87
- ):
88
- position = Position.meters((0.0, 3.2, 3000.0), frame)
89
- velocity = Velocity.meters_per_second((1.0, 3.0, 0.0), frame)
90
- angular_velocity = (0.01, 0.01, 0.0)
91
-
92
- assert isinstance(
93
- State(instant, position, velocity, quaternion, angular_velocity, frame),
94
- State,
95
- )
96
-
97
- def test_constructors_array(
98
- self, instant: Instant, quaternion: Quaternion, frame: Frame
99
- ):
100
- position = Position.meters(np.array((0.0, 3.2, 3000.0)), Frame.GCRF())
101
- velocity = Velocity.meters_per_second(np.array((1.0, 3.0, 0.0)), Frame.GCRF())
102
- angular_velocity = np.array((0.01, 0.01, 0.0))
103
-
104
- assert isinstance(
105
- State(instant, position, velocity, quaternion, angular_velocity, frame),
106
- State,
107
- )
108
-
109
- def test_comparators(self, state: State):
110
- assert (state == state) is True
111
- assert (state != state) is False
112
-
113
- def test_get_instant(self, instant: Instant, state: State):
114
- assert isinstance(state.get_instant(), Instant)
115
- assert state.get_instant() == instant
116
-
117
- def test_get_position(self, position: Position, state: State):
118
- assert isinstance(state.get_position(), Position)
119
- assert state.get_position() == position
120
-
121
- def test_get_velocity(self, velocity: Velocity, state: State):
122
- assert isinstance(state.get_velocity(), Velocity)
123
- assert state.get_velocity() == velocity
124
-
125
- def test_get_attitude(self, quaternion: Quaternion, state: State):
126
- assert isinstance(state.get_attitude(), Quaternion)
127
- assert state.get_attitude() == quaternion
128
-
129
- def test_get_angular_velocity(self, angular_velocity: np.array, state: State):
130
- assert isinstance(state.get_angular_velocity(), np.ndarray)
131
- assert np.array_equal(state.get_angular_velocity(), angular_velocity)
132
-
133
- def test_get_frame(self, frame: Frame, state: State):
134
- assert isinstance(state.get_frame(), Frame)
135
- assert state.get_frame() == frame
136
-
137
- def test_in_frame(self, frame: Frame, state: State):
138
- assert isinstance(state.in_frame(frame), State)
139
-
140
- def test_undefined(self):
141
- state: State = State.undefined()
142
-
143
- assert isinstance(state, State)
144
- assert state.is_defined() is False
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,89 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- import numpy as np
6
-
7
- from ostk.mathematics.geometry.d3.objects import Cuboid
8
- from ostk.mathematics.geometry.d3.objects import Composite
9
- from ostk.mathematics.geometry.d3.objects import Point
10
-
11
- from ostk.physics.units import Mass
12
- from ostk.physics.time import Instant
13
- from ostk.physics.time import DateTime
14
- from ostk.physics.time import Scale
15
- from ostk.physics.coordinate import Position
16
- from ostk.physics.coordinate import Velocity
17
- from ostk.physics.coordinate import Frame
18
- from ostk.physics.environment.atmospheric import Earth as EarthAtmosphericModel
19
- from ostk.physics.environment.gravitational import Earth as EarthGravitationalModel
20
- from ostk.physics.environment.magnetic import Earth as EarthMagneticModel
21
- from ostk.physics.environment.objects.celestial_bodies import Earth
22
-
23
- from ostk.astrodynamics.trajectory import State
24
- from ostk.astrodynamics.flight.system import SatelliteSystem
25
- from ostk.astrodynamics.flight.system import Dynamics
26
- from ostk.astrodynamics.flight.system.dynamics import AtmosphericDrag
27
-
28
-
29
- @pytest.fixture
30
- def earth() -> Earth:
31
- return Earth.from_models(
32
- EarthGravitationalModel(EarthGravitationalModel.Type.Undefined),
33
- EarthMagneticModel(EarthMagneticModel.Type.Undefined),
34
- EarthAtmosphericModel(EarthAtmosphericModel.Type.Exponential),
35
- )
36
-
37
-
38
- @pytest.fixture
39
- def satellite_system() -> SatelliteSystem:
40
- mass = Mass(100.0, Mass.Unit.Kilogram)
41
- satellite_geometry = Composite(
42
- Cuboid(
43
- Point(0.0, 0.0, 0.0),
44
- [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
45
- [1.0, 0.0, 0.0],
46
- )
47
- )
48
- inertia_tensor = np.ndarray(shape=(3, 3))
49
- surface_area = 500.0
50
- drag_coefficient = 2.1
51
-
52
- return SatelliteSystem(
53
- mass, satellite_geometry, inertia_tensor, surface_area, drag_coefficient
54
- )
55
-
56
-
57
- @pytest.fixture
58
- def dynamics(earth: Earth, satellite_system: SatelliteSystem) -> AtmosphericDrag:
59
- return AtmosphericDrag(earth, satellite_system)
60
-
61
-
62
- @pytest.fixture
63
- def state() -> State:
64
- frame: Frame = Frame.GCRF()
65
- position: Position = Position.meters([7000000.0, 0.0, 0.0], frame)
66
- velocity: Velocity = Velocity.meters_per_second([0.0, 7546.05329, 0.0], frame)
67
- instant = Instant.date_time(DateTime(2021, 3, 20, 12, 0, 0), Scale.UTC)
68
- return State(instant, position, velocity)
69
-
70
-
71
- class TestAtmosphericDrag:
72
- def test_constructors(self, dynamics: AtmosphericDrag):
73
- assert dynamics is not None
74
- assert isinstance(dynamics, AtmosphericDrag)
75
- assert isinstance(dynamics, Dynamics)
76
- assert dynamics.is_defined()
77
-
78
- def test_getters(self, dynamics: AtmosphericDrag, earth: Earth):
79
- assert dynamics.get_celestial() == earth
80
-
81
- def test_compute_contribution(self, dynamics: AtmosphericDrag, state: State):
82
- contribution = dynamics.compute_contribution(
83
- state.get_instant(), state.get_coordinates(), state.get_frame()
84
- )
85
-
86
- assert len(contribution) == 3
87
- assert contribution == pytest.approx(
88
- [0.0, -0.0000278707803890, -0.0000000000197640], abs=5e-11
89
- )
@@ -1,58 +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 import State
16
- from ostk.astrodynamics.flight.system import Dynamics
17
- from ostk.astrodynamics.flight.system.dynamics import CentralBodyGravity
18
-
19
-
20
- @pytest.fixture
21
- def earth() -> Earth:
22
- return Earth.spherical()
23
-
24
-
25
- @pytest.fixture
26
- def dynamics(earth: Earth) -> CentralBodyGravity:
27
- return CentralBodyGravity(earth)
28
-
29
-
30
- @pytest.fixture
31
- def state() -> State:
32
- frame: Frame = Frame.GCRF()
33
- position: Position = Position.meters([7000000.0, 0.0, 0.0], frame)
34
- velocity: Velocity = Velocity.meters_per_second([0.0, 0.0, 0.0], frame)
35
- instant = Instant.date_time(DateTime(2021, 3, 20, 12, 0, 0), Scale.UTC)
36
- return State(instant, position, velocity)
37
-
38
-
39
- class TestCentralBodyGravity:
40
- def test_constructors(
41
- self,
42
- dynamics: CentralBodyGravity,
43
- ):
44
- assert dynamics is not None
45
- assert isinstance(dynamics, CentralBodyGravity)
46
- assert isinstance(dynamics, Dynamics)
47
- assert dynamics.is_defined()
48
-
49
- def test_getters(self, dynamics: CentralBodyGravity, earth: Earth):
50
- assert dynamics.get_celestial() == earth
51
-
52
- def test_compute_contribution(self, dynamics: CentralBodyGravity, state: State):
53
- contribution = dynamics.compute_contribution(
54
- state.get_instant(), state.get_coordinates(), state.get_frame()
55
- )
56
-
57
- assert len(contribution) == 3
58
- assert contribution == pytest.approx([-8.134702887755102, 0.0, 0.0])
@@ -1,37 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from ostk.astrodynamics.flight.system import Dynamics
6
- from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianPosition
7
-
8
-
9
- @pytest.fixture
10
- def name() -> str:
11
- return "MyDynamics"
12
-
13
-
14
- @pytest.fixture
15
- def dynamics(name: str) -> Dynamics:
16
- class MyDynamics(Dynamics):
17
- def is_defined():
18
- return True
19
-
20
- def get_read_coordinates_subsets(self):
21
- return [CartesianPosition.default()]
22
-
23
- def get_write_coordinates_subsets(self):
24
- return [CartesianPosition.default()]
25
-
26
- def compute_contribution(self, instant, state_vector, frame):
27
- return state_vector
28
-
29
- return MyDynamics(name)
30
-
31
-
32
- class TestDynamics:
33
- def test_subclass(self, dynamics: Dynamics):
34
- assert dynamics is not None
35
-
36
- def test_get_name(self, dynamics: Dynamics, name: str):
37
- assert dynamics.get_name() == name
@@ -1,51 +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 import State
16
- from ostk.astrodynamics.flight.system import Dynamics
17
- from ostk.astrodynamics.flight.system.dynamics import PositionDerivative
18
-
19
-
20
- @pytest.fixture
21
- def dynamics() -> PositionDerivative:
22
- return PositionDerivative()
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
- instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
33
- return State(instant, position, velocity)
34
-
35
-
36
- class TestPositionDerivative:
37
- def test_constructors(
38
- self,
39
- dynamics: PositionDerivative,
40
- ):
41
- assert dynamics is not None
42
- assert isinstance(dynamics, PositionDerivative)
43
- assert isinstance(dynamics, Dynamics)
44
- assert dynamics.is_defined()
45
-
46
- def test_compute_contribution(self, dynamics: PositionDerivative, state: State):
47
- contribution = dynamics.compute_contribution(
48
- state.get_instant(), state.get_coordinates(), state.get_frame()
49
- )
50
- assert len(contribution) == 3
51
- assert contribution == pytest.approx(state.get_coordinates()[:3])
@@ -1,67 +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 Moon
14
-
15
- from ostk.astrodynamics.trajectory import State
16
- from ostk.astrodynamics.flight.system import Dynamics
17
- from ostk.astrodynamics.flight.system.dynamics import ThirdBodyGravity
18
-
19
-
20
- @pytest.fixture
21
- def moon() -> Moon:
22
- return Moon.spherical()
23
-
24
-
25
- @pytest.fixture
26
- def dynamics(moon: Moon) -> ThirdBodyGravity:
27
- return ThirdBodyGravity(moon)
28
-
29
-
30
- @pytest.fixture
31
- def state() -> State:
32
- frame: Frame = Frame.GCRF()
33
- position: Position = Position.meters([7000000.0, 0.0, 0.0], frame)
34
- velocity: Velocity = Velocity.meters_per_second([0.0, 0.0, 0.0], frame)
35
- instant = Instant.date_time(DateTime(2021, 3, 20, 12, 0, 0), Scale.UTC)
36
- return State(instant, position, velocity)
37
-
38
-
39
- class TestThirdBodyGravity:
40
- def test_constructors(
41
- self,
42
- dynamics: ThirdBodyGravity,
43
- ):
44
- assert dynamics is not None
45
- assert isinstance(dynamics, ThirdBodyGravity)
46
- assert isinstance(dynamics, Dynamics)
47
- assert dynamics.is_defined()
48
-
49
- def test_getters(
50
- self,
51
- dynamics: ThirdBodyGravity,
52
- moon: Moon,
53
- ):
54
- assert dynamics.get_celestial() == moon
55
-
56
- def test_compute_contribution(
57
- self,
58
- dynamics: ThirdBodyGravity,
59
- state: State,
60
- ):
61
- contribution = dynamics.compute_contribution(
62
- state.get_instant(), state.get_coordinates(), state.get_frame()
63
- )
64
- assert len(contribution) == 3
65
- assert contribution == pytest.approx(
66
- [-4.620543790697659e-07, 2.948717888154649e-07, 1.301648617451192e-07]
67
- )