open-space-toolkit-astrodynamics 5.1.5__py38-none-any.whl → 5.2.0__py38-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-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/METADATA +1 -1
- open_space_toolkit_astrodynamics-5.2.0.dist-info/RECORD +96 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-38-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/converters.py +44 -6
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.5 +0 -0
- ostk/astrodynamics/pytrajectory/pystate.py +1 -3
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +248 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +1 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +325 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +303 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +416 -0
- ostk/astrodynamics/test/dynamics/__init__.py +1 -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_third_body_gravity.py +67 -0
- ostk/astrodynamics/test/dynamics/test_thruster.py +142 -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_coe_condition.py +87 -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/__init__.py +1 -0
- ostk/astrodynamics/test/flight/profile/test_state.py +144 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +46 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_profile.py +153 -0
- ostk/astrodynamics/test/flight/test_system.py +55 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +139 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
- ostk/astrodynamics/test/test_access.py +2 -6
- ostk/astrodynamics/test/test_converters.py +213 -6
- ostk/astrodynamics/test/test_viewer.py +1 -2
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +18 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +44 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/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 +167 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +195 -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 +55 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_angular_velocity.py +30 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_attitude_quaternion.py +18 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +107 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +115 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +84 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +43 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +64 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +92 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +402 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +288 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +459 -0
- ostk/astrodynamics/test/trajectory/test_state.py +223 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
- ostk/astrodynamics/viewer.py +1 -3
- open_space_toolkit_astrodynamics-5.1.5.dist-info/RECORD +0 -25
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/WHEEL +0 -0
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/top_level.txt +0 -0
- {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,55 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import ostk.physics as physics
|
6
|
+
|
7
|
+
import ostk.astrodynamics as astrodynamics
|
8
|
+
|
9
|
+
Length = physics.units.Length
|
10
|
+
Angle = physics.units.Angle
|
11
|
+
Scale = physics.time.Scale
|
12
|
+
Instant = physics.time.Instant
|
13
|
+
Interval = physics.time.Interval
|
14
|
+
DateTime = physics.time.DateTime
|
15
|
+
Position = physics.coordinate.Position
|
16
|
+
Velocity = physics.coordinate.Velocity
|
17
|
+
Frame = physics.coordinate.Frame
|
18
|
+
Environment = physics.Environment
|
19
|
+
|
20
|
+
Trajectory = astrodynamics.Trajectory
|
21
|
+
Model = astrodynamics.trajectory.Model
|
22
|
+
Orbit = astrodynamics.trajectory.Orbit
|
23
|
+
Pass = astrodynamics.trajectory.orbit.Pass
|
24
|
+
Kepler = astrodynamics.trajectory.orbit.models.Kepler
|
25
|
+
COE = astrodynamics.trajectory.orbit.models.kepler.COE
|
26
|
+
SGP4 = astrodynamics.trajectory.orbit.models.SGP4
|
27
|
+
TLE = astrodynamics.trajectory.orbit.models.sgp4.TLE
|
28
|
+
State = astrodynamics.trajectory.State
|
29
|
+
Access = astrodynamics.Access
|
30
|
+
|
31
|
+
earth = Environment.default().access_celestial_object_with_name("Earth")
|
32
|
+
|
33
|
+
|
34
|
+
def test_trajectory_orbit_pass():
|
35
|
+
pass_type = Pass.Type.Partial
|
36
|
+
pass_revolution_number = 123
|
37
|
+
pass_start_instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
38
|
+
pass_end_instant = Instant.date_time(DateTime(2018, 1, 1, 1, 0, 0), Scale.UTC)
|
39
|
+
pass_interval = Interval.closed(pass_start_instant, pass_end_instant)
|
40
|
+
|
41
|
+
pass_ = Pass(pass_type, pass_revolution_number, pass_interval)
|
42
|
+
|
43
|
+
assert pass_ is not None
|
44
|
+
assert isinstance(pass_, Pass)
|
45
|
+
|
46
|
+
assert pass_.is_defined()
|
47
|
+
assert pass_.is_complete() is not None
|
48
|
+
assert pass_.get_type() is not None
|
49
|
+
assert pass_.get_revolution_number() is not None
|
50
|
+
# Interval conversion to Python type of issue
|
51
|
+
# assert pass_.get_interval() is not None
|
52
|
+
|
53
|
+
assert Pass.string_from_type(Pass.Type.Complete) is not None
|
54
|
+
assert Pass.string_from_phase(Pass.Phase.Ascending) is not None
|
55
|
+
assert Pass.string_from_quarter(Pass.Quarter.First) is not None
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.astrodynamics.trajectory.state.coordinates_subset import (
|
6
|
+
AngularVelocity,
|
7
|
+
AttitudeQuaternion,
|
8
|
+
)
|
9
|
+
|
10
|
+
|
11
|
+
@pytest.fixture
|
12
|
+
def attitude_quaternion() -> AttitudeQuaternion:
|
13
|
+
return AttitudeQuaternion.default()
|
14
|
+
|
15
|
+
|
16
|
+
@pytest.fixture
|
17
|
+
def name() -> str:
|
18
|
+
return "Angular Velocity"
|
19
|
+
|
20
|
+
|
21
|
+
class TestAngularVelocity:
|
22
|
+
def test_constructor(
|
23
|
+
self,
|
24
|
+
attitude_quaternion: AttitudeQuaternion,
|
25
|
+
name: str,
|
26
|
+
):
|
27
|
+
assert AngularVelocity(attitude_quaternion, name) is not None
|
28
|
+
|
29
|
+
def test_default(self):
|
30
|
+
assert AttitudeQuaternion.default() is not None
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.astrodynamics.trajectory.state.coordinates_subset import AttitudeQuaternion
|
6
|
+
|
7
|
+
|
8
|
+
@pytest.fixture
|
9
|
+
def name() -> str:
|
10
|
+
return "Attitude"
|
11
|
+
|
12
|
+
|
13
|
+
class TestAttitudeQuaternion:
|
14
|
+
def test_constructor(self, name: str):
|
15
|
+
assert AttitudeQuaternion(name) is not None
|
16
|
+
|
17
|
+
def test_default(self):
|
18
|
+
assert AttitudeQuaternion.default() is not None
|
@@ -0,0 +1,107 @@
|
|
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(
|
24
|
+
cartesian_position: CartesianPosition,
|
25
|
+
) -> list[CoordinatesSubset]:
|
26
|
+
return [cartesian_position]
|
27
|
+
|
28
|
+
|
29
|
+
@pytest.fixture
|
30
|
+
def instant() -> Instant:
|
31
|
+
return Instant.J2000()
|
32
|
+
|
33
|
+
|
34
|
+
@pytest.fixture
|
35
|
+
def frame() -> Frame:
|
36
|
+
return Frame.GCRF()
|
37
|
+
|
38
|
+
|
39
|
+
@pytest.fixture
|
40
|
+
def coordinates_broker(
|
41
|
+
coordinates_subsets: list[CoordinatesSubset],
|
42
|
+
) -> CoordinatesBroker:
|
43
|
+
return CoordinatesBroker(coordinates_subsets)
|
44
|
+
|
45
|
+
|
46
|
+
@pytest.fixture
|
47
|
+
def coordinates() -> list[float]:
|
48
|
+
return [7000000.0, 0.0, 0.0]
|
49
|
+
|
50
|
+
|
51
|
+
@pytest.fixture
|
52
|
+
def another_coordinates() -> list[float]:
|
53
|
+
return [0.0, 7000000.0, 0.0]
|
54
|
+
|
55
|
+
|
56
|
+
class TestCartesianPosition:
|
57
|
+
def test_constructor(self, name: str):
|
58
|
+
assert CartesianPosition(name) is not None
|
59
|
+
|
60
|
+
def test_add(
|
61
|
+
self,
|
62
|
+
cartesian_position: CartesianPosition,
|
63
|
+
instant: Instant,
|
64
|
+
frame: Frame,
|
65
|
+
coordinates: list[float],
|
66
|
+
another_coordinates: list[float],
|
67
|
+
coordinates_broker: CoordinatesBroker,
|
68
|
+
):
|
69
|
+
assert all(
|
70
|
+
cartesian_position.add(
|
71
|
+
instant, coordinates, another_coordinates, frame, coordinates_broker
|
72
|
+
)
|
73
|
+
== [7000000.0, 7000000.0, 0.0]
|
74
|
+
)
|
75
|
+
|
76
|
+
def test_subtract(
|
77
|
+
self,
|
78
|
+
cartesian_position: CartesianPosition,
|
79
|
+
instant: Instant,
|
80
|
+
frame: Frame,
|
81
|
+
coordinates: list[float],
|
82
|
+
another_coordinates: list[float],
|
83
|
+
coordinates_broker: CoordinatesBroker,
|
84
|
+
):
|
85
|
+
assert all(
|
86
|
+
cartesian_position.subtract(
|
87
|
+
instant, coordinates, another_coordinates, frame, coordinates_broker
|
88
|
+
)
|
89
|
+
== [7000000.0, -7000000.0, 0.0]
|
90
|
+
)
|
91
|
+
|
92
|
+
def test_in_frame(
|
93
|
+
self,
|
94
|
+
cartesian_position: CartesianPosition,
|
95
|
+
instant: Instant,
|
96
|
+
frame: Frame,
|
97
|
+
coordinates: list[float],
|
98
|
+
another_coordinates: list[float],
|
99
|
+
coordinates_broker: CoordinatesBroker,
|
100
|
+
):
|
101
|
+
for value, expected in zip(
|
102
|
+
cartesian_position.in_frame(
|
103
|
+
instant, coordinates, frame, Frame.ITRF(), coordinates_broker
|
104
|
+
),
|
105
|
+
[1238864.12746338, 6889500.39136482, -176.262107699686],
|
106
|
+
):
|
107
|
+
assert value == pytest.approx(expected, rel=1e-14)
|
@@ -0,0 +1,115 @@
|
|
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(
|
49
|
+
coordinates_subsets: list[CoordinatesSubset],
|
50
|
+
) -> CoordinatesBroker:
|
51
|
+
return CoordinatesBroker(coordinates_subsets)
|
52
|
+
|
53
|
+
|
54
|
+
@pytest.fixture
|
55
|
+
def coordinates() -> list[float]:
|
56
|
+
return [7000000.0, 0.0, 0.0, 0.0, 5335.865450622126, 5335.865450622126]
|
57
|
+
|
58
|
+
|
59
|
+
@pytest.fixture
|
60
|
+
def another_coordinates() -> list[float]:
|
61
|
+
return [0.0, 7000000.0, 0.0, 5335.865450622126, 0.0, 0.0]
|
62
|
+
|
63
|
+
|
64
|
+
class TestCartesianVelocity:
|
65
|
+
def test_constructor(self, name: str):
|
66
|
+
assert CartesianVelocity(CartesianPosition.default(), name) is not None
|
67
|
+
|
68
|
+
def test_add(
|
69
|
+
self,
|
70
|
+
cartesian_velocity: CartesianVelocity,
|
71
|
+
instant: Instant,
|
72
|
+
frame: Frame,
|
73
|
+
coordinates: list[float],
|
74
|
+
another_coordinates: list[float],
|
75
|
+
coordinates_broker: CoordinatesBroker,
|
76
|
+
):
|
77
|
+
assert all(
|
78
|
+
cartesian_velocity.add(
|
79
|
+
instant, coordinates, another_coordinates, frame, coordinates_broker
|
80
|
+
)
|
81
|
+
== [5335.865450622126, 5335.865450622126, 5335.865450622126]
|
82
|
+
)
|
83
|
+
|
84
|
+
def test_subtract(
|
85
|
+
self,
|
86
|
+
cartesian_velocity: CartesianVelocity,
|
87
|
+
instant: Instant,
|
88
|
+
frame: Frame,
|
89
|
+
coordinates: list[float],
|
90
|
+
another_coordinates: list[float],
|
91
|
+
coordinates_broker: CoordinatesBroker,
|
92
|
+
):
|
93
|
+
assert all(
|
94
|
+
cartesian_velocity.subtract(
|
95
|
+
instant, coordinates, another_coordinates, frame, coordinates_broker
|
96
|
+
)
|
97
|
+
== [-5335.865450622126, 5335.865450622126, 5335.865450622126]
|
98
|
+
)
|
99
|
+
|
100
|
+
def test_in_frame(
|
101
|
+
self,
|
102
|
+
cartesian_velocity: CartesianVelocity,
|
103
|
+
instant: Instant,
|
104
|
+
frame: Frame,
|
105
|
+
coordinates: list[float],
|
106
|
+
another_coordinates: list[float],
|
107
|
+
coordinates_broker: CoordinatesBroker,
|
108
|
+
):
|
109
|
+
for value, expected in zip(
|
110
|
+
cartesian_velocity.in_frame(
|
111
|
+
instant, coordinates, frame, Frame.ITRF(), coordinates_broker
|
112
|
+
),
|
113
|
+
[-4749.36551256577, 854.163395375881, 5335.71857543495],
|
114
|
+
):
|
115
|
+
assert value == pytest.approx(expected, rel=1e-14)
|
@@ -0,0 +1,84 @@
|
|
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 test_extract_coordinate(
|
61
|
+
self,
|
62
|
+
coordinates_broker: CoordinatesBroker,
|
63
|
+
coordinates: list[float],
|
64
|
+
coordinates_subsets: list[CoordinatesSubset],
|
65
|
+
):
|
66
|
+
assert (
|
67
|
+
coordinates_broker.extract_coordinate(coordinates, coordinates_subsets[0])
|
68
|
+
== [1.0, 2.0]
|
69
|
+
).all()
|
70
|
+
assert (
|
71
|
+
coordinates_broker.extract_coordinate(coordinates, coordinates_subsets[1])
|
72
|
+
== [3.0, 4.0, 5.0]
|
73
|
+
).all()
|
74
|
+
|
75
|
+
def test_extract_coordinates(
|
76
|
+
self,
|
77
|
+
coordinates_broker: CoordinatesBroker,
|
78
|
+
coordinates: list[float],
|
79
|
+
coordinates_subsets: list[CoordinatesSubset],
|
80
|
+
):
|
81
|
+
assert (
|
82
|
+
coordinates_broker.extract_coordinates(coordinates, coordinates_subsets)
|
83
|
+
== [1.0, 2.0, 3.0, 4.0, 5.0]
|
84
|
+
).all()
|
@@ -0,0 +1,43 @@
|
|
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
|