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.
- {open_space_toolkit_astrodynamics-2.2.0.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.2.0.dist-info/RECORD +0 -77
- 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_boolean_condition.py +0 -55
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +0 -126
- 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 -89
- 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/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_model.py +0 -1
- ostk/astrodynamics/test/trajectory/test_orbit.py +0 -92
- ostk/astrodynamics/test/trajectory/test_propagator.py +0 -234
- ostk/astrodynamics/test/trajectory/test_state.py +0 -121
- {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/WHEEL +0 -0
- {open_space_toolkit_astrodynamics-2.2.0.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_astrodynamics-2.2.0.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,103 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.physics.time import Instant
|
6
|
-
from ostk.physics.coordinate import Frame
|
7
|
-
|
8
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker, CoordinatesSubset
|
9
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianPosition
|
10
|
-
|
11
|
-
|
12
|
-
@pytest.fixture
|
13
|
-
def name() -> str:
|
14
|
-
return "Position"
|
15
|
-
|
16
|
-
|
17
|
-
@pytest.fixture
|
18
|
-
def cartesian_position() -> CartesianPosition:
|
19
|
-
return CartesianPosition.default()
|
20
|
-
|
21
|
-
|
22
|
-
@pytest.fixture
|
23
|
-
def coordinates_subsets(cartesian_position: CartesianPosition) -> list[CoordinatesSubset]:
|
24
|
-
return [cartesian_position]
|
25
|
-
|
26
|
-
|
27
|
-
@pytest.fixture
|
28
|
-
def instant() -> Instant:
|
29
|
-
return Instant.J2000()
|
30
|
-
|
31
|
-
|
32
|
-
@pytest.fixture
|
33
|
-
def frame() -> Frame:
|
34
|
-
return Frame.GCRF()
|
35
|
-
|
36
|
-
|
37
|
-
@pytest.fixture
|
38
|
-
def coordinates_broker(coordinates_subsets: list[CoordinatesSubset]) -> CoordinatesBroker:
|
39
|
-
return CoordinatesBroker(coordinates_subsets)
|
40
|
-
|
41
|
-
|
42
|
-
@pytest.fixture
|
43
|
-
def coordinates() -> list[float]:
|
44
|
-
return [7000000.0, 0.0, 0.0]
|
45
|
-
|
46
|
-
|
47
|
-
@pytest.fixture
|
48
|
-
def another_coordinates() -> list[float]:
|
49
|
-
return [0.0, 7000000.0, 0.0]
|
50
|
-
|
51
|
-
|
52
|
-
class TestCoordinatesSubset:
|
53
|
-
def test_constructor(self, name: str):
|
54
|
-
assert CartesianPosition(name) is not None
|
55
|
-
|
56
|
-
def test_add(
|
57
|
-
self,
|
58
|
-
cartesian_position: CartesianPosition,
|
59
|
-
instant: Instant,
|
60
|
-
frame: Frame,
|
61
|
-
coordinates: list[float],
|
62
|
-
another_coordinates: list[float],
|
63
|
-
coordinates_broker: CoordinatesBroker,
|
64
|
-
):
|
65
|
-
assert all(
|
66
|
-
cartesian_position.add(
|
67
|
-
instant, coordinates, another_coordinates, frame, coordinates_broker
|
68
|
-
)
|
69
|
-
== [7000000.0, 7000000.0, 0.0]
|
70
|
-
)
|
71
|
-
|
72
|
-
def test_subtract(
|
73
|
-
self,
|
74
|
-
cartesian_position: CartesianPosition,
|
75
|
-
instant: Instant,
|
76
|
-
frame: Frame,
|
77
|
-
coordinates: list[float],
|
78
|
-
another_coordinates: list[float],
|
79
|
-
coordinates_broker: CoordinatesBroker,
|
80
|
-
):
|
81
|
-
assert all(
|
82
|
-
cartesian_position.subtract(
|
83
|
-
instant, coordinates, another_coordinates, frame, coordinates_broker
|
84
|
-
)
|
85
|
-
== [7000000.0, -7000000.0, 0.0]
|
86
|
-
)
|
87
|
-
|
88
|
-
def test_in_frame(
|
89
|
-
self,
|
90
|
-
cartesian_position: CartesianPosition,
|
91
|
-
instant: Instant,
|
92
|
-
frame: Frame,
|
93
|
-
coordinates: list[float],
|
94
|
-
another_coordinates: list[float],
|
95
|
-
coordinates_broker: CoordinatesBroker,
|
96
|
-
):
|
97
|
-
for value, expected in zip(
|
98
|
-
cartesian_position.in_frame(
|
99
|
-
instant, coordinates, frame, Frame.ITRF(), coordinates_broker
|
100
|
-
),
|
101
|
-
[1238864.12746338, 6889500.39136482, -176.262107699686],
|
102
|
-
):
|
103
|
-
assert value == pytest.approx(expected, rel=1e-14)
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.physics.time import Instant
|
6
|
-
from ostk.physics.coordinate import Frame
|
7
|
-
|
8
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker, CoordinatesSubset
|
9
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import (
|
10
|
-
CartesianVelocity,
|
11
|
-
CartesianPosition,
|
12
|
-
)
|
13
|
-
|
14
|
-
|
15
|
-
@pytest.fixture
|
16
|
-
def name() -> str:
|
17
|
-
return "Position"
|
18
|
-
|
19
|
-
|
20
|
-
@pytest.fixture
|
21
|
-
def cartesian_position() -> CartesianPosition:
|
22
|
-
return CartesianPosition.default()
|
23
|
-
|
24
|
-
|
25
|
-
@pytest.fixture
|
26
|
-
def cartesian_velocity() -> CartesianVelocity:
|
27
|
-
return CartesianVelocity.default()
|
28
|
-
|
29
|
-
|
30
|
-
@pytest.fixture
|
31
|
-
def coordinates_subsets(
|
32
|
-
cartesian_position: CartesianPosition, cartesian_velocity: CartesianVelocity
|
33
|
-
) -> list[CoordinatesSubset]:
|
34
|
-
return [cartesian_position, cartesian_velocity]
|
35
|
-
|
36
|
-
|
37
|
-
@pytest.fixture
|
38
|
-
def instant() -> Instant:
|
39
|
-
return Instant.J2000()
|
40
|
-
|
41
|
-
|
42
|
-
@pytest.fixture
|
43
|
-
def frame() -> Frame:
|
44
|
-
return Frame.GCRF()
|
45
|
-
|
46
|
-
|
47
|
-
@pytest.fixture
|
48
|
-
def coordinates_broker(coordinates_subsets: list[CoordinatesSubset]) -> CoordinatesBroker:
|
49
|
-
return CoordinatesBroker(coordinates_subsets)
|
50
|
-
|
51
|
-
|
52
|
-
@pytest.fixture
|
53
|
-
def coordinates() -> list[float]:
|
54
|
-
return [7000000.0, 0.0, 0.0, 0.0, 5335.865450622126, 5335.865450622126]
|
55
|
-
|
56
|
-
|
57
|
-
@pytest.fixture
|
58
|
-
def another_coordinates() -> list[float]:
|
59
|
-
return [0.0, 7000000.0, 0.0, 5335.865450622126, 0.0, 0.0]
|
60
|
-
|
61
|
-
|
62
|
-
class TestCoordinatesSubset:
|
63
|
-
def test_constructor(self, name: str):
|
64
|
-
assert CartesianVelocity(CartesianPosition.default(), name) is not None
|
65
|
-
|
66
|
-
def test_add(
|
67
|
-
self,
|
68
|
-
cartesian_velocity: CartesianVelocity,
|
69
|
-
instant: Instant,
|
70
|
-
frame: Frame,
|
71
|
-
coordinates: list[float],
|
72
|
-
another_coordinates: list[float],
|
73
|
-
coordinates_broker: CoordinatesBroker,
|
74
|
-
):
|
75
|
-
assert all(
|
76
|
-
cartesian_velocity.add(
|
77
|
-
instant, coordinates, another_coordinates, frame, coordinates_broker
|
78
|
-
)
|
79
|
-
== [5335.865450622126, 5335.865450622126, 5335.865450622126]
|
80
|
-
)
|
81
|
-
|
82
|
-
def test_subtract(
|
83
|
-
self,
|
84
|
-
cartesian_velocity: CartesianVelocity,
|
85
|
-
instant: Instant,
|
86
|
-
frame: Frame,
|
87
|
-
coordinates: list[float],
|
88
|
-
another_coordinates: list[float],
|
89
|
-
coordinates_broker: CoordinatesBroker,
|
90
|
-
):
|
91
|
-
assert all(
|
92
|
-
cartesian_velocity.subtract(
|
93
|
-
instant, coordinates, another_coordinates, frame, coordinates_broker
|
94
|
-
)
|
95
|
-
== [-5335.865450622126, 5335.865450622126, 5335.865450622126]
|
96
|
-
)
|
97
|
-
|
98
|
-
def test_in_frame(
|
99
|
-
self,
|
100
|
-
cartesian_velocity: CartesianVelocity,
|
101
|
-
instant: Instant,
|
102
|
-
frame: Frame,
|
103
|
-
coordinates: list[float],
|
104
|
-
another_coordinates: list[float],
|
105
|
-
coordinates_broker: CoordinatesBroker,
|
106
|
-
):
|
107
|
-
for value, expected in zip(
|
108
|
-
cartesian_velocity.in_frame(
|
109
|
-
instant, coordinates, frame, Frame.ITRF(), coordinates_broker
|
110
|
-
),
|
111
|
-
[-4749.36551256577, 854.163395375881, 5335.71857543495],
|
112
|
-
):
|
113
|
-
assert value == pytest.approx(expected, rel=1e-14)
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker, CoordinatesSubset
|
6
|
-
|
7
|
-
|
8
|
-
@pytest.fixture
|
9
|
-
def coordinates_subsets() -> list:
|
10
|
-
return [CoordinatesSubset("Subset1", 2), CoordinatesSubset("Subset2", 3)]
|
11
|
-
|
12
|
-
|
13
|
-
@pytest.fixture
|
14
|
-
def coordinates_broker(coordinates_subsets) -> CoordinatesBroker:
|
15
|
-
return CoordinatesBroker(coordinates_subsets)
|
16
|
-
|
17
|
-
|
18
|
-
@pytest.fixture
|
19
|
-
def coordinates() -> list[float]:
|
20
|
-
return [1.0, 2.0, 3.0, 4.0, 5.0]
|
21
|
-
|
22
|
-
|
23
|
-
class TestCoordinatesBroker:
|
24
|
-
def test_constructor(self, coordinates_broker: CoordinatesBroker):
|
25
|
-
assert coordinates_broker is not None
|
26
|
-
|
27
|
-
def test_eq(self, coordinates_broker: CoordinatesBroker):
|
28
|
-
assert coordinates_broker == coordinates_broker
|
29
|
-
|
30
|
-
def test_ne(self, coordinates_broker: CoordinatesBroker):
|
31
|
-
assert (coordinates_broker != coordinates_broker) == False
|
32
|
-
|
33
|
-
def test_access_subsets(
|
34
|
-
self, coordinates_broker: CoordinatesBroker, coordinates_subsets: list
|
35
|
-
):
|
36
|
-
assert coordinates_broker.access_subsets() == coordinates_subsets
|
37
|
-
|
38
|
-
def test_get_number_of_coordinates(self, coordinates_broker: CoordinatesBroker):
|
39
|
-
assert coordinates_broker.get_number_of_coordinates() == 5
|
40
|
-
|
41
|
-
def test_get_number_of_subsets(self, coordinates_broker: CoordinatesBroker):
|
42
|
-
assert coordinates_broker.get_number_of_subsets() == 2
|
43
|
-
|
44
|
-
def test_get_subsets(
|
45
|
-
self, coordinates_broker: CoordinatesBroker, coordinates_subsets: list
|
46
|
-
):
|
47
|
-
assert coordinates_broker.get_subsets() == coordinates_subsets
|
48
|
-
|
49
|
-
def test_add_subset(self, coordinates_broker: CoordinatesBroker):
|
50
|
-
new_subset = CoordinatesSubset("NewSubset", 4)
|
51
|
-
number_of_coordinates = coordinates_broker.get_number_of_coordinates()
|
52
|
-
assert coordinates_broker.add_subset(new_subset) == number_of_coordinates
|
53
|
-
assert coordinates_broker.has_subset(new_subset)
|
54
|
-
|
55
|
-
def test_has_subset(
|
56
|
-
self, coordinates_broker: CoordinatesBroker, coordinates_subsets: list
|
57
|
-
):
|
58
|
-
assert coordinates_broker.has_subset(coordinates_subsets[0])
|
59
|
-
|
60
|
-
def extract_coordinates(
|
61
|
-
self,
|
62
|
-
coordinates_broker: CoordinatesBroker,
|
63
|
-
coordinates: list[float],
|
64
|
-
coordinates_subsets: list[CoordinatesSubset],
|
65
|
-
):
|
66
|
-
assert coordinates_broker.extract_coordinates(
|
67
|
-
coordinates, coordinates_subsets[0]
|
68
|
-
) == [1.0, 2.0]
|
69
|
-
assert coordinates_broker.extract_coordinates(
|
70
|
-
coordinates, coordinates_subsets[1]
|
71
|
-
) == [3.0, 4.0, 5.0]
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesSubset
|
6
|
-
|
7
|
-
|
8
|
-
@pytest.fixture
|
9
|
-
def name() -> str:
|
10
|
-
return "MySubset"
|
11
|
-
|
12
|
-
|
13
|
-
@pytest.fixture
|
14
|
-
def size() -> int:
|
15
|
-
return 3
|
16
|
-
|
17
|
-
|
18
|
-
@pytest.fixture
|
19
|
-
def coordinates_subset(name: str, size: int) -> CoordinatesSubset:
|
20
|
-
return CoordinatesSubset(name, size)
|
21
|
-
|
22
|
-
|
23
|
-
class TestCoordinatesSubset:
|
24
|
-
def test_constructor(self, coordinates_subset: CoordinatesSubset):
|
25
|
-
assert coordinates_subset is not None
|
26
|
-
|
27
|
-
def test_eq(self, coordinates_subset: CoordinatesSubset):
|
28
|
-
assert coordinates_subset == coordinates_subset
|
29
|
-
|
30
|
-
def test_ne(self, coordinates_subset: CoordinatesSubset):
|
31
|
-
assert (coordinates_subset != coordinates_subset) == False
|
32
|
-
|
33
|
-
def test_get_id(self, coordinates_subset: CoordinatesSubset):
|
34
|
-
assert coordinates_subset.get_id() is not None
|
35
|
-
|
36
|
-
def test_get_name(self, coordinates_subset: CoordinatesSubset, name: str):
|
37
|
-
assert coordinates_subset.get_name() == name
|
38
|
-
|
39
|
-
def test_get_size(self, coordinates_subset: CoordinatesSubset, size: int):
|
40
|
-
assert coordinates_subset.get_size() == size
|
41
|
-
|
42
|
-
def test_mass(self):
|
43
|
-
assert CoordinatesSubset.mass() is not None
|
@@ -1,242 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
import numpy as np
|
6
|
-
import math
|
7
|
-
|
8
|
-
from ostk.physics.time import Instant, Duration
|
9
|
-
from ostk.physics.coordinate import Frame
|
10
|
-
|
11
|
-
from ostk.astrodynamics.trajectory import State
|
12
|
-
from ostk.astrodynamics.trajectory.state import (
|
13
|
-
NumericalSolver,
|
14
|
-
CoordinatesBroker,
|
15
|
-
CoordinatesSubset,
|
16
|
-
)
|
17
|
-
from ostk.astrodynamics.event_condition import RealCondition
|
18
|
-
|
19
|
-
|
20
|
-
def oscillator(x, dxdt, _):
|
21
|
-
dxdt[0] = x[1]
|
22
|
-
dxdt[1] = -x[0]
|
23
|
-
return dxdt
|
24
|
-
|
25
|
-
|
26
|
-
def get_state_vec(time: float) -> np.ndarray:
|
27
|
-
return np.array([math.sin(time), math.cos(time)])
|
28
|
-
|
29
|
-
|
30
|
-
@pytest.fixture
|
31
|
-
def coordinates_subsets() -> list[CoordinatesSubset]:
|
32
|
-
return [CoordinatesSubset("Subset", 2)]
|
33
|
-
|
34
|
-
|
35
|
-
@pytest.fixture
|
36
|
-
def coordinates_broker(coordinates_subsets: list[CoordinatesSubset]) -> CoordinatesBroker:
|
37
|
-
return CoordinatesBroker(coordinates_subsets)
|
38
|
-
|
39
|
-
|
40
|
-
@pytest.fixture
|
41
|
-
def start_instant() -> Instant:
|
42
|
-
return Instant.J2000()
|
43
|
-
|
44
|
-
|
45
|
-
@pytest.fixture
|
46
|
-
def frame() -> Frame:
|
47
|
-
return Frame.GCRF()
|
48
|
-
|
49
|
-
|
50
|
-
@pytest.fixture
|
51
|
-
def initial_state(
|
52
|
-
start_instant: Instant,
|
53
|
-
frame: Frame,
|
54
|
-
coordinates_broker: CoordinatesBroker,
|
55
|
-
) -> State:
|
56
|
-
return State(start_instant, get_state_vec(0.0), frame, coordinates_broker)
|
57
|
-
|
58
|
-
|
59
|
-
@pytest.fixture
|
60
|
-
def custom_condition() -> RealCondition:
|
61
|
-
return RealCondition(
|
62
|
-
"Custom",
|
63
|
-
RealCondition.Criterion.StrictlyPositive,
|
64
|
-
lambda state: (state.get_instant() - Instant.J2000()).in_seconds(),
|
65
|
-
5.0,
|
66
|
-
)
|
67
|
-
|
68
|
-
|
69
|
-
@pytest.fixture
|
70
|
-
def numerical_solver_default_inputs() -> (
|
71
|
-
tuple[NumericalSolver.LogType, NumericalSolver.StepperType, float, float, float]
|
72
|
-
):
|
73
|
-
log_type = NumericalSolver.LogType.NoLog
|
74
|
-
stepper_type = NumericalSolver.StepperType.RungeKuttaCashKarp54
|
75
|
-
initial_time_step = 5.0
|
76
|
-
relative_tolerance = 1.0e-15
|
77
|
-
absolute_tolerance = 1.0e-15
|
78
|
-
|
79
|
-
return (
|
80
|
-
log_type,
|
81
|
-
stepper_type,
|
82
|
-
initial_time_step,
|
83
|
-
relative_tolerance,
|
84
|
-
absolute_tolerance,
|
85
|
-
)
|
86
|
-
|
87
|
-
|
88
|
-
@pytest.fixture
|
89
|
-
def numerical_solver(numerical_solver_default_inputs) -> NumericalSolver:
|
90
|
-
return NumericalSolver(*numerical_solver_default_inputs)
|
91
|
-
|
92
|
-
|
93
|
-
@pytest.fixture
|
94
|
-
def numerical_solver_conditional() -> NumericalSolver:
|
95
|
-
return NumericalSolver(
|
96
|
-
NumericalSolver.LogType.NoLog,
|
97
|
-
NumericalSolver.StepperType.RungeKuttaDopri5,
|
98
|
-
5.0,
|
99
|
-
1.0e-15,
|
100
|
-
1.0e-15,
|
101
|
-
)
|
102
|
-
|
103
|
-
|
104
|
-
class TestNumericalSolver:
|
105
|
-
def test_constructors(self, numerical_solver: NumericalSolver):
|
106
|
-
assert numerical_solver is not None
|
107
|
-
assert isinstance(numerical_solver, NumericalSolver)
|
108
|
-
assert numerical_solver.is_defined()
|
109
|
-
|
110
|
-
def test_comparators(self, numerical_solver: NumericalSolver):
|
111
|
-
assert numerical_solver == numerical_solver
|
112
|
-
assert (numerical_solver != numerical_solver) is False
|
113
|
-
|
114
|
-
def test_get_types(
|
115
|
-
self,
|
116
|
-
numerical_solver_default_inputs: tuple[
|
117
|
-
NumericalSolver.LogType, NumericalSolver.StepperType, float, float, float
|
118
|
-
],
|
119
|
-
numerical_solver: NumericalSolver,
|
120
|
-
):
|
121
|
-
(
|
122
|
-
log_type,
|
123
|
-
stepper_type,
|
124
|
-
initial_time_step,
|
125
|
-
relative_tolerance,
|
126
|
-
absolute_tolerance,
|
127
|
-
) = numerical_solver_default_inputs
|
128
|
-
|
129
|
-
assert numerical_solver.get_log_type() == log_type
|
130
|
-
assert numerical_solver.get_stepper_type() == stepper_type
|
131
|
-
assert numerical_solver.get_time_step() == initial_time_step
|
132
|
-
assert numerical_solver.get_relative_tolerance() == relative_tolerance
|
133
|
-
assert numerical_solver.get_absolute_tolerance() == absolute_tolerance
|
134
|
-
assert numerical_solver.get_root_solver() is not None
|
135
|
-
assert numerical_solver.get_observed_states() is not None
|
136
|
-
|
137
|
-
def test_get_string_from_types(self):
|
138
|
-
assert (
|
139
|
-
NumericalSolver.string_from_stepper_type(
|
140
|
-
NumericalSolver.StepperType.RungeKutta4
|
141
|
-
)
|
142
|
-
== "RungeKutta4"
|
143
|
-
)
|
144
|
-
assert (
|
145
|
-
NumericalSolver.string_from_stepper_type(
|
146
|
-
NumericalSolver.StepperType.RungeKuttaCashKarp54
|
147
|
-
)
|
148
|
-
== "RungeKuttaCashKarp54"
|
149
|
-
)
|
150
|
-
assert (
|
151
|
-
NumericalSolver.string_from_stepper_type(
|
152
|
-
NumericalSolver.StepperType.RungeKuttaFehlberg78
|
153
|
-
)
|
154
|
-
== "RungeKuttaFehlberg78"
|
155
|
-
)
|
156
|
-
assert (
|
157
|
-
NumericalSolver.string_from_log_type(NumericalSolver.LogType.NoLog) == "NoLog"
|
158
|
-
)
|
159
|
-
assert (
|
160
|
-
NumericalSolver.string_from_log_type(NumericalSolver.LogType.LogConstant)
|
161
|
-
== "LogConstant"
|
162
|
-
)
|
163
|
-
assert (
|
164
|
-
NumericalSolver.string_from_log_type(NumericalSolver.LogType.LogAdaptive)
|
165
|
-
== "LogAdaptive"
|
166
|
-
)
|
167
|
-
|
168
|
-
def test_integrate_time(
|
169
|
-
self,
|
170
|
-
initial_state: State,
|
171
|
-
numerical_solver: NumericalSolver,
|
172
|
-
):
|
173
|
-
duration_seconds: float = 100.0
|
174
|
-
end_instant: Instant = initial_state.get_instant() + Duration.seconds(
|
175
|
-
duration_seconds
|
176
|
-
)
|
177
|
-
|
178
|
-
state_vector: np.ndarray = numerical_solver.integrate_time(
|
179
|
-
initial_state, end_instant, oscillator
|
180
|
-
).get_coordinates()
|
181
|
-
|
182
|
-
assert 5e-9 >= abs(state_vector[0] - math.sin(duration_seconds))
|
183
|
-
assert 5e-9 >= abs(state_vector[1] - math.cos(duration_seconds))
|
184
|
-
|
185
|
-
end_instants: list[Instant] = [
|
186
|
-
initial_state.get_instant() + Duration.seconds(duration)
|
187
|
-
for duration in np.arange(600.0, 1000.0, 50.0)
|
188
|
-
]
|
189
|
-
states: list[State] = numerical_solver.integrate_time(
|
190
|
-
initial_state, end_instants, oscillator
|
191
|
-
)
|
192
|
-
|
193
|
-
for state, end_instant in zip(states, end_instants):
|
194
|
-
state_vector: np.ndarray = state.get_coordinates()
|
195
|
-
|
196
|
-
assert 5e-9 >= abs(
|
197
|
-
state_vector[0]
|
198
|
-
- math.sin((end_instant - initial_state.get_instant()).in_seconds())
|
199
|
-
)
|
200
|
-
assert 5e-9 >= abs(
|
201
|
-
state_vector[1]
|
202
|
-
- math.cos((end_instant - initial_state.get_instant()).in_seconds())
|
203
|
-
)
|
204
|
-
|
205
|
-
def test_integrate_time_with_condition(
|
206
|
-
self,
|
207
|
-
initial_state: State,
|
208
|
-
numerical_solver_conditional: NumericalSolver,
|
209
|
-
custom_condition: RealCondition,
|
210
|
-
):
|
211
|
-
end_time: float = initial_state.get_instant() + Duration.seconds(100.0)
|
212
|
-
|
213
|
-
condition_solution = numerical_solver_conditional.integrate_time(
|
214
|
-
initial_state, end_time, oscillator, custom_condition
|
215
|
-
)
|
216
|
-
|
217
|
-
assert condition_solution.condition_is_satisfied
|
218
|
-
assert (
|
219
|
-
condition_solution.iteration_count
|
220
|
-
< numerical_solver_conditional.get_root_solver().get_maximum_iteration_count()
|
221
|
-
)
|
222
|
-
assert condition_solution.root_solver_has_converged
|
223
|
-
|
224
|
-
state_vector = condition_solution.state.get_coordinates()
|
225
|
-
time = (
|
226
|
-
condition_solution.state.get_instant() - initial_state.get_instant()
|
227
|
-
).in_seconds()
|
228
|
-
|
229
|
-
assert abs(float(time - custom_condition.get_target())) < 1e-6
|
230
|
-
|
231
|
-
assert 5e-9 >= abs(state_vector[0] - math.sin(time))
|
232
|
-
assert 5e-9 >= abs(state_vector[1] - math.cos(time))
|
233
|
-
|
234
|
-
def test_default(self):
|
235
|
-
assert NumericalSolver.default() is not None
|
236
|
-
|
237
|
-
def test_default_conditional(self):
|
238
|
-
assert NumericalSolver.default_conditional() is not None
|
239
|
-
|
240
|
-
def test_undefined(self):
|
241
|
-
assert NumericalSolver.undefined() is not None
|
242
|
-
assert NumericalSolver.undefined().is_defined() is False
|
@@ -1 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
from ostk.physics import Environment
|
6
|
-
from ostk.physics.units import Length, Angle
|
7
|
-
from ostk.physics.time import Scale, Instant, DateTime, Time
|
8
|
-
|
9
|
-
from ostk.astrodynamics.trajectory import Orbit, State
|
10
|
-
from ostk.astrodynamics.trajectory.orbit.models import SGP4
|
11
|
-
from ostk.astrodynamics.trajectory.orbit.models.sgp4 import TLE
|
12
|
-
|
13
|
-
|
14
|
-
@pytest.fixture
|
15
|
-
def earth():
|
16
|
-
return Environment.default().access_celestial_object_with_name("Earth")
|
17
|
-
|
18
|
-
|
19
|
-
class TestOrbit:
|
20
|
-
def test_trajectory_orbit_constructors(self, earth):
|
21
|
-
# Construct Two-Line Element set
|
22
|
-
tle = TLE(
|
23
|
-
"1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
|
24
|
-
"2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
|
25
|
-
)
|
26
|
-
|
27
|
-
# Construct orbit using SGP4 model
|
28
|
-
orbit = Orbit(SGP4(tle), earth)
|
29
|
-
|
30
|
-
assert orbit is not None
|
31
|
-
assert isinstance(orbit, Orbit)
|
32
|
-
assert orbit.is_defined()
|
33
|
-
|
34
|
-
# Construct get state at current epoch
|
35
|
-
state: State = orbit.get_state_at(Instant.now())
|
36
|
-
|
37
|
-
assert state is not None
|
38
|
-
assert isinstance(state, State)
|
39
|
-
|
40
|
-
def test_trajectory_orbit_circular(self, earth):
|
41
|
-
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
42
|
-
altitude = Length.kilometers(500.0)
|
43
|
-
inclination = Angle.degrees(45.0)
|
44
|
-
|
45
|
-
orbit: Orbit = Orbit.circular(epoch, altitude, inclination, earth)
|
46
|
-
|
47
|
-
def test_trajectory_orbit_equatorial(self, earth):
|
48
|
-
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
49
|
-
apoapsis_altitude = Length.kilometers(500.1)
|
50
|
-
periapsis_altitude = Length.kilometers(499.9)
|
51
|
-
|
52
|
-
orbit: Orbit = Orbit.equatorial(
|
53
|
-
epoch, apoapsis_altitude, periapsis_altitude, earth
|
54
|
-
)
|
55
|
-
|
56
|
-
assert orbit is not None
|
57
|
-
assert isinstance(orbit, Orbit)
|
58
|
-
assert orbit.is_defined()
|
59
|
-
|
60
|
-
def test_trajectory_orbit_circular_equatorial(self, earth):
|
61
|
-
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
62
|
-
altitude = Length.kilometers(500.0)
|
63
|
-
|
64
|
-
orbit: Orbit = Orbit.circular_equatorial(epoch, altitude, earth)
|
65
|
-
|
66
|
-
assert orbit is not None
|
67
|
-
assert isinstance(orbit, Orbit)
|
68
|
-
assert orbit.is_defined()
|
69
|
-
|
70
|
-
def test_trajectory_orbit_geo_synchronous(self, earth):
|
71
|
-
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
72
|
-
inclination = Angle.degrees(45.0)
|
73
|
-
longitude = Angle.degrees(45.0)
|
74
|
-
|
75
|
-
orbit: Orbit = Orbit.geo_synchronous(epoch, inclination, longitude, earth)
|
76
|
-
|
77
|
-
assert orbit is not None
|
78
|
-
assert isinstance(orbit, Orbit)
|
79
|
-
assert orbit.is_defined()
|
80
|
-
|
81
|
-
def test_trajectory_orbit_sun_synchronous(self, earth):
|
82
|
-
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
83
|
-
altitude = Length.kilometers(500.0)
|
84
|
-
local_time_at_descending_node = Time.midnight()
|
85
|
-
|
86
|
-
orbit: Orbit = Orbit.sun_synchronous(
|
87
|
-
epoch, altitude, local_time_at_descending_node, earth
|
88
|
-
)
|
89
|
-
|
90
|
-
assert orbit is not None
|
91
|
-
assert isinstance(orbit, Orbit)
|
92
|
-
assert orbit.is_defined()
|