Skip to content

Commit

Permalink
fix: fix switched radii
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Dec 19, 2024
1 parent 162084a commit 0a605b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/lox-bodies/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ pub trait Spheroid: TriaxialEllipsoid {

pub trait TrySpheroid: TryTriaxialEllipsoid {
fn try_equatorial_radius(&self) -> Result<f64, UndefinedOriginPropertyError> {
self.try_radii().map(|radii| radii.2)
self.try_radii().map(|radii| radii.0)

Check warning on line 81 in crates/lox-bodies/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/lox-bodies/src/lib.rs#L81

Added line #L81 was not covered by tests
}

fn try_polar_radius(&self) -> Result<f64, UndefinedOriginPropertyError> {
self.try_radii().map(|radii| radii.0)
self.try_radii().map(|radii| radii.2)

Check warning on line 85 in crates/lox-bodies/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/lox-bodies/src/lib.rs#L85

Added line #L85 was not covered by tests
}

fn try_flattening(&self) -> Result<f64, UndefinedOriginPropertyError> {
Expand Down
4 changes: 2 additions & 2 deletions crates/lox-space/tests/test_propagators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def test_ground(provider):
tai = lox.UTC.from_iso("2022-01-31T23:00:00").to_tai()
loc = lox.GroundLocation(lox.Origin("Earth"), lon, lat, 0.0)
ground = lox.GroundPropagator(loc, provider)
expected = np.array([-1760.0326388434466, 4509.415893243589, 4106.374974141291])
expected = np.array([-1765.9535510583582, 4524.585984442561, 4120.189198495323])
actual = ground.propagate(tai).position()
npt.assert_allclose(actual, expected, rtol=1e-4)
npt.assert_allclose(actual, expected)
6 changes: 3 additions & 3 deletions crates/lox-space/tests/test_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def test_state_to_ground_location():
np.array([-3.53237875783652, -3.152377656863808, 5.642296713889555]),
)
ground = state.to_ground_location()
assert ground.longitude() == pytest.approx(2.643578045424445, rel=1e-4)
assert ground.latitude() == pytest.approx(-0.2794439537542346, abs=1e-4)
assert ground.altitude() == pytest.approx(439.2316688043311, rel=1e-4)
assert ground.longitude() == pytest.approx(2.643578045424445)
assert ground.latitude() == pytest.approx(-0.27944957125091063)
assert ground.altitude() == pytest.approx(417.8524151150059)


def test_state_to_origin(ephemeris):
Expand Down

0 comments on commit 0a605b9

Please sign in to comment.