Skip to content

Apply nutation after precession for deep-sky objects without an ephemeris - #316

Merged
rhannequin merged 3 commits into
mainfrom
claude/astronoby-issue-313-validation-e22673
Oct 31, 2026
Merged

rhannequin merged 3 commits into
mainfrom
claude/astronoby-issue-313-validation-e22673

Conversation

@rhannequin

@rhannequin rhannequin commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

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. That branch had its own copy of the rotation and was missed back then. It now goes through Apparent.build_from_astrometric, which takes earth_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_astrometric without Earth.

…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.
@rhannequin rhannequin self-assigned this Oct 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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
rhannequin merged commit ca70190 into main Oct 31, 2026
45 checks passed
@rhannequin
rhannequin deleted the claude/astronoby-issue-313-validation-e22673 branch October 31, 2026 20:27
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepSkyObject without an ephemeris applies precession and nutation in the wrong order

2 participants