open-space-toolkit-physics 11.2.1__py313-none-manylinux2014_aarch64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. open_space_toolkit_physics-11.2.1.dist-info/METADATA +29 -0
  2. open_space_toolkit_physics-11.2.1.dist-info/RECORD +81 -0
  3. open_space_toolkit_physics-11.2.1.dist-info/WHEEL +5 -0
  4. open_space_toolkit_physics-11.2.1.dist-info/top_level.txt +1 -0
  5. open_space_toolkit_physics-11.2.1.dist-info/zip-safe +1 -0
  6. ostk/__init__.py +1 -0
  7. ostk/physics/OpenSpaceToolkitPhysicsPy.cpython-313-aarch64-linux-gnu.so +0 -0
  8. ostk/physics/__init__.py +6 -0
  9. ostk/physics/libopen-space-toolkit-physics.so.11 +0 -0
  10. ostk/physics/test/__init__.py +1 -0
  11. ostk/physics/test/coordinate/__init__.py +1 -0
  12. ostk/physics/test/coordinate/frame/__init__.py +1 -0
  13. ostk/physics/test/coordinate/frame/provider/__init__.py +1 -0
  14. ostk/physics/test/coordinate/frame/provider/iers/__init__.py +1 -0
  15. ostk/physics/test/coordinate/frame/provider/iers/conftest.py +38 -0
  16. ostk/physics/test/coordinate/frame/provider/iers/data/finals2000A.data +10953 -0
  17. ostk/physics/test/coordinate/frame/provider/iers/data/ser7.dat +524 -0
  18. ostk/physics/test/coordinate/frame/provider/iers/test_bulletin_a.py +108 -0
  19. ostk/physics/test/coordinate/frame/provider/iers/test_finals_2000a.py +93 -0
  20. ostk/physics/test/coordinate/frame/provider/iers/test_manager.py +205 -0
  21. ostk/physics/test/coordinate/spherical/__init__.py +1 -0
  22. ostk/physics/test/coordinate/spherical/test_aer.py +143 -0
  23. ostk/physics/test/coordinate/spherical/test_lla.py +490 -0
  24. ostk/physics/test/coordinate/test_axes.py +116 -0
  25. ostk/physics/test/coordinate/test_frame.py +107 -0
  26. ostk/physics/test/coordinate/test_position.py +206 -0
  27. ostk/physics/test/coordinate/test_transform.py +294 -0
  28. ostk/physics/test/coordinate/test_velocity.py +180 -0
  29. ostk/physics/test/data/conftest.py +34 -0
  30. ostk/physics/test/data/data/manifest.json +22 -0
  31. ostk/physics/test/data/provider/test_provider.py +34 -0
  32. ostk/physics/test/data/test_direction.py +40 -0
  33. ostk/physics/test/data/test_manifest.py +43 -0
  34. ostk/physics/test/data/test_manifest_manager.py +62 -0
  35. ostk/physics/test/data/test_scalar.py +54 -0
  36. ostk/physics/test/data/test_vector.py +70 -0
  37. ostk/physics/test/environment/__init__.py +1 -0
  38. ostk/physics/test/environment/atmospheric/__init__.py +1 -0
  39. ostk/physics/test/environment/atmospheric/earth/__init__.py +1 -0
  40. ostk/physics/test/environment/atmospheric/earth/conftest.py +67 -0
  41. ostk/physics/test/environment/atmospheric/earth/data/SW-Last5Years.test.csv +22 -0
  42. ostk/physics/test/environment/atmospheric/earth/data/SpaceWeather-All-v1.2.test.txt +811 -0
  43. ostk/physics/test/environment/atmospheric/earth/test_cssi_space_weather.py +126 -0
  44. ostk/physics/test/environment/atmospheric/earth/test_exponential.py +34 -0
  45. ostk/physics/test/environment/atmospheric/earth/test_manager.py +173 -0
  46. ostk/physics/test/environment/atmospheric/earth/test_nrlmsise00.py +34 -0
  47. ostk/physics/test/environment/atmospheric/test_earth.py +141 -0
  48. ostk/physics/test/environment/gravitational/__init__.py +1 -0
  49. ostk/physics/test/environment/gravitational/earth/__init__.py +1 -0
  50. ostk/physics/test/environment/gravitational/earth/test_manager.py +76 -0
  51. ostk/physics/test/environment/gravitational/test_earth.py +103 -0
  52. ostk/physics/test/environment/gravitational/test_moon.py +55 -0
  53. ostk/physics/test/environment/gravitational/test_spherical.py +36 -0
  54. ostk/physics/test/environment/gravitational/test_sun.py +53 -0
  55. ostk/physics/test/environment/magnetic/__init__.py +1 -0
  56. ostk/physics/test/environment/magnetic/earth/test_manager.py +64 -0
  57. ostk/physics/test/environment/magnetic/test_earth.py +38 -0
  58. ostk/physics/test/environment/object/__init__.py +1 -0
  59. ostk/physics/test/environment/object/celestial/__init__ .py +1 -0
  60. ostk/physics/test/environment/object/celestial/test_earth.py +174 -0
  61. ostk/physics/test/environment/object/celestial/test_moon.py +17 -0
  62. ostk/physics/test/environment/object/celestial/test_sun.py +17 -0
  63. ostk/physics/test/environment/object/test_celestial.py +12 -0
  64. ostk/physics/test/test_environment.py +97 -0
  65. ostk/physics/test/test_import.py +25 -0
  66. ostk/physics/test/time/__init__.py +1 -0
  67. ostk/physics/test/time/test_date.py +136 -0
  68. ostk/physics/test/time/test_date_time.py +230 -0
  69. ostk/physics/test/time/test_duration.py +215 -0
  70. ostk/physics/test/time/test_instant.py +103 -0
  71. ostk/physics/test/time/test_interval.py +432 -0
  72. ostk/physics/test/time/test_scale.py +11 -0
  73. ostk/physics/test/time/test_time.py +114 -0
  74. ostk/physics/test/unit/__init__.py +1 -0
  75. ostk/physics/test/unit/derived/__init__.py +1 -0
  76. ostk/physics/test/unit/derived/test_angle.py +368 -0
  77. ostk/physics/test/unit/test_derived.py +152 -0
  78. ostk/physics/test/unit/test_electric_current.py +5 -0
  79. ostk/physics/test/unit/test_length.py +297 -0
  80. ostk/physics/test/unit/test_mass.py +141 -0
  81. ostk/physics/test/unit/test_time.py +101 -0
