open-space-toolkit-physics 11.2.1__py311-none-manylinux2014_aarch64.whl → 12.0.0__py311-none-manylinux2014_aarch64.whl
Sign up to get free protection for your applications and to get access to all the features.
- {open_space_toolkit_physics-11.2.1.dist-info → open_space_toolkit_physics-12.0.0.dist-info}/METADATA +3 -3
- {open_space_toolkit_physics-11.2.1.dist-info → open_space_toolkit_physics-12.0.0.dist-info}/RECORD +35 -13
- {open_space_toolkit_physics-11.2.1.dist-info → open_space_toolkit_physics-12.0.0.dist-info}/WHEEL +1 -1
- ostk/physics/OpenSpaceToolkitPhysicsPy.cpython-311-aarch64-linux-gnu.so +0 -0
- ostk/physics/__init__.pyi +488 -0
- ostk/physics/coordinate/__init__.pyi +1002 -0
- ostk/physics/coordinate/frame/__init__.pyi +30 -0
- ostk/physics/coordinate/frame/provider/__init__.pyi +77 -0
- ostk/physics/coordinate/frame/provider/iau.pyi +64 -0
- ostk/physics/coordinate/frame/provider/iers.pyi +584 -0
- ostk/physics/coordinate/spherical.pyi +421 -0
- ostk/physics/data/__init__.pyi +459 -0
- ostk/physics/data/provider.pyi +21 -0
- ostk/physics/environment/__init__.pyi +108 -0
- ostk/physics/environment/atmospheric/__init__.pyi +181 -0
- ostk/physics/environment/atmospheric/earth.pyi +552 -0
- ostk/physics/environment/gravitational/__init__.pyi +559 -0
- ostk/physics/environment/gravitational/earth.pyi +56 -0
- ostk/physics/environment/magnetic/__init__.pyi +171 -0
- ostk/physics/environment/magnetic/earth.pyi +56 -0
- ostk/physics/environment/object/__init__.pyi +430 -0
- ostk/physics/environment/object/celestial/__init__.pyi +248 -0
- ostk/physics/environment/object/celestial/moon.pyi +2 -0
- ostk/physics/environment/object/celestial/sun.pyi +2 -0
- ostk/physics/libopen-space-toolkit-physics.so.12 +0 -0
- ostk/physics/test/coordinate/frame/provider/iers/conftest.py +2 -5
- ostk/physics/test/coordinate/frame/provider/iers/test_bulletin_a.py +1 -4
- ostk/physics/test/coordinate/frame/provider/iers/test_finals_2000a.py +1 -4
- ostk/physics/test/coordinate/spherical/test_lla.py +24 -0
- ostk/physics/test/coordinate/test_position.py +129 -134
- ostk/physics/test/environment/atmospheric/earth/test_cssi_space_weather.py +11 -8
- ostk/physics/time.pyi +1744 -0
- ostk/physics/unit.pyi +1590 -0
- ostk/physics/libopen-space-toolkit-physics.so.11 +0 -0
- {open_space_toolkit_physics-11.2.1.dist-info → open_space_toolkit_physics-12.0.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_physics-11.2.1.dist-info → open_space_toolkit_physics-12.0.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,248 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import ostk.core.type
|
3
|
+
import ostk.physics.environment.object
|
4
|
+
import ostk.physics.unit
|
5
|
+
import typing
|
6
|
+
from . import moon
|
7
|
+
from . import sun
|
8
|
+
__all__ = ['Earth', 'Moon', 'Sun', 'moon', 'sun']
|
9
|
+
class Earth(ostk.physics.environment.object.Celestial):
|
10
|
+
"""
|
11
|
+
|
12
|
+
Earth
|
13
|
+
|
14
|
+
"""
|
15
|
+
@staticmethod
|
16
|
+
def EGM2008(degree: ostk.core.type.Integer = ..., order: ostk.core.type.Integer = ...) -> Earth:
|
17
|
+
"""
|
18
|
+
Earth Gravity Model 2008 model (EGM2008).
|
19
|
+
|
20
|
+
Args:
|
21
|
+
degree (int): Degree.
|
22
|
+
order (int): Order.
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
Earth: Earth.
|
26
|
+
"""
|
27
|
+
@staticmethod
|
28
|
+
def EGM84(degree: ostk.core.type.Integer = ..., order: ostk.core.type.Integer = ...) -> Earth:
|
29
|
+
"""
|
30
|
+
Earth Gravity Model 1984 (EGM84).
|
31
|
+
|
32
|
+
Args:
|
33
|
+
degree (int): Degree.
|
34
|
+
order (int): Order.
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
Earth: Earth.
|
38
|
+
"""
|
39
|
+
@staticmethod
|
40
|
+
def EGM96(degree: ostk.core.type.Integer = ..., order: ostk.core.type.Integer = ...) -> Earth:
|
41
|
+
"""
|
42
|
+
Earth Gravity Model 1996 (EGM96).
|
43
|
+
|
44
|
+
Args:
|
45
|
+
degree (int): Degree.
|
46
|
+
order (int): Order.
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
Earth: Earth.
|
50
|
+
"""
|
51
|
+
@staticmethod
|
52
|
+
def WGS84(degree: ostk.core.type.Integer = ..., order: ostk.core.type.Integer = ...) -> Earth:
|
53
|
+
"""
|
54
|
+
World Geodetic System 1984 (WGS84).
|
55
|
+
|
56
|
+
Args:
|
57
|
+
degree (int): Degree.
|
58
|
+
order (int): Order.
|
59
|
+
|
60
|
+
Returns:
|
61
|
+
Earth: Earth.
|
62
|
+
"""
|
63
|
+
@staticmethod
|
64
|
+
def WGS84_EGM96(degree: ostk.core.type.Integer = ..., order: ostk.core.type.Integer = ...) -> Earth:
|
65
|
+
"""
|
66
|
+
World Geodetic System 1984 (WGS84) + Earth Gravity Model 1996 (EGM96).
|
67
|
+
|
68
|
+
EGM96 coefficients and WGS84 shape.
|
69
|
+
Gravitational parameter: 398600441800000 [m^3/s^2].
|
70
|
+
Equatorial radius: 6378137.0 [m].
|
71
|
+
|
72
|
+
Args:
|
73
|
+
degree (int): Degree.
|
74
|
+
order (int): Order.
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
Earth: Earth.
|
78
|
+
"""
|
79
|
+
@staticmethod
|
80
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
81
|
+
...
|
82
|
+
@staticmethod
|
83
|
+
def atmospheric_only(atmospheric_model: typing.Any) -> Earth:
|
84
|
+
"""
|
85
|
+
Just atmospheric model.
|
86
|
+
|
87
|
+
Args:
|
88
|
+
atmospheric_model (EarthAtmosphericModel): Atmospheric model.
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
Earth: Earth.
|
92
|
+
"""
|
93
|
+
@staticmethod
|
94
|
+
def default() -> Earth:
|
95
|
+
"""
|
96
|
+
Default Earth model (EGM2008).
|
97
|
+
|
98
|
+
Returns:
|
99
|
+
Earth: Earth
|
100
|
+
"""
|
101
|
+
@staticmethod
|
102
|
+
def from_models(gravity_model: typing.Any, magnetic_model: typing.Any, atmospheric_model: typing.Any) -> Earth:
|
103
|
+
"""
|
104
|
+
Create earth from specified models.
|
105
|
+
|
106
|
+
Args:
|
107
|
+
gravity_model (EarthGravitationalModel): Gravitational model.
|
108
|
+
magnetic_model (EarthMagneticModel): Magnetic model.
|
109
|
+
atmospheric_model (EarthAtmosphericModel): Atmospheric model.
|
110
|
+
|
111
|
+
Returns:
|
112
|
+
Earth: Earth.
|
113
|
+
"""
|
114
|
+
@staticmethod
|
115
|
+
def gravitational_only(gravity_model: typing.Any) -> Earth:
|
116
|
+
"""
|
117
|
+
Just gravity model.
|
118
|
+
|
119
|
+
Args:
|
120
|
+
gravity_model (EarthGravitationalModel): Gravitational model.
|
121
|
+
|
122
|
+
Returns:
|
123
|
+
Earth: Earth.
|
124
|
+
"""
|
125
|
+
@staticmethod
|
126
|
+
def magnetic_only(magnetic_model: typing.Any) -> Earth:
|
127
|
+
"""
|
128
|
+
Just magnetic model.
|
129
|
+
|
130
|
+
Args:
|
131
|
+
magnetic_model (EarthMagneticModel): Magnetic model.
|
132
|
+
|
133
|
+
Returns:
|
134
|
+
Earth: Earth.
|
135
|
+
"""
|
136
|
+
@staticmethod
|
137
|
+
def spherical() -> Earth:
|
138
|
+
"""
|
139
|
+
Spherical model.
|
140
|
+
|
141
|
+
Returns:
|
142
|
+
Earth: Earth.
|
143
|
+
"""
|
144
|
+
@typing.overload
|
145
|
+
def __init__(self, gravitational_parameter: ostk.physics.unit.Derived, equatorial_radius: ostk.physics.unit.Length, flattening: ostk.core.type.Real, J2_parameter_value: ostk.core.type.Real, J4_parameter_value: ostk.core.type.Real, ephemeris: typing.Any, gravitational_model: typing.Any, magnetic_model: typing.Any, atmospheric_model: typing.Any) -> None:
|
146
|
+
"""
|
147
|
+
Constructor
|
148
|
+
|
149
|
+
Args:
|
150
|
+
gravitational_parameter (Derived): Gravitational parameter [m³/s²].
|
151
|
+
equatorial_radius (Length): Equatorial radius [m].
|
152
|
+
flattening (Real): Flattening.
|
153
|
+
J2_parameter_value (Real): J2 parameter value.
|
154
|
+
J4_parameter_value (Real): J4 parameter value.
|
155
|
+
ephemeris (Ephemeris): Ephemeris.
|
156
|
+
gravitational_model (EarthGravitationalModel): Gravitational model.
|
157
|
+
magnetic_model (EarthMagneticModel): Magnetic model.
|
158
|
+
atmospheric_model (EarthAtmosphericModel): Atmospheric model.
|
159
|
+
"""
|
160
|
+
@typing.overload
|
161
|
+
def __init__(self, ephemeris: typing.Any, gravitational_model: typing.Any = None, magnetic_model: typing.Any = None, atmospheric_model: typing.Any = None) -> None:
|
162
|
+
"""
|
163
|
+
Constructor
|
164
|
+
|
165
|
+
Args:
|
166
|
+
ephemeris (Ephemeris): Ephemeris.
|
167
|
+
gravitational_model (EarthGravitationalModel): Gravitational model. Defaults to None.
|
168
|
+
magnetic_model (EarthMagneticModel): Magnetic model. Defaults to None.
|
169
|
+
atmospheric_model (EarthAtmosphericModel): Atmospheric model. Defaults to None.
|
170
|
+
"""
|
171
|
+
def __repr__(self) -> str:
|
172
|
+
...
|
173
|
+
def __str__(self) -> str:
|
174
|
+
...
|
175
|
+
class Moon(ostk.physics.environment.object.Celestial):
|
176
|
+
"""
|
177
|
+
|
178
|
+
Moon.
|
179
|
+
|
180
|
+
"""
|
181
|
+
@staticmethod
|
182
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
183
|
+
...
|
184
|
+
@staticmethod
|
185
|
+
def default() -> Moon:
|
186
|
+
"""
|
187
|
+
Create a default Moon.
|
188
|
+
|
189
|
+
Returns:
|
190
|
+
Moon: Default Moon.
|
191
|
+
"""
|
192
|
+
@staticmethod
|
193
|
+
def spherical() -> Moon:
|
194
|
+
"""
|
195
|
+
Spherical model.
|
196
|
+
|
197
|
+
Returns:
|
198
|
+
Moon: Moon.
|
199
|
+
"""
|
200
|
+
def __init__(self, ephemeris: typing.Any, gravitational_model: typing.Any) -> None:
|
201
|
+
"""
|
202
|
+
Constructor.
|
203
|
+
|
204
|
+
Args:
|
205
|
+
ephemeris (Ephemeris): Ephemeris.
|
206
|
+
gravitational_model (MoonGravitationalModel): Gravitational model.
|
207
|
+
"""
|
208
|
+
def __repr__(self) -> str:
|
209
|
+
...
|
210
|
+
def __str__(self) -> str:
|
211
|
+
...
|
212
|
+
class Sun(ostk.physics.environment.object.Celestial):
|
213
|
+
"""
|
214
|
+
|
215
|
+
Sun.
|
216
|
+
|
217
|
+
"""
|
218
|
+
@staticmethod
|
219
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
220
|
+
...
|
221
|
+
@staticmethod
|
222
|
+
def default() -> Sun:
|
223
|
+
"""
|
224
|
+
Create a default Sun.
|
225
|
+
|
226
|
+
Returns:
|
227
|
+
Sun: Default Sun.
|
228
|
+
"""
|
229
|
+
@staticmethod
|
230
|
+
def spherical() -> Sun:
|
231
|
+
"""
|
232
|
+
Spherical model.
|
233
|
+
|
234
|
+
Returns:
|
235
|
+
Sun: Sun.
|
236
|
+
"""
|
237
|
+
def __init__(self, ephemeris: typing.Any, gravitational_model: typing.Any) -> None:
|
238
|
+
"""
|
239
|
+
Constructor.
|
240
|
+
|
241
|
+
Args:
|
242
|
+
ephemeris (Ephemeris): Ephemeris.
|
243
|
+
gravitational_model (SunGravitationalModel): Gravitational model.
|
244
|
+
"""
|
245
|
+
def __repr__(self) -> str:
|
246
|
+
...
|
247
|
+
def __str__(self) -> str:
|
248
|
+
...
|
Binary file
|
@@ -6,11 +6,8 @@ import pathlib
|
|
6
6
|
|
7
7
|
from ostk.core.filesystem import Path
|
8
8
|
from ostk.core.filesystem import File
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
BulletinA = physics.coordinate.frame.provider.iers.BulletinA
|
13
|
-
Finals2000A = physics.coordinate.frame.provider.iers.Finals2000A
|
9
|
+
from ostk.physics.coordinate.frame.provider.iers import BulletinA
|
10
|
+
from ostk.physics.coordinate.frame.provider.iers import Finals2000A
|
14
11
|
|
15
12
|
|
16
13
|
@pytest.fixture
|
@@ -6,10 +6,7 @@ from ostk.core.filesystem import File
|
|
6
6
|
|
7
7
|
from ostk.physics.time import Scale
|
8
8
|
from ostk.physics.time import Instant
|
9
|
-
|
10
|
-
import ostk.physics as physics
|
11
|
-
|
12
|
-
BulletinA = physics.coordinate.frame.provider.iers.BulletinA
|
9
|
+
from ostk.physics.coordinate.frame.provider.iers import BulletinA
|
13
10
|
|
14
11
|
|
15
12
|
class TestBulletinA:
|
@@ -6,10 +6,7 @@ from ostk.core.filesystem import File
|
|
6
6
|
|
7
7
|
from ostk.physics.time import Scale
|
8
8
|
from ostk.physics.time import Instant
|
9
|
-
|
10
|
-
import ostk.physics as physics
|
11
|
-
|
12
|
-
Finals2000A = physics.coordinate.frame.provider.iers.Finals2000A
|
9
|
+
from ostk.physics.coordinate.frame.provider.iers import Finals2000A
|
13
10
|
|
14
11
|
|
15
12
|
class TestFinals2000A:
|
@@ -8,7 +8,9 @@ from ostk.core.type import String
|
|
8
8
|
from ostk.physics import Environment
|
9
9
|
from ostk.physics.unit import Angle, Length
|
10
10
|
from ostk.physics.coordinate.spherical import LLA
|
11
|
+
from ostk.physics.coordinate import Frame, Position
|
11
12
|
from ostk.physics.environment.gravitational import Earth as EarthGravitationalModel
|
13
|
+
from ostk.physics.environment.object.celestial import Earth
|
12
14
|
|
13
15
|
Spherical = EarthGravitationalModel.spherical
|
14
16
|
WGS84_EGM96 = EarthGravitationalModel.WGS84_EGM96
|
@@ -488,3 +490,25 @@ class TestLLA:
|
|
488
490
|
)
|
489
491
|
assert llas is not None
|
490
492
|
assert len(llas) == n_points
|
493
|
+
|
494
|
+
def test_from_position(self):
|
495
|
+
earth = Earth.WGS84()
|
496
|
+
frame = Frame.ITRF()
|
497
|
+
position = Position.meters([6378137.0, 0.0, 0.0], frame) # Point on equator
|
498
|
+
|
499
|
+
lla = LLA.from_position(position, earth)
|
500
|
+
assert lla is not None
|
501
|
+
assert abs(float(lla.get_latitude().in_degrees())) < 1e-10 # Should be on equator
|
502
|
+
|
503
|
+
assert (
|
504
|
+
abs(float(lla.get_longitude().in_degrees())) < 1e-10
|
505
|
+
) # Should be at prime meridian
|
506
|
+
assert abs(float(lla.get_altitude().in_meters())) < 1e-6 # Should be near surface
|
507
|
+
|
508
|
+
# Test with undefined position
|
509
|
+
with pytest.raises(RuntimeError):
|
510
|
+
LLA.from_position(Position.undefined())
|
511
|
+
|
512
|
+
# Test with global environment
|
513
|
+
lla = LLA.from_position(position)
|
514
|
+
assert lla is not None
|
@@ -4,203 +4,198 @@ import pytest
|
|
4
4
|
import numpy as np
|
5
5
|
|
6
6
|
from ostk.core.type import String
|
7
|
-
import ostk.physics as physics
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
from ostk.physics import Environment
|
9
|
+
from ostk.physics.coordinate import Frame
|
10
|
+
from ostk.physics.coordinate import Position
|
11
|
+
from ostk.physics.coordinate.spherical import LLA
|
12
|
+
from ostk.physics.time import Instant
|
13
|
+
from ostk.physics.time import Scale
|
14
|
+
from ostk.physics.time import DateTime
|
15
|
+
from ostk.physics.unit import Length
|
15
16
|
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
unit: Unit = Unit.Meter
|
18
|
+
@pytest.fixture
|
19
|
+
def unit() -> Length.Unit:
|
20
|
+
return Length.Unit.Meter
|
21
21
|
|
22
|
-
# Construction with python lists
|
23
|
-
vector = [1000.0, 0.0, 0.0]
|
24
22
|
|
25
|
-
|
23
|
+
@pytest.fixture
|
24
|
+
def frame() -> Frame:
|
25
|
+
return Frame.GCRF()
|
26
26
|
|
27
|
-
assert position is not None
|
28
|
-
assert isinstance(position, Position)
|
29
|
-
assert position.is_defined()
|
30
27
|
|
31
|
-
|
32
|
-
|
28
|
+
@pytest.fixture
|
29
|
+
def earth():
|
30
|
+
return Environment.default().access_celestial_object_with_name("Earth")
|
33
31
|
|
34
|
-
position: Position = Position(vector, unit, frame)
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
@pytest.fixture
|
34
|
+
def lla() -> LLA:
|
35
|
+
return LLA.vector([0.0, 0.0, 0.0])
|
39
36
|
|
40
|
-
# Construction with python numpy arrays
|
41
|
-
vector = np.array((1000.0, 0.0, 0.0))
|
42
37
|
|
43
|
-
|
38
|
+
class TestPosition:
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
def test_constructors(self, unit: Length.Unit, frame: Frame):
|
41
|
+
# Construction with python lists
|
42
|
+
vector = [1000.0, 0.0, 0.0]
|
48
43
|
|
49
|
-
|
50
|
-
position: Position = Position.meters(vector, frame)
|
44
|
+
position: Position = Position(vector, unit, frame)
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
assert position is not None
|
47
|
+
assert isinstance(position, Position)
|
48
|
+
assert position.is_defined()
|
55
49
|
|
56
|
-
|
57
|
-
|
50
|
+
# Construction with python tuples
|
51
|
+
vector = (1000.0, 0.0, 0.0)
|
58
52
|
|
59
|
-
|
60
|
-
assert isinstance(position, Position)
|
61
|
-
assert position.is_defined() is False
|
53
|
+
position: Position = Position(vector, unit, frame)
|
62
54
|
|
55
|
+
assert position is not None
|
56
|
+
assert isinstance(position, Position)
|
57
|
+
assert position.is_defined()
|
63
58
|
|
64
|
-
|
65
|
-
|
66
|
-
unit: Unit = Unit.Meter
|
67
|
-
vector_1 = [1000.0, 0.0, 0.0]
|
68
|
-
vector_2 = [-450.3, 234.9, -23.0]
|
59
|
+
# Construction with python numpy arrays
|
60
|
+
vector = np.array((1000.0, 0.0, 0.0))
|
69
61
|
|
70
|
-
|
71
|
-
position_2: Position = Position(vector_2, unit, frame)
|
62
|
+
position: Position = Position(vector, unit, frame)
|
72
63
|
|
73
|
-
|
74
|
-
|
75
|
-
|
64
|
+
assert position is not None
|
65
|
+
assert isinstance(position, Position)
|
66
|
+
assert position.is_defined()
|
76
67
|
|
68
|
+
# Construction with meters static constructor
|
69
|
+
position: Position = Position.meters(vector, frame)
|
77
70
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
vector = [1000.0, 0.0, 0.0]
|
82
|
-
position: Position = Position(vector, unit, frame)
|
71
|
+
assert position is not None
|
72
|
+
assert isinstance(position, Position)
|
73
|
+
assert position.is_defined()
|
83
74
|
|
84
|
-
|
85
|
-
|
75
|
+
# Construction with undefined static constructor
|
76
|
+
position: Position = Position.undefined()
|
86
77
|
|
78
|
+
assert position is not None
|
79
|
+
assert isinstance(position, Position)
|
80
|
+
assert position.is_defined() is False
|
87
81
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
unit: Unit = Unit.Meter
|
82
|
+
def test_comparators(self, unit: Length.Unit, frame: Frame):
|
83
|
+
vector_1 = [1000.0, 0.0, 0.0]
|
84
|
+
vector_2 = [-450.3, 234.9, -23.0]
|
92
85
|
|
93
|
-
|
94
|
-
|
86
|
+
position_1: Position = Position(vector_1, unit, frame)
|
87
|
+
position_2: Position = Position(vector_2, unit, frame)
|
95
88
|
|
96
|
-
|
97
|
-
|
89
|
+
assert position_1 == position_1
|
90
|
+
assert position_2 == position_2
|
91
|
+
assert position_1 != position_2
|
98
92
|
|
99
|
-
|
100
|
-
|
93
|
+
def test_is_defined(self, unit: Length.Unit, frame: Frame):
|
94
|
+
vector = [1000.0, 0.0, 0.0]
|
95
|
+
position: Position = Position(vector, unit, frame)
|
101
96
|
|
97
|
+
assert position.is_defined()
|
98
|
+
assert Position.undefined().is_defined() is False
|
102
99
|
|
103
|
-
|
104
|
-
|
105
|
-
unit: Unit = Unit.Meter
|
106
|
-
vector = [1000.0, 0.0, 0.0]
|
100
|
+
@pytest.mark.skip
|
101
|
+
def test_is_near(self, unit: Length.Unit, frame: Frame):
|
107
102
|
|
108
|
-
|
103
|
+
vector_1 = [1000.0, 0.0, 0.0]
|
104
|
+
vector_2 = [1000.00001, 0.0001, 0.0]
|
109
105
|
|
110
|
-
|
106
|
+
position_1: Position = Position(vector_1, unit, frame)
|
107
|
+
position_2: Position = Position(vector_2, unit, frame)
|
111
108
|
|
112
|
-
|
113
|
-
|
114
|
-
assert ans_frame == frame
|
109
|
+
assert position_1.is_near(position_2, Length.Unit.Meter)
|
110
|
+
assert position_2.is_near(position_1, Length.Unit.Meter)
|
115
111
|
|
112
|
+
def test_access_frame(self, unit: Length.Unit, frame: Frame):
|
113
|
+
vector = [1000.0, 0.0, 0.0]
|
116
114
|
|
117
|
-
|
118
|
-
frame: Frame = Frame.GCRF()
|
119
|
-
unit: Unit = Unit.Meter
|
120
|
-
vector = [1000.0, 0.0, 0.0]
|
115
|
+
position: Position = Position(vector, unit, frame)
|
121
116
|
|
122
|
-
|
117
|
+
ans_frame = position.access_frame()
|
123
118
|
|
124
|
-
|
119
|
+
assert ans_frame is not None
|
120
|
+
assert isinstance(ans_frame, Frame)
|
121
|
+
assert ans_frame == frame
|
125
122
|
|
126
|
-
|
127
|
-
|
128
|
-
assert np.array_equal(coordinates, vector)
|
123
|
+
def test_get_coordinates(self, unit: Length.Unit, frame: Frame):
|
124
|
+
vector = [1000.0, 0.0, 0.0]
|
129
125
|
|
126
|
+
position: Position = Position(vector, unit, frame)
|
130
127
|
|
131
|
-
|
132
|
-
frame: Frame = Frame.GCRF()
|
133
|
-
unit: Unit = Unit.Meter
|
134
|
-
vector = [1000.0, 0.0, 0.0]
|
128
|
+
coordinates = position.get_coordinates()
|
135
129
|
|
136
|
-
|
130
|
+
assert coordinates is not None
|
131
|
+
assert isinstance(coordinates, np.ndarray)
|
132
|
+
assert np.array_equal(coordinates, vector)
|
137
133
|
|
138
|
-
|
134
|
+
def test_get_unit(self, unit: Length.Unit, frame: Frame):
|
135
|
+
vector = [1000.0, 0.0, 0.0]
|
139
136
|
|
140
|
-
|
141
|
-
assert isinstance(ans_unit, Unit)
|
142
|
-
assert ans_unit == unit
|
137
|
+
position: Position = Position(vector, unit, frame)
|
143
138
|
|
139
|
+
ans_unit = position.get_unit()
|
144
140
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
vector = [1000.0, 0.0, 0.0]
|
141
|
+
assert ans_unit is not None
|
142
|
+
assert isinstance(ans_unit, Length.Unit)
|
143
|
+
assert ans_unit == unit
|
149
144
|
|
150
|
-
|
145
|
+
def test_in_unit(self, unit: Length.Unit, frame: Frame):
|
146
|
+
vector = [1000.0, 0.0, 0.0]
|
151
147
|
|
152
|
-
|
148
|
+
position: Position = Position(vector, unit, frame)
|
153
149
|
|
154
|
-
|
155
|
-
assert isinstance(new_position, Position)
|
156
|
-
assert new_position == position
|
150
|
+
new_position: Position = position.in_unit(Length.Unit.Meter)
|
157
151
|
|
158
|
-
|
152
|
+
assert new_position is not None
|
153
|
+
assert isinstance(new_position, Position)
|
154
|
+
assert new_position == position
|
159
155
|
|
160
|
-
|
161
|
-
assert isinstance(new_position, Position)
|
162
|
-
# assert new_position == position
|
156
|
+
new_position: Position = position.in_unit(Length.Unit.TerrestrialMile)
|
163
157
|
|
158
|
+
assert new_position is not None
|
159
|
+
assert isinstance(new_position, Position)
|
160
|
+
# assert new_position == position
|
164
161
|
|
165
|
-
def
|
166
|
-
|
167
|
-
unit: Unit = Unit.Meter
|
168
|
-
vector = [1000.0, 0.0, 0.0]
|
162
|
+
def test_in_meters(self, unit: Length.Unit, frame: Frame):
|
163
|
+
vector = [1000.0, 0.0, 0.0]
|
169
164
|
|
170
|
-
|
165
|
+
position: Position = Position(vector, unit, frame)
|
171
166
|
|
172
|
-
|
167
|
+
new_position: Position = position.in_meters()
|
173
168
|
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
assert new_position is not None
|
170
|
+
assert isinstance(new_position, Position)
|
171
|
+
assert new_position == position
|
177
172
|
|
173
|
+
def test_in_frame(self, unit: Length.Unit, frame: Frame):
|
174
|
+
vector = [1000.0, 0.0, 0.0]
|
178
175
|
|
179
|
-
|
180
|
-
frame: Frame = Frame.GCRF()
|
181
|
-
unit: Unit = Unit.Meter
|
182
|
-
vector = [1000.0, 0.0, 0.0]
|
176
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
183
177
|
|
184
|
-
|
178
|
+
position: Position = Position(vector, unit, frame)
|
185
179
|
|
186
|
-
|
180
|
+
new_position: Position = position.in_frame(frame, instant)
|
187
181
|
|
188
|
-
|
182
|
+
assert new_position is not None
|
183
|
+
assert isinstance(new_position, Position)
|
184
|
+
assert new_position == position
|
189
185
|
|
190
|
-
|
191
|
-
|
192
|
-
assert new_position == position
|
186
|
+
def test_to_string(self, unit: Length.Unit, frame: Frame):
|
187
|
+
vector = [1000.0, 0.0, 0.0]
|
193
188
|
|
189
|
+
position: Position = Position(vector, unit, frame)
|
194
190
|
|
195
|
-
|
196
|
-
frame: Frame = Frame.GCRF()
|
197
|
-
unit: Unit = Unit.Meter
|
198
|
-
vector = [1000.0, 0.0, 0.0]
|
191
|
+
string: String = position.to_string()
|
199
192
|
|
200
|
-
|
193
|
+
assert string is not None
|
194
|
+
assert isinstance(string, String)
|
195
|
+
assert string == "[1000.0, 0.0, 0.0] [m] @ GCRF"
|
201
196
|
|
202
|
-
|
197
|
+
def test_from_lla(self, lla: LLA, earth):
|
198
|
+
assert Position.from_lla(lla, earth) is not None
|
203
199
|
|
204
|
-
|
205
|
-
|
206
|
-
assert string == "[1000.0, 0.0, 0.0] [m] @ GCRF"
|
200
|
+
Environment.default(True)
|
201
|
+
assert Position.from_lla(lla) is not None
|