Skip to content

Implement new aberration correction#136

Merged
rhannequin merged 1 commit intomainfrom
new-aberration-correction
Feb 24, 2025
Merged

Implement new aberration correction#136
rhannequin merged 1 commit intomainfrom
new-aberration-correction

Conversation

@rhannequin
Copy link
Owner

What is aberration?

Aberration of light is the apparent shift in the position of a celestial object due to the observer's motion. Essentially, if you're moving relative to the light source, the light appears to come from a slightly different direction. It's similar to how raindrops appear to fall at an angle when you're running.

The stellar aberration of light is one of the physical effects that affect an apparent object in the sky. A precise and accurate aberration correction is necessary for a final precise and accurate apparent position.

This new implementation is inspired by Skyfield, and sourced by the Explanatory Supplement to the Astronomical Almanac by Sean E. Urban and O. Kenneth Seidelmann (University Science Books).

At the moment, the naming Aberration2 is not great, but this new class will replace the legacy Aberration once all the steps are ready for computing an apparent position.

Usage

time = Time.utc(2025, 4, 1)
instant = Astronoby::Instant.from_time(time)

ephem = Astronoby::Ephem.load("tmp/de440s.bsp")
earth = Astronoby::Earth.new(instant: instant, ephem: ephem)
mars = Astronoby::Mars.new(instant: instant, ephem: ephem)

aberration = Astronoby::Aberration2.new(
  astrometric_position: mars.astrometric.position,
  observer_velocity: earth.geometric.velocity
)

aberration.corrected_position.map(&:km).map(&:round)
# => Vector[-67181971, 140334599, 69466965]

Accuracy

The values are compared with Skyfield, it can be reproduced with the following code snippet:

from skyfield.api import load
from skyfield.relativity import add_aberration
from skyfield.constants import AU_KM

ts = load.timescale()
t = ts.utc(2025, 8, 1, 0, 0, 0)

planets = load('de440s.bsp')
earth, target = planets['earth'], planets['neptune barycenter']

barycentric = target.at(t)
astrometric = earth.at(t).observe(target)

position = astrometric.position.au.copy()
velocity = astrometric.center_barycentric.velocity.au_per_d.copy()
light_time = astrometric.light_time.copy()

add_aberration(position, velocity, light_time)

print(position[0] * AU_KM, position[1] * AU_KM, position[2] * AU_KM)
# => 4375222143.58675 154854262.90884656 -45253746.55063224

> Aberration of light is the apparent shift in the position of a celestial
> object due to the observer's motion. Essentially, if you're moving relative
> to the light source, the light appears to come from a slightly different
> direction. It's similar to how raindrops appear to fall at an angle when
> you're running.

This new implementation is inspired by Skyfield, and sourced by the
_Explanatory Supplement to the Astronomical Almanac_ by Sean E. Urban
and O. Kenneth Seidelmann (University Science Books).

The stellar aberration of light is one of the physical effects that
affect an apparent object in the sky. A precise and accurate aberration
correction is necessary for a final precise and accurate apparent
position.

The values are compared with Skyfield, it can be reproduced with the
following code snippet:

```py
from skyfield.api import load
from skyfield.relativity import add_aberration
from skyfield.constants import AU_KM

ts = load.timescale()
t = ts.utc(2025, 8, 1, 0, 0, 0)

planets = load('de440s.bsp')
earth, target = planets['earth'], planets['neptune barycenter']

barycentric = target.at(t)
astrometric = earth.at(t).observe(target)

position = astrometric.position.au.copy()
velocity = astrometric.center_barycentric.velocity.au_per_d.copy()
light_time = astrometric.light_time.copy()

add_aberration(position, velocity, light_time)

print(position[0] * AU_KM, position[1] * AU_KM, position[2] * AU_KM)
 # => 4375222143.58675 154854262.90884656 -45253746.55063224
```
@rhannequin rhannequin self-assigned this Feb 21, 2025
@rhannequin rhannequin merged commit 79adaaa into main Feb 24, 2025
34 checks passed
@rhannequin rhannequin deleted the new-aberration-correction branch February 24, 2025 20:07
@rhannequin rhannequin mentioned this pull request Apr 30, 2025
rhannequin added a commit that referenced this pull request May 12, 2025
## 0.7.0 - 2025-05-12

