Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Dec 13, 2024
1 parent 1f12032 commit 2ad16e6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion crates/lox-space/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def estrack():
]
return {
name: lox.GroundLocation(
lox.Planet("Earth"), np.radians(lon), np.radians(lat), 0
lox.Origin("Earth"), np.radians(lon), np.radians(lat), 0
)
for name, lat, lon in stations
}
19 changes: 11 additions & 8 deletions crates/lox-space/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
import pytest


@pytest.mark.parametrize("obj", [
lox.Sun(),
lox.Barycenter("Solar System Barycenter"),
lox.Planet("Earth"),
lox.Satellite("Moon"),
lox.MinorBody("Ceres"),
lox.ElevationMask.fixed(0.0),
])
@pytest.mark.parametrize(
"obj",
[
# lox.Sun(),
# lox.Barycenter("Solar System Barycenter"),
# lox.Planet("Earth"),
# lox.Satellite("Moon"),
# lox.MinorBody("Ceres"),
lox.ElevationMask.fixed(0.0),
],
)
def test_pickle(obj):
pickled = pickle.dumps(obj)
unpickled = pickle.loads(pickled)
Expand Down
6 changes: 4 additions & 2 deletions crates/lox-space/tests/test_propagators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ def test_sgp4():
t1 = sgp4.time() + lox.TimeDelta.from_minutes(92.821)
s1 = sgp4.propagate(t1)
k1 = s1.to_keplerian()
assert k1.orbital_period().to_decimal_seconds() == pytest.approx(92.821 * 60, rel=1e-4)
assert k1.orbital_period().to_decimal_seconds() == pytest.approx(
92.821 * 60, rel=1e-4
)


def test_ground(provider):
lat = np.radians(40.4527)
lon = np.radians(-4.3676)
tai = lox.UTC.from_iso("2022-01-31T23:00:00").to_tai()
loc = lox.GroundLocation(lox.Planet("Earth"), lon, lat, 0.0)
loc = lox.GroundLocation(lox.Origin("Earth"), lon, lat, 0.0)
ground = lox.GroundPropagator(loc, provider)
expected = np.array([-1765.9535510583582, 4524.585984442561, 4120.189198495323])
actual = ground.propagate(tai).position()
Expand Down
4 changes: 2 additions & 2 deletions crates/lox-space/tests/test_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_state_to_ground_location():
time = lox.Time.from_iso("2024-07-05T09:09:18.173 TAI")
position = (-5530.01774359, -3487.0895338, -1850.03476185)
velocity = (1.29534407, -5.02456882, 5.6391936)
state = lox.State(time, position, velocity, lox.Planet("Earth"), lox.Frame("ICRF"))
state = lox.State(time, position, velocity, lox.Origin("Earth"), lox.Frame("ICRF"))
ground = state.to_ground_location()
assert ground.longitude() == pytest.approx(2.646276127963636)
assert ground.latitude() == pytest.approx(-0.2794495715104036)
Expand All @@ -49,7 +49,7 @@ def test_state_to_origin(ephemeris):
tai = utc.to_tai()

s_earth = lox.State(tai, tuple(r), tuple(v))
s_venus = s_earth.to_origin(lox.Planet("Venus"), ephemeris)
s_venus = s_earth.to_origin(lox.Origin("Venus"), ephemeris)

r_act = s_venus.position()
v_act = s_venus.velocity()
Expand Down

0 comments on commit 2ad16e6

Please sign in to comment.