astrox-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- astrox/__init__.py +49 -0
- astrox/_http.py +504 -0
- astrox/access.py +173 -0
- astrox/components/__init__.py +202 -0
- astrox/components/_axes.py +508 -0
- astrox/components/_common.py +141 -0
- astrox/components/_constraints.py +138 -0
- astrox/components/_objects.py +167 -0
- astrox/components/_positions.py +673 -0
- astrox/components/_rotations.py +115 -0
- astrox/components/_sensors.py +134 -0
- astrox/components/_vgt.py +337 -0
- astrox/coverage/__init__.py +41 -0
- astrox/coverage/_core.py +552 -0
- astrox/coverage/_fom.py +125 -0
- astrox/coverage/coverage_time.py +83 -0
- astrox/coverage/number_of_assets.py +160 -0
- astrox/coverage/response_time.py +160 -0
- astrox/coverage/revisit_time.py +160 -0
- astrox/coverage/simple_coverage.py +152 -0
- astrox/exceptions.py +92 -0
- astrox/lighting.py +121 -0
- astrox/orbits.py +499 -0
- astrox/propagator.py +1072 -0
- astrox/rocket.py +82 -0
- astrox_python-0.1.0.dist-info/METADATA +82 -0
- astrox_python-0.1.0.dist-info/RECORD +29 -0
- astrox_python-0.1.0.dist-info/WHEEL +4 -0
- astrox_python-0.1.0.dist-info/licenses/LICENSE +21 -0
astrox/access.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""Access analysis functions and access-owned chain fragments."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Sequence
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from astrox import components
|
|
10
|
+
from astrox._http import raw
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Connection",
|
|
14
|
+
"chain",
|
|
15
|
+
"compute",
|
|
16
|
+
"connection",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _include_if_supplied(payload: dict[str, Any], wire_key: str, value: Any) -> None:
|
|
21
|
+
if value is not None:
|
|
22
|
+
payload[wire_key] = value
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _entity_to_wire(entity: components.Entity, *, parameter: str) -> dict[str, Any]:
|
|
26
|
+
if not isinstance(entity, components.Entity):
|
|
27
|
+
raise TypeError(f"{parameter} must be an astrox.components.Entity value")
|
|
28
|
+
return entity.to_wire()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _participant_name(
|
|
32
|
+
value: components.Entity | components.EntityGroup | str,
|
|
33
|
+
*,
|
|
34
|
+
parameter: str,
|
|
35
|
+
) -> str:
|
|
36
|
+
if isinstance(value, components.Entity):
|
|
37
|
+
return value.name
|
|
38
|
+
if isinstance(value, components.EntityGroup):
|
|
39
|
+
return value.name
|
|
40
|
+
if isinstance(value, str):
|
|
41
|
+
return value
|
|
42
|
+
raise TypeError(f"{parameter} must be an Entity, EntityGroup, or string name")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _participant_to_wire(
|
|
46
|
+
value: components.Entity | components.EntityGroup,
|
|
47
|
+
*,
|
|
48
|
+
parameter: str,
|
|
49
|
+
) -> dict[str, Any]:
|
|
50
|
+
if isinstance(value, components.Entity):
|
|
51
|
+
return {"$type": "EntityPath", **value.to_wire()}
|
|
52
|
+
if isinstance(value, components.EntityGroup):
|
|
53
|
+
return value.to_wire()
|
|
54
|
+
raise TypeError(f"{parameter} items must be Entity or EntityGroup values")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _participants_to_wire(
|
|
58
|
+
values: Sequence[components.Entity | components.EntityGroup],
|
|
59
|
+
) -> list[dict[str, Any]]:
|
|
60
|
+
if isinstance(values, (str, bytes)) or not isinstance(values, Sequence):
|
|
61
|
+
raise TypeError("participants must be a sequence of Entity or EntityGroup values")
|
|
62
|
+
return [
|
|
63
|
+
_participant_to_wire(value, parameter="participants")
|
|
64
|
+
for value in values
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _connections_to_wire(values: Sequence[Connection]) -> list[dict[str, Any]]:
|
|
69
|
+
if isinstance(values, (str, bytes)) or not isinstance(values, Sequence):
|
|
70
|
+
raise TypeError("connections must be a sequence of Connection values")
|
|
71
|
+
items = list(values)
|
|
72
|
+
if not all(isinstance(item, Connection) for item in items):
|
|
73
|
+
raise TypeError("connections must be a sequence of Connection values")
|
|
74
|
+
return [item.to_wire() for item in items]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass(frozen=True, kw_only=True)
|
|
78
|
+
class Connection:
|
|
79
|
+
"""Explicit access-chain connection between named participants."""
|
|
80
|
+
|
|
81
|
+
from_participant: components.Entity | components.EntityGroup | str
|
|
82
|
+
to_participant: components.Entity | components.EntityGroup | str
|
|
83
|
+
min_uses: int | None = None
|
|
84
|
+
max_uses: int | None = None
|
|
85
|
+
|
|
86
|
+
def to_wire(self) -> dict[str, Any]:
|
|
87
|
+
"""Lower to the ASTROX LinkConnection fragment."""
|
|
88
|
+
payload: dict[str, Any] = {
|
|
89
|
+
"FromObject": _participant_name(
|
|
90
|
+
self.from_participant,
|
|
91
|
+
parameter="from_participant",
|
|
92
|
+
),
|
|
93
|
+
"ToObject": _participant_name(
|
|
94
|
+
self.to_participant,
|
|
95
|
+
parameter="to_participant",
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
_include_if_supplied(payload, "MinUses", self.min_uses)
|
|
99
|
+
_include_if_supplied(payload, "MaxUses", self.max_uses)
|
|
100
|
+
return payload
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def connection(
|
|
104
|
+
from_participant: components.Entity | components.EntityGroup | str,
|
|
105
|
+
to_participant: components.Entity | components.EntityGroup | str,
|
|
106
|
+
*,
|
|
107
|
+
min_uses: int | None = None,
|
|
108
|
+
max_uses: int | None = None,
|
|
109
|
+
) -> Connection:
|
|
110
|
+
"""Create an explicit access-chain connection fragment."""
|
|
111
|
+
_participant_name(from_participant, parameter="from_participant")
|
|
112
|
+
_participant_name(to_participant, parameter="to_participant")
|
|
113
|
+
return Connection(
|
|
114
|
+
from_participant=from_participant,
|
|
115
|
+
to_participant=to_participant,
|
|
116
|
+
min_uses=min_uses,
|
|
117
|
+
max_uses=max_uses,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def compute(
|
|
122
|
+
*,
|
|
123
|
+
start: str,
|
|
124
|
+
stop: str,
|
|
125
|
+
from_entity: components.Entity,
|
|
126
|
+
to_entity: components.Entity,
|
|
127
|
+
step_s: float | None = None,
|
|
128
|
+
compute_aer: bool | None = None,
|
|
129
|
+
use_light_time_delay: bool | None = None,
|
|
130
|
+
) -> dict[str, Any]:
|
|
131
|
+
"""Compute direct access between two entities."""
|
|
132
|
+
payload: dict[str, Any] = {
|
|
133
|
+
"Start": start,
|
|
134
|
+
"Stop": stop,
|
|
135
|
+
"FromObjectPath": _entity_to_wire(from_entity, parameter="from_entity"),
|
|
136
|
+
"ToObjectPath": _entity_to_wire(to_entity, parameter="to_entity"),
|
|
137
|
+
}
|
|
138
|
+
_include_if_supplied(payload, "OutStep", step_s)
|
|
139
|
+
_include_if_supplied(payload, "ComputeAER", compute_aer)
|
|
140
|
+
_include_if_supplied(payload, "UseLightTimeDelay", use_light_time_delay)
|
|
141
|
+
|
|
142
|
+
return raw.post("/access/AccessComputeV2", json=payload)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def chain(
|
|
146
|
+
*,
|
|
147
|
+
start: str,
|
|
148
|
+
stop: str,
|
|
149
|
+
participants: Sequence[components.Entity | components.EntityGroup],
|
|
150
|
+
start_participant: components.Entity | components.EntityGroup | str,
|
|
151
|
+
end_participant: components.Entity | components.EntityGroup | str,
|
|
152
|
+
connections: Sequence[Connection] | None = None,
|
|
153
|
+
use_light_time_delay: bool | None = None,
|
|
154
|
+
) -> dict[str, Any]:
|
|
155
|
+
"""Compute access over a named direct or multi-hop participant chain."""
|
|
156
|
+
payload: dict[str, Any] = {
|
|
157
|
+
"Start": start,
|
|
158
|
+
"Stop": stop,
|
|
159
|
+
"AllObjects": _participants_to_wire(participants),
|
|
160
|
+
"StartObject": _participant_name(
|
|
161
|
+
start_participant,
|
|
162
|
+
parameter="start_participant",
|
|
163
|
+
),
|
|
164
|
+
"EndObject": _participant_name(end_participant, parameter="end_participant"),
|
|
165
|
+
"Connections": (
|
|
166
|
+
_connections_to_wire(connections)
|
|
167
|
+
if connections is not None
|
|
168
|
+
else None
|
|
169
|
+
),
|
|
170
|
+
}
|
|
171
|
+
_include_if_supplied(payload, "UseLightTimeDelay", use_light_time_delay)
|
|
172
|
+
|
|
173
|
+
return raw.post("/access/ChainCompute", json=payload)
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""Public reusable component value objects for ASTROX SDK workflows.
|
|
2
|
+
|
|
3
|
+
ASTROX uses the word ``Orientation`` at two different levels. Entity
|
|
4
|
+
``Orientation`` fields are coordinate axes definitions from the ``CrdnAxes``
|
|
5
|
+
schema family: VVLH, LVLH, VNC, Fixed, FixedAtEpoch, Composite, and CZML-backed
|
|
6
|
+
axes. Sensor pointing and fixed axes then contain smaller Az/El, quaternion, or
|
|
7
|
+
Euler-angle orientation fragments. The SDK names those two levels separately:
|
|
8
|
+
public constructors and dataclasses use ``Axes`` for entity-level attitude
|
|
9
|
+
frames and ``Rotation`` for the inner Az/El, quaternion, or Euler fragments.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from ._axes import (
|
|
15
|
+
AlignedAndConstrainedAxes,
|
|
16
|
+
CompositeAxes,
|
|
17
|
+
CzmlAxes,
|
|
18
|
+
EntityAxes,
|
|
19
|
+
FixedAtEpochAxes,
|
|
20
|
+
FixedAxes,
|
|
21
|
+
LvlhAxes,
|
|
22
|
+
VncAxes,
|
|
23
|
+
VvlhAxes,
|
|
24
|
+
_axes_reference_name,
|
|
25
|
+
_axes_to_wire,
|
|
26
|
+
aligned_and_constrained_axes,
|
|
27
|
+
composite_axes,
|
|
28
|
+
czml_axes,
|
|
29
|
+
fixed_at_epoch_axes,
|
|
30
|
+
fixed_axes,
|
|
31
|
+
lvlh_axes,
|
|
32
|
+
vnc_axes,
|
|
33
|
+
vvlh_axes,
|
|
34
|
+
)
|
|
35
|
+
from ._constraints import (
|
|
36
|
+
AzElMaskConstraint,
|
|
37
|
+
Constraint,
|
|
38
|
+
ElevationConstraint,
|
|
39
|
+
RangeConstraint,
|
|
40
|
+
_constraint_to_wire,
|
|
41
|
+
az_el_mask_constraint,
|
|
42
|
+
elevation_constraint,
|
|
43
|
+
range_constraint,
|
|
44
|
+
)
|
|
45
|
+
from ._objects import Entity, EntityGroup, entity, entity_group
|
|
46
|
+
from ._positions import (
|
|
47
|
+
BallisticPosition,
|
|
48
|
+
CentralBodyPosition,
|
|
49
|
+
CzmlPosition,
|
|
50
|
+
CzmlPositionSTM,
|
|
51
|
+
CzmlPositions,
|
|
52
|
+
EntityPosition,
|
|
53
|
+
HpopPosition,
|
|
54
|
+
J2Position,
|
|
55
|
+
Sgp4Position,
|
|
56
|
+
SimpleAscentPosition,
|
|
57
|
+
SitePosition,
|
|
58
|
+
TwoBodyPosition,
|
|
59
|
+
_position_to_wire,
|
|
60
|
+
_site_position_to_wire,
|
|
61
|
+
ballistic_position,
|
|
62
|
+
central_body_position,
|
|
63
|
+
czml_position,
|
|
64
|
+
czml_positions,
|
|
65
|
+
hpop_position,
|
|
66
|
+
j2_position,
|
|
67
|
+
sgp4_position,
|
|
68
|
+
simple_ascent_position,
|
|
69
|
+
site_position,
|
|
70
|
+
two_body_position,
|
|
71
|
+
)
|
|
72
|
+
from ._rotations import (
|
|
73
|
+
AzElRotation,
|
|
74
|
+
EulerRotation,
|
|
75
|
+
QuaternionRotation,
|
|
76
|
+
Rotation,
|
|
77
|
+
_rotation_to_wire,
|
|
78
|
+
az_el_rotation,
|
|
79
|
+
euler_rotation,
|
|
80
|
+
quaternion_rotation,
|
|
81
|
+
)
|
|
82
|
+
from ._sensors import (
|
|
83
|
+
ConicSensor,
|
|
84
|
+
EntitySensor,
|
|
85
|
+
FixedSensorPointing,
|
|
86
|
+
RectangularSensor,
|
|
87
|
+
SensorPointing,
|
|
88
|
+
_sensor_pointing_to_wire,
|
|
89
|
+
_sensor_to_wire,
|
|
90
|
+
conic_sensor,
|
|
91
|
+
fixed_sensor_pointing,
|
|
92
|
+
rectangular_sensor,
|
|
93
|
+
)
|
|
94
|
+
from ._vgt import (
|
|
95
|
+
RaDecDirection,
|
|
96
|
+
VgtAngle,
|
|
97
|
+
VgtDirection,
|
|
98
|
+
VgtFixedVector,
|
|
99
|
+
VgtPlane,
|
|
100
|
+
VgtPoint,
|
|
101
|
+
VgtProvider,
|
|
102
|
+
VgtSystem,
|
|
103
|
+
VgtVector,
|
|
104
|
+
XyzDirection,
|
|
105
|
+
_direction_to_wire,
|
|
106
|
+
_vector_reference_name,
|
|
107
|
+
_vgt_to_wire,
|
|
108
|
+
ra_dec_direction,
|
|
109
|
+
vgt,
|
|
110
|
+
vgt_angle,
|
|
111
|
+
vgt_fixed_vector,
|
|
112
|
+
vgt_plane,
|
|
113
|
+
vgt_point,
|
|
114
|
+
vgt_system,
|
|
115
|
+
xyz_direction,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
__all__ = [
|
|
119
|
+
"AlignedAndConstrainedAxes",
|
|
120
|
+
"AzElRotation",
|
|
121
|
+
"BallisticPosition",
|
|
122
|
+
"CentralBodyPosition",
|
|
123
|
+
"AzElMaskConstraint",
|
|
124
|
+
"ConicSensor",
|
|
125
|
+
"CompositeAxes",
|
|
126
|
+
"Constraint",
|
|
127
|
+
"CzmlPosition",
|
|
128
|
+
"CzmlPositionSTM",
|
|
129
|
+
"CzmlPositions",
|
|
130
|
+
"CzmlAxes",
|
|
131
|
+
"ElevationConstraint",
|
|
132
|
+
"Entity",
|
|
133
|
+
"EntityAxes",
|
|
134
|
+
"EntityGroup",
|
|
135
|
+
"EntityPosition",
|
|
136
|
+
"EntitySensor",
|
|
137
|
+
"EulerRotation",
|
|
138
|
+
"FixedAtEpochAxes",
|
|
139
|
+
"FixedAxes",
|
|
140
|
+
"FixedSensorPointing",
|
|
141
|
+
"HpopPosition",
|
|
142
|
+
"J2Position",
|
|
143
|
+
"LvlhAxes",
|
|
144
|
+
"QuaternionRotation",
|
|
145
|
+
"RangeConstraint",
|
|
146
|
+
"RectangularSensor",
|
|
147
|
+
"Rotation",
|
|
148
|
+
"RaDecDirection",
|
|
149
|
+
"SensorPointing",
|
|
150
|
+
"Sgp4Position",
|
|
151
|
+
"SitePosition",
|
|
152
|
+
"SimpleAscentPosition",
|
|
153
|
+
"TwoBodyPosition",
|
|
154
|
+
"VgtAngle",
|
|
155
|
+
"VgtDirection",
|
|
156
|
+
"VgtFixedVector",
|
|
157
|
+
"VgtPlane",
|
|
158
|
+
"VgtPoint",
|
|
159
|
+
"VgtProvider",
|
|
160
|
+
"VgtSystem",
|
|
161
|
+
"VgtVector",
|
|
162
|
+
"VncAxes",
|
|
163
|
+
"VvlhAxes",
|
|
164
|
+
"XyzDirection",
|
|
165
|
+
"aligned_and_constrained_axes",
|
|
166
|
+
"az_el_rotation",
|
|
167
|
+
"az_el_mask_constraint",
|
|
168
|
+
"ballistic_position",
|
|
169
|
+
"central_body_position",
|
|
170
|
+
"conic_sensor",
|
|
171
|
+
"composite_axes",
|
|
172
|
+
"czml_position",
|
|
173
|
+
"czml_positions",
|
|
174
|
+
"czml_axes",
|
|
175
|
+
"entity",
|
|
176
|
+
"entity_group",
|
|
177
|
+
"euler_rotation",
|
|
178
|
+
"elevation_constraint",
|
|
179
|
+
"fixed_axes",
|
|
180
|
+
"fixed_at_epoch_axes",
|
|
181
|
+
"fixed_sensor_pointing",
|
|
182
|
+
"hpop_position",
|
|
183
|
+
"j2_position",
|
|
184
|
+
"lvlh_axes",
|
|
185
|
+
"quaternion_rotation",
|
|
186
|
+
"range_constraint",
|
|
187
|
+
"ra_dec_direction",
|
|
188
|
+
"rectangular_sensor",
|
|
189
|
+
"vgt",
|
|
190
|
+
"vgt_angle",
|
|
191
|
+
"vgt_fixed_vector",
|
|
192
|
+
"vgt_plane",
|
|
193
|
+
"vgt_point",
|
|
194
|
+
"vgt_system",
|
|
195
|
+
"vnc_axes",
|
|
196
|
+
"vvlh_axes",
|
|
197
|
+
"xyz_direction",
|
|
198
|
+
"sgp4_position",
|
|
199
|
+
"site_position",
|
|
200
|
+
"simple_ascent_position",
|
|
201
|
+
"two_body_position",
|
|
202
|
+
]
|