From 2ad16e62c466c33bdbe096d88cd567be6cfe6163 Mon Sep 17 00:00:00 2001 From: Helge Eichhorn Date: Fri, 13 Dec 2024 15:06:38 +0100 Subject: [PATCH] WIP --- crates/lox-space/tests/conftest.py | 2 +- crates/lox-space/tests/test_pickle.py | 19 +++++++++++-------- crates/lox-space/tests/test_propagators.py | 6 ++++-- crates/lox-space/tests/test_states.py | 4 ++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/crates/lox-space/tests/conftest.py b/crates/lox-space/tests/conftest.py index b5c56521..cb6c2e39 100644 --- a/crates/lox-space/tests/conftest.py +++ b/crates/lox-space/tests/conftest.py @@ -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 } diff --git a/crates/lox-space/tests/test_pickle.py b/crates/lox-space/tests/test_pickle.py index b90f33e6..34afb07d 100644 --- a/crates/lox-space/tests/test_pickle.py +++ b/crates/lox-space/tests/test_pickle.py @@ -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) diff --git a/crates/lox-space/tests/test_propagators.py b/crates/lox-space/tests/test_propagators.py index dd2a95c6..ec43bccf 100644 --- a/crates/lox-space/tests/test_propagators.py +++ b/crates/lox-space/tests/test_propagators.py @@ -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() diff --git a/crates/lox-space/tests/test_states.py b/crates/lox-space/tests/test_states.py index 441f3b15..1b8e74a0 100644 --- a/crates/lox-space/tests/test_states.py +++ b/crates/lox-space/tests/test_states.py @@ -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) @@ -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()