Match SPICE last-loaded-wins precedence for overlapping segments#83
Merged
Conversation
When a key's segments overlap, return the later segment to match SPICE's last-loaded-takes-precedence rule (and the pre-0.5.0 to_h behaviour the multi-segment routing replaced). Real kernels split bodies into contiguous, non-overlapping intervals, so this only matters at the edges of a genuine overlap.
Merged
rhannequin
added a commit
that referenced
this pull request
Jun 22, 2026
## [0.5.0] - 2026-06-23 ### Features - Read binary PCK (`DAF/PCK`) orientation kernels via `Ephem::PCK`, exposing a body's Euler angles and rates over time (`angles_at`, `orientation_at`), the foundation for DE440-grade lunar libration ([#76], [#80]) - Add `Ephem::Core::Orientation` (Euler angles + optional rates) and `Ephem::Core::Rotation` (kernel-agnostic rotation-matrix helpers), plus `Orientation#to_matrix` / `OrientationSegment#matrix_at` for the built-in 3-1-3 (Z-X-Z) reference→body convention - Excerpt and the `excerpt` CLI now support binary PCK kernels, detecting the kernel kind automatically - Download binary PCK lunar orientation kernels from NAIF via `Ephem::Download` - Add `#inspect` and `#to_s` to `State` for easier debugging ([#67]) ### Improvements - Route queries to the covering segment when a body/pair spans multiple time-split segments (SPK and PCK), with no overhead for single-segment keys - Share the type-2 Chebyshev machinery between SPK and PCK segments - Evaluate position and velocity in a single Chebyshev pass (`ChebyshevPolynomial.evaluate_with_derivative`), speeding up every state / orientation query (`compute_and_differentiate`, `state_at`, `orientation_at`) with bit-for-bit identical results - Correct the documented velocity unit to km/day (the actual, validated value) - Remove the `numo-narray` dependency ([#65]) - Skip derivative evaluation in `Segment#compute` ([#57]) - Hoist loop-invariant `t2` computation in Chebyshev evaluation ([#58]) - Cache the `RecordParser` instance in `SummaryManager` ([#63]) - Eliminate a redundant `read_record` call in `SummaryManager` ([#62]) - Replace duplicated endianness format lookups with shared constants ([#64]) - Replace `instance_variable_get` with proper `attr_reader`s in `Excerpt` ([#66]) - Use separate error margins for position and velocity validation ([#61]) - Add a comprehensive benchmark suite ([#68]) - Upgrade default Ruby to 4.0.5 ([#81]) - Match SPICE last-loaded-wins precedence for overlapping segments ([#83]) - Add a dedicated spec for the shared type-2 Chebyshev evaluation ([#84]) - Bump standard from 1.50.0 to 1.55.0 by @dependabot ([#45], [#46], [#56], [#78]) - Bump actions/checkout from 4 to 7 by @dependabot ([#44], [#52], [#79]) - Bump rake from 13.3.0 to 13.4.2 by @dependabot ([#48], [#73]) - Bump zlib from 3.2.1 to 3.2.3 by @dependabot ([#49], [#70]) - Bump rspec from 3.13.1 to 3.13.2 by @dependabot ([#47]) - Bump parallel from 1.27.0 to 1.28.0 by @dependabot ([#71]) - Bump benchmark-ips from 2.14.0 to 2.15.1 by @dependabot ([#75]) - Bump json from 2.18.1 to 2.19.2 by @dependabot ([#77]) ### Bug fixes - Fix `compute_and_differentiate` returning mismatched velocities for an array of times - Fix precision loss in `time_to_seconds` for dates far from J2000 ([#60]) [#44]: #44 [#45]: #45 [#46]: #46 [#47]: #47 [#48]: #48 [#49]: #49 [#52]: #52 [#56]: #56 [#57]: #57 [#58]: #58 [#60]: #60 [#61]: #61 [#62]: #62 [#63]: #63 [#64]: #64 [#65]: #65 [#66]: #66 [#67]: #67 [#68]: #68 [#70]: #70 [#71]: #71 [#73]: #73 [#75]: #75 [#76]: #76 [#77]: #77 [#78]: #78 [#79]: #79 [#80]: #80 [#81]: #81 [#83]: #83 [#84]: #84 **Full Changelog**: v0.4.1...v0.5.0
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.
The 0.5.0 multi-segment time-split routing resolved a time to the first
matching segment (
@segments.find). The pre-0.5.0 code built its segmentmap with
to_h, which for duplicate keys kept the last segment —matching SPICE's last-loaded-takes-precedence rule.
This restores that behaviour by searching in reverse (
reverse_each.find).Real DE/PCK kernels split a body into contiguous, non-overlapping
intervals, so this is only observable at the edges of a genuine overlap,
but it keeps ephem consistent with SPICE and with the pre-0.5.0 semantics.
Found while auditing the new routing for the 0.5.0 release.
🤖 Generated with Claude Code