open-space-toolkit-astrodynamics 17.2.0__py312-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_space_toolkit_astrodynamics-17.2.0.dist-info/METADATA +30 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/RECORD +151 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/WHEEL +5 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-312-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +11 -0
- ostk/astrodynamics/__init__.pyi +720 -0
- ostk/astrodynamics/access.pyi +577 -0
- ostk/astrodynamics/conjunction/__init__.pyi +121 -0
- ostk/astrodynamics/conjunction/close_approach.pyi +89 -0
- ostk/astrodynamics/conjunction/message/__init__.pyi +3 -0
- ostk/astrodynamics/conjunction/message/ccsds.pyi +705 -0
- ostk/astrodynamics/converters.py +130 -0
- ostk/astrodynamics/converters.pyi +58 -0
- ostk/astrodynamics/data/__init__.pyi +3 -0
- ostk/astrodynamics/data/provider.pyi +22 -0
- ostk/astrodynamics/dataframe.py +597 -0
- ostk/astrodynamics/display.py +281 -0
- ostk/astrodynamics/dynamics.pyi +311 -0
- ostk/astrodynamics/eclipse.pyi +70 -0
- ostk/astrodynamics/estimator.pyi +268 -0
- ostk/astrodynamics/event_condition.pyi +910 -0
- ostk/astrodynamics/flight/__init__.pyi +626 -0
- ostk/astrodynamics/flight/profile/__init__.pyi +99 -0
- ostk/astrodynamics/flight/profile/model.pyi +179 -0
- ostk/astrodynamics/flight/system.pyi +268 -0
- ostk/astrodynamics/guidance_law.pyi +416 -0
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.17 +0 -0
- ostk/astrodynamics/pytrajectory/__init__.py +1 -0
- ostk/astrodynamics/pytrajectory/__init__.pyi +3 -0
- ostk/astrodynamics/pytrajectory/pystate.py +263 -0
- ostk/astrodynamics/pytrajectory/pystate.pyi +66 -0
- ostk/astrodynamics/solver.pyi +432 -0
- ostk/astrodynamics/test/__init__.py +1 -0
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +319 -0
- ostk/astrodynamics/test/access/test_visibility_criterion.py +201 -0
- ostk/astrodynamics/test/conftest.py +119 -0
- ostk/astrodynamics/test/conjunction/close_approach/__init__.py +0 -0
- ostk/astrodynamics/test/conjunction/close_approach/test_generator.py +228 -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/conjunction/test_close_approach.py +244 -0
- ostk/astrodynamics/test/data/provider/test_off_nadir.py +58 -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 +157 -0
- ostk/astrodynamics/test/eclipse/__init__.py +1 -0
- ostk/astrodynamics/test/eclipse/test_generator.py +138 -0
- ostk/astrodynamics/test/estimator/test_orbit_determination_solver.py +261 -0
- ostk/astrodynamics/test/estimator/test_tle_solver.py +216 -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_brouwer_lyddane_mean_long_condition.py +135 -0
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +135 -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/profile/model/test_tabulated_profile.py +115 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +64 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +83 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_maneuver.py +231 -0
- ostk/astrodynamics/test/flight/test_profile.py +293 -0
- ostk/astrodynamics/test/flight/test_system.py +45 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +177 -0
- ostk/astrodynamics/test/guidance_law/test_guidance_law.py +60 -0
- ostk/astrodynamics/test/guidance_law/test_heterogeneous_guidance_law.py +164 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +209 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +196 -0
- ostk/astrodynamics/test/solvers/test_least_squares_solver.py +334 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +161 -0
- ostk/astrodynamics/test/test_access.py +128 -0
- ostk/astrodynamics/test/test_converters.py +290 -0
- ostk/astrodynamics/test/test_dataframe.py +1355 -0
- ostk/astrodynamics/test/test_display.py +184 -0
- ostk/astrodynamics/test/test_event_condition.py +80 -0
- ostk/astrodynamics/test/test_import.py +26 -0
- ostk/astrodynamics/test/test_root_solver.py +70 -0
- ostk/astrodynamics/test/test_trajectory.py +126 -0
- ostk/astrodynamics/test/test_utilities.py +338 -0
- ostk/astrodynamics/test/test_viewer.py +318 -0
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/model/test_nadir_trajectory.py +87 -0
- ostk/astrodynamics/test/trajectory/model/test_tabulated_trajectory.py +303 -0
- ostk/astrodynamics/test/trajectory/model/test_target_scan_trajectory.py +126 -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 +305 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +337 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_modified_equinoctial.py +142 -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_acceleration.py +136 -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 +58 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +316 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +119 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +212 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +452 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +694 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +550 -0
- ostk/astrodynamics/test/trajectory/test_state.py +629 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +172 -0
- ostk/astrodynamics/trajectory/__init__.pyi +1982 -0
- ostk/astrodynamics/trajectory/model.pyi +259 -0
- ostk/astrodynamics/trajectory/orbit/__init__.pyi +349 -0
- ostk/astrodynamics/trajectory/orbit/message/__init__.pyi +3 -0
- ostk/astrodynamics/trajectory/orbit/message/spacex.pyi +264 -0
- ostk/astrodynamics/trajectory/orbit/model/__init__.pyi +648 -0
- ostk/astrodynamics/trajectory/orbit/model/brouwerLyddaneMean.pyi +121 -0
- ostk/astrodynamics/trajectory/orbit/model/kepler.pyi +709 -0
- ostk/astrodynamics/trajectory/orbit/model/sgp4.pyi +330 -0
- ostk/astrodynamics/trajectory/state/__init__.pyi +402 -0
- ostk/astrodynamics/trajectory/state/coordinate_subset.pyi +208 -0
- ostk/astrodynamics/utilities.py +396 -0
- ostk/astrodynamics/viewer.py +851 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from ostk.physics import Environment
|
|
6
|
+
from ostk.physics.coordinate import Position
|
|
7
|
+
from ostk.physics.coordinate.spherical import LLA
|
|
8
|
+
from ostk.physics.environment.object import Celestial
|
|
9
|
+
from ostk.physics.time import DateTime
|
|
10
|
+
from ostk.physics.time import Duration
|
|
11
|
+
from ostk.physics.time import Instant
|
|
12
|
+
from ostk.physics.time import Interval
|
|
13
|
+
from ostk.physics.time import Scale
|
|
14
|
+
from ostk.physics.unit import Length
|
|
15
|
+
from ostk.physics.unit import Angle
|
|
16
|
+
|
|
17
|
+
from ostk.astrodynamics import display
|
|
18
|
+
from ostk.astrodynamics.access import Generator as AccessGenerator
|
|
19
|
+
from ostk.astrodynamics.trajectory import Orbit
|
|
20
|
+
from ostk.astrodynamics.trajectory.orbit.model import SGP4
|
|
21
|
+
from ostk.astrodynamics.trajectory.orbit.model.sgp4 import TLE
|
|
22
|
+
from ostk.astrodynamics import Access
|
|
23
|
+
from ostk.astrodynamics.access import AccessTarget
|
|
24
|
+
from ostk.astrodynamics.access import VisibilityCriterion
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.fixture
|
|
28
|
+
def environment() -> Environment:
|
|
29
|
+
return Environment.default()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture
|
|
33
|
+
def earth(environment: Environment) -> Celestial:
|
|
34
|
+
return environment.access_celestial_object_with_name("Earth")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.fixture
|
|
38
|
+
def search_interval() -> Interval:
|
|
39
|
+
start_instant: Instant = Instant.date_time(
|
|
40
|
+
DateTime(2023, 1, 3, 0, 0, 0),
|
|
41
|
+
Scale.UTC,
|
|
42
|
+
)
|
|
43
|
+
duration: Duration = Duration.hours(1.0)
|
|
44
|
+
stop_instant: Instant = start_instant + duration
|
|
45
|
+
return Interval.closed(start_instant, stop_instant)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@pytest.fixture
|
|
49
|
+
def access_plot() -> display.AccessesPlot:
|
|
50
|
+
return display.AccessesPlot(
|
|
51
|
+
earth=earth,
|
|
52
|
+
interval=search_interval,
|
|
53
|
+
trajectory_step=Duration.minutes(5.0),
|
|
54
|
+
access_step=Duration.seconds(10.0),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@pytest.fixture
|
|
59
|
+
def satellite_1_trajectory(earth: Celestial) -> Orbit:
|
|
60
|
+
tle_1 = TLE(
|
|
61
|
+
"1 55076U 23001BV 23146.17959645 .00004328 00000-0 23719-3 0 9993",
|
|
62
|
+
"2 55076 97.4793 205.9529 0016244 89.9523 270.3571 15.14609100 21723",
|
|
63
|
+
)
|
|
64
|
+
return Orbit(SGP4(tle_1), earth)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@pytest.fixture
|
|
68
|
+
def satellite_2_trajectory(earth: Celestial) -> Orbit:
|
|
69
|
+
tle_2 = TLE(
|
|
70
|
+
"1 48915U 21059AN 23146.32782040 .00004955 00000-0 24678-3 0 9999",
|
|
71
|
+
"2 48915 97.5954 279.7041 0010303 354.9434 5.1694 15.18004448105867",
|
|
72
|
+
)
|
|
73
|
+
return Orbit(SGP4(tle_2), earth)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@pytest.fixture
|
|
77
|
+
def ground_station_lla() -> LLA:
|
|
78
|
+
return LLA(
|
|
79
|
+
Angle.degrees(70.0),
|
|
80
|
+
Angle.degrees(160.0),
|
|
81
|
+
Length.meters(0.0),
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@pytest.fixture
|
|
86
|
+
def access_target(
|
|
87
|
+
environment: Environment,
|
|
88
|
+
ground_station_lla: LLA,
|
|
89
|
+
) -> AccessTarget:
|
|
90
|
+
return AccessTarget.from_position(
|
|
91
|
+
VisibilityCriterion.from_line_of_sight(environment),
|
|
92
|
+
Position.from_lla(
|
|
93
|
+
ground_station_lla,
|
|
94
|
+
environment.access_celestial_object_with_name("Earth"),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@pytest.fixture
|
|
100
|
+
def access_generator(environment: Environment) -> AccessGenerator:
|
|
101
|
+
return AccessGenerator(
|
|
102
|
+
environment=environment,
|
|
103
|
+
step=Duration.seconds(10.0),
|
|
104
|
+
tolerance=Duration.seconds(1.0),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@pytest.fixture
|
|
109
|
+
def satellite_1_accesses(
|
|
110
|
+
satellite_1_trajectory: Orbit,
|
|
111
|
+
environment: Environment,
|
|
112
|
+
search_interval: Interval,
|
|
113
|
+
access_target: AccessTarget,
|
|
114
|
+
access_generator: AccessGenerator,
|
|
115
|
+
) -> list[Access]:
|
|
116
|
+
return access_generator.compute_accesses(
|
|
117
|
+
interval=search_interval,
|
|
118
|
+
access_target=access_target,
|
|
119
|
+
to_trajectory=satellite_1_trajectory,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@pytest.fixture
|
|
124
|
+
def satellite_2_accesses(
|
|
125
|
+
satellite_2_trajectory: Orbit,
|
|
126
|
+
environment: Environment,
|
|
127
|
+
search_interval: Interval,
|
|
128
|
+
access_target: AccessTarget,
|
|
129
|
+
access_generator: AccessGenerator,
|
|
130
|
+
) -> list[Access]:
|
|
131
|
+
return access_generator.compute_accesses(
|
|
132
|
+
interval=search_interval,
|
|
133
|
+
access_target=access_target,
|
|
134
|
+
to_trajectory=satellite_2_trajectory,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class TestDisplay:
|
|
139
|
+
def test_accesses_plot(
|
|
140
|
+
self,
|
|
141
|
+
environment: Environment,
|
|
142
|
+
earth: Celestial,
|
|
143
|
+
search_interval: Interval,
|
|
144
|
+
access_target: AccessTarget,
|
|
145
|
+
ground_station_lla: LLA,
|
|
146
|
+
satellite_1_trajectory: Orbit,
|
|
147
|
+
satellite_2_trajectory: Orbit,
|
|
148
|
+
satellite_1_accesses: list[Access],
|
|
149
|
+
satellite_2_accesses: list[Access],
|
|
150
|
+
):
|
|
151
|
+
|
|
152
|
+
accesses_plot = display.AccessesPlot(
|
|
153
|
+
earth=earth,
|
|
154
|
+
interval=search_interval,
|
|
155
|
+
trajectory_step=Duration.minutes(5.0),
|
|
156
|
+
access_step=Duration.seconds(10.0),
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
accesses_plot.add_satellite(
|
|
160
|
+
trajectory=satellite_1_trajectory,
|
|
161
|
+
rgb=[180, 0, 0],
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
accesses_plot.add_satellite(
|
|
165
|
+
trajectory=satellite_2_trajectory,
|
|
166
|
+
rgb=[0, 0, 180],
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
accesses_plot.add_accesses(
|
|
170
|
+
trajectory=satellite_1_trajectory,
|
|
171
|
+
accesses=satellite_1_accesses,
|
|
172
|
+
rgb=[180, 0, 0],
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
accesses_plot.add_accesses(
|
|
176
|
+
trajectory=satellite_2_trajectory,
|
|
177
|
+
accesses=satellite_2_accesses,
|
|
178
|
+
rgb=[0, 0, 180],
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
accesses_plot.add_ground_station(
|
|
182
|
+
ground_station_lla,
|
|
183
|
+
color="green",
|
|
184
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
from typing import Callable
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from ostk.physics.time import Instant
|
|
8
|
+
from ostk.physics.coordinate import Position, Velocity, Frame
|
|
9
|
+
|
|
10
|
+
from ostk.astrodynamics.trajectory import State
|
|
11
|
+
from ostk.astrodynamics import EventCondition
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture
|
|
15
|
+
def name() -> str:
|
|
16
|
+
return "MyEvent"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@pytest.fixture
|
|
20
|
+
def evaluator() -> Callable:
|
|
21
|
+
return lambda state: 5.0
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.fixture
|
|
25
|
+
def target_value() -> float:
|
|
26
|
+
return 0.0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@pytest.fixture
|
|
30
|
+
def target(target_value: float) -> EventCondition.Target:
|
|
31
|
+
return EventCondition.Target(target_value, EventCondition.Target.Type.Relative)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.fixture
|
|
35
|
+
def event_condition(
|
|
36
|
+
name: str, evaluator: Callable, target: EventCondition.Target
|
|
37
|
+
) -> EventCondition:
|
|
38
|
+
class MyEventCondition(EventCondition):
|
|
39
|
+
def is_satisfied(
|
|
40
|
+
self,
|
|
41
|
+
current_state,
|
|
42
|
+
previous_state,
|
|
43
|
+
):
|
|
44
|
+
return (
|
|
45
|
+
current_state.get_position().get_coordinates()[2] > 0.0
|
|
46
|
+
and previous_state.get_position().get_coordinates()[2] < 0.0
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return MyEventCondition(name, evaluator, target)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class TestEventCondition:
|
|
53
|
+
def test_subclass(self, event_condition: EventCondition):
|
|
54
|
+
assert event_condition is not None
|
|
55
|
+
|
|
56
|
+
def test_get_name(self, event_condition: EventCondition, name: str):
|
|
57
|
+
assert event_condition.get_name() == name
|
|
58
|
+
|
|
59
|
+
def test_get_evaluator(self, event_condition: EventCondition):
|
|
60
|
+
assert event_condition.get_evaluator() is not None
|
|
61
|
+
|
|
62
|
+
def test_get_target(
|
|
63
|
+
self, event_condition: EventCondition, target: EventCondition.Target
|
|
64
|
+
):
|
|
65
|
+
assert event_condition.get_target() == target
|
|
66
|
+
|
|
67
|
+
def test_update_target(
|
|
68
|
+
self,
|
|
69
|
+
event_condition: EventCondition,
|
|
70
|
+
):
|
|
71
|
+
current_target_value_offset: float = event_condition.get_target().value_offset
|
|
72
|
+
event_condition.update_target(
|
|
73
|
+
State(
|
|
74
|
+
Instant.J2000(),
|
|
75
|
+
Position.meters([0.0, 0.0, 0.0], Frame.GCRF()),
|
|
76
|
+
Velocity.meters_per_second([0.0, 0.0, 0.0], Frame.GCRF()),
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
assert event_condition.get_target().value_offset != current_target_value_offset
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestImport:
|
|
7
|
+
def test_import(self):
|
|
8
|
+
from ostk.astrodynamics import Trajectory
|
|
9
|
+
from ostk.astrodynamics.trajectory import State
|
|
10
|
+
from ostk.astrodynamics.trajectory import Orbit
|
|
11
|
+
from ostk.astrodynamics.trajectory import Model
|
|
12
|
+
from ostk.astrodynamics.trajectory.orbit import Pass
|
|
13
|
+
from ostk.astrodynamics.trajectory.orbit.model import Kepler
|
|
14
|
+
from ostk.astrodynamics.trajectory.orbit.model.kepler import COE
|
|
15
|
+
from ostk.astrodynamics.trajectory.orbit.model import SGP4
|
|
16
|
+
from ostk.astrodynamics.trajectory.orbit.model.sgp4 import TLE
|
|
17
|
+
from ostk.astrodynamics.trajectory.orbit.model import Propagated
|
|
18
|
+
from ostk.astrodynamics.flight import Profile
|
|
19
|
+
from ostk.astrodynamics.flight import System
|
|
20
|
+
from ostk.astrodynamics.flight import Maneuver
|
|
21
|
+
from ostk.astrodynamics.flight.system import SatelliteSystem
|
|
22
|
+
from ostk.astrodynamics.dynamics import CentralBodyGravity
|
|
23
|
+
from ostk.astrodynamics.dynamics import AtmosphericDrag
|
|
24
|
+
from ostk.astrodynamics import Access
|
|
25
|
+
from ostk.astrodynamics.access import Generator
|
|
26
|
+
from ostk.astrodynamics.trajectory.state import NumericalSolver
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from ostk.astrodynamics import RootSolver
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def quadratic_function(x):
|
|
9
|
+
return x**2 - 4
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture
|
|
13
|
+
def maximum_iteration_count() -> int:
|
|
14
|
+
return 100
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture
|
|
18
|
+
def tolerance() -> float:
|
|
19
|
+
return 1e-15
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture
|
|
23
|
+
def root_solver(maximum_iteration_count: int, tolerance: float) -> RootSolver:
|
|
24
|
+
return RootSolver(maximum_iteration_count, tolerance)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TestRootSolver:
|
|
28
|
+
def test_constructor(self, maximum_iteration_count: int, tolerance: float):
|
|
29
|
+
assert (
|
|
30
|
+
RootSolver(
|
|
31
|
+
maximum_iteration_count=maximum_iteration_count, tolerance=tolerance
|
|
32
|
+
)
|
|
33
|
+
is not None
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def test_getters(
|
|
37
|
+
self,
|
|
38
|
+
root_solver: RootSolver,
|
|
39
|
+
maximum_iteration_count: int,
|
|
40
|
+
tolerance: float,
|
|
41
|
+
):
|
|
42
|
+
assert root_solver.get_tolerance() == tolerance
|
|
43
|
+
assert root_solver.get_maximum_iteration_count() == maximum_iteration_count
|
|
44
|
+
|
|
45
|
+
def test_bracket_and_solve(self, root_solver):
|
|
46
|
+
solution = root_solver.bracket_and_solve(
|
|
47
|
+
function=quadratic_function,
|
|
48
|
+
initial_guess=1.0,
|
|
49
|
+
is_rising=True,
|
|
50
|
+
)
|
|
51
|
+
assert pytest.approx(solution.root, abs=1e-15) == 2.0
|
|
52
|
+
|
|
53
|
+
def test_solve(self, root_solver):
|
|
54
|
+
solution = root_solver.solve(
|
|
55
|
+
function=quadratic_function,
|
|
56
|
+
lower_bound=1.0,
|
|
57
|
+
upper_bound=3.0,
|
|
58
|
+
)
|
|
59
|
+
assert pytest.approx(solution.root, abs=1e-15) == 2.0
|
|
60
|
+
|
|
61
|
+
def test_bisection(self, root_solver):
|
|
62
|
+
solution = root_solver.bisection(
|
|
63
|
+
function=quadratic_function,
|
|
64
|
+
lower_bound=1.0,
|
|
65
|
+
upper_bound=3.0,
|
|
66
|
+
)
|
|
67
|
+
assert pytest.approx(solution.root, abs=1e-15) == 2.0
|
|
68
|
+
|
|
69
|
+
def test_default(self):
|
|
70
|
+
assert RootSolver.default() is not None
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from ostk.physics.environment.object.celestial import Earth
|
|
6
|
+
from ostk.physics.coordinate.spherical import LLA
|
|
7
|
+
from ostk.physics.coordinate import Position
|
|
8
|
+
from ostk.physics.coordinate import Frame
|
|
9
|
+
from ostk.physics.time import Instant
|
|
10
|
+
from ostk.physics.time import Duration
|
|
11
|
+
from ostk.physics.unit import Derived
|
|
12
|
+
from ostk.physics.unit import Length
|
|
13
|
+
from ostk.physics.unit import Angle
|
|
14
|
+
|
|
15
|
+
from ostk.astrodynamics import Trajectory
|
|
16
|
+
from ostk.astrodynamics.trajectory import State
|
|
17
|
+
from ostk.astrodynamics.trajectory import Orbit
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.fixture
|
|
21
|
+
def start_lla() -> LLA:
|
|
22
|
+
return LLA.vector([0.0, 0.0, 0.0])
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.fixture
|
|
26
|
+
def end_lla() -> LLA:
|
|
27
|
+
return LLA.vector([1.0, 0.0, 0.0])
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.fixture
|
|
31
|
+
def start_instant() -> Instant:
|
|
32
|
+
return Instant.J2000()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.fixture
|
|
36
|
+
def ground_speed() -> Derived:
|
|
37
|
+
return Derived(7000.0, Derived.Unit.meter_per_second())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.fixture
|
|
41
|
+
def earth() -> Earth:
|
|
42
|
+
return Earth.WGS84()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.fixture
|
|
46
|
+
def instants() -> list[Instant]:
|
|
47
|
+
return [Instant.J2000(), Instant.J2000() + Duration.seconds(10.0)]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@pytest.fixture
|
|
51
|
+
def position() -> Position:
|
|
52
|
+
return Position.meters([0.0, 0.0, 0.0], Frame.ITRF())
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.fixture
|
|
56
|
+
def trajectory(position: Position) -> Trajectory:
|
|
57
|
+
return Trajectory.position(position)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@pytest.fixture
|
|
61
|
+
def states(trajectory: Trajectory) -> list[State]:
|
|
62
|
+
return trajectory.get_states_at(
|
|
63
|
+
[Instant.J2000(), Instant.J2000() + Duration.seconds(10.0)]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@pytest.fixture
|
|
68
|
+
def orbit() -> Orbit:
|
|
69
|
+
return Orbit.circular(
|
|
70
|
+
epoch=Instant.J2000(),
|
|
71
|
+
altitude=Length.meters(545000.0),
|
|
72
|
+
inclination=Angle.degrees(0.0),
|
|
73
|
+
celestial_object=Earth.WGS84(),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class TestTrajectory:
|
|
78
|
+
def test_trajectory(
|
|
79
|
+
self,
|
|
80
|
+
states: list[State],
|
|
81
|
+
):
|
|
82
|
+
assert Trajectory(states) is not None
|
|
83
|
+
|
|
84
|
+
def test_is_defined(
|
|
85
|
+
self,
|
|
86
|
+
trajectory: Trajectory,
|
|
87
|
+
):
|
|
88
|
+
assert trajectory.is_defined()
|
|
89
|
+
|
|
90
|
+
def test_access_model(
|
|
91
|
+
self,
|
|
92
|
+
trajectory: Trajectory,
|
|
93
|
+
):
|
|
94
|
+
assert trajectory.access_model() is not None
|
|
95
|
+
|
|
96
|
+
def test_get_state_at(
|
|
97
|
+
self,
|
|
98
|
+
trajectory: Trajectory,
|
|
99
|
+
):
|
|
100
|
+
assert trajectory.get_state_at(Instant.J2000()) is not None
|
|
101
|
+
|
|
102
|
+
def test_get_states_at(
|
|
103
|
+
self,
|
|
104
|
+
trajectory: Trajectory,
|
|
105
|
+
):
|
|
106
|
+
assert (
|
|
107
|
+
trajectory.get_states_at(
|
|
108
|
+
[Instant.J2000(), Instant.J2000() + Duration.seconds(10.0)]
|
|
109
|
+
)
|
|
110
|
+
is not None
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def test_trajectory_undefined(self):
|
|
114
|
+
trajectory: Trajectory = Trajectory.undefined()
|
|
115
|
+
|
|
116
|
+
assert trajectory is not None
|
|
117
|
+
assert isinstance(trajectory, Trajectory)
|
|
118
|
+
assert trajectory.is_defined() is False
|
|
119
|
+
|
|
120
|
+
def test_trajectory_position(
|
|
121
|
+
self,
|
|
122
|
+
position: Position,
|
|
123
|
+
):
|
|
124
|
+
trajectory: Trajectory = Trajectory.position(position)
|
|
125
|
+
|
|
126
|
+
assert trajectory is not None
|