@@ -0,0 +1,206 @@
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
+ Position = physics.coordinate.Position
14
+ Unit = physics.unit.Length.Unit
15
+
16
+
17
+ def test_coordinate_position_constructors():
18
+ # Construct arbitrary frame
19
+ frame: Frame = Frame.GCRF()
20
+ unit: Unit = Unit.Meter
21
+
22
+ # Construction with python lists
23
+ vector = [1000.0, 0.0, 0.0]
24
+
25
+ position: Position = Position(vector, unit, frame)
26
+
27
+ assert position is not None
28
+ assert isinstance(position, Position)
29
+ assert position.is_defined()
30
+
31
+ # Construction with python tuples
32
+ vector = (1000.0, 0.0, 0.0)
33
+
34
+ position: Position = Position(vector, unit, frame)
35
+
36
+ assert position is not None
37
+ assert isinstance(position, Position)
38
+ assert position.is_defined()
39
+
40
+ # Construction with python numpy arrays
41
+ vector = np.array((1000.0, 0.0, 0.0))
42
+
43
+ position: Position = Position(vector, unit, frame)
44
+
45
+ assert position is not None
46
+ assert isinstance(position, Position)
47
+ assert position.is_defined()
48
+
49
+ # Construction with meters static constructor
50
+ position: Position = Position.meters(vector, frame)
51
+
52
+ assert position is not None
53
+ assert isinstance(position, Position)
54
+ assert position.is_defined()
55
+
56
+ # Construction with undefined static constructor
57
+ position: Position = Position.undefined()
58
+
59
+ assert position is not None
60
+ assert isinstance(position, Position)
61
+ assert position.is_defined() is False
62
+
63
+
64
+ def test_coordinate_position_comparators():
65
+ frame: Frame = Frame.GCRF()
66
+ unit: Unit = Unit.Meter
67
+ vector_1 = [1000.0, 0.0, 0.0]
68
+ vector_2 = [-450.3, 234.9, -23.0]
69
+
70
+ position_1: Position = Position(vector_1, unit, frame)
71
+ position_2: Position = Position(vector_2, unit, frame)
72
+
73
+ assert position_1 == position_1
74
+ assert position_2 == position_2
75
+ assert position_1 != position_2
76
+
77
+
78
+ def test_coordinate_position_is_defined():
79
+ frame: Frame = Frame.GCRF()
80
+ unit: Unit = Unit.Meter
81
+ vector = [1000.0, 0.0, 0.0]
82
+ position: Position = Position(vector, unit, frame)
83
+
84
+ assert position.is_defined()
85
+ assert Position.undefined().is_defined() is False
86
+
87
+
88
+ @pytest.mark.skip
89
+ def test_coordinate_position_is_near():
90
+ frame: Frame = Frame.GCRF()
91
+ unit: Unit = Unit.Meter
92
+
93
+ vector_1 = [1000.0, 0.0, 0.0]
94
+ vector_2 = [1000.00001, 0.0001, 0.0]
95
+
96
+ position_1: Position = Position(vector_1, unit, frame)
97
+ position_2: Position = Position(vector_2, unit, frame)
98
+
99
+ assert position_1.is_near(position_2, Unit.Meter)
100
+ assert position_2.is_near(position_1, Unit.Meter)
101
+
102
+
103
+ def test_coordinate_position_access_frame():
104
+ frame: Frame = Frame.GCRF()
105
+ unit: Unit = Unit.Meter
106
+ vector = [1000.0, 0.0, 0.0]
107
+
108
+ position: Position = Position(vector, unit, frame)
109
+
110
+ ans_frame = position.access_frame()
111
+
112
+ assert ans_frame is not None
113
+ assert isinstance(ans_frame, Frame)
114
+ assert ans_frame == frame
115
+
116
+
117
+ def test_coordinate_position_get_coordinates():
118
+ frame: Frame = Frame.GCRF()
119
+ unit: Unit = Unit.Meter
120
+ vector = [1000.0, 0.0, 0.0]
121
+
122
+ position: Position = Position(vector, unit, frame)
123
+
124
+ coordinates = position.get_coordinates()
125
+
126
+ assert coordinates is not None
127
+ assert isinstance(coordinates, np.ndarray)
128
+ assert np.array_equal(coordinates, vector)
129
+
130
+
131
+ def test_coordinate_position_get_unit():
132
+ frame: Frame = Frame.GCRF()
133
+ unit: Unit = Unit.Meter
134
+ vector = [1000.0, 0.0, 0.0]
135
+
136
+ position: Position = Position(vector, unit, frame)
137
+
138
+ ans_unit = position.get_unit()
139
+
140
+ assert ans_unit is not None
141
+ assert isinstance(ans_unit, Unit)
142
+ assert ans_unit == unit
143
+
144
+
145
+ def test_coordinate_position_in_unit():
146
+ frame: Frame = Frame.GCRF()
147
+ unit: Unit = Unit.Meter
148
+ vector = [1000.0, 0.0, 0.0]
149
+
150
+ position: Position = Position(vector, unit, frame)
151
+
152
+ new_position: Position = position.in_unit(Unit.Meter)
153
+
154
+ assert new_position is not None
155
+ assert isinstance(new_position, Position)
156
+ assert new_position == position
157
+
158
+ new_position: Position = position.in_unit(Unit.TerrestrialMile)
159
+
160
+ assert new_position is not None
161
+ assert isinstance(new_position, Position)
162
+ # assert new_position == position
163
+
164
+
165
+ def test_coordinate_position_in_meters():
166
+ frame: Frame = Frame.GCRF()
167
+ unit: Unit = Unit.Meter
168
+ vector = [1000.0, 0.0, 0.0]
169
+
170
+ position: Position = Position(vector, unit, frame)
171
+
172
+ new_position: Position = position.in_meters()
173
+
174
+ assert new_position is not None
175
+ assert isinstance(new_position, Position)
176
+ assert new_position == position
177
+
178
+
179
+ def test_coordinate_position_in_frame():
180
+ frame: Frame = Frame.GCRF()
181
+ unit: Unit = Unit.Meter
182
+ vector = [1000.0, 0.0, 0.0]
183
+
184
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
185
+
186
+ position: Position = Position(vector, unit, frame)
187
+
188
+ new_position: Position = position.in_frame(frame, instant)
189
+
190
+ assert new_position is not None
191
+ assert isinstance(new_position, Position)
192
+ assert new_position == position
193
+
194
+
195
+ def test_coordinate_position_to_string():
196
+ frame: Frame = Frame.GCRF()
197
+ unit: Unit = Unit.Meter
198
+ vector = [1000.0, 0.0, 0.0]
199
+
200
+ position: Position = Position(vector, unit, frame)
201
+
202
+ string: String = position.to_string()
203
+
204
+ assert string is not None
205
+ assert isinstance(string, String)
206
+ assert string == "[1000.0, 0.0, 0.0] [m] @ GCRF"
@@ -0,0 +1,294 @@
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
+ import ostk.mathematics as mathematics
10
+
11
+ Scale = physics.time.Scale
12
+ DateTime = physics.time.DateTime
13
+ Instant = physics.time.Instant
14
+ Quaternion = mathematics.geometry.d3.transformation.rotation.Quaternion
15
+ Transform = physics.coordinate.Transform
16
+ Type = Transform.Type
17
+
18
+
19
+ def test_coordinate_transform_type():
20
+ enum_members = Type.__members__
21
+
22
+ list_keys = ["Undefined", "Active", "Passive"]
23
+ list_values = [Type.Undefined, Type.Active, Type.Passive]
24
+
25
+ assert list(enum_members.keys()) == list_keys
26
+ assert list(enum_members.values()) == list_values
27
+
28
+
29
+ def test_coordinate_transform_constructors():
30
+ # Construct arbitrary Instant
31
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
32
+
33
+ # Construct arbitrary Orientation
34
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
35
+
36
+ # Construct Transform Type
37
+ transform_type: Type = Type.Passive
38
+
39
+ # Construction using python lists
40
+ translation = [1.0, 0.0, 0.0]
41
+ velocity = [0.01, 0.0, 0.0]
42
+ angular_velocity = [0.01, 0.01, 0.01]
43
+
44
+ transform: Transform = Transform(
45
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
46
+ )
47
+
48
+ assert transform is not None
49
+ assert isinstance(transform, Transform)
50
+
51
+ # Construction using python tuples
52
+ translation = (1.0, 0.0, 0.0)
53
+ velocity = (0.01, 0.0, 0.0)
54
+ angular_velocity = (0.01, 0.01, 0.01)
55
+
56
+ transform: Transform = Transform(
57
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
58
+ )
59
+
60
+ assert transform is not None
61
+ assert isinstance(transform, Transform)
62
+
63
+ # Construction using python numpy arrays
64
+ translation = np.array(translation)
65
+ velocity = np.array(velocity)
66
+ angular_velocity = np.array(angular_velocity)
67
+
68
+ transform: Transform = Transform(
69
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
70
+ )
71
+
72
+ assert transform is not None
73
+ assert isinstance(transform, Transform)
74
+
75
+ # Construct using identity static constructor
76
+
77
+ transform: Transform = Transform.identity(instant)
78
+
79
+ assert transform is not None
80
+ assert isinstance(transform, Transform)
81
+
82
+ # Construct using active static constructor
83
+
84
+ transform: Transform = Transform.active(
85
+ instant, translation, velocity, quaternion, angular_velocity
86
+ )
87
+
88
+ assert transform is not None
89
+ assert isinstance(transform, Transform)
90
+
91
+ # Construct using passive static constructor
92
+
93
+ transform: Transform = Transform.passive(
94
+ instant, translation, velocity, quaternion, angular_velocity
95
+ )
96
+
97
+ assert transform is not None
98
+ assert isinstance(transform, Transform)
99
+
100
+
101
+ def test_coordinate_transform_comparators():
102
+ # Construct arbitrary Instant
103
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
104
+
105
+ # Construct arbitrary Orientation
106
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
107
+
108
+ # Construct Transform Type
109
+ transform_type: Type = Type.Passive
110
+
111
+ # Construction using python lists
112
+ translation_1 = [1.0, 0.0, 0.0]
113
+ translation_2 = [0.0, 0.0, 0.0]
114
+ velocity = [0.01, 0.0, 0.0]
115
+ angular_velocity = [0.01, 0.01, 0.01]
116
+
117
+ transform_1: Transform = Transform(
118
+ instant, translation_1, velocity, quaternion, angular_velocity, transform_type
119
+ )
120
+ transform_2: Transform = Transform(
121
+ instant, translation_2, velocity, quaternion, angular_velocity, transform_type
122
+ )
123
+
124
+ assert transform_1 == transform_1
125
+ assert transform_2 == transform_2
126
+ assert transform_1 != transform_2
127
+
128
+
129
+ def test_coordinate_transform_operators():
130
+ # Construct arbitrary Instant
131
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
132
+
133
+ # Construct arbitrary Orientation
134
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
135
+
136
+ # Construct Transform Type
137
+ transform_type: Type = Type.Passive
138
+
139
+ # Construction using python lists
140
+ translation = [1.0, 0.0, 0.0]
141
+ velocity = [0.01, 0.0, 0.0]
142
+ angular_velocity = [0.01, 0.01, 0.01]
143
+
144
+ transform: Transform = Transform(
145
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
146
+ )
147
+
148
+ mul_transform = transform * transform
149
+
150
+ assert mul_transform is not None
151
+ assert isinstance(mul_transform, Transform)
152
+ assert mul_transform.is_defined()
153
+
154
+ transform *= transform
155
+
156
+ assert transform is not None
157
+ assert isinstance(transform, Transform)
158
+ assert transform.is_defined()
159
+
160
+
161
+ def test_coordinate_transform_is_defined():
162
+ # Construct arbitrary Instant
163
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
164
+
165
+ # Construct arbitrary Orientation
166
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
167
+
168
+ # Construct Transform Type
169
+ transform_type: Type = Type.Passive
170
+
171
+ # Construction using python lists
172
+ translation = [1.0, 0.0, 0.0]
173
+ velocity = [0.01, 0.0, 0.0]
174
+ angular_velocity = [0.01, 0.01, 0.01]
175
+
176
+ transform: Transform = Transform(
177
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
178
+ )
179
+
180
+ assert transform.is_defined()
181
+ assert transform.undefined().is_defined() is False
182
+
183
+
184
+ def test_coordinate_transform_is_identity():
185
+ # Construct arbitrary Instant
186
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
187
+
188
+ # Construct arbitrary Orientation
189
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
190
+
191
+ # Construct Transform Type
192
+ transform_type: Type = Type.Passive
193
+
194
+ # Construction using python lists
195
+ translation = [0.0, 0.0, 0.0]
196
+ velocity = [0.00, 0.0, 0.0]
197
+ angular_velocity = [0.00, 0.00, 0.00]
198
+
199
+ transform: Transform = Transform(
200
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
201
+ )
202
+
203
+ assert transform.is_defined()
204
+ assert transform.is_identity()
205
+ assert transform.identity(instant).is_identity()
206
+
207
+
208
+ # def test_coordinate_transform_accesses ():
209
+
210
+ # access_instant
211
+
212
+
213
+ # access_translation
214
+
215
+
216
+ # access_velocity
217
+
218
+
219
+ # access_orientation
220
+
221
+
222
+ # access_angular_velocity
223
+
224
+
225
+ def test_coordinate_transform_getters():
226
+ # Construct arbitrary Instant
227
+ instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
228
+
229
+ # Construct arbitrary Orientation
230
+ quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
231
+
232
+ # Construct Transform Type
233
+ transform_type: Type = Type.Passive
234
+
235
+ # Construction using python lists
236
+ translation = [1.0, 0.0, 0.0]
237
+ velocity = [0.01, 0.0, 0.0]
238
+ angular_velocity = [0.01, 0.01, 0.01]
239
+
240
+ transform: Transform = Transform(
241
+ instant, translation, velocity, quaternion, angular_velocity, transform_type
242
+ )
243
+
244
+ # get_instant
245
+ ans_instant: Instant = transform.get_instant()
246
+
247
+ assert ans_instant is not None
248
+ assert isinstance(ans_instant, Instant)
249
+ assert ans_instant == instant
250
+
251
+ # get_translation
252
+ ans_translation = transform.get_translation()
253
+
254
+ assert ans_translation is not None
255
+ assert isinstance(ans_translation, np.ndarray)
256
+ assert np.array_equal(ans_translation, translation)
257
+
258
+ # get_velocity
259
+ ans_velocity = transform.get_velocity()
260
+
261
+ assert ans_velocity is not None
262
+ assert isinstance(ans_velocity, np.ndarray)
263
+ assert np.array_equal(ans_velocity, velocity)
264
+
265
+ # get_orientation
266
+ ans_quaternion = transform.get_orientation()
267
+
268
+ assert ans_quaternion is not None
269
+ assert isinstance(ans_quaternion, Quaternion)
270
+ assert ans_quaternion == quaternion
271
+
272
+ # get_angular_velocity
273
+ ans_angular_velocity = transform.get_angular_velocity()
274
+
275
+ assert ans_angular_velocity is not None
276
+ assert isinstance(ans_angular_velocity, np.ndarray)
277
+ assert np.array_equal(ans_angular_velocity, angular_velocity)
278
+
279
+ # get_inverse
280
+ inverse: Transform = transform.get_inverse()
281
+
282
+ assert inverse is not None
283
+ assert isinstance(inverse, Transform)
284
+
285
+
286
+ # def test_coordinate_transform_apply_to_position ():
287
+
288
+ # ################################################################################################################################################################
289
+
290
+ # def test_coordinate_transform_apply_to_velocity ():
291
+
292
+ # ################################################################################################################################################################
293
+
294
+ # def test_coordinate_transform_apply_to_vector ():
@@ -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()