Cross-check duplicate numerics, fix scalar high-e Kepler crash, canonicalize geodesics (item 6)#13
Merged
Merged
Conversation
…e geodesics - Fix orbital_dynamics.solve_kepler: scalar input with eccentricity > 0.8 raised TypeError because NumPy ufuncs collapse 0-d inputs to scalars and the high-eccentricity starting guess used in-place item assignment. - Make pyproj.Geod (Karney) the canonical WGS84 geodesic in validation.py, matching search.py and sensitivity.py; the retired Vincenty inverse is preserved verbatim in the new test module as an independent reference. - Add tests/test_numeric_crosschecks.py pinning the two Kepler solvers (< 1e-12 rad wrapped), the two element->state converters (< 1 mm, < 1 um/s), and Geod vs the Vincenty reference (sub-mm), plus a regression test for the scalar high-eccentricity crash.
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Work-plan item 6: the repo carries duplicate implementations of three numeric pieces. This PR pins them against each other with tests, fixes a real latent bug the cross-check flushed out, and reduces the geodesics to one canonical implementation.
orbital_dynamics.solve_keplercrashed withTypeErrorfor scalar input wheneccentricity > 0.8: NumPy ufuncs collapse 0-d inputs to scalars, sonp.mod(np.asarray(scalar), 2π)returnsnp.float64and the high-eccentricity starting guesseccentric[...] = np.pifailed on item assignment. This meanselements_to_statewith e > 0.8 crashed on main. Fixed withnp.full_like/ explicit array copy; behavior for array inputs and e ≤ 0.8 is bit-identical.validation.wgs84_geodesic_distance_kmnow delegates topyproj.Geod(ellps="WGS84").inv(Karney), the same implementationsearch.pyandsensitivity.pyalready use (pyproj became a declared dependency in fix: declare pyproj as a direct dependency #5). Signature and name unchanged. The retired hand-rolled Vincenty inverse moves verbatim into the test module as an independent reference.tests/test_numeric_crosschecks.py:orbital_dynamics.elements_to_statevsstability.orbital_elements_to_icrf_state, which is deliberately standalone) agree to < 1 mm and < 1 µm/s over a 7,200-case element grid;Measured agreement in a NumPy-only replica before encoding tolerances: 8.9e-15 rad (Kepler, wrapped), 2.9e-10 km and 2.0e-14 km/s (element→state grid) — the asserted tolerances have 3+ orders of margin.
stability._solve_keplerand its converter are intentionally kept (the module documents standalone capability); the cross-check tests now guard against divergence instead of deleting the redundancy.Scientific impact
Effectively none, but stated honestly:
validation_report.jsoncoordinate-error values may shift in far decimal places, orders of magnitude below the 25 km target. No pass/fail status can change.Checklist