open-space-toolkit-astrodynamics 5.1.5__py310-none-any.whl → 5.2.0__py310-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 (85) hide show
  1. {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/METADATA +1 -1
  2. open_space_toolkit_astrodynamics-5.2.0.dist-info/RECORD +96 -0
  3. ostk/__init__.py +1 -0
  4. ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-310-x86_64-linux-gnu.so +0 -0
  5. ostk/astrodynamics/converters.py +44 -6
  6. ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.5 +0 -0
  7. ostk/astrodynamics/pytrajectory/pystate.py +1 -3
  8. ostk/astrodynamics/test/access/__init__.py +1 -0
  9. ostk/astrodynamics/test/access/test_generator.py +248 -0
  10. ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +1 -0
  11. ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +325 -0
  12. ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +303 -0
  13. ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +416 -0
  14. ostk/astrodynamics/test/dynamics/__init__.py +1 -0
  15. ostk/astrodynamics/test/dynamics/test_atmospheric_drag.py +128 -0
  16. ostk/astrodynamics/test/dynamics/test_central_body_gravity.py +58 -0
  17. ostk/astrodynamics/test/dynamics/test_dynamics.py +50 -0
  18. ostk/astrodynamics/test/dynamics/test_position_derivative.py +51 -0
  19. ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
  20. ostk/astrodynamics/test/dynamics/test_thruster.py +142 -0
  21. ostk/astrodynamics/test/event_condition/test_angular_condition.py +113 -0
  22. ostk/astrodynamics/test/event_condition/test_boolean_condition.py +55 -0
  23. ostk/astrodynamics/test/event_condition/test_coe_condition.py +87 -0
  24. ostk/astrodynamics/test/event_condition/test_instant_condition.py +48 -0
  25. ostk/astrodynamics/test/event_condition/test_logical_condition.py +120 -0
  26. ostk/astrodynamics/test/event_condition/test_real_condition.py +50 -0
  27. ostk/astrodynamics/test/flight/__init__.py +1 -0
  28. ostk/astrodynamics/test/flight/profile/__init__.py +1 -0
  29. ostk/astrodynamics/test/flight/profile/test_state.py +144 -0
  30. ostk/astrodynamics/test/flight/system/__init__.py +1 -0
  31. ostk/astrodynamics/test/flight/system/test_propulsion_system.py +46 -0
  32. ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
  33. ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
  34. ostk/astrodynamics/test/flight/test_profile.py +153 -0
  35. ostk/astrodynamics/test/flight/test_system.py +55 -0
  36. ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
  37. ostk/astrodynamics/test/guidance_law/test_qlaw.py +139 -0
  38. ostk/astrodynamics/test/solvers/__init__.py +1 -0
  39. ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
  40. ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
  41. ostk/astrodynamics/test/test_access.py +2 -6
  42. ostk/astrodynamics/test/test_converters.py +213 -6
  43. ostk/astrodynamics/test/test_viewer.py +1 -2
  44. ostk/astrodynamics/test/trajectory/__init__.py +1 -0
  45. ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
  46. ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +1 -0
  47. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +1 -0
  48. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +18 -0
  49. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +44 -0
  50. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +108 -0
  51. ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +1 -0
  52. ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +1 -0
  53. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean.py +65 -0
  54. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_long.py +102 -0
  55. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_short.py +102 -0
  56. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +167 -0
  57. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
  58. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
  59. ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
  60. ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +195 -0
  61. ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +1 -0
  62. ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +380 -0
  63. ostk/astrodynamics/test/trajectory/orbit/test_model.py +1 -0
  64. ostk/astrodynamics/test/trajectory/orbit/test_pass.py +55 -0
  65. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_angular_velocity.py +30 -0
  66. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_attitude_quaternion.py +18 -0
  67. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +107 -0
  68. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +115 -0
  69. ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +84 -0
  70. ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +43 -0
  71. ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
  72. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
  73. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +64 -0
  74. ostk/astrodynamics/test/trajectory/test_model.py +1 -0
  75. ostk/astrodynamics/test/trajectory/test_orbit.py +92 -0
  76. ostk/astrodynamics/test/trajectory/test_propagator.py +402 -0
  77. ostk/astrodynamics/test/trajectory/test_segment.py +288 -0
  78. ostk/astrodynamics/test/trajectory/test_sequence.py +459 -0
  79. ostk/astrodynamics/test/trajectory/test_state.py +223 -0
  80. ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
  81. ostk/astrodynamics/viewer.py +1 -3
  82. open_space_toolkit_astrodynamics-5.1.5.dist-info/RECORD +0 -25
  83. {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/WHEEL +0 -0
  84. {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/top_level.txt +0 -0
  85. {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,50 @@
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_evaluate(self, state: State, event_condition: RealCondition):
44
+ assert event_condition.evaluate(state) is not None
45
+
46
+ def test_is_satisfied(self, state: State, event_condition: RealCondition):
47
+ assert (
48
+ event_condition.is_satisfied(previous_state=state, current_state=state)
49
+ is not None
50
+ )
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,144 @@
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.transformation.rotation.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
@@ -0,0 +1 @@
1
+ # Apache License 2.0
@@ -0,0 +1,46 @@
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()
@@ -0,0 +1,91 @@
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
+ PropulsionSystem = astrodynamics.flight.system.PropulsionSystem
21
+
22
+
23
+ @pytest.fixture
24
+ def satellite_system_default_inputs():
25
+ mass = Mass(90.0, Mass.Unit.Kilogram)
26
+ satellite_geometry = Composite(
27
+ Cuboid(
28
+ Point(0.0, 0.0, 0.0),
29
+ [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
30
+ [1.0, 0.0, 0.0],
31
+ )
32
+ )
33
+ inertia_tensor = np.ndarray(shape=(3, 3))
34
+ surface_area = 0.8
35
+ drag_coefficient = 2.2
36
+ propulsion_system = PropulsionSystem(
37
+ 1.0,
38
+ 150.0,
39
+ )
40
+
41
+ return (
42
+ mass,
43
+ satellite_geometry,
44
+ inertia_tensor,
45
+ surface_area,
46
+ drag_coefficient,
47
+ propulsion_system,
48
+ )
49
+
50
+
51
+ @pytest.fixture
52
+ def satellite_system(satellite_system_default_inputs) -> SatelliteSystem:
53
+ return SatelliteSystem(*satellite_system_default_inputs)
54
+
55
+
56
+ class TestSatelliteSystem:
57
+ def test_constructors(
58
+ self,
59
+ satellite_system: SatelliteSystem,
60
+ ):
61
+ assert satellite_system is not None
62
+ assert isinstance(satellite_system, SatelliteSystem)
63
+ assert satellite_system.is_defined()
64
+
65
+ def test_comparators(
66
+ self,
67
+ satellite_system: SatelliteSystem,
68
+ ):
69
+ assert (satellite_system == satellite_system) is True
70
+ assert (satellite_system != satellite_system) is False
71
+
72
+ def test_getters(
73
+ self,
74
+ satellite_system_default_inputs,
75
+ satellite_system: SatelliteSystem,
76
+ ):
77
+ (
78
+ mass,
79
+ satellite_geometry,
80
+ inertia_tensor,
81
+ surface_area,
82
+ drag_coefficient,
83
+ propulsion_system,
84
+ ) = satellite_system_default_inputs
85
+
86
+ assert satellite_system.get_mass() == mass
87
+ assert satellite_system.get_geometry() == satellite_geometry
88
+ assert np.array_equal(satellite_system.get_inertia_tensor(), inertia_tensor)
89
+ assert satellite_system.get_cross_sectional_surface_area() == surface_area
90
+ assert satellite_system.get_drag_coefficient() == drag_coefficient
91
+ assert satellite_system.get_propulsion_system() == propulsion_system
@@ -0,0 +1,71 @@
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
+ SatelliteSystemBuilder = astrodynamics.flight.system.SatelliteSystemBuilder
21
+ PropulsionSystem = astrodynamics.flight.system.PropulsionSystem
22
+
23
+
24
+ class TestSatelliteSystemBuilder:
25
+ def test_constructors(self):
26
+ builder: SatelliteSystemBuilder = SatelliteSystemBuilder()
27
+ assert builder is not None
28
+ assert isinstance(builder, SatelliteSystemBuilder)
29
+
30
+ default_builder: SatelliteSystemBuilder = SatelliteSystemBuilder.default()
31
+ assert default_builder is not None
32
+ assert isinstance(default_builder, SatelliteSystemBuilder)
33
+
34
+ def test_build(self):
35
+ dry_mass = Mass(90.0, Mass.Unit.Kilogram)
36
+ geometry = Composite(
37
+ Cuboid(
38
+ Point(0.0, 0.0, 0.0),
39
+ [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
40
+ [1.0, 0.0, 0.0],
41
+ )
42
+ )
43
+ inertia_tensor = np.ndarray(shape=(3, 3))
44
+ cross_sectional_surface_area = 0.8
45
+ drag_coefficient = 2.2
46
+ propulsion_system = PropulsionSystem(
47
+ 1.0,
48
+ 150.0,
49
+ )
50
+
51
+ builder: SatelliteSystemBuilder = (
52
+ SatelliteSystemBuilder()
53
+ .with_dry_mass(dry_mass)
54
+ .with_geometry(geometry)
55
+ .with_inertia_tensor(inertia_tensor)
56
+ .with_cross_sectional_surface_area(cross_sectional_surface_area)
57
+ .with_drag_coefficient(drag_coefficient)
58
+ .with_propulsion_system(propulsion_system)
59
+ )
60
+
61
+ satellite_system: SatelliteSystem = builder.build()
62
+
63
+ assert satellite_system.get_mass() == dry_mass
64
+ assert satellite_system.get_geometry() == geometry
65
+ assert np.array_equal(satellite_system.get_inertia_tensor(), inertia_tensor)
66
+ assert (
67
+ satellite_system.get_cross_sectional_surface_area()
68
+ == cross_sectional_surface_area
69
+ )
70
+ assert satellite_system.get_drag_coefficient() == drag_coefficient
71
+ assert satellite_system.get_propulsion_system() == propulsion_system
@@ -0,0 +1,153 @@
1
+ # Apache License 2.0
2
+
3
+ from datetime import datetime
4
+
5
+ import pytest
6
+
7
+ from ostk.mathematics.geometry.d3.transformation.rotation 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
+ )
@@ -0,0 +1,55 @@
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