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 +0,0 @@
1
- # Apache License 2.0
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,18 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- import pathlib
6
-
7
- from ostk.core.filesystem import Path
8
- from ostk.core.filesystem import File
9
-
10
-
11
- @pytest.fixture
12
- def data_directory_path() -> str:
13
- return f"{pathlib.Path(__file__).parent.absolute()}/data"
14
-
15
-
16
- @pytest.fixture
17
- def opm_file(data_directory_path: str) -> File:
18
- return File.path(Path.parse(f"{data_directory_path}/opm_1.yaml"))
@@ -1,44 +0,0 @@
1
- # Dummy SpaceX OPM output
2
-
3
- # Notes:
4
- # - ECEF velocity is Earth relative
5
- # - Apogee/Perigee altitude assumes a spherical Earth, 6378.137 km radius
6
- # - Orbital elements are computed in an inertial frame realized by inertially
7
- # freezing the WGS84 ECEF frame at time of current state
8
- # - State is post-deployment, so includes separation delta-velocity
9
-
10
-
11
- header:
12
- generation_date: 2020-01-01T12:34:56.789Z
13
- launch_date: 2020-01-02T12:34:56.789Z
14
-
15
-
16
- deployments:
17
-
18
- - name: satellite_a
19
- sequence_number: 1
20
- mission_time_s: 3600.0
21
- date: 2020-01-02T13:34:56.789Z
22
- r_ecef_m: [693289.644, 6876578.628, -133035.288]
23
- v_ecef_m_per_s: [1305.783, 39.783, 7525.920]
24
- mean_perigee_altitude_km: 526.768
25
- mean_apogee_altitude_km: 568.430
26
- mean_inclination_deg: 97.123
27
- mean_argument_of_perigee_deg: -179.513
28
- mean_longitude_ascending_node_deg: 85.057
29
- mean_mean_anomaly_deg: 179.263
30
- ballistic_coef_kg_per_m2: 47.55
31
-
32
- - name: satellite_b
33
- sequence_number: 2
34
- mission_time_s: 7200.0
35
- date: 2020-01-02T14:34:56.789Z
36
- r_ecef_m: [699863.059, 6875647.517, -123777.595]
37
- v_ecef_m_per_s: [1504.658, 6.705, 7538.669]
38
- mean_perigee_altitude_km: 536.779
39
- mean_apogee_altitude_km: 529.851
40
- mean_inclination_deg: 97.124
41
- mean_argument_of_perigee_deg: 136.875
42
- mean_longitude_ascending_node_deg: 85.032
43
- mean_mean_anomaly_deg: -127.164
44
- ballistic_coef_kg_per_m2: 44.26
@@ -1,108 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- from datetime import datetime
6
-
7
- from ostk.core.containers import Dictionary
8
- from ostk.core.filesystem import Path
9
- from ostk.core.filesystem import File
10
-
11
- from ostk.physics.units import Length
12
- from ostk.physics.units import Angle
13
- from ostk.physics.time import Instant
14
- from ostk.physics.time import Scale
15
- from ostk.physics.time import Duration
16
- from ostk.physics.coordinate import Position
17
- from ostk.physics.coordinate import Velocity
18
- from ostk.physics.coordinate import Frame
19
-
20
- from ostk.astrodynamics.trajectory.orbit.messages.spacex import OPM
21
-
22
-
23
- @pytest.fixture
24
- def opm() -> OPM:
25
- return OPM(
26
- header=OPM.Header(
27
- generation_date=Instant.date_time(datetime(2020, 1, 2, 3, 4, 5), Scale.UTC),
28
- launch_date=Instant.date_time(datetime(2020, 1, 3, 3, 4, 5), Scale.UTC),
29
- ),
30
- deployments=[
31
- OPM.Deployment(
32
- name="A",
33
- sequence_number=1,
34
- mission_time=Duration.hours(3600.0),
35
- date=Instant.date_time(datetime(2020, 1, 4, 3, 4, 5), Scale.UTC),
36
- position=Position.meters((1.0, 2.0, 3.0), Frame.ITRF()),
37
- velocity=Velocity.meters_per_second((4.0, 5.0, 6.0), Frame.ITRF()),
38
- mean_perigee_altitude=Length.kilometers(500.0),
39
- mean_apogee_altitude=Length.kilometers(500.0),
40
- mean_inclination=Angle.degrees(1.0),
41
- mean_argument_of_perigee=Angle.degrees(2.0),
42
- mean_longitude_ascending_node=Angle.degrees(3.0),
43
- mean_mean_anomaly=Angle.degrees(4.0),
44
- ballistic_coefficient=123.456,
45
- ),
46
- ],
47
- )
48
-
49
-
50
- class TestOPM:
51
- def test_constructor(self, opm: OPM):
52
- assert opm is not None
53
-
54
- def test_get_header(self, opm: OPM):
55
- assert opm.get_header() is not None
56
-
57
- def test_get_deployments(self, opm: OPM):
58
- assert len(opm.get_deployments()) == 1
59
-
60
- def test_get_deployment_at(self, opm: OPM):
61
- assert opm.get_deployment_at(index=0).name == "A"
62
-
63
- def test_get_deployment_with_name(self, opm: OPM):
64
- assert opm.get_deployment_with_name(name="A").name == "A"
65
-
66
- def test_undefined(self):
67
- assert OPM.undefined().is_defined() is False
68
-
69
- def test_dictionary(self):
70
- dictionary = Dictionary(
71
- {
72
- "header": {
73
- "generation_date": "2020-01-01T12:34:56.789Z",
74
- "launch_date": "2020-01-02T12:34:56.789Z",
75
- },
76
- "deployments": [
77
- {
78
- "name": "satellite_a",
79
- "sequence_number": 1,
80
- "mission_time_s": 3600.0,
81
- "date": "2020-01-02T13:34:56.789Z",
82
- "r_ecef_m": [693289.644, 6876578.628, -133035.288],
83
- "v_ecef_m_per_s": [1305.783, 39.783, 7525.920],
84
- "mean_perigee_altitude_km": 526.768,
85
- "mean_apogee_altitude_km": 568.430,
86
- "mean_inclination_deg": 97.123,
87
- "mean_argument_of_perigee_deg": -179.513,
88
- "mean_longitude_ascending_node_deg": 85.057,
89
- "mean_mean_anomaly_deg": 179.263,
90
- "ballistic_coef_kg_per_m2": 47.55,
91
- }
92
- ],
93
- }
94
- )
95
-
96
- assert OPM.dictionary(dictionary) is not None
97
-
98
- def test_parse(self, opm_file: File):
99
- with open(str(opm_file.get_path().to_string()), "r") as stream:
100
- assert OPM.parse(string=stream.read()) is not None
101
-
102
- def test_load(self, opm_file: File):
103
- assert OPM.load(file=opm_file) is not None
104
-
105
-
106
- class TestOPMDeployment:
107
- def test_to_state(self, opm: OPM):
108
- assert opm.get_deployment_with_name(name="A").to_state() is not None
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,112 +0,0 @@
1
- # Apache License 2.0
2
-
3
- from ostk.physics.units import Length
4
- from ostk.physics.units import Angle
5
- from ostk.physics.environment.gravitational import Earth
6
-
7
- from ostk.astrodynamics.trajectory.orbit.models.kepler import COE
8
-
9
-
10
- def construct_coe():
11
- a = Length.kilometers(7000.0)
12
- e = 0.1
13
- i = Angle.degrees(35.0)
14
- raan = Angle.degrees(40.0)
15
- aop = Angle.degrees(50.0)
16
- nu = Angle.degrees(60.0)
17
-
18
- coe = COE(a, e, i, raan, aop, nu)
19
-
20
- return coe
21
-
22
-
23
- def test_trajectory_orbit_models_kepler_coe_constructors():
24
- a = Length.kilometers(7000.0)
25
- e = 0.1
26
- i = Angle.degrees(35.0)
27
- raan = Angle.degrees(40.0)
28
- aop = Angle.degrees(50.0)
29
- nu = Angle.degrees(60.0)
30
-
31
- coe: COE = COE(a, e, i, raan, aop, nu)
32
-
33
- assert coe is not None
34
- assert isinstance(coe, COE)
35
- assert coe.is_defined()
36
-
37
- coe: COE = COE.undefined()
38
-
39
- assert coe is not None
40
- assert isinstance(coe, COE)
41
- assert coe.is_defined() is False
42
-
43
-
44
- def test_trajectory_orbit_models_kepler_coe_comparators():
45
- coe: COE = construct_coe()
46
-
47
- assert coe == coe
48
- assert (coe != coe) is False
49
-
50
-
51
- def test_trajectory_orbit_models_kepler_coe_getters():
52
- coe: COE = construct_coe()
53
-
54
- # get_semi_major_axis()
55
-
56
- assert coe.get_semi_major_axis() is not None
57
-
58
- # get_eccentricity()
59
-
60
- assert coe.get_eccentricity() is not None
61
-
62
- # get_inclination()
63
-
64
- assert coe.get_inclination() is not None
65
-
66
- # get_raan()
67
-
68
- assert coe.get_raan() is not None
69
-
70
- # get_aop()
71
-
72
- assert coe.get_aop() is not None
73
-
74
- # get_true_anomaly()
75
-
76
- assert coe.get_true_anomaly() is not None
77
-
78
- # get_mean_anomaly()
79
-
80
- assert coe.get_mean_anomaly() is not None
81
-
82
- # get_eccentric_anomaly()
83
-
84
- assert coe.get_eccentric_anomaly() is not None
85
-
86
-
87
- def test_trajectory_orbit_models_kepler_coe_get_mean_motion():
88
- coe: COE = construct_coe()
89
-
90
- assert coe.get_mean_motion(Earth.EGM2008.gravitational_parameter) is not None
91
-
92
-
93
- def test_trajectory_orbit_models_kepler_coe_get_orbital_period():
94
- coe: COE = construct_coe()
95
-
96
- assert coe.get_orbital_period(Earth.EGM2008.gravitational_parameter) is not None
97
-
98
-
99
- def test_trajectory_orbit_models_kepler_coe_static_methods():
100
- coe: COE = construct_coe()
101
-
102
- assert COE.eccentric_anomaly_from_true_anomaly(Angle.degrees(0.0), 0.0) is not None
103
- assert COE.true_anomaly_from_eccentric_anomaly(Angle.degrees(0.0), 0.0) is not None
104
- assert COE.mean_anomaly_from_eccentric_anomaly(Angle.degrees(0.0), 0.0) is not None
105
- assert (
106
- COE.eccentric_anomaly_from_mean_anomaly(Angle.degrees(0.0), 0.0, 0.0) is not None
107
- )
108
-
109
-
110
- def test_string_from_element():
111
- element_str = COE.string_from_element(COE.Element.SemiMajorAxis)
112
- assert element_str == "SemiMajorAxis"
@@ -1 +0,0 @@
1
- # Apache License 2.0
@@ -1,331 +0,0 @@
1
- # Apache License 2.0
2
-
3
- import pytest
4
-
5
- import tempfile
6
-
7
- from ostk.core.filesystem import Path
8
- from ostk.core.filesystem import File
9
-
10
- from ostk.physics.units import Time
11
- from ostk.physics.units import Angle
12
- from ostk.physics.units import Derived
13
- from ostk.physics.time import Instant
14
- from ostk.physics.time import Scale
15
- from ostk.physics.time import DateTime
16
-
17
- from ostk.astrodynamics.trajectory.orbit.models.sgp4 import TLE
18
-
19
-
20
- @pytest.fixture
21
- def tle() -> TLE:
22
- return TLE(
23
- satellite_name="Satellite",
24
- first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
25
- second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
26
- )
27
-
28
-
29
- class TestTLE:
30
- def test_constructor(self):
31
- tle = TLE(
32
- first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
33
- second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
34
- )
35
-
36
- assert isinstance(tle, TLE)
37
-
38
- def test_constructor_with_satellite_name(self):
39
- tle = TLE(
40
- satellite_name="Satellite",
41
- first_line="1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
42
- second_line="2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
43
- )
44
-
45
- assert isinstance(tle, TLE)
46
-
47
- def test_comparators(self, tle: TLE):
48
- assert (tle == tle) is True
49
- assert (tle != tle) is False
50
-
51
- def test_is_defined(self, tle: TLE):
52
- assert tle.is_defined()
53
-
54
- def test_get_satellite_name(self, tle: TLE):
55
- assert tle.get_satellite_name() == "Satellite"
56
-
57
- def test_get_first_line(self, tle: TLE):
58
- assert (
59
- tle.get_first_line()
60
- == "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
61
- )
62
-
63
- def test_get_second_line(self, tle: TLE):
64
- assert (
65
- tle.get_second_line()
66
- == "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316"
67
- )
68
-
69
- def test_get_satellite_number(self, tle: TLE):
70
- assert tle.get_satellite_number() == 25544
71
-
72
- def test_get_classification(self, tle: TLE):
73
- assert tle.get_classification() == "U"
74
-
75
- def test_get_international_designator(self, tle: TLE):
76
- assert tle.get_international_designator() == "98067A"
77
-
78
- def test_get_epoch(self, tle: TLE):
79
- assert tle.get_epoch() == Instant.date_time(
80
- DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
81
- )
82
-
83
- def test_get_mean_motion_first_time_derivative_divided_by_two(self, tle: TLE):
84
- assert (
85
- tle.get_mean_motion_first_time_derivative_divided_by_two()
86
- == 1.8700000000000001e-06
87
- )
88
-
89
- def test_get_mean_motion_second_time_derivative_divided_by_six(self, tle: TLE):
90
- assert tle.get_mean_motion_second_time_derivative_divided_by_six() == 0.0
91
-
92
- def test_get_b_star_drag_term(self, tle: TLE):
93
- assert tle.get_b_star_drag_term() == 1.0196e-05
94
-
95
- def test_get_ephemeris_type(self, tle: TLE):
96
- assert tle.get_ephemeris_type() == 0
97
-
98
- def test_get_element_set_number(self, tle: TLE):
99
- assert tle.get_element_set_number() == 999
100
-
101
- def test_get_first_line_checksum(self, tle: TLE):
102
- assert tle.get_first_line_checksum() == 4
103
-
104
- def test_get_inclination(self, tle: TLE):
105
- assert tle.get_inclination().in_degrees() == 51.6447
106
-
107
- def test_get_raan(self, tle: TLE):
108
- assert tle.get_raan().in_degrees() == 64.782399999999996
109
-
110
- def test_get_eccentricity(self, tle: TLE):
111
- assert tle.get_eccentricity() == 0.00059710000000000004
112
-
113
- def test_get_aop(self, tle: TLE):
114
- assert tle.get_aop().in_degrees() == 73.146699999999996
115
-
116
- def test_get_mean_anomaly(self, tle: TLE):
117
- assert tle.get_mean_anomaly().in_degrees() == 36.436599999999999
118
-
119
- def test_get_mean_motion(self, tle: TLE):
120
- assert (
121
- tle.get_mean_motion().in_unit(
122
- Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day)
123
- )
124
- == 15.53848234
125
- )
126
-
127
- def test_get_revolution_number_at_epoch(self, tle: TLE):
128
- assert tle.get_revolution_number_at_epoch() == 12831
129
-
130
- def test_get_second_line_checksum(self, tle: TLE):
131
- assert tle.get_second_line_checksum() == 6
132
-
133
- def test_set_satellite_number(self, tle: TLE):
134
- tle.set_satellite_number(99959)
135
-
136
- assert tle.get_satellite_number() == 99959
137
-
138
- tle.set_satellite_number(25544)
139
-
140
- assert tle.get_satellite_number() == 25544
141
-
142
- def test_set_epoch(self, tle: TLE):
143
- tle.set_epoch(
144
- Instant.date_time(DateTime(2019, 9, 20, 5, 18, 28, 232, 361, 0), Scale.UTC)
145
- )
146
-
147
- assert tle.get_epoch() == Instant.date_time(
148
- DateTime(2019, 9, 20, 5, 18, 28, 231, 776, 0), Scale.UTC
149
- )
150
-
151
- tle.set_epoch(
152
- Instant.date_time(DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC)
153
- )
154
-
155
- assert tle.get_epoch() == Instant.date_time(
156
- DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
157
- )
158
-
159
- def test_set_revolution_number_at_epoch(self, tle: TLE):
160
- tle.set_revolution_number_at_epoch(2345)
161
-
162
- assert tle.get_revolution_number_at_epoch() == 2345
163
- assert (
164
- tle.get_first_line()
165
- == "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
166
- )
167
- assert (
168
- tle.get_second_line()
169
- == "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234 23455"
170
- )
171
-
172
- tle.set_revolution_number_at_epoch(6)
173
-
174
- assert tle.get_revolution_number_at_epoch() == 6
175
- assert (
176
- tle.get_first_line()
177
- == "1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994"
178
- )
179
- assert (
180
- tle.get_second_line()
181
- == "2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234 67"
182
- )
183
-
184
- other_tle = TLE(
185
- "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995",
186
- "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975009992",
187
- )
188
-
189
- assert other_tle.get_revolution_number_at_epoch() == 999
190
-
191
- other_tle.set_revolution_number_at_epoch(999)
192
-
193
- assert other_tle.get_revolution_number_at_epoch() == 999
194
- assert (
195
- other_tle.get_first_line()
196
- == "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
197
- )
198
- assert (
199
- other_tle.get_second_line()
200
- == "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 9992"
201
- )
202
-
203
- other_tle.set_revolution_number_at_epoch(9909)
204
-
205
- assert other_tle.get_revolution_number_at_epoch() == 9909
206
- assert (
207
- other_tle.get_first_line()
208
- == "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
209
- )
210
- assert (
211
- other_tle.get_second_line()
212
- == "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 99092"
213
- )
214
-
215
- other_tle.set_revolution_number_at_epoch(99)
216
-
217
- assert other_tle.get_revolution_number_at_epoch() == 99
218
- assert (
219
- other_tle.get_first_line()
220
- == "1 99993U 21990ZZZ 21182.62513889 .00000763 00000-0 42347-4 0 99995"
221
- )
222
- assert (
223
- other_tle.get_second_line()
224
- == "2 99993 097.5132 311.4037 0016005 231.4378 006.3908 15.13696975 993"
225
- )
226
-
227
- def test_can_parse(self, tle: TLE):
228
- assert TLE.can_parse(tle.get_first_line(), tle.get_second_line())
229
-
230
- def test_parse(self, tle: TLE):
231
- tle_lines: str = "\n".join(
232
- [
233
- str(tle.get_satellite_name()),
234
- str(tle.get_first_line()),
235
- str(tle.get_second_line()),
236
- ]
237
- )
238
-
239
- assert TLE.parse(tle_lines) == tle
240
-
241
- def test_load(self, tle: TLE):
242
- tle_lines: str = "\n".join(
243
- [
244
- str(tle.get_satellite_name()),
245
- str(tle.get_first_line()),
246
- str(tle.get_second_line()),
247
- ]
248
- )
249
-
250
- tle_file = tempfile.NamedTemporaryFile(suffix=".tle", delete=False)
251
- tle_file.write(tle_lines.encode())
252
- tle_file.close()
253
-
254
- try:
255
- assert TLE.load(File.path(Path.parse(tle_file.name))) == tle
256
-
257
- finally:
258
- File.path(Path.parse(tle_file.name)).remove()
259
-
260
- def test_construct_with_satellite_name(self, tle: TLE):
261
- constructed_tle = TLE.construct(
262
- satellite_name="Satellite",
263
- satellite_number=25544,
264
- classification="U",
265
- international_designator="98067A",
266
- epoch=Instant.date_time(
267
- DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
268
- ),
269
- mean_motion_first_time_derivative_divided_by_two=1.8700000000000001e-06,
270
- mean_motion_second_time_derivative_divided_by_six=0.0,
271
- b_star_drag_term=1.0196e-05,
272
- ephemeris_type=0,
273
- element_set_number=999,
274
- inclination=Angle.degrees(51.6447),
275
- raan=Angle.degrees(64.782399999999996),
276
- eccentricity=0.00059710000000000004,
277
- aop=Angle.degrees(73.146699999999996),
278
- mean_anomaly=Angle.degrees(36.436599999999999),
279
- mean_motion=Derived(
280
- 15.53848234,
281
- Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day),
282
- ),
283
- revolution_number_at_epoch=12831,
284
- )
285
-
286
- assert constructed_tle == tle
287
-
288
- def test_construct_without_satellite_name(self, tle: TLE):
289
- constructed_tle = TLE.construct(
290
- satellite_number=25544,
291
- classification="U",
292
- international_designator="98067A",
293
- epoch=Instant.date_time(
294
- DateTime(2018, 8, 19, 4, 17, 27, 231, 360, 0), Scale.UTC
295
- ),
296
- mean_motion_first_time_derivative_divided_by_two=1.8700000000000001e-06,
297
- mean_motion_second_time_derivative_divided_by_six=0.0,
298
- b_star_drag_term=1.0196e-05,
299
- ephemeris_type=0,
300
- element_set_number=999,
301
- inclination=Angle.degrees(51.6447),
302
- raan=Angle.degrees(64.782399999999996),
303
- eccentricity=0.00059710000000000004,
304
- aop=Angle.degrees(73.146699999999996),
305
- mean_anomaly=Angle.degrees(36.436599999999999),
306
- mean_motion=Derived(
307
- 15.53848234,
308
- Derived.Unit.angular_velocity(Angle.Unit.Revolution, Time.Unit.Day),
309
- ),
310
- revolution_number_at_epoch=12831,
311
- )
312
-
313
- assert constructed_tle.get_first_line() == tle.get_first_line()
314
- assert constructed_tle.get_second_line() == tle.get_second_line()
315
-
316
- def test_generate_checksum(self, tle: TLE):
317
- assert (
318
- TLE.generate_checksum(tle.get_first_line()) == tle.get_first_line_checksum()
319
- )
320
- assert (
321
- TLE.generate_checksum(tle.get_second_line()) == tle.get_second_line_checksum()
322
- )
323
-
324
- assert (
325
- TLE.generate_checksum(f"{str(tle.get_first_line())[:-1]}0")
326
- == tle.get_first_line_checksum()
327
- )
328
- assert (
329
- TLE.generate_checksum(f"{str(tle.get_second_line())[:-1]}9")
330
- == tle.get_second_line_checksum()
331
- )