open-space-toolkit-astrodynamics 2.4.1__py311-none-any.whl → 5.0.0__py311-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/METADATA +2 -2
  2. open_space_toolkit_astrodynamics-5.0.0.dist-info/RECORD +25 -0
  3. ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-311-x86_64-linux-gnu.so +0 -0
  4. ostk/astrodynamics/__init__.py +6 -0
  5. ostk/astrodynamics/converters.py +1 -1
  6. ostk/astrodynamics/{libopen-space-toolkit-astrodynamics.so.2 → libopen-space-toolkit-astrodynamics.so.5} +0 -0
  7. ostk/astrodynamics/pytrajectory/pystate.py +36 -0
  8. ostk/astrodynamics/test/test_access.py +1 -1
  9. ostk/astrodynamics/test/test_converters.py +1 -1
  10. ostk/astrodynamics/test/test_event_condition.py +27 -2
  11. ostk/astrodynamics/test/test_import.py +2 -2
  12. ostk/astrodynamics/test/test_trajectory.py +1 -1
  13. ostk/astrodynamics/viewer.py +1 -1
  14. open_space_toolkit_astrodynamics-2.4.1.dist-info/RECORD +0 -83
  15. ostk/astrodynamics/test/access/__init__.py +0 -1
  16. ostk/astrodynamics/test/access/test_generator.py +0 -248
  17. ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +0 -1
  18. ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +0 -325
  19. ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +0 -303
  20. ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +0 -416
  21. ostk/astrodynamics/test/event_condition/test_angular_condition.py +0 -113
  22. ostk/astrodynamics/test/event_condition/test_boolean_condition.py +0 -55
  23. ostk/astrodynamics/test/event_condition/test_coe_condition.py +0 -91
  24. ostk/astrodynamics/test/event_condition/test_instant_condition.py +0 -48
  25. ostk/astrodynamics/test/event_condition/test_logical_condition.py +0 -120
  26. ostk/astrodynamics/test/event_condition/test_real_condition.py +0 -53
  27. ostk/astrodynamics/test/flight/__init__.py +0 -1
  28. ostk/astrodynamics/test/flight/profile/__init__.py +0 -1
  29. ostk/astrodynamics/test/flight/profile/test_state.py +0 -144
  30. ostk/astrodynamics/test/flight/system/__init__.py +0 -1
  31. ostk/astrodynamics/test/flight/system/dynamics/__init__.py +0 -1
  32. ostk/astrodynamics/test/flight/system/dynamics/test_atmospheric_drag.py +0 -128
  33. ostk/astrodynamics/test/flight/system/dynamics/test_central_body_gravity.py +0 -58
  34. ostk/astrodynamics/test/flight/system/dynamics/test_dynamics.py +0 -37
  35. ostk/astrodynamics/test/flight/system/dynamics/test_position_derivative.py +0 -51
  36. ostk/astrodynamics/test/flight/system/dynamics/test_third_body_gravity.py +0 -67
  37. ostk/astrodynamics/test/flight/system/dynamics/thruster/test_constant_thrust.py +0 -143
  38. ostk/astrodynamics/test/flight/system/test_propulsion_system.py +0 -46
  39. ostk/astrodynamics/test/flight/system/test_satellite_system.py +0 -77
  40. ostk/astrodynamics/test/flight/test_profile.py +0 -153
  41. ostk/astrodynamics/test/flight/test_system.py +0 -55
  42. ostk/astrodynamics/test/solvers/__init__.py +0 -1
  43. ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +0 -153
  44. ostk/astrodynamics/test/trajectory/__init__.py +0 -1
  45. ostk/astrodynamics/test/trajectory/orbit/__init__.py +0 -1
  46. ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +0 -1
  47. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +0 -1
  48. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +0 -18
  49. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +0 -44
  50. ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +0 -108
  51. ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +0 -1
  52. ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +0 -1
  53. ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +0 -112
  54. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +0 -1
  55. ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +0 -331
  56. ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +0 -130
  57. ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +0 -195
  58. ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +0 -1
  59. ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +0 -380
  60. ostk/astrodynamics/test/trajectory/orbit/test_model.py +0 -1
  61. ostk/astrodynamics/test/trajectory/orbit/test_pass.py +0 -55
  62. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +0 -103
  63. ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +0 -113
  64. ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +0 -71
  65. ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +0 -43
  66. ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +0 -242
  67. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +0 -82
  68. ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +0 -64
  69. ostk/astrodynamics/test/trajectory/test_model.py +0 -1
  70. ostk/astrodynamics/test/trajectory/test_orbit.py +0 -92
  71. ostk/astrodynamics/test/trajectory/test_propagator.py +0 -387
  72. ostk/astrodynamics/test/trajectory/test_state.py +0 -134
  73. ostk/astrodynamics/test/trajectory/test_trajectory_segment.py +0 -136
  74. {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/WHEEL +0 -0
  75. {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/top_level.txt +0 -0
  76. {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/zip-safe +0 -0
  77. /ostk/{__init__.py → astrodynamics/pytrajectory/__init__.py} +0 -0
@@ -1,55 +0,0 @@
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
@@ -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,82 +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 import LocalOrbitalFrameFactory
9
- from ostk.astrodynamics.trajectory import LocalOrbitalFrameDirection
10
-
11
-
12
- @pytest.fixture
13
- def local_orbital_frame_factory() -> LocalOrbitalFrameFactory:
14
- return LocalOrbitalFrameFactory.VNC(Frame.GCRF())
15
-
16
-
17
- @pytest.fixture
18
- def direction_vector() -> list:
19
- return [1.0, 0.0, 0.0]
20
-
21
-
22
- @pytest.fixture
23
- def local_orbital_frame_direction(
24
- direction_vector: list,
25
- local_orbital_frame_factory: LocalOrbitalFrameFactory,
26
- ) -> LocalOrbitalFrameDirection:
27
- return LocalOrbitalFrameDirection(
28
- direction_vector,
29
- local_orbital_frame_factory,
30
- )
31
-
32
-
33
- class TestLocalOrbitalFrameDirection:
34
- def test_constructor(
35
- self,
36
- direction_vector: list,
37
- local_orbital_frame_factory: LocalOrbitalFrameFactory,
38
- ):
39
- local_orbital_frame_direction: LocalOrbitalFrameDirection = (
40
- LocalOrbitalFrameDirection(
41
- direction_vector,
42
- local_orbital_frame_factory,
43
- )
44
- )
45
-
46
- assert local_orbital_frame_direction is not None
47
- assert isinstance(local_orbital_frame_direction, LocalOrbitalFrameDirection)
48
-
49
- def test_equal_to_operator(
50
- self, local_orbital_frame_direction: LocalOrbitalFrameDirection
51
- ):
52
- assert local_orbital_frame_direction == local_orbital_frame_direction
53
- assert local_orbital_frame_direction != LocalOrbitalFrameDirection(
54
- [0.0, 1.0, 0.0],
55
- local_orbital_frame_direction.get_local_orbital_frame_factory(),
56
- )
57
-
58
- def test_is_defined(
59
- self,
60
- local_orbital_frame_direction: LocalOrbitalFrameDirection,
61
- ):
62
- assert local_orbital_frame_direction.is_defined()
63
-
64
- def test_getters(
65
- self,
66
- local_orbital_frame_direction: LocalOrbitalFrameDirection,
67
- direction_vector: list,
68
- local_orbital_frame_factory: LocalOrbitalFrameFactory,
69
- ):
70
- assert list(local_orbital_frame_direction.get_value()) == direction_vector
71
- assert (
72
- local_orbital_frame_direction.get_local_orbital_frame_factory()
73
- == local_orbital_frame_factory
74
- )
75
-
76
- def test_undefined(
77
- self,
78
- ):
79
- local_orbital_frame_direction: LocalOrbitalFrameDirection = (
80
- LocalOrbitalFrameDirection.undefined()
81
- )
82
- assert local_orbital_frame_direction.is_defined() is False