_If you are upgrading: please see [UPGRADING.md]._

### Bug fixes

* Fix Moon monthly phase events calculation by @valeriy-sokoloff in ([#124])

### Features

* Add `Instant` value object ([#121])
* Introduce barycentric position of Solar System major bodies ([#127])
* Introduce Astrometric position for planets ([#129])
* Rename Barycentric into Geometric ([#130])
* Rename IRCF and remove module Position ([#131])
* Geometric and Astrometric reference frames with coordinates ([#132])
* Ecliptic coordinates for Geometric and Astrometric reference frames ([#134])
* Add Geometric and Astrometric positions for `Sun` and `Moon` ([#135])
* Implement new aberration correction ([#136])
* Precession matrix for 2006 P03 model ([#137])
* Introduce `MeanOfDate` reference frame ([#138])
* New nutation model ([#141])
* Light deflection correction ([#142])
* Introduce `Apparent` reference frame ([#143])
* Introduce `Topocentric` reference frame ([#145])
* Improve Vector integration with value objects ([#146])
* Handle refracted topocentric horizontal coordinates ([#147])
* Add `#angular_diameter` to apparent and topocentric reference frames ([#149])
* Introduce new calculator for rising, transit and setting times ([#148])
* Clean code after Ephem refactoring ([#152])
* Improve `RisingTransitSettingEventsCalculator` ([#155])
* Simplify `RisingTransitSettingEventsCalculator` ([#156])
* Lazy-load reference frames ([#157])
* Overall performance improvements ([#163])
* Add support for IMCCE INPOP by @JoelQ and @rhannequin ([#166])
* Update INPOP excerpt in spec data ([#167])
* Introduce a better rise/transit/set calculator ([#168])
* Drop `Astronoby::Observer#observe` ([#174])

### Improvements

* Bump standard from 1.42.1 to 1.49.0 by @dependabot ([#123], [#128], [#150], [#165])
* Bump rubyzip from 2.3.2 to 2.4.1 by @dependabot ([#120])
* Add more tests for Julian Date conversion ([#122])
* Upgrade main Ruby version and supported ones ([#125])
* Update email address and gem description ([#126])
* Increase precision of mean obliquity ([#133])
* Add supported Rubies ([#139])
* Set Ruby 3.4.2 as default version ([#140])
* Fix dependency secutiry patch ([#151])
* Improve HMS/DMS formats ([#153])
* Use excerpts ephemerides for specs of Sun and Moon ([#154])
* Add link to deprecated documentation ([#160])
* Default Ruby 3.4.3 and support recent rubies ([#169])
* Better Moon phases test coverage ([#172])
* Optimize Observer with GMST from Instant ([#173])
* Update README about documentation location ([#175])
* Add GitHub Actions permissions ([#176])

### New Contributors

* @valeriy-sokoloff made their first contribution in #124
* @JoelQ made their first contribution in #166

**Full Changelog**: v0.6.0...v0.7.0

[#120]: #120
[#121]: #121
[#122]: #122
[#123]: #123
[#124]: #124
[#125]: #125
[#126]: #126
[#127]: #127
[#128]: #128
[#129]: #129
[#130]: #130
[#131]: #131
[#132]: #132
[#133]: #133
[#134]: #134
[#135]: #135
[#136]: #136
[#137]: #137
[#138]: #138
[#139]: #139
[#140]: #140
[#141]: #141
[#142]: #142
[#143]: #143
[#145]: #145
[#146]: #146
[#147]: #147
[#148]: #148
[#149]: #149
[#150]: #150
[#151]: #151
[#152]: #152
[#153]: #153
[#154]: #154
[#155]: #155
[#156]: #156
[#157]: #157
[#160]: #160
[#163]: #163
[#165]: #165
[#166]: #166
[#167]: #167
[#168]: #168
[#169]: #169
[#172]: #172
[#173]: #173
[#174]: #174
[#175]: #175
[#176]: #176
[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
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.

1 participant