Repository navigation
Apply nutation after precession for deep-sky objects without an ephemeris - #316
Merged
Merged
Conversation
…eris Closes #313 Without an ephemeris, `DeepSkyObjectPosition` rotated the position and velocity by precession * nutation. The nutation matrix is expressed in mean-of-date axes, so it has to be applied after precession, as `Apparent` does since #250. This branch was missed back then. The rotation is now nutation * precession. The apparent position of a star changes by up to about 0.1 arcsecond depending on the date, about 0.05 arcsecond today, and now matches ERFA and Skyfield. It also agrees with the position computed when `ephem:` is given. The two specs for the no-ephemeris case have new expected values, and a new spec covers the rotation order for position and velocity.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the deep-sky apparent-frame correction.
No open issues 🎉
What changed in this PR
Fixes #313 by applying nutation after precession for deep-sky objects without an ephemeris, extending the correction from #250 to this calculation path.
Changes:
- Routes all deep-sky apparent-frame calculations through
Apparent.build_from_astrometric. - Makes Earth’s geometric frame optional, skipping aberration when it is absent.
- Updates coordinate expectations, adds velocity and optional-Earth coverage, and documents the fix.
| File | Description |
|---|---|
spec/astronoby/reference_frames/apparent_spec.rb |
Tests that omitting Earth matches using a motionless Earth. |
spec/astronoby/bodies/deep_sky_object_position_spec.rb |
Updates coordinate expectations and adds velocity regression coverage. |
lib/astronoby/reference_frames/apparent.rb |
Accepts an optional Earth frame and conditionally applies aberration. |
lib/astronoby/bodies/deep_sky_object_position.rb |
Replaces duplicated rotation logic with the shared apparent-frame builder. |
CHANGELOG.md |
Documents the rotation-order fix and remaining absence of aberration without an ephemeris. |
Review effort: Balanced
rhannequin
added a commit
that referenced
this pull request
Oct 31, 2026
Closes #314 Converting many points for one observer and one instant with `DeepSkyObject#at(instant).observed_by(observer).horizontal` rebuilds the reference frames and the sidereal time for each point. `HorizontalTransformation` computes the nutation and precession rotation and the local apparent sidereal time once, then `apply` converts equatorial coordinates at J2000 epoch to horizontal coordinates. A point takes about 4 µs instead of about 280 µs. The result is the one of a `DeepSkyObject` without an ephemeris: fixed directions, with no aberration, proper motion or parallax. `refraction:` is optional, and coordinates that are not at J2000 epoch raise `IncompatibleArgumentsError`. Based on #316, as the two paths only agree once nutation is applied after precession there. To be retargeted to `main` once it is merged.
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.
Closes #313
Without an ephemeris,
DeepSkyObjectPositionrotated the position and velocity by precession * nutation. The nutation matrix is expressed in mean-of-date axes, so it has to be applied after precession, asApparentdoes since #250. That branch had its own copy of the rotation and was missed back then. It now goes throughApparent.build_from_astrometric, which takesearth_geometric:as optional and skips aberration when it is absent.The apparent position of a star changes by up to about 0.1 arcsecond depending on the date, about 0.05 arcsecond today, and now matches ERFA and Skyfield. Without an ephemeris there is still no aberration, so the position differs from the one computed with
ephem:by up to about 20 arcseconds.The two specs for the no-ephemeris case have new expected values with ERFA, Skyfield and Astropy references, and new specs cover the velocity and
Apparent.build_from_astrometricwithout Earth.