open-space-toolkit-physics 11.3.0__py311-none-manylinux2014_x86_64.whl
Sign up to get free protection for your applications and to get access to all the features.
- open_space_toolkit_physics-11.3.0.dist-info/METADATA +29 -0
- open_space_toolkit_physics-11.3.0.dist-info/RECORD +104 -0
- open_space_toolkit_physics-11.3.0.dist-info/WHEEL +5 -0
- open_space_toolkit_physics-11.3.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_physics-11.3.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/physics/OpenSpaceToolkitPhysicsPy.cpython-311-x86_64-linux-gnu.so +0 -0
- ostk/physics/__init__.py +6 -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.11 +0 -0
- ostk/physics/py.typed +0 -0
- ostk/physics/test/__init__.py +1 -0
- ostk/physics/test/coordinate/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/iers/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/iers/conftest.py +38 -0
- ostk/physics/test/coordinate/frame/provider/iers/data/finals2000A.data +10953 -0
- ostk/physics/test/coordinate/frame/provider/iers/data/ser7.dat +524 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_bulletin_a.py +108 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_finals_2000a.py +93 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_manager.py +205 -0
- ostk/physics/test/coordinate/spherical/__init__.py +1 -0
- ostk/physics/test/coordinate/spherical/test_aer.py +143 -0
- ostk/physics/test/coordinate/spherical/test_lla.py +514 -0
- ostk/physics/test/coordinate/test_axes.py +116 -0
- ostk/physics/test/coordinate/test_frame.py +107 -0
- ostk/physics/test/coordinate/test_position.py +201 -0
- ostk/physics/test/coordinate/test_transform.py +294 -0
- ostk/physics/test/coordinate/test_velocity.py +180 -0
- ostk/physics/test/data/conftest.py +34 -0
- ostk/physics/test/data/data/manifest.json +22 -0
- ostk/physics/test/data/provider/test_provider.py +34 -0
- ostk/physics/test/data/test_direction.py +40 -0
- ostk/physics/test/data/test_manifest.py +43 -0
- ostk/physics/test/data/test_manifest_manager.py +62 -0
- ostk/physics/test/data/test_scalar.py +54 -0
- ostk/physics/test/data/test_vector.py +70 -0
- ostk/physics/test/environment/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/earth/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/earth/conftest.py +67 -0
- ostk/physics/test/environment/atmospheric/earth/data/SW-Last5Years.test.csv +22 -0
- ostk/physics/test/environment/atmospheric/earth/data/SpaceWeather-All-v1.2.test.txt +811 -0
- ostk/physics/test/environment/atmospheric/earth/test_cssi_space_weather.py +126 -0
- ostk/physics/test/environment/atmospheric/earth/test_exponential.py +34 -0
- ostk/physics/test/environment/atmospheric/earth/test_manager.py +173 -0
- ostk/physics/test/environment/atmospheric/earth/test_nrlmsise00.py +34 -0
- ostk/physics/test/environment/atmospheric/test_earth.py +141 -0
- ostk/physics/test/environment/gravitational/__init__.py +1 -0
- ostk/physics/test/environment/gravitational/earth/__init__.py +1 -0
- ostk/physics/test/environment/gravitational/earth/test_manager.py +76 -0
- ostk/physics/test/environment/gravitational/test_earth.py +103 -0
- ostk/physics/test/environment/gravitational/test_moon.py +55 -0
- ostk/physics/test/environment/gravitational/test_spherical.py +36 -0
- ostk/physics/test/environment/gravitational/test_sun.py +53 -0
- ostk/physics/test/environment/magnetic/__init__.py +1 -0
- ostk/physics/test/environment/magnetic/earth/test_manager.py +64 -0
- ostk/physics/test/environment/magnetic/test_earth.py +38 -0
- ostk/physics/test/environment/object/__init__.py +1 -0
- ostk/physics/test/environment/object/celestial/__init__ .py +1 -0
- ostk/physics/test/environment/object/celestial/test_earth.py +174 -0
- ostk/physics/test/environment/object/celestial/test_moon.py +17 -0
- ostk/physics/test/environment/object/celestial/test_sun.py +17 -0
- ostk/physics/test/environment/object/test_celestial.py +12 -0
- ostk/physics/test/test_environment.py +97 -0
- ostk/physics/test/test_import.py +25 -0
- ostk/physics/test/time/__init__.py +1 -0
- ostk/physics/test/time/test_date.py +136 -0
- ostk/physics/test/time/test_date_time.py +230 -0
- ostk/physics/test/time/test_duration.py +215 -0
- ostk/physics/test/time/test_instant.py +103 -0
- ostk/physics/test/time/test_interval.py +432 -0
- ostk/physics/test/time/test_scale.py +11 -0
- ostk/physics/test/time/test_time.py +114 -0
- ostk/physics/test/unit/__init__.py +1 -0
- ostk/physics/test/unit/derived/__init__.py +1 -0
- ostk/physics/test/unit/derived/test_angle.py +368 -0
- ostk/physics/test/unit/test_derived.py +152 -0
- ostk/physics/test/unit/test_electric_current.py +5 -0
- ostk/physics/test/unit/test_length.py +297 -0
- ostk/physics/test/unit/test_mass.py +141 -0
- ostk/physics/test/unit/test_time.py +101 -0
- ostk/physics/time.pyi +1744 -0
- ostk/physics/unit.pyi +1590 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
from datetime import datetime
|
4
|
+
|
5
|
+
from ostk.core.filesystem import File
|
6
|
+
|
7
|
+
from ostk.physics.time import Scale
|
8
|
+
from ostk.physics.time import Instant
|
9
|
+
|
10
|
+
import ostk.physics as physics
|
11
|
+
|
12
|
+
Finals2000A = physics.coordinate.frame.provider.iers.Finals2000A
|
13
|
+
|
14
|
+
|
15
|
+
class TestFinals2000A:
|
16
|
+
def test_str_success(self, finals_2000a: Finals2000A):
|
17
|
+
assert str(finals_2000a).startswith("-- Finals 2000A --")
|
18
|
+
|
19
|
+
def test_repr_success(self, finals_2000a: Finals2000A):
|
20
|
+
assert repr(finals_2000a).startswith("-- Finals 2000A --")
|
21
|
+
|
22
|
+
def test_is_defined_success(self, finals_2000a: Finals2000A):
|
23
|
+
assert finals_2000a.is_defined() is True
|
24
|
+
|
25
|
+
def test_get_interval_success(self, finals_2000a: Finals2000A):
|
26
|
+
assert (
|
27
|
+
finals_2000a.get_interval().to_string()
|
28
|
+
== "[1992-01-01 00:00:00 - 2021-12-26 00:00:00] [UTC]"
|
29
|
+
)
|
30
|
+
|
31
|
+
def test_get_polar_motion_at_success(self, finals_2000a: Finals2000A):
|
32
|
+
assert list(
|
33
|
+
finals_2000a.get_polar_motion_at(
|
34
|
+
Instant.date_time(datetime(2020, 10, 31, 0, 0, 0), Scale.UTC)
|
35
|
+
)
|
36
|
+
) == [0.160621, 0.297128]
|
37
|
+
|
38
|
+
def test_get_ut1_minus_utc_at_success(self, finals_2000a: Finals2000A):
|
39
|
+
assert (
|
40
|
+
finals_2000a.get_ut1_minus_utc_at(
|
41
|
+
Instant.date_time(datetime(2020, 10, 31, 0, 0, 0), Scale.UTC)
|
42
|
+
)
|
43
|
+
== -0.17524010000000001
|
44
|
+
)
|
45
|
+
|
46
|
+
def test_get_lod_at_success(self, finals_2000a: Finals2000A):
|
47
|
+
assert (
|
48
|
+
finals_2000a.get_lod_at(
|
49
|
+
Instant.date_time(datetime(2015, 10, 31, 0, 0, 0), Scale.UTC)
|
50
|
+
)
|
51
|
+
== 1.5646
|
52
|
+
)
|
53
|
+
assert not finals_2000a.get_lod_at(
|
54
|
+
Instant.date_time(datetime(2020, 10, 31, 0, 0, 0), Scale.UTC)
|
55
|
+
).is_defined()
|
56
|
+
|
57
|
+
def test_get_data_at_success(self, finals_2000a: Finals2000A):
|
58
|
+
data: Finals2000A.Data = finals_2000a.get_data_at(
|
59
|
+
Instant.date_time(datetime(2020, 10, 31, 0, 0, 0), Scale.UTC)
|
60
|
+
)
|
61
|
+
|
62
|
+
assert isinstance(data, Finals2000A.Data)
|
63
|
+
|
64
|
+
assert data.year == 20
|
65
|
+
assert data.month == 10
|
66
|
+
assert data.day == 30
|
67
|
+
assert data.mjd == 59153.0
|
68
|
+
assert data.polar_motionflag == "P"
|
69
|
+
assert data.x_a == 0.16062100000000001
|
70
|
+
assert data.x_error_a == 0.000892
|
71
|
+
assert data.y_a == 0.297128
|
72
|
+
assert data.y_error_a == 0.00066399999999999999
|
73
|
+
assert data.ut1_minus_utc_flag == "P"
|
74
|
+
assert data.ut1_minus_utc_a == -0.17524010000000001
|
75
|
+
assert data.ut1_minus_utc_error_a == 0.0002041
|
76
|
+
assert not data.lod_a.is_defined()
|
77
|
+
assert not data.lod_error_a.is_defined()
|
78
|
+
assert data.nutation_flag == "P"
|
79
|
+
assert data.dx_a == 0.021999999999999999
|
80
|
+
assert data.dx_error_a == 0.128
|
81
|
+
assert data.dy_a == 0.17899999999999999
|
82
|
+
assert data.dy_error_a == 0.16
|
83
|
+
assert not data.x_b.is_defined()
|
84
|
+
assert not data.y_b.is_defined()
|
85
|
+
assert not data.ut1_minus_utc_b.is_defined()
|
86
|
+
assert not data.dx_b.is_defined()
|
87
|
+
assert not data.dy_b.is_defined()
|
88
|
+
|
89
|
+
def test_undefined_success(self):
|
90
|
+
assert Finals2000A.undefined() is not None
|
91
|
+
|
92
|
+
def test_load_success(self, finals_2000a_file: File):
|
93
|
+
assert Finals2000A.load(finals_2000a_file) is not None
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from datetime import datetime
|
6
|
+
import pathlib
|
7
|
+
|
8
|
+
from ostk.core.filesystem import Path
|
9
|
+
from ostk.core.filesystem import File
|
10
|
+
from ostk.core.filesystem import Directory
|
11
|
+
|
12
|
+
from ostk.physics.time import Scale
|
13
|
+
from ostk.physics.time import Instant
|
14
|
+
from ostk.physics.time import Duration
|
15
|
+
|
16
|
+
from ostk.physics.coordinate.frame.provider.iers import Manager
|
17
|
+
from ostk.physics.coordinate.frame.provider.iers import BulletinA
|
18
|
+
from ostk.physics.coordinate.frame.provider.iers import Finals2000A
|
19
|
+
|
20
|
+
|
21
|
+
@pytest.fixture
|
22
|
+
def manager(bulletin_a) -> Manager:
|
23
|
+
manager = Manager.get()
|
24
|
+
|
25
|
+
manager.set_mode(Manager.Mode.Automatic)
|
26
|
+
|
27
|
+
manager.load_bulletin_a(bulletin_a)
|
28
|
+
|
29
|
+
yield manager
|
30
|
+
|
31
|
+
manager.reset()
|
32
|
+
manager.clear_local_repository()
|
33
|
+
|
34
|
+
|
35
|
+
class TestManager:
|
36
|
+
def test_get_mode_success(self, manager: Manager):
|
37
|
+
assert manager.get_mode() == Manager.Mode.Automatic
|
38
|
+
|
39
|
+
def test_get_local_repository_success(self, manager: Manager):
|
40
|
+
assert isinstance(manager.get_local_repository(), Directory)
|
41
|
+
assert len(str(manager.get_local_repository().to_string())) > 0
|
42
|
+
|
43
|
+
def test_get_bulletin_a_directory_success(self, manager: Manager):
|
44
|
+
assert isinstance(manager.get_bulletin_a_directory(), Directory)
|
45
|
+
assert len(str(manager.get_bulletin_a_directory().to_string())) > 0
|
46
|
+
|
47
|
+
def test_get_finals_2000a_directory_success(self, manager: Manager):
|
48
|
+
assert isinstance(manager.get_finals_2000a_directory(), Directory)
|
49
|
+
assert len(str(manager.get_finals_2000a_directory().to_string())) > 0
|
50
|
+
|
51
|
+
def test_get_bulletin_a_success(self, manager: Manager):
|
52
|
+
bulletin_a: BulletinA = manager.get_bulletin_a()
|
53
|
+
|
54
|
+
assert isinstance(bulletin_a, BulletinA)
|
55
|
+
|
56
|
+
def test_get_finals_2000a_success(self, manager: Manager):
|
57
|
+
finals_2000a: Finals2000A = manager.get_finals_2000a()
|
58
|
+
|
59
|
+
assert isinstance(finals_2000a, Finals2000A)
|
60
|
+
|
61
|
+
def test_get_polar_motion_at_success(self, manager: Manager):
|
62
|
+
assert list(
|
63
|
+
manager.get_polar_motion_at(
|
64
|
+
Instant.date_time(datetime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
65
|
+
)
|
66
|
+
) == [0.076577, 0.282336]
|
67
|
+
|
68
|
+
@pytest.mark.skip(reason="Flaky external dependency.")
|
69
|
+
def test_get_polar_motion_at_success_2(self, manager: Manager):
|
70
|
+
assert len(manager.get_bulletin_a_array()) == 0
|
71
|
+
assert len(manager.get_finals_2000a_array()) == 0
|
72
|
+
|
73
|
+
assert manager.get_polar_motion_at(Instant.now() - Duration.days(7.0)) is not None
|
74
|
+
|
75
|
+
assert len(manager.get_bulletin_a_array()) == 1
|
76
|
+
assert len(manager.get_finals_2000a_array()) == 0
|
77
|
+
|
78
|
+
assert (
|
79
|
+
manager.get_polar_motion_at(
|
80
|
+
Instant.date_time(datetime(2000, 1, 1, 0, 0, 0), Scale.UTC)
|
81
|
+
)
|
82
|
+
is not None
|
83
|
+
)
|
84
|
+
assert (
|
85
|
+
manager.get_polar_motion_at(
|
86
|
+
Instant.date_time(datetime(2010, 1, 1, 0, 0, 0), Scale.UTC)
|
87
|
+
)
|
88
|
+
is not None
|
89
|
+
)
|
90
|
+
assert (
|
91
|
+
manager.get_polar_motion_at(
|
92
|
+
Instant.date_time(datetime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
93
|
+
)
|
94
|
+
is not None
|
95
|
+
)
|
96
|
+
assert (
|
97
|
+
manager.get_polar_motion_at(
|
98
|
+
Instant.date_time(datetime(2023, 7, 16, 0, 0, 0), Scale.UTC)
|
99
|
+
)
|
100
|
+
is not None
|
101
|
+
)
|
102
|
+
|
103
|
+
assert len(manager.get_bulletin_a_array()) == 1
|
104
|
+
assert len(manager.get_finals_2000a_array()) == 1
|
105
|
+
|
106
|
+
def test_get_ut1_minus_utc_at_success(self, manager: Manager):
|
107
|
+
assert (
|
108
|
+
manager.get_ut1_minus_utc_at(
|
109
|
+
Instant.date_time(datetime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
110
|
+
)
|
111
|
+
== -0.17715539999999999
|
112
|
+
)
|
113
|
+
|
114
|
+
def test_get_lod_at_success(self, manager: Manager):
|
115
|
+
assert (
|
116
|
+
manager.get_lod_at(
|
117
|
+
Instant.date_time(datetime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
118
|
+
)
|
119
|
+
== 0.43790000000000001
|
120
|
+
)
|
121
|
+
|
122
|
+
def test_set_mode_success(self, manager: Manager):
|
123
|
+
assert manager.get_mode() == Manager.Mode.Automatic
|
124
|
+
|
125
|
+
manager.set_mode(Manager.Mode.Manual)
|
126
|
+
|
127
|
+
assert manager.get_mode() == Manager.Mode.Manual
|
128
|
+
|
129
|
+
def test_set_local_repository_success(self, manager: Manager):
|
130
|
+
assert isinstance(manager.get_local_repository(), Directory)
|
131
|
+
assert len(str(manager.get_local_repository().to_string())) > 0
|
132
|
+
|
133
|
+
manager.set_local_repository(
|
134
|
+
Directory.path(
|
135
|
+
Path.parse(
|
136
|
+
"./.open-space-toolkit/physics/coordinate/frame/provider/iers2"
|
137
|
+
)
|
138
|
+
)
|
139
|
+
)
|
140
|
+
|
141
|
+
assert isinstance(manager.get_local_repository(), Directory)
|
142
|
+
assert (
|
143
|
+
manager.get_local_repository().to_string()
|
144
|
+
== "./.open-space-toolkit/physics/coordinate/frame/provider/iers2"
|
145
|
+
)
|
146
|
+
|
147
|
+
def test_load_bulletin_a_success(self, manager: Manager, bulletin_a: BulletinA):
|
148
|
+
manager.load_bulletin_a(bulletin_a)
|
149
|
+
|
150
|
+
assert manager.get_bulletin_a().is_defined()
|
151
|
+
|
152
|
+
def test_load_finals_2000a_success(self, manager: Manager, finals_2000a: Finals2000A):
|
153
|
+
manager.load_finals_2000a(finals_2000a)
|
154
|
+
|
155
|
+
assert manager.get_finals_2000a().is_defined()
|
156
|
+
|
157
|
+
def test_fetch_latest_bulletin_a_success(self, manager: Manager):
|
158
|
+
file: File = manager.fetch_latest_bulletin_a()
|
159
|
+
|
160
|
+
assert isinstance(file, File)
|
161
|
+
assert file.exists()
|
162
|
+
|
163
|
+
file.remove()
|
164
|
+
|
165
|
+
def test_fetch_latest_finals_2000a_success(self, manager: Manager):
|
166
|
+
file: File = manager.fetch_latest_finals_2000a()
|
167
|
+
|
168
|
+
assert isinstance(file, File)
|
169
|
+
assert file.exists()
|
170
|
+
|
171
|
+
file.remove()
|
172
|
+
|
173
|
+
def test_reset_success(self, manager: Manager, bulletin_a: BulletinA):
|
174
|
+
assert manager.get_bulletin_a().is_defined()
|
175
|
+
|
176
|
+
manager.reset()
|
177
|
+
|
178
|
+
# The get methods automatically load things if they are not loaded, so we set to manual
|
179
|
+
manager.set_mode(manager.Mode.Manual)
|
180
|
+
|
181
|
+
with pytest.raises(Exception):
|
182
|
+
manager.get_bulletin_a()
|
183
|
+
|
184
|
+
manager.set_mode(manager.Mode.Automatic)
|
185
|
+
|
186
|
+
def test_clear_local_repository_success(self, manager: Manager):
|
187
|
+
assert manager.get_local_repository().exists()
|
188
|
+
assert manager.get_bulletin_a_directory().exists()
|
189
|
+
assert manager.get_finals_2000a_directory().exists()
|
190
|
+
pathlib.Path(
|
191
|
+
str(manager.get_bulletin_a_directory().get_path().to_string()) + "/toto"
|
192
|
+
).touch()
|
193
|
+
pathlib.Path(
|
194
|
+
str(manager.get_finals_2000a_directory().get_path().to_string()) + "/toto"
|
195
|
+
).touch()
|
196
|
+
assert not manager.get_local_repository().is_empty()
|
197
|
+
|
198
|
+
manager.clear_local_repository()
|
199
|
+
|
200
|
+
assert manager.get_local_repository().exists()
|
201
|
+
assert manager.get_bulletin_a_directory().is_empty()
|
202
|
+
assert manager.get_finals_2000a_directory().is_empty()
|
203
|
+
|
204
|
+
def test_get_success(self):
|
205
|
+
assert isinstance(Manager.get(), Manager)
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from ostk.core.type import String
|
7
|
+
|
8
|
+
import ostk.physics as physics
|
9
|
+
|
10
|
+
Angle = physics.unit.Angle
|
11
|
+
Length = physics.unit.Length
|
12
|
+
AER = physics.coordinate.spherical.AER
|
13
|
+
|
14
|
+
|
15
|
+
def test_coordinate_spherical_aer_constructors():
|
16
|
+
# Main Constructor
|
17
|
+
azimuth: Angle = Angle(30.0, Angle.Unit.Degree)
|
18
|
+
elevation: Angle = Angle(30.0, Angle.Unit.Degree)
|
19
|
+
aer_range: Length = Length(1000.0, Length.Unit.Meter)
|
20
|
+
|
21
|
+
# Construction with undefined static method
|
22
|
+
|
23
|
+
aer: AER = AER(azimuth, elevation, aer_range)
|
24
|
+
|
25
|
+
assert aer is not None
|
26
|
+
assert isinstance(aer, AER)
|
27
|
+
|
28
|
+
# Construction with vector static method
|
29
|
+
|
30
|
+
# ... with python list
|
31
|
+
aer: AER = AER.vector([1.0, 1.0, 1.0])
|
32
|
+
|
33
|
+
assert aer is not None
|
34
|
+
assert isinstance(aer, AER)
|
35
|
+
|
36
|
+
# ... with python tuple
|
37
|
+
aer: AER = AER.vector((1.0, 1.0, 1.0))
|
38
|
+
|
39
|
+
assert aer is not None
|
40
|
+
assert isinstance(aer, AER)
|
41
|
+
|
42
|
+
# ... with python numpy array
|
43
|
+
aer: AER = AER.vector(np.array((1.0, 1.0, 1.0)))
|
44
|
+
|
45
|
+
assert aer is not None
|
46
|
+
assert isinstance(aer, AER)
|
47
|
+
|
48
|
+
# Invalid azimuth
|
49
|
+
|
50
|
+
with pytest.raises(RuntimeError):
|
51
|
+
aer: AER = AER.vector((400.0, 1.0, 1.0))
|
52
|
+
|
53
|
+
# Invalid elevation
|
54
|
+
|
55
|
+
with pytest.raises(RuntimeError):
|
56
|
+
aer: AER = AER.vector((1.0, 181.0, 1.0))
|
57
|
+
|
58
|
+
# Negative Range
|
59
|
+
|
60
|
+
with pytest.raises(RuntimeError):
|
61
|
+
aer: AER = AER.vector((1.0, 2.0, -1.0))
|
62
|
+
|
63
|
+
|
64
|
+
def test_coordinate_spherical_aer_comparators():
|
65
|
+
# Main Constructor
|
66
|
+
azimuth: Angle = Angle(30.0, Angle.Unit.Degree)
|
67
|
+
elevation: Angle = Angle(30.0, Angle.Unit.Degree)
|
68
|
+
aer_range: Length = Length(1000.0, Length.Unit.Meter)
|
69
|
+
|
70
|
+
# Construction
|
71
|
+
aer_1: AER = AER(azimuth, elevation, aer_range)
|
72
|
+
aer_2: AER = AER(azimuth, elevation, Length(10.0, Length.Unit.Meter))
|
73
|
+
|
74
|
+
assert aer_1 == aer_1
|
75
|
+
assert aer_2 == aer_2
|
76
|
+
assert aer_1 != aer_2
|
77
|
+
|
78
|
+
|
79
|
+
def test_coordinate_spherical_aer_is_defined():
|
80
|
+
# Main Constructor
|
81
|
+
azimuth: Angle = Angle(30.0, Angle.Unit.Degree)
|
82
|
+
elevation: Angle = Angle(30.0, Angle.Unit.Degree)
|
83
|
+
aer_range: Length = Length(1000.0, Length.Unit.Meter)
|
84
|
+
|
85
|
+
# Construction
|
86
|
+
aer: AER = AER(azimuth, elevation, aer_range)
|
87
|
+
|
88
|
+
assert aer.is_defined()
|
89
|
+
assert AER.undefined().is_defined() is False
|
90
|
+
|
91
|
+
|
92
|
+
def test_coordinate_spherical_aer_getters():
|
93
|
+
# Main Constructor
|
94
|
+
azimuth: Angle = Angle(30.0, Angle.Unit.Degree)
|
95
|
+
elevation: Angle = Angle(30.0, Angle.Unit.Degree)
|
96
|
+
aer_range: Length = Length(1000.0, Length.Unit.Meter)
|
97
|
+
|
98
|
+
# Construction
|
99
|
+
aer: AER = AER(azimuth, elevation, aer_range)
|
100
|
+
|
101
|
+
# get_azimuth
|
102
|
+
lat = aer.get_azimuth()
|
103
|
+
|
104
|
+
assert lat is not None
|
105
|
+
assert isinstance(lat, Angle)
|
106
|
+
|
107
|
+
# get_elevation
|
108
|
+
lon = aer.get_elevation()
|
109
|
+
|
110
|
+
assert lon is not None
|
111
|
+
assert isinstance(lon, Angle)
|
112
|
+
|
113
|
+
# get_range
|
114
|
+
alt = aer.get_range()
|
115
|
+
|
116
|
+
assert alt is not None
|
117
|
+
assert isinstance(alt, Length)
|
118
|
+
|
119
|
+
|
120
|
+
def test_coordinate_spherical_aer_conversions():
|
121
|
+
# Main Constructor
|
122
|
+
azimuth: Angle = Angle(30.0, Angle.Unit.Degree)
|
123
|
+
elevation: Angle = Angle(30.0, Angle.Unit.Degree)
|
124
|
+
aer_range: Length = Length(1000.0, Length.Unit.Meter)
|
125
|
+
|
126
|
+
# Construction
|
127
|
+
aer: AER = AER(azimuth, elevation, aer_range)
|
128
|
+
|
129
|
+
# to_vector
|
130
|
+
vector = AER.to_vector(aer)
|
131
|
+
|
132
|
+
assert vector is not None
|
133
|
+
assert isinstance(vector, np.ndarray)
|
134
|
+
|
135
|
+
# to_string
|
136
|
+
string = aer.to_string()
|
137
|
+
|
138
|
+
assert string is not None
|
139
|
+
assert isinstance(string, String)
|
140
|
+
assert string == "[30.0 [deg], 30.0 [deg], 1000.0 [m]]"
|
141
|
+
|
142
|
+
|
143
|
+
# def test_coordinate_spherical_aer_from_position_to_position ():
|