Release GIL in Python bindings; simplification cleanups; criterion benchmark suite#119
Open
ssmichael1 wants to merge 3 commits into
Open
Release GIL in Python bindings; simplification cleanups; criterion benchmark suite#119ssmichael1 wants to merge 3 commits into
ssmichael1 wants to merge 3 commits into
Conversation
Python bindings: - propagate, TLE.fit_from_states, sgp4 (all input forms), and the array-valued frame-transform/ephemeris helpers now run detached (Python::detach) so other Python threads progress during long calls - sgp4 paths clone the TLE, compute detached, and write back the cached SGP4 init state; batch list path extracts sources under the GIL and computes detached - shared reject_unused_kwargs helper replaces three hand-rolled extraneous-kwargs folds; duration() now rejects unknown kwargs instead of silently ignoring them - quaternion/itrfcoord/kepler pickle impls share pack_f64s/unpack_f64s (wire format unchanged); vec3 array helpers drop per-element unsafe pointer copies Rust core: - earth_orientation_params::get_or_zero / eop_from_mjd_utc_or_zero helpers replace repeated .unwrap_or([0.0; 6]) pattern - remove dead legacy finals2000A.all EOP loader and its error variants - lpephem::moon::phase wrap via rem_euclid (dead branch removed); use std::f64::consts::TAU for 2*pi literals - delete stray scratch files test.py / test2.py Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
benches/hotpaths.rs covers the per-call costs that dominate real workloads: high-precision propagation (LEO drag / GEO RKV98, GEO Gauss-Jackson 8, LEO with STM), SGP4 cold + cached over 1 day at 1-minute cadence, frame transforms (exact and approx), spherical harmonic gravity (degree 4/16, with partials), JPL ephemeris lookups, and NRLMSISE-00 density. Baseline (M-series macOS, --quick): - propagation/leo_drag_1day_rkv98 12.9 ms - propagation/leo_stm_1day_rkv98 33.8 ms - propagation/geo_1day_rkv98 685 us - propagation/geo_1day_gj8 494 us - sgp4 1-day @ 1-min (1441 pts) 404 us (~280 ns/step) - frametransform/qgcrf2itrf 18.9 us - frametransform/qgcrf2itrf_approx 159 ns - earthgravity/accel_deg4 85 ns - jplephem/moon_geocentric_pos 24 ns - nrlmsise/density_400km 1.5 us Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds a 'Local Tangent Planes and Working with Many Coordinates' section to the Geodetic Coordinates tutorial: scalar to_enu/to_ned usage (which the intro promised but no section covered), the one-rotation numpy matmul pattern for batch ENU/NED (~15 ms/million points vs ~1 s/million looped), and the per-point comprehension pattern for Cartesian -> geodetic. Documents that batched itrfcoord inputs are deliberately not part of the API (context: issue #118). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Three threads of work, no behavior changes to numerical results:
Python bindings release the GIL during long computations
propagate,TLE.fit_from_states,sgp4(all three input forms), and every array-valued frame-transform / ephemeris helper now run detached (Python::detach), so other Python threads make progress during multi-second propagations and large batch transforms.qgcrf2itrfcall over 100k times (previously it would have been blocked the entire time).Simplification cleanups
earth_orientation_params::get_or_zero/eop_from_mjd_utc_or_zeroreplace six copies of.unwrap_or([0.0; 6]).finals2000A.allEOP loader and its three orphaned error variants.lpephem::moon::phasewrap simplified torem_euclid(the> 2πbranch was unreachable);2.0 * PIliterals →std::f64::consts::TAU.reject_unused_kwargshelper replaces three hand-rolled extraneous-kwargs folds.quaternion/itrfcoord/keplerpickle impls sharepack_f64s/unpack_f64s; wire format is byte-identical, old pickles load unchanged.unsafepointer copies.Two deliberate behavior changes (both changelogged):
duration(day=1)(typo'd kwargs) now raisesValueError— previously silently ignored, returning a zero duration.propsettingsinvalid kwargs raiseValueErrorinstead ofRuntimeError, for consistency.Criterion benchmark suite
benches/hotpaths.rs(cargo bench) baselines the hot paths: propagation per regime/integrator, SGP4 cold + cached, frame transforms, spherical-harmonic gravity, JPL ephemeris, NRLMSISE-00. Key numbers (M-series macOS): LEO+drag 1-day 12.9 ms, +STM 33.8 ms, GEO 685 µs, SGP4 ~280 ns/step, exactqgcrf2itrf18.9 µs vs 159 ns approx.Test plan
cargo test: 190 lib + 41 integration tests passpytest python/test/: 97 tests passcargo bench --bench hotpaths -- --quickruns clean🤖 Generated with Claude Code