open-space-toolkit-astrodynamics 2.4.1__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.
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/METADATA +2 -2
- open_space_toolkit_astrodynamics-5.0.0.dist-info/RECORD +25 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-311-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +6 -0
- ostk/astrodynamics/converters.py +1 -1
- ostk/astrodynamics/{libopen-space-toolkit-astrodynamics.so.2 → libopen-space-toolkit-astrodynamics.so.5} +0 -0
- ostk/astrodynamics/pytrajectory/pystate.py +36 -0
- ostk/astrodynamics/test/test_access.py +1 -1
- ostk/astrodynamics/test/test_converters.py +1 -1
- ostk/astrodynamics/test/test_event_condition.py +27 -2
- ostk/astrodynamics/test/test_import.py +2 -2
- ostk/astrodynamics/test/test_trajectory.py +1 -1
- ostk/astrodynamics/viewer.py +1 -1
- open_space_toolkit_astrodynamics-2.4.1.dist-info/RECORD +0 -83
- ostk/astrodynamics/test/access/__init__.py +0 -1
- ostk/astrodynamics/test/access/test_generator.py +0 -248
- ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +0 -1
- ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +0 -325
- ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +0 -303
- ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +0 -416
- ostk/astrodynamics/test/event_condition/test_angular_condition.py +0 -113
- ostk/astrodynamics/test/event_condition/test_boolean_condition.py +0 -55
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +0 -91
- ostk/astrodynamics/test/event_condition/test_instant_condition.py +0 -48
- ostk/astrodynamics/test/event_condition/test_logical_condition.py +0 -120
- ostk/astrodynamics/test/event_condition/test_real_condition.py +0 -53
- ostk/astrodynamics/test/flight/__init__.py +0 -1
- ostk/astrodynamics/test/flight/profile/__init__.py +0 -1
- ostk/astrodynamics/test/flight/profile/test_state.py +0 -144
- ostk/astrodynamics/test/flight/system/__init__.py +0 -1
- ostk/astrodynamics/test/flight/system/dynamics/__init__.py +0 -1
- ostk/astrodynamics/test/flight/system/dynamics/test_atmospheric_drag.py +0 -128
- ostk/astrodynamics/test/flight/system/dynamics/test_central_body_gravity.py +0 -58
- ostk/astrodynamics/test/flight/system/dynamics/test_dynamics.py +0 -37
- ostk/astrodynamics/test/flight/system/dynamics/test_position_derivative.py +0 -51
- ostk/astrodynamics/test/flight/system/dynamics/test_third_body_gravity.py +0 -67
- ostk/astrodynamics/test/flight/system/dynamics/thruster/test_constant_thrust.py +0 -143
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +0 -46
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +0 -77
- ostk/astrodynamics/test/flight/test_profile.py +0 -153
- ostk/astrodynamics/test/flight/test_system.py +0 -55
- ostk/astrodynamics/test/solvers/__init__.py +0 -1
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +0 -153
- ostk/astrodynamics/test/trajectory/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +0 -18
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +0 -44
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +0 -108
- ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +0 -112
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +0 -331
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +0 -130
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +0 -195
- ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +0 -380
- ostk/astrodynamics/test/trajectory/orbit/test_model.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/test_pass.py +0 -55
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +0 -103
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +0 -113
- ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +0 -71
- ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +0 -43
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +0 -242
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +0 -82
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +0 -64
- ostk/astrodynamics/test/trajectory/test_model.py +0 -1
- ostk/astrodynamics/test/trajectory/test_orbit.py +0 -92
- ostk/astrodynamics/test/trajectory/test_propagator.py +0 -387
- ostk/astrodynamics/test/trajectory/test_state.py +0 -134
- ostk/astrodynamics/test/trajectory/test_trajectory_segment.py +0 -136
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/WHEEL +0 -0
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/zip-safe +0 -0
- /ostk/{__init__.py → astrodynamics/pytrajectory/__init__.py} +0 -0
@@ -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
|
-
)
|
@@ -1,143 +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
|
-
|
19
|
-
from ostk.astrodynamics.trajectory import LocalOrbitalFrameFactory
|
20
|
-
from ostk.astrodynamics.trajectory import LocalOrbitalFrameDirection
|
21
|
-
|
22
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesSubset
|
23
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianPosition
|
24
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianVelocity
|
25
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker
|
26
|
-
|
27
|
-
from ostk.astrodynamics.trajectory import State
|
28
|
-
from ostk.astrodynamics.flight.system import PropulsionSystem
|
29
|
-
from ostk.astrodynamics.flight.system import SatelliteSystem
|
30
|
-
from ostk.astrodynamics.flight.system import Dynamics
|
31
|
-
from ostk.astrodynamics.flight.system.dynamics.thruster import ConstantThrust
|
32
|
-
|
33
|
-
|
34
|
-
@pytest.fixture
|
35
|
-
def local_orbital_frame_direction() -> LocalOrbitalFrameDirection:
|
36
|
-
return LocalOrbitalFrameDirection(
|
37
|
-
[1.0, 0.0, 0.0],
|
38
|
-
LocalOrbitalFrameFactory.VNC(Frame.GCRF()),
|
39
|
-
)
|
40
|
-
|
41
|
-
|
42
|
-
@pytest.fixture
|
43
|
-
def propulsion_system() -> PropulsionSystem:
|
44
|
-
return PropulsionSystem(
|
45
|
-
1.0,
|
46
|
-
150.0,
|
47
|
-
)
|
48
|
-
|
49
|
-
|
50
|
-
@pytest.fixture
|
51
|
-
def satellite_system(propulsion_system: PropulsionSystem) -> SatelliteSystem:
|
52
|
-
mass = Mass(100.0, Mass.Unit.Kilogram)
|
53
|
-
satellite_geometry = Composite(
|
54
|
-
Cuboid(
|
55
|
-
Point(0.0, 0.0, 0.0),
|
56
|
-
[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
|
57
|
-
[1.0, 0.0, 0.0],
|
58
|
-
)
|
59
|
-
)
|
60
|
-
inertia_tensor = np.ndarray(shape=(3, 3))
|
61
|
-
surface_area = 0.8
|
62
|
-
drag_coefficient = 2.1
|
63
|
-
|
64
|
-
return SatelliteSystem(
|
65
|
-
mass,
|
66
|
-
satellite_geometry,
|
67
|
-
inertia_tensor,
|
68
|
-
surface_area,
|
69
|
-
drag_coefficient,
|
70
|
-
propulsion_system,
|
71
|
-
)
|
72
|
-
|
73
|
-
|
74
|
-
@pytest.fixture
|
75
|
-
def dynamics(
|
76
|
-
satellite_system: SatelliteSystem,
|
77
|
-
local_orbital_frame_direction: LocalOrbitalFrameDirection,
|
78
|
-
) -> ConstantThrust:
|
79
|
-
return ConstantThrust(
|
80
|
-
satellite_system,
|
81
|
-
local_orbital_frame_direction,
|
82
|
-
"Constant Thrust Thruster Dynamics",
|
83
|
-
)
|
84
|
-
|
85
|
-
|
86
|
-
@pytest.fixture
|
87
|
-
def coordinates_broker() -> CoordinatesBroker:
|
88
|
-
return CoordinatesBroker(
|
89
|
-
[
|
90
|
-
CartesianPosition.default(),
|
91
|
-
CartesianVelocity.default(),
|
92
|
-
CoordinatesSubset.mass(),
|
93
|
-
]
|
94
|
-
)
|
95
|
-
|
96
|
-
|
97
|
-
@pytest.fixture
|
98
|
-
def state(coordinates_broker: CoordinatesBroker) -> State:
|
99
|
-
instant: Instant = Instant.date_time(DateTime(2021, 3, 20, 12, 0, 0), Scale.UTC)
|
100
|
-
coordinates: list = [7000000.0, 0.0, 0.0, 0.0, 7546.05329, 0.0, 105.0]
|
101
|
-
|
102
|
-
return State(instant, coordinates, Frame.GCRF(), coordinates_broker)
|
103
|
-
|
104
|
-
|
105
|
-
class TestConstantThrust:
|
106
|
-
def test_constructors(self, dynamics: ConstantThrust):
|
107
|
-
assert dynamics is not None
|
108
|
-
assert isinstance(dynamics, ConstantThrust)
|
109
|
-
assert isinstance(dynamics, Dynamics)
|
110
|
-
assert dynamics.is_defined()
|
111
|
-
|
112
|
-
def test_compute_contribution_success(self, dynamics: ConstantThrust, state: State):
|
113
|
-
contribution = dynamics.compute_contribution(
|
114
|
-
state.get_instant(), state.get_coordinates(), state.get_frame()
|
115
|
-
)
|
116
|
-
|
117
|
-
assert len(contribution) == 4
|
118
|
-
assert contribution == pytest.approx(
|
119
|
-
[0.0, 0.009523809523809525, 0.0, -0.0006798108086519521], abs=5e-11
|
120
|
-
)
|
121
|
-
|
122
|
-
def test_compute_contribution_failure_out_of_fuel(
|
123
|
-
self,
|
124
|
-
satellite_system: SatelliteSystem,
|
125
|
-
coordinates_broker: CoordinatesBroker,
|
126
|
-
dynamics: ConstantThrust,
|
127
|
-
):
|
128
|
-
instant: Instant = Instant.date_time(DateTime(2021, 3, 20, 12, 0, 0), Scale.UTC)
|
129
|
-
coordinates: list = [
|
130
|
-
7000000.0,
|
131
|
-
0.0,
|
132
|
-
0.0,
|
133
|
-
0.0,
|
134
|
-
7546.05329,
|
135
|
-
0.0,
|
136
|
-
satellite_system.get_mass().in_kilograms(),
|
137
|
-
]
|
138
|
-
state = State(instant, coordinates, Frame.GCRF(), coordinates_broker)
|
139
|
-
|
140
|
-
with pytest.raises(RuntimeError):
|
141
|
-
contribution = dynamics.compute_contribution(
|
142
|
-
state.get_instant(), state.get_coordinates(), state.get_frame()
|
143
|
-
)
|
@@ -1,46 +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
|
-
Mass = physics.units.Mass
|
14
|
-
|
15
|
-
PropulsionSystem = astrodynamics.flight.system.PropulsionSystem
|
16
|
-
|
17
|
-
|
18
|
-
@pytest.fixture
|
19
|
-
def propulsion_system() -> PropulsionSystem:
|
20
|
-
return PropulsionSystem(
|
21
|
-
1.0,
|
22
|
-
150.0,
|
23
|
-
)
|
24
|
-
|
25
|
-
|
26
|
-
class TestPropulsionSystem:
|
27
|
-
def test_constructors(
|
28
|
-
self,
|
29
|
-
propulsion_system: PropulsionSystem,
|
30
|
-
):
|
31
|
-
assert propulsion_system is not None
|
32
|
-
assert isinstance(propulsion_system, PropulsionSystem)
|
33
|
-
assert propulsion_system.is_defined()
|
34
|
-
|
35
|
-
def test_comparators(
|
36
|
-
self,
|
37
|
-
propulsion_system: PropulsionSystem,
|
38
|
-
):
|
39
|
-
assert (propulsion_system == propulsion_system) is True
|
40
|
-
assert (propulsion_system != propulsion_system) is False
|
41
|
-
|
42
|
-
def test_is_defined(
|
43
|
-
self,
|
44
|
-
propulsion_system: PropulsionSystem,
|
45
|
-
):
|
46
|
-
assert propulsion_system.is_defined()
|
@@ -1,77 +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
|
-
Cuboid = mathematics.geometry.d3.objects.Cuboid
|
14
|
-
Composite = mathematics.geometry.d3.objects.Composite
|
15
|
-
Point = mathematics.geometry.d3.objects.Point
|
16
|
-
|
17
|
-
Mass = physics.units.Mass
|
18
|
-
|
19
|
-
SatelliteSystem = astrodynamics.flight.system.SatelliteSystem
|
20
|
-
|
21
|
-
|
22
|
-
@pytest.fixture
|
23
|
-
def satellite_system_default_inputs():
|
24
|
-
mass = Mass(90.0, Mass.Unit.Kilogram)
|
25
|
-
satellite_geometry = Composite(
|
26
|
-
Cuboid(
|
27
|
-
Point(0.0, 0.0, 0.0),
|
28
|
-
[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
|
29
|
-
[1.0, 0.0, 0.0],
|
30
|
-
)
|
31
|
-
)
|
32
|
-
inertia_tensor = np.ndarray(shape=(3, 3))
|
33
|
-
surface_area = 0.8
|
34
|
-
drag_coefficient = 2.2
|
35
|
-
|
36
|
-
return (mass, satellite_geometry, inertia_tensor, surface_area, drag_coefficient)
|
37
|
-
|
38
|
-
|
39
|
-
@pytest.fixture
|
40
|
-
def satellite_system(satellite_system_default_inputs) -> SatelliteSystem:
|
41
|
-
return SatelliteSystem(*satellite_system_default_inputs)
|
42
|
-
|
43
|
-
|
44
|
-
class TestSatelliteSystem:
|
45
|
-
def test_constructors(
|
46
|
-
self,
|
47
|
-
satellite_system: SatelliteSystem,
|
48
|
-
):
|
49
|
-
assert satellite_system is not None
|
50
|
-
assert isinstance(satellite_system, SatelliteSystem)
|
51
|
-
assert satellite_system.is_defined()
|
52
|
-
|
53
|
-
def test_comparators(
|
54
|
-
self,
|
55
|
-
satellite_system: SatelliteSystem,
|
56
|
-
):
|
57
|
-
assert (satellite_system == satellite_system) is True
|
58
|
-
assert (satellite_system != satellite_system) is False
|
59
|
-
|
60
|
-
def test_getters(
|
61
|
-
self,
|
62
|
-
satellite_system_default_inputs,
|
63
|
-
satellite_system: SatelliteSystem,
|
64
|
-
):
|
65
|
-
(
|
66
|
-
mass,
|
67
|
-
satellite_geometry,
|
68
|
-
inertia_tensor,
|
69
|
-
surface_area,
|
70
|
-
drag_coefficient,
|
71
|
-
) = satellite_system_default_inputs
|
72
|
-
|
73
|
-
assert satellite_system.get_mass() == mass
|
74
|
-
assert satellite_system.get_geometry() == satellite_geometry
|
75
|
-
assert np.array_equal(satellite_system.get_inertia_tensor(), inertia_tensor)
|
76
|
-
assert satellite_system.get_cross_sectional_surface_area() == surface_area
|
77
|
-
assert satellite_system.get_drag_coefficient() == drag_coefficient
|
@@ -1,153 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
from datetime import datetime
|
4
|
-
|
5
|
-
import pytest
|
6
|
-
|
7
|
-
from ostk.mathematics.geometry.d3.transformations.rotations import Quaternion
|
8
|
-
|
9
|
-
from ostk.physics import Environment
|
10
|
-
from ostk.physics.time import DateTime
|
11
|
-
from ostk.physics.time import Time
|
12
|
-
from ostk.physics.time import Scale
|
13
|
-
from ostk.physics.time import Instant
|
14
|
-
from ostk.physics.units import Length
|
15
|
-
from ostk.physics.coordinate import Transform
|
16
|
-
from ostk.physics.coordinate import Position
|
17
|
-
from ostk.physics.coordinate import Velocity
|
18
|
-
from ostk.physics.coordinate import Frame
|
19
|
-
from ostk.physics.coordinate import Axes
|
20
|
-
from ostk.physics.coordinate.frame.providers import Dynamic as DynamicProvider
|
21
|
-
|
22
|
-
from ostk.astrodynamics import Trajectory
|
23
|
-
from ostk.astrodynamics.trajectory import Orbit
|
24
|
-
from ostk.astrodynamics.flight import Profile
|
25
|
-
from ostk.astrodynamics.flight.profile import State
|
26
|
-
from ostk.astrodynamics.flight.profile.models import Transform as TransformModel
|
27
|
-
from ostk.astrodynamics.flight.profile.models import Tabulated as TabulatedModel
|
28
|
-
|
29
|
-
|
30
|
-
@pytest.fixture
|
31
|
-
def instant() -> Instant:
|
32
|
-
return Instant.date_time(DateTime(2020, 1, 3), Scale.UTC)
|
33
|
-
|
34
|
-
|
35
|
-
@pytest.fixture
|
36
|
-
def profile() -> Profile:
|
37
|
-
def dynamic_provider_generator(instant: Instant):
|
38
|
-
return Transform.identity(instant)
|
39
|
-
|
40
|
-
return Profile(
|
41
|
-
model=TransformModel(
|
42
|
-
dynamic_provider=DynamicProvider(dynamic_provider_generator),
|
43
|
-
frame=Frame.GCRF(),
|
44
|
-
),
|
45
|
-
)
|
46
|
-
|
47
|
-
|
48
|
-
class TestProfile:
|
49
|
-
def test_constructors(self, profile: Profile):
|
50
|
-
assert profile is not None
|
51
|
-
assert isinstance(profile, Profile)
|
52
|
-
|
53
|
-
def test_get_state_at(self, profile: Profile, instant: Instant):
|
54
|
-
state: State = profile.get_state_at(instant)
|
55
|
-
|
56
|
-
assert state is not None
|
57
|
-
assert isinstance(state, State)
|
58
|
-
state.is_defined()
|
59
|
-
|
60
|
-
def test_get_states_at(self, profile: Profile, instant: Instant):
|
61
|
-
states = profile.get_states_at([instant, instant])
|
62
|
-
|
63
|
-
assert states is not None
|
64
|
-
|
65
|
-
def test_get_axes_at(self, profile: Profile, instant: Instant):
|
66
|
-
axes = profile.get_axes_at(instant)
|
67
|
-
|
68
|
-
assert axes is not None
|
69
|
-
assert isinstance(axes, Axes)
|
70
|
-
|
71
|
-
def test_get_body_frame(self, profile: Profile, instant: Instant):
|
72
|
-
frame = profile.get_body_frame("Name")
|
73
|
-
|
74
|
-
assert frame is not None
|
75
|
-
assert isinstance(frame, Frame)
|
76
|
-
|
77
|
-
def test_undefined(self):
|
78
|
-
profile: Profile = Profile.undefined()
|
79
|
-
|
80
|
-
assert profile is not None
|
81
|
-
assert isinstance(profile, Profile)
|
82
|
-
assert profile.is_defined() is False
|
83
|
-
|
84
|
-
def test_inertial_pointing(self):
|
85
|
-
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0, 1.0], Quaternion.Format.XYZS)
|
86
|
-
|
87
|
-
trajectory: Trajectory = Trajectory.position(
|
88
|
-
Position.meters((0.0, 0.0, 0.0), Frame.GCRF())
|
89
|
-
)
|
90
|
-
|
91
|
-
profile: Profile = Profile.inertial_pointing(trajectory, quaternion)
|
92
|
-
|
93
|
-
assert profile is not None
|
94
|
-
assert isinstance(profile, Profile)
|
95
|
-
assert profile.is_defined()
|
96
|
-
|
97
|
-
def test_nadir_pointing(self):
|
98
|
-
environment = Environment.default()
|
99
|
-
|
100
|
-
orbit = Orbit.sun_synchronous(
|
101
|
-
epoch=Instant.date_time(datetime(2020, 1, 1, 0, 0, 0), Scale.UTC),
|
102
|
-
altitude=Length.kilometers(500.0),
|
103
|
-
local_time_at_descending_node=Time(14, 0, 0),
|
104
|
-
celestial_object=environment.access_celestial_object_with_name("Earth"),
|
105
|
-
)
|
106
|
-
|
107
|
-
profile: Profile = Profile.nadir_pointing(orbit, Orbit.FrameType.VVLH)
|
108
|
-
|
109
|
-
assert profile is not None
|
110
|
-
assert isinstance(profile, Profile)
|
111
|
-
assert profile.is_defined()
|
112
|
-
|
113
|
-
def test_tabulated(self):
|
114
|
-
profile = Profile(
|
115
|
-
model=TabulatedModel(
|
116
|
-
states=[
|
117
|
-
State(
|
118
|
-
instant=Instant.date_time(
|
119
|
-
datetime(2020, 1, 1, 0, 0, 0), Scale.UTC
|
120
|
-
),
|
121
|
-
position=Position.meters((0.0, 0.0, 0.0), Frame.GCRF()),
|
122
|
-
velocity=Velocity.meters_per_second(
|
123
|
-
(0.0, 0.0, 0.0), Frame.GCRF()
|
124
|
-
),
|
125
|
-
attitude=Quaternion.unit(),
|
126
|
-
angular_velocity=(0.0, 0.0, 0.0),
|
127
|
-
reference_frame=Frame.GCRF(),
|
128
|
-
),
|
129
|
-
State(
|
130
|
-
instant=Instant.date_time(
|
131
|
-
datetime(2020, 1, 1, 0, 1, 0), Scale.UTC
|
132
|
-
),
|
133
|
-
position=Position.meters((0.0, 0.0, 0.0), Frame.GCRF()),
|
134
|
-
velocity=Velocity.meters_per_second(
|
135
|
-
(0.0, 0.0, 0.0), Frame.GCRF()
|
136
|
-
),
|
137
|
-
attitude=Quaternion.unit(),
|
138
|
-
angular_velocity=(0.0, 0.0, 0.0),
|
139
|
-
reference_frame=Frame.GCRF(),
|
140
|
-
),
|
141
|
-
],
|
142
|
-
),
|
143
|
-
)
|
144
|
-
|
145
|
-
assert isinstance(profile, Profile)
|
146
|
-
assert profile.is_defined()
|
147
|
-
|
148
|
-
assert (
|
149
|
-
profile.get_state_at(
|
150
|
-
Instant.date_time(datetime(2020, 1, 1, 0, 0, 30), Scale.UTC)
|
151
|
-
)
|
152
|
-
is not None
|
153
|
-
)
|
@@ -1,55 +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
|
-
Cuboid = mathematics.geometry.d3.objects.Cuboid
|
14
|
-
Composite = mathematics.geometry.d3.objects.Composite
|
15
|
-
Point = mathematics.geometry.d3.objects.Point
|
16
|
-
|
17
|
-
Mass = physics.units.Mass
|
18
|
-
|
19
|
-
System = astrodynamics.flight.System
|
20
|
-
|
21
|
-
|
22
|
-
@pytest.fixture
|
23
|
-
def system_default_inputs():
|
24
|
-
mass = Mass(90.0, Mass.Unit.Kilogram)
|
25
|
-
geometry = Composite(
|
26
|
-
Cuboid(
|
27
|
-
Point(0.0, 0.0, 0.0),
|
28
|
-
[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
|
29
|
-
[1.0, 0.0, 0.0],
|
30
|
-
)
|
31
|
-
)
|
32
|
-
|
33
|
-
return (mass, geometry)
|
34
|
-
|
35
|
-
|
36
|
-
@pytest.fixture
|
37
|
-
def system(system_default_inputs) -> System:
|
38
|
-
return System(*system_default_inputs)
|
39
|
-
|
40
|
-
|
41
|
-
class TestSatelliteSystem:
|
42
|
-
def test_constructors(self, system: System):
|
43
|
-
assert system is not None
|
44
|
-
assert isinstance(system, System)
|
45
|
-
assert system.is_defined()
|
46
|
-
|
47
|
-
def test_comparators(self, system: System):
|
48
|
-
assert (system == system) is True
|
49
|
-
assert (system != system) is False
|
50
|
-
|
51
|
-
def test_getters(self, system_default_inputs, system: System):
|
52
|
-
(mass, geometry) = system_default_inputs
|
53
|
-
|
54
|
-
assert system.get_mass() == mass
|
55
|
-
assert system.get_geometry() == geometry
|
@@ -1 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
@@ -1,153 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.physics.units import Length
|
6
|
-
from ostk.physics.units import Angle
|
7
|
-
from ostk.physics.time import Instant
|
8
|
-
from ostk.physics.time import Duration
|
9
|
-
from ostk.physics.time import Interval
|
10
|
-
from ostk.physics.time import DateTime
|
11
|
-
from ostk.physics.time import Scale
|
12
|
-
from ostk.physics import Environment
|
13
|
-
|
14
|
-
from ostk.astrodynamics.trajectory import Orbit
|
15
|
-
from ostk.astrodynamics.trajectory.orbit.models import Kepler
|
16
|
-
from ostk.astrodynamics.trajectory.orbit.models.kepler import COE
|
17
|
-
from ostk.astrodynamics.access import Generator
|
18
|
-
from ostk.astrodynamics.solvers import TemporalConditionSolver
|
19
|
-
|
20
|
-
|
21
|
-
@pytest.fixture
|
22
|
-
def temporal_condition_solver() -> TemporalConditionSolver:
|
23
|
-
return TemporalConditionSolver(
|
24
|
-
time_step=Duration.seconds(30.0),
|
25
|
-
tolerance=Duration.milliseconds(1.0),
|
26
|
-
maximum_iteration_count=1234,
|
27
|
-
)
|
28
|
-
|
29
|
-
|
30
|
-
@pytest.fixture
|
31
|
-
def interval() -> Interval:
|
32
|
-
return Interval.closed(
|
33
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC),
|
34
|
-
Instant.date_time(DateTime(2018, 1, 1, 2, 0, 0), Scale.UTC),
|
35
|
-
)
|
36
|
-
|
37
|
-
|
38
|
-
class TestTemporalConditionSolver:
|
39
|
-
def test_constructor_success(self):
|
40
|
-
temporal_condition_solver = TemporalConditionSolver(
|
41
|
-
time_step=Duration.seconds(30.0),
|
42
|
-
tolerance=Duration.milliseconds(1.0),
|
43
|
-
maximum_iteration_count=1234,
|
44
|
-
)
|
45
|
-
|
46
|
-
assert isinstance(temporal_condition_solver, TemporalConditionSolver)
|
47
|
-
|
48
|
-
def test_getters_success(
|
49
|
-
self,
|
50
|
-
temporal_condition_solver: TemporalConditionSolver,
|
51
|
-
):
|
52
|
-
assert temporal_condition_solver.get_time_step() == Duration.seconds(30.0)
|
53
|
-
assert temporal_condition_solver.get_tolerance() == Duration.milliseconds(1.0)
|
54
|
-
assert temporal_condition_solver.get_maximum_iteration_count() == 1234
|
55
|
-
|
56
|
-
def test_solve_success_one_condition_always_true(
|
57
|
-
self,
|
58
|
-
temporal_condition_solver: TemporalConditionSolver,
|
59
|
-
interval: Interval,
|
60
|
-
):
|
61
|
-
solution: list[Interval] = temporal_condition_solver.solve(
|
62
|
-
condition=lambda _: True,
|
63
|
-
interval=interval,
|
64
|
-
)
|
65
|
-
|
66
|
-
assert isinstance(solution, list)
|
67
|
-
assert solution == [interval]
|
68
|
-
|
69
|
-
def test_solve_success_one_condition_always_false(
|
70
|
-
self,
|
71
|
-
temporal_condition_solver: TemporalConditionSolver,
|
72
|
-
interval: Interval,
|
73
|
-
):
|
74
|
-
solution: list[Interval] = temporal_condition_solver.solve(
|
75
|
-
condition=lambda _: False,
|
76
|
-
interval=interval,
|
77
|
-
)
|
78
|
-
|
79
|
-
assert isinstance(solution, list)
|
80
|
-
assert solution == []
|
81
|
-
|
82
|
-
def test_solve_success_multiple_conditions_always_true(
|
83
|
-
self,
|
84
|
-
temporal_condition_solver: TemporalConditionSolver,
|
85
|
-
interval: Interval,
|
86
|
-
):
|
87
|
-
solution: list[Interval] = temporal_condition_solver.solve(
|
88
|
-
conditions=[
|
89
|
-
lambda _: True,
|
90
|
-
lambda _: True,
|
91
|
-
],
|
92
|
-
interval=interval,
|
93
|
-
)
|
94
|
-
|
95
|
-
assert isinstance(solution, list)
|
96
|
-
assert solution == [interval]
|
97
|
-
|
98
|
-
def test_solve_success_multiple_conditions_one_always_false(
|
99
|
-
self,
|
100
|
-
temporal_condition_solver: TemporalConditionSolver,
|
101
|
-
interval: Interval,
|
102
|
-
):
|
103
|
-
solution: list[Interval] = temporal_condition_solver.solve(
|
104
|
-
conditions=[
|
105
|
-
lambda _: True,
|
106
|
-
lambda _: False,
|
107
|
-
],
|
108
|
-
interval=interval,
|
109
|
-
)
|
110
|
-
|
111
|
-
assert isinstance(solution, list)
|
112
|
-
assert solution == []
|
113
|
-
|
114
|
-
def test_solve_success_using_access_generator(
|
115
|
-
self,
|
116
|
-
temporal_condition_solver: TemporalConditionSolver,
|
117
|
-
interval: Interval,
|
118
|
-
):
|
119
|
-
environment = Environment.default()
|
120
|
-
|
121
|
-
generator = Generator(
|
122
|
-
environment=environment,
|
123
|
-
)
|
124
|
-
|
125
|
-
earth = environment.access_celestial_object_with_name("Earth")
|
126
|
-
|
127
|
-
trajectory = Orbit(
|
128
|
-
model=Kepler(
|
129
|
-
coe=COE(
|
130
|
-
semi_major_axis=Length.kilometers(7000.0),
|
131
|
-
eccentricity=0.0,
|
132
|
-
inclination=Angle.degrees(45.0),
|
133
|
-
raan=Angle.degrees(0.0),
|
134
|
-
aop=Angle.degrees(0.0),
|
135
|
-
true_anomaly=Angle.degrees(0.0),
|
136
|
-
),
|
137
|
-
epoch=Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC),
|
138
|
-
celestial_object=earth,
|
139
|
-
perturbation_type=Kepler.PerturbationType.No,
|
140
|
-
),
|
141
|
-
celestial_object=earth,
|
142
|
-
)
|
143
|
-
|
144
|
-
solution: list[Interval] = temporal_condition_solver.solve(
|
145
|
-
condition=generator.get_condition_function(
|
146
|
-
from_trajectory=trajectory,
|
147
|
-
to_trajectory=trajectory,
|
148
|
-
),
|
149
|
-
interval=interval,
|
150
|
-
)
|
151
|
-
|
152
|
-
assert isinstance(solution, list)
|
153
|
-
assert solution == [interval]
|
@@ -1 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
@@ -1 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|