Skip to content

Refactor FrameRotationProvider and improve code formatting#67

Merged
VPRamon merged 8 commits intomainfrom
iau2000a
Mar 28, 2026
Merged

Refactor FrameRotationProvider and improve code formatting#67
VPRamon merged 8 commits intomainfrom
iau2000a

Conversation

@VPRamon
Copy link
Copy Markdown
Member

@VPRamon VPRamon commented Mar 16, 2026

This pull request introduces a significant refactor and generalization of the nutation model infrastructure in the codebase. The main change is the introduction of a NutationModel trait and two concrete models (IAU 2006/2000A and IAU 2000B), enabling type-level selection of nutation models throughout the astrometry pipeline. This allows for more flexible, accurate, and extensible handling of nutation computations, and paves the way for full-precision astrometry by default. Several public APIs and internal functions are updated to be generic over nutation models, and the full IAU 2006/2000A implementation is added.

Nutation model infrastructure and generalization:

  • Introduced the NutationModel trait and two marker types, Iau2006A (full, 1365-term, sub-µas model) and Iau2000B (77-term, ~1 mas model), in a new src/astro/nutation/mod.rs module. The trait enables compile-time selection of nutation models via the AstroContext type parameter.
  • Updated all relevant function signatures and APIs (e.g., in earth_rotation_provider.rs, horizontal.rs, observer_state.rs, and coordinate transforms) to be generic over Nut: NutationModel, ensuring model-agnostic nutation handling throughout the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Full IAU 2006/2000A nutation model implementation:

  • Added new files nut00a.rs and nut00a_tables.rs implementing the full IAU 2006/2000A nutation model, including all 1365 terms and IAU 2006 precession corrections, with extensive documentation and tests.

Documentation and API improvements:

  • Significantly expanded and clarified the documentation for the nutation module, explaining model selection, usage, and references. Updated related documentation in the precession module to reference both nutation models. [1] [2]

These changes modernize the nutation infrastructure, improve accuracy, and make the codebase more maintainable and extensible for future astrometric improvements.

VPRamon added 3 commits March 11, 2026 22:36
- Updated the rotation methods in frames_planetary.rs and frames_teme.rs to require NutationModel as a generic parameter.
- Modified the implementation of the rotation methods to utilize the NutationModel for computing nutation values.
- Adjusted the FrameRotationProvider trait definition in mod.rs to include NutationModel.
- Enhanced tests in tests.rs to ensure compliance with the new NutationModel integration, including regression tests against ERFA values.
- Updated mathematical expressions in `nut00a.rs` for improved readability by consolidating lines.
- Changed `const` to `static` for `NUT00A_LS` and `NUT00A_PL` in `nut00a_tables.rs` to reflect proper usage.
- Enhanced function signatures in `horizontal.rs` and `to_topocentric.rs` for better clarity and consistency.
- Reformatted assertions in tests for improved readability in `bias.rs` and `tests.rs`.
- Cleaned up import statements in `mod.rs` for better organization.
- Improved formatting of matrix definitions in `tests.rs` for better alignment and readability.
@VPRamon VPRamon self-assigned this Mar 16, 2026
@VPRamon VPRamon added the enhancement New feature or request label Mar 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 16, 2026

Code Coverage

Package Line Rate Complexity Health
src.astro.nutation 95% 0
src.calculus.solar 95% 0
src.calculus.stellar 94% 0
src.calculus 95% 0
src.calculus.ephemeris 96% 0
src.coordinates.transform.providers 96% 0
src.coordinates 98% 0
src.calculus.jpl 96% 0
src.calculus.elp2000 99% 0
src.calculus.lunar 93% 0
src.calculus.azimuth 92% 0
src.coordinates.observation 97% 0
src.calculus.kepler_equations 92% 0
src.calculus.math_core 96% 0
src.calculus.altitude 94% 0
src.calculus.vsop87 100% 0
src 100% 0
src.targets 99% 0
src.data 89% 0
src.astro 89% 0
src.bodies 100% 0
src.coordinates.transform.frames 95% 0
src.coordinates.transform.centers 100% 0
src.coordinates.transform.centers.position 77% 0
src.coordinates.transform 90% 0
Summary 94% (12813 / 13638) 0

VPRamon added 5 commits March 16, 2026 23:03
- Introduced runtime-selectable Earth orientation model presets to allow for more flexible transformations in astronomical calculations.
- Updated the `TransformCenter` trait to accept custom ephemeris, Earth orientation, and nutation model types for expert users.
- Refactored various transformation functions to utilize the new context models, ensuring compatibility with the updated trait signatures.
- Improved documentation throughout the codebase for clarity on the new features and their usage.
- Added tests to verify the correct behavior of the new runtime model selection in transformations.
- Removed NutationModel from AstroContext in various rotation and shift functions across frames_planetary.rs, frames_teme.rs, and mod.rs.
- Updated related tests to reflect changes in AstroContext instantiation.
- Introduced new functions for frame rotation and center shift that accept a generic context type, allowing for more flexible usage.
@VPRamon VPRamon merged commit c65dde2 into main Mar 28, 2026
6 checks passed
@VPRamon VPRamon deleted the iau2000a branch March 29, 2026 20:46
VPRamon added a commit that referenced this pull request Apr 30, 2026
Refactor FrameRotationProvider and improve code formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant