open-space-toolkit-physics 11.3.0__py313-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-313-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,180 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from ostk.core.type import String
|
7
|
+
import ostk.physics as physics
|
8
|
+
|
9
|
+
Scale = physics.time.Scale
|
10
|
+
DateTime = physics.time.DateTime
|
11
|
+
Instant = physics.time.Instant
|
12
|
+
Frame = physics.coordinate.Frame
|
13
|
+
Velocity = physics.coordinate.Velocity
|
14
|
+
Unit = Velocity.Unit
|
15
|
+
|
16
|
+
|
17
|
+
def test_coordinate_position_constructors():
|
18
|
+
# Construct arbitrary frame
|
19
|
+
frame: Frame = Frame.GCRF()
|
20
|
+
unit: Unit = Unit.MeterPerSecond
|
21
|
+
|
22
|
+
# Construction with python lists
|
23
|
+
vector = [1000.0, 0.0, 0.0]
|
24
|
+
|
25
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
26
|
+
|
27
|
+
assert velocity is not None
|
28
|
+
assert isinstance(velocity, Velocity)
|
29
|
+
assert velocity.is_defined()
|
30
|
+
|
31
|
+
# Construction with python tuples
|
32
|
+
vector = (1000.0, 0.0, 0.0)
|
33
|
+
|
34
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
35
|
+
|
36
|
+
assert velocity is not None
|
37
|
+
assert isinstance(velocity, Velocity)
|
38
|
+
assert velocity.is_defined()
|
39
|
+
|
40
|
+
# Construction with python numpy arrays
|
41
|
+
vector = np.array((1000.0, 0.0, 0.0))
|
42
|
+
|
43
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
44
|
+
|
45
|
+
assert velocity is not None
|
46
|
+
assert isinstance(velocity, Velocity)
|
47
|
+
assert velocity.is_defined()
|
48
|
+
|
49
|
+
# Construction with meters static constructor
|
50
|
+
velocity: Velocity = Velocity.meters_per_second(vector, frame)
|
51
|
+
|
52
|
+
assert velocity is not None
|
53
|
+
assert isinstance(velocity, Velocity)
|
54
|
+
assert velocity.is_defined()
|
55
|
+
|
56
|
+
# Construction with undefined static constructor
|
57
|
+
velocity: Velocity = Velocity.undefined()
|
58
|
+
|
59
|
+
assert velocity is not None
|
60
|
+
assert isinstance(velocity, Velocity)
|
61
|
+
assert velocity.is_defined() is False
|
62
|
+
|
63
|
+
|
64
|
+
def test_coordinate_velocity_comparators():
|
65
|
+
frame: Frame = Frame.GCRF()
|
66
|
+
unit: Unit = Unit.MeterPerSecond
|
67
|
+
vector_1 = [1000.0, 0.0, 0.0]
|
68
|
+
vector_2 = [-450.3, 234.9, -23.0]
|
69
|
+
|
70
|
+
velocity_1: Velocity = Velocity(vector_1, unit, frame)
|
71
|
+
velocity_2: Velocity = Velocity(vector_2, unit, frame)
|
72
|
+
|
73
|
+
assert velocity_1 == velocity_1
|
74
|
+
assert velocity_2 == velocity_2
|
75
|
+
assert velocity_1 != velocity_2
|
76
|
+
|
77
|
+
|
78
|
+
def test_coordinate_velocity_is_defined():
|
79
|
+
frame: Frame = Frame.GCRF()
|
80
|
+
unit: Unit = Unit.MeterPerSecond
|
81
|
+
vector = [1000.0, 0.0, 0.0]
|
82
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
83
|
+
|
84
|
+
assert velocity.is_defined()
|
85
|
+
assert Velocity.undefined().is_defined() is False
|
86
|
+
|
87
|
+
|
88
|
+
def test_coordinate_velocity_access_frame():
|
89
|
+
frame: Frame = Frame.GCRF()
|
90
|
+
unit: Unit = Unit.MeterPerSecond
|
91
|
+
vector = [1000.0, 0.0, 0.0]
|
92
|
+
|
93
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
94
|
+
|
95
|
+
ans_frame = velocity.access_frame()
|
96
|
+
|
97
|
+
assert ans_frame is not None
|
98
|
+
assert isinstance(ans_frame, Frame)
|
99
|
+
assert ans_frame == frame
|
100
|
+
|
101
|
+
|
102
|
+
def test_coordinate_velocity_get_coordinates():
|
103
|
+
frame: Frame = Frame.GCRF()
|
104
|
+
unit: Unit = Unit.MeterPerSecond
|
105
|
+
vector = [1000.0, 0.0, 0.0]
|
106
|
+
|
107
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
108
|
+
|
109
|
+
coordinates = velocity.get_coordinates()
|
110
|
+
|
111
|
+
assert coordinates is not None
|
112
|
+
assert isinstance(coordinates, np.ndarray)
|
113
|
+
assert np.array_equal(coordinates, vector)
|
114
|
+
|
115
|
+
|
116
|
+
def test_coordinate_velocity_get_unit():
|
117
|
+
frame: Frame = Frame.GCRF()
|
118
|
+
unit: Unit = Unit.MeterPerSecond
|
119
|
+
vector = [1000.0, 0.0, 0.0]
|
120
|
+
|
121
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
122
|
+
|
123
|
+
ans_unit = velocity.get_unit()
|
124
|
+
|
125
|
+
assert ans_unit is not None
|
126
|
+
assert isinstance(ans_unit, Unit)
|
127
|
+
assert ans_unit == unit
|
128
|
+
|
129
|
+
|
130
|
+
def test_coordinate_velocity_in_unit():
|
131
|
+
frame: Frame = Frame.GCRF()
|
132
|
+
unit: Unit = Unit.MeterPerSecond
|
133
|
+
vector = [1000.0, 0.0, 0.0]
|
134
|
+
|
135
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
136
|
+
|
137
|
+
new_velocity: Velocity = velocity.in_unit(Unit.MeterPerSecond)
|
138
|
+
|
139
|
+
assert new_velocity is not None
|
140
|
+
assert isinstance(new_velocity, Velocity)
|
141
|
+
assert new_velocity == velocity
|
142
|
+
|
143
|
+
|
144
|
+
@pytest.mark.skip
|
145
|
+
def test_coordinate_velocity_in_frame():
|
146
|
+
frame: Frame = Frame.GCRF()
|
147
|
+
unit: Unit = Unit.MeterPerSecond
|
148
|
+
vector = [1000.0, 0.0, 0.0]
|
149
|
+
|
150
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
151
|
+
|
152
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
153
|
+
|
154
|
+
new_velocity: Velocity = velocity.in_frame(frame, instant)
|
155
|
+
|
156
|
+
assert new_velocity is not None
|
157
|
+
assert isinstance(new_velocity, Velocity)
|
158
|
+
assert new_velocity == velocity
|
159
|
+
|
160
|
+
|
161
|
+
def test_coordinate_velocity_to_string():
|
162
|
+
frame: Frame = Frame.GCRF()
|
163
|
+
unit: Unit = Unit.MeterPerSecond
|
164
|
+
vector = [1000.0, 0.0, 0.0]
|
165
|
+
|
166
|
+
velocity: Velocity = Velocity(vector, unit, frame)
|
167
|
+
|
168
|
+
string: String = velocity.to_string()
|
169
|
+
|
170
|
+
assert string is not None
|
171
|
+
assert isinstance(string, String)
|
172
|
+
assert string == "[1000.0, 0.0, 0.0] [m/s] @ GCRF"
|
173
|
+
|
174
|
+
|
175
|
+
def test_coordinate_velocity_string_from_unit():
|
176
|
+
string: String = Velocity.string_from_unit(Unit.MeterPerSecond)
|
177
|
+
|
178
|
+
assert string is not None
|
179
|
+
assert isinstance(string, String)
|
180
|
+
assert string == "m/s"
|
@@ -0,0 +1,34 @@
|
|
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
|
+
from ostk.physics.data import Manager, Manifest
|
11
|
+
|
12
|
+
|
13
|
+
@pytest.fixture
|
14
|
+
def data_directory_path() -> str:
|
15
|
+
return f"{pathlib.Path(__file__).parent.absolute()}/data"
|
16
|
+
|
17
|
+
|
18
|
+
@pytest.fixture
|
19
|
+
def manifest_file(data_directory_path: str) -> File:
|
20
|
+
return File.path(Path.parse(f"{data_directory_path}/manifest.json"))
|
21
|
+
|
22
|
+
|
23
|
+
@pytest.fixture
|
24
|
+
def manifest(manifest_file: File) -> Manifest:
|
25
|
+
return Manifest.load(manifest_file)
|
26
|
+
|
27
|
+
|
28
|
+
@pytest.fixture
|
29
|
+
def manager() -> Manager:
|
30
|
+
manager = Manager.get()
|
31
|
+
|
32
|
+
yield manager
|
33
|
+
|
34
|
+
manager.reset()
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"manifest": {
|
3
|
+
"path": "",
|
4
|
+
"filenames": "manifest.json",
|
5
|
+
"file_meta": "This file. Entry tracks the expected manifest update time on the github so that local OSTk can make smarter pulling decisions.",
|
6
|
+
"last_update": "2023-11-01T22:05:43.789048",
|
7
|
+
"next_update_check": "2023-11-02T04:05:43.789093",
|
8
|
+
"check_frequency": "6 hours"
|
9
|
+
},
|
10
|
+
"bulletin-A": {
|
11
|
+
"path": "coordinate/frame/providers/iers/bulletin-A",
|
12
|
+
"filenames": "ser7.dat",
|
13
|
+
"remote_sources": [
|
14
|
+
{
|
15
|
+
"url": "https://maia.usno.navy.mil/ser7/ser7.dat"
|
16
|
+
}
|
17
|
+
],
|
18
|
+
"last_update": "2023-08-04T12:02:17.028701",
|
19
|
+
"next_update_check": "2023-08-05T12:02:17.029315",
|
20
|
+
"check_frequency": "1 day"
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics import Environment
|
6
|
+
from ostk.physics.environment.object import Celestial
|
7
|
+
from ostk.physics.coordinate import Position
|
8
|
+
from ostk.physics.coordinate import Frame
|
9
|
+
from ostk.physics.data import provider
|
10
|
+
|
11
|
+
|
12
|
+
@pytest.fixture
|
13
|
+
def environment() -> Environment:
|
14
|
+
return Environment.default()
|
15
|
+
|
16
|
+
|
17
|
+
@pytest.fixture
|
18
|
+
def celestial(environment: Environment) -> Celestial:
|
19
|
+
return environment.access_celestial_object_with_name("Earth")
|
20
|
+
|
21
|
+
|
22
|
+
@pytest.fixture
|
23
|
+
def position():
|
24
|
+
return Position.meters([6671000.0, 0.0, 0.0], Frame.ITRF())
|
25
|
+
|
26
|
+
|
27
|
+
class TestProvider:
|
28
|
+
def test_nadir(
|
29
|
+
self,
|
30
|
+
celestial: Celestial,
|
31
|
+
position: Position,
|
32
|
+
environment: Environment,
|
33
|
+
):
|
34
|
+
assert provider.nadir(position, celestial, environment) is not None
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
from ostk.physics.data import Direction
|
8
|
+
from ostk.physics.coordinate import Frame
|
9
|
+
|
10
|
+
|
11
|
+
@pytest.fixture
|
12
|
+
def value() -> np.ndarray:
|
13
|
+
return np.array([1.0, 0.0, 0.0])
|
14
|
+
|
15
|
+
|
16
|
+
@pytest.fixture
|
17
|
+
def frame() -> Frame:
|
18
|
+
return Frame.GCRF()
|
19
|
+
|
20
|
+
|
21
|
+
@pytest.fixture
|
22
|
+
def direction(value: float, frame: Frame) -> Direction:
|
23
|
+
return Direction(
|
24
|
+
value=value,
|
25
|
+
frame=frame,
|
26
|
+
)
|
27
|
+
|
28
|
+
|
29
|
+
class TestDirection:
|
30
|
+
def test_constructor(self, direction: Direction):
|
31
|
+
assert direction is not None
|
32
|
+
|
33
|
+
def test_equals(self, direction: Direction):
|
34
|
+
assert direction == direction
|
35
|
+
|
36
|
+
def test_not_equals(self, direction: Direction):
|
37
|
+
assert (direction != direction) is False
|
38
|
+
|
39
|
+
def test_undefined(self):
|
40
|
+
assert Direction.undefined() is not None
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
from datetime import datetime
|
5
|
+
|
6
|
+
from ostk.core.filesystem import File
|
7
|
+
from ostk.core.filesystem import Path
|
8
|
+
|
9
|
+
from ostk.io import URL
|
10
|
+
|
11
|
+
from ostk.physics.data import Manifest
|
12
|
+
from ostk.physics.time import Instant
|
13
|
+
|
14
|
+
|
15
|
+
class TestManifest:
|
16
|
+
def test_is_defined_success(self, manifest: Manifest):
|
17
|
+
assert manifest.is_defined() == True
|
18
|
+
|
19
|
+
def test_get_last_modified_timestamp_success(self, manifest: Manifest):
|
20
|
+
assert isinstance(manifest.get_last_modified_timestamp(), Instant)
|
21
|
+
|
22
|
+
def test_get_last_update_timestamp_for_success(self, manifest: Manifest):
|
23
|
+
assert isinstance(manifest.get_last_update_timestamp_for("manifest"), Instant)
|
24
|
+
|
25
|
+
def test_get_next_update_check_timestamp_for_success(self, manifest: Manifest):
|
26
|
+
assert isinstance(
|
27
|
+
manifest.get_next_update_check_timestamp_for("manifest"), Instant
|
28
|
+
)
|
29
|
+
|
30
|
+
def test_get_remote_data_urls_success(self, manifest: Manifest):
|
31
|
+
test_url: URL = URL.parse("http://test.com")
|
32
|
+
assert isinstance(manifest.get_remote_data_urls(test_url, "manifest"), list)
|
33
|
+
|
34
|
+
def test_find_remote_data_urls_success(self, manifest: Manifest):
|
35
|
+
test_url: URL = URL.parse("http://test.com")
|
36
|
+
assert isinstance(manifest.find_remote_data_urls(test_url, ".*"), list)
|
37
|
+
|
38
|
+
def test_undefined_success(self):
|
39
|
+
assert isinstance(Manifest.undefined(), Manifest)
|
40
|
+
|
41
|
+
def test_load_success(self, manifest_file: File):
|
42
|
+
manifest = Manifest.load(manifest_file)
|
43
|
+
assert isinstance(manifest, Manifest)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
from datetime import datetime
|
5
|
+
from ostk.core.filesystem import Directory
|
6
|
+
from ostk.core.filesystem import File
|
7
|
+
from ostk.core.filesystem import Path
|
8
|
+
|
9
|
+
from ostk.io import URL
|
10
|
+
|
11
|
+
from ostk.physics.time import Instant
|
12
|
+
from ostk.physics.data import Manager
|
13
|
+
from ostk.physics.data import Manifest
|
14
|
+
|
15
|
+
|
16
|
+
class TestManager:
|
17
|
+
def test_get_last_update_timestamp_for_success(self, manager: Manager):
|
18
|
+
assert isinstance(manager.get_last_update_timestamp_for("manifest"), Instant)
|
19
|
+
|
20
|
+
def test_get_remote_url_success(self, manager: Manager):
|
21
|
+
assert isinstance(manager.get_remote_url(), URL)
|
22
|
+
|
23
|
+
def test_get_local_repository_success(self, manager: Manager):
|
24
|
+
assert isinstance(manager.get_local_repository(), Directory)
|
25
|
+
|
26
|
+
def test_get_remote_data_urls_success(self, manager: Manager):
|
27
|
+
assert isinstance(manager.get_remote_data_urls("data_name"), list)
|
28
|
+
|
29
|
+
def test_get_manifest_success(self, manager: Manager):
|
30
|
+
assert isinstance(manager.get_manifest(), Manifest)
|
31
|
+
|
32
|
+
def test_set_remote_url_success(self, manager: Manager):
|
33
|
+
manager.set_remote_url(URL.parse("http://example.com"))
|
34
|
+
assert manager.get_remote_url() == URL.parse("http://example.com")
|
35
|
+
|
36
|
+
def test_set_local_repository_success(self, manager: Manager):
|
37
|
+
directory = Directory.path(Path.parse("./test_directory"))
|
38
|
+
manager.set_local_repository(directory)
|
39
|
+
assert manager.get_local_repository() == directory
|
40
|
+
|
41
|
+
def test_find_remote_data_urls_success(self, manager: Manager):
|
42
|
+
assert isinstance(manager.find_remote_data_urls(".*"), list)
|
43
|
+
|
44
|
+
def test_load_manifest_success(self, manager: Manager, manifest: Manifest):
|
45
|
+
manager.load_manifest(manifest)
|
46
|
+
assert manager.get_manifest().is_defined()
|
47
|
+
|
48
|
+
def test_manifest_file_exists_success(self, manager: Manager):
|
49
|
+
assert isinstance(manager.manifest_file_exists(), bool)
|
50
|
+
|
51
|
+
def test_reset_success(self, manager: Manager, manifest: Manifest):
|
52
|
+
manager.load_manifest(manifest)
|
53
|
+
assert manager.get_manifest().is_defined()
|
54
|
+
|
55
|
+
manager.reset()
|
56
|
+
assert not manager.get_manifest().is_defined()
|
57
|
+
|
58
|
+
def test_get_success(self):
|
59
|
+
assert isinstance(Manager.get(), Manager)
|
60
|
+
|
61
|
+
def test_default_remote_url_success(self, manager: Manager):
|
62
|
+
assert isinstance(manager.default_remote_url(), URL)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics import Unit
|
6
|
+
from ostk.physics.data import Scalar
|
7
|
+
from ostk.physics.unit import Length
|
8
|
+
|
9
|
+
|
10
|
+
@pytest.fixture
|
11
|
+
def unit() -> Unit:
|
12
|
+
return Unit.length(Length.Unit.Meter)
|
13
|
+
|
14
|
+
|
15
|
+
@pytest.fixture
|
16
|
+
def value() -> float:
|
17
|
+
return 5.0
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.fixture
|
21
|
+
def scalar(value: float, unit: Unit) -> Scalar:
|
22
|
+
return Scalar(
|
23
|
+
value=value,
|
24
|
+
unit=unit,
|
25
|
+
)
|
26
|
+
|
27
|
+
|
28
|
+
class TestScalar:
|
29
|
+
def test_constructor(self, scalar: Scalar):
|
30
|
+
assert scalar is not None
|
31
|
+
|
32
|
+
def test_equals(self, scalar: Scalar):
|
33
|
+
assert scalar == scalar
|
34
|
+
|
35
|
+
def test_not_equals(self, scalar: Scalar):
|
36
|
+
assert (scalar != scalar) is False
|
37
|
+
|
38
|
+
def test_is_defined(self, scalar: Scalar):
|
39
|
+
assert scalar.is_defined()
|
40
|
+
|
41
|
+
def test_get_value(self, scalar: Scalar, value: float):
|
42
|
+
assert scalar.get_value() == value
|
43
|
+
|
44
|
+
def test_get_unit(self, scalar: Scalar):
|
45
|
+
assert scalar.get_unit().is_defined()
|
46
|
+
|
47
|
+
def test_in_unit(self, scalar: Scalar):
|
48
|
+
assert scalar.in_unit(Unit.length(Length.Unit.Foot)) is not None
|
49
|
+
|
50
|
+
def test_to_string(self, scalar: Scalar):
|
51
|
+
assert scalar.to_string() is not None
|
52
|
+
|
53
|
+
def test_undefined(self):
|
54
|
+
assert Scalar.undefined() is not None
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
from ostk.physics import Unit
|
8
|
+
from ostk.physics.data import Vector
|
9
|
+
from ostk.physics.unit import Length
|
10
|
+
from ostk.physics.time import Instant
|
11
|
+
from ostk.physics.coordinate import Frame
|
12
|
+
|
13
|
+
|
14
|
+
@pytest.fixture
|
15
|
+
def unit() -> Unit:
|
16
|
+
return Unit.length(Length.Unit.Meter)
|
17
|
+
|
18
|
+
|
19
|
+
@pytest.fixture
|
20
|
+
def value() -> np.ndarray:
|
21
|
+
return np.array([1.0, 2.0, 3.0])
|
22
|
+
|
23
|
+
|
24
|
+
@pytest.fixture
|
25
|
+
def frame() -> Frame:
|
26
|
+
return Frame.GCRF()
|
27
|
+
|
28
|
+
|
29
|
+
@pytest.fixture
|
30
|
+
def vector(value: float, unit: Unit, frame: Frame) -> Vector:
|
31
|
+
return Vector(
|
32
|
+
value=value,
|
33
|
+
unit=unit,
|
34
|
+
frame=frame,
|
35
|
+
)
|
36
|
+
|
37
|
+
|
38
|
+
class TestVector:
|
39
|
+
def test_constructor(self, vector: Vector):
|
40
|
+
assert vector is not None
|
41
|
+
|
42
|
+
def test_equals(self, vector: Vector):
|
43
|
+
assert vector == vector
|
44
|
+
|
45
|
+
def test_not_equals(self, vector: Vector):
|
46
|
+
assert (vector != vector) is False
|
47
|
+
|
48
|
+
def test_is_defined(self, vector: Vector):
|
49
|
+
assert vector.is_defined()
|
50
|
+
|
51
|
+
def test_get_value(self, vector: Vector, value: float):
|
52
|
+
assert np.all(vector.get_value() == value)
|
53
|
+
|
54
|
+
def test_get_unit(self, vector: Vector):
|
55
|
+
assert vector.get_unit().is_defined()
|
56
|
+
|
57
|
+
def test_get_frame(self, vector: Vector, frame: Frame):
|
58
|
+
assert vector.get_frame() == frame
|
59
|
+
|
60
|
+
def test_in_unit(self, vector: Vector):
|
61
|
+
assert vector.in_unit(Unit.length(Length.Unit.Foot)) is not None
|
62
|
+
|
63
|
+
def test_in_frame(self, vector: Vector):
|
64
|
+
assert vector.in_frame(Frame.ITRF(), Instant.J2000()) is not None
|
65
|
+
|
66
|
+
def test_to_string(self, vector: Vector):
|
67
|
+
assert vector.to_string() is not None
|
68
|
+
|
69
|
+
def test_undefined(self):
|
70
|
+
assert Vector.undefined() is not None
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1,67 @@
|
|
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
|
+
from ostk.io import URL
|
11
|
+
|
12
|
+
from ostk.physics.coordinate import Frame
|
13
|
+
from ostk.physics.environment.object.celestial import Sun
|
14
|
+
from ostk.physics.environment.atmospheric.earth import Manager
|
15
|
+
from ostk.physics.environment.atmospheric.earth import CSSISpaceWeather
|
16
|
+
from ostk.physics.environment.atmospheric.earth import Exponential
|
17
|
+
from ostk.physics.environment.atmospheric.earth import NRLMSISE00
|
18
|
+
from ostk.physics.environment.gravitational import Earth as EarthGravityModel
|
19
|
+
|
20
|
+
|
21
|
+
@pytest.fixture
|
22
|
+
def data_directory_path() -> str:
|
23
|
+
return f"{pathlib.Path(__file__).parent.absolute()}/data"
|
24
|
+
|
25
|
+
|
26
|
+
@pytest.fixture
|
27
|
+
def cssi_space_weather_file(data_directory_path: str) -> File:
|
28
|
+
return File.path(Path.parse(f"{data_directory_path}/SW-Last5Years.test.csv"))
|
29
|
+
|
30
|
+
|
31
|
+
@pytest.fixture
|
32
|
+
def cssi_space_weather_legacy_file(data_directory_path: str) -> File:
|
33
|
+
return File.path(Path.parse(f"{data_directory_path}/SpaceWeather-All-v1.2.test.txt"))
|
34
|
+
|
35
|
+
|
36
|
+
@pytest.fixture
|
37
|
+
def cssi_space_weather(cssi_space_weather_file: File) -> CSSISpaceWeather:
|
38
|
+
return CSSISpaceWeather.load(cssi_space_weather_file)
|
39
|
+
|
40
|
+
|
41
|
+
@pytest.fixture
|
42
|
+
def manager() -> Manager:
|
43
|
+
manager = Manager.get()
|
44
|
+
|
45
|
+
yield manager
|
46
|
+
|
47
|
+
manager.reset()
|
48
|
+
manager.clear_local_repository()
|
49
|
+
|
50
|
+
|
51
|
+
@pytest.fixture
|
52
|
+
def exponential_model() -> Exponential:
|
53
|
+
return Exponential()
|
54
|
+
|
55
|
+
|
56
|
+
@pytest.fixture
|
57
|
+
def nrlmsise00_model() -> NRLMSISE00:
|
58
|
+
return NRLMSISE00(
|
59
|
+
NRLMSISE00.InputDataType.CSSISpaceWeatherFile,
|
60
|
+
160.0,
|
61
|
+
160.0,
|
62
|
+
3.0,
|
63
|
+
Frame.ITRF(),
|
64
|
+
EarthGravityModel.WGS84.equatorial_radius,
|
65
|
+
EarthGravityModel.WGS84.flattening,
|
66
|
+
Sun.spherical(),
|
67
|
+
)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
DATE,BSRN,ND,KP1,KP2,KP3,KP4,KP5,KP6,KP7,KP8,KP_SUM,AP1,AP2,AP3,AP4,AP5,AP6,AP7,AP8,AP_AVG,CP,C9,ISN,F10.7_OBS,F10.7_ADJ,F10.7_DATA_TYPE,F10.7_OBS_CENTER81,F10.7_OBS_LAST81,F10.7_ADJ_CENTER81,F10.7_ADJ_LAST81
|
2
|
+
2018-01-01,2515,21,33,37,23,23,27,10,10,13,177,18,22,9,9,12,4,4,5,10,0.6,3,0,69.1,66.8,OBS,71.4,72.5,69.3,70.8
|
3
|
+
2018-01-02,2515,22,17,7,3,7,17,10,20,10,90,6,3,2,3,6,4,7,4,4,0.2,1,0,69.5,67.2,OBS,71.5,72.5,69.3,70.8
|
4
|
+
2018-01-03,2515,23,0,7,10,7,3,10,3,0,40,0,3,4,3,2,4,2,0,2,0.0,0,0,70.7,68.3,INT,71.6,72.5,69.4,70.8
|
5
|
+
2023-06-18,2589,17,27,20,13,20,17,17,27,20,160,12,7,5,7,6,6,12,7,8,0.4,2,159,164.1,169.4,OBS,160.4,152.8,165.2,155.5
|
6
|
+
2023-06-19,2589,18,23,17,17,13,20,27,30,30,177,9,6,6,5,7,12,15,15,9,0.5,2,179,168.8,174.3,OBS,160.1,153.1,164.9,155.9
|
7
|
+
|
8
|
+
2023-06-20,2589,19,27,20,10,17,20,23,10,40,167,12,7,4,6,7,9,4,27,9,0.5,2,203,164.6,170.0,PRD,160.2,153.6,165.0,156.4
|
9
|
+
2023-06-21,2589,20,30,37,27,27,20,20,27,27,213,15,22,12,12,7,7,12,12,12,0.7,3,119,164.6,170.0,PRD,160.3,154.0,165.1,157.0
|
10
|
+
2023-08-02,2591,8,13,13,13,13,13,13,13,13,104,5,5,5,5,5,5,5,5,5,0.2,1,123,165.0,170.0,PRD,157.5,160.8,162.0,165.7
|
11
|
+
2023-08-03,2591,9,13,13,13,13,13,13,13,13,104,5,5,5,5,5,5,5,5,5,0.2,1,123,165.1,170.0,PRD,157.4,161.1,161.8,166.0
|
12
|
+
|
13
|
+
2023-09-01,2592,11,,,,,,,,,,,,,,,,,,,,,124,151.3,154.2,PRM,154.2,158.3,156.9,163.1
|
14
|
+
2023-10-01,2593,14,,,,,,,,,,,,,,,,,,,,,126,154.0,154.4,PRM,153.9,154.5,154.3,157.9
|
15
|
+
2023-11-01,2594,18,,,,,,,,,,,,,,,,,,,,,128,156.6,154.3,PRM,156.4,153.1,154.3,154.2
|
16
|
+
2023-12-01,2595,21,,,,,,,,,,,,,,,,,,,,,129,158.5,154.2,PRM,158.2,155.6,154.2,154.3
|
17
|
+
2028-08-01,2658,25,,,,,,,,,,,,,,,,,,,,,45,82.7,85.2,PRM,83.3,84.3,85.6,86.9
|
18
|
+
2028-09-01,2660,2,,,,,,,,,,,,,,,,,,,,,43,82.7,84.2,PRM,83.2,83.5,84.6,85.9
|
19
|
+
2028-10-01,2661,5,,,,,,,,,,,,,,,,,,,,,41,82.9,83.1,PRM,83.5,83.2,83.6,85.0
|
20
|
+
2028-11-01,2662,9,,,,,,,,,,,,,,,,,,,,,40,83.3,82.1,PRM,83.8,83.4,82.6,84.0
|
21
|
+
2028-12-01,2663,12,,,,,,,,,,,,,,,,,,,,,38,83.7,81.4,PRM,83.9,83.7,81.8,83.0
|
22
|
+
2029-01-01,2664,16,,,,,,,,,,,,,,,,,,,,,36,83.5,80.7,PRM,83.6,83.9,81.0,82.0
|