Skip to content

Deep Sky Object: Compute astrometric position#217

Merged
rhannequin merged 1 commit intomainfrom
deep-sky-object-astrometric-position
Oct 20, 2025
Merged

Deep Sky Object: Compute astrometric position#217
rhannequin merged 1 commit intomainfrom
deep-sky-object-astrometric-position

Conversation

@rhannequin
Copy link
Owner

This is the first piece for handling deep sky objects such as stars, galaxies, clusters, nebulae, etc.

Disclaimer: For now, Astronoby won't store the initial data of these objects. Depending on the used catalogues, there could be between hundreds and billions of objects. The Messier catalogue has 110 objects, the NGC contains 7840 objects, the Hipparcos catalogue has 118218 objects and the Gaia DR3 contains 1.8 billion sources.
Also, each catalogue might expose data differently, which would increase complexity for Astronoby.
In the future, it is possible Astronoby wold make it easier to fetch data from external data sources. We'll see.

This first piece handle astrometric position of deep sky objects.

What

Given J2000 equatorial coordinates and optionally additional attributes, a DeepSkyObject object is instantiated and exposes the astrometric method, which, the same way as for solar system bodies, describes the astrometric reference frame of the object.

How

J2000 equatorial coordinates can be found on the internet, the suggested source is the SIMBAD Astronomical Database.

If only instant and equatorial_coordinates key arguments are provided, Astronoby will simply instantiate the object with no transformation.

If the following optional key attributes are provided, Astronoby will compute the propagated astrometric position which applies correction of the object's proper motion:

  • proper_motion_ra (Astronoby::AngularVelocity): object's proper motion in right ascension
  • proper_motion_dec (Astronoby::AngularVelocity): object's proper motion in declination
  • parallax (Astronoby::Angle): stellar parallax
  • radial_velocity (Astronoby::Velocity): variation over time of the object's velocity

Example

Vega (Alpha Lyrae) data coming from SIMBAD: https://simbad.u-strasbg.fr/simbad/sim-basic?Ident=vega

time = Time.utc(2025, 10, 1)
instant = Astronoby::Instant.from_time(time)
equatorial_coordinates = Astronoby::Coordinates::Equatorial.new(
  right_ascension: Astronoby::Angle.from_hms(18, 36, 56.33635),
  declination: Astronoby::Angle.from_dms(38, 47, 1.2802),
)
proper_motion_ra = Astronoby::AngularVelocity.from_milliarcseconds_per_year(200.94)
proper_motion_dec = Astronoby::AngularVelocity.from_milliarcseconds_per_year(286.23)
parallax = Astronoby::Angle.from_degree_arcseconds(130.23 / 1000.0)
radial_velocity = Astronoby::Velocity.from_kilometers_per_second(-13.5)

dso = Astronoby::DeepSkyObject.new(
  instant: instant,
  equatorial_coordinates: equatorial_coordinates,
  proper_motion_ra: Astronoby::AngularVelocity.from_milliarcseconds_per_year(200.94),
  proper_motion_dec: Astronoby::AngularVelocity.from_milliarcseconds_per_year(286.23),
  parallax: Astronoby::Angle.from_degree_arcseconds(130.23 / 1000.0),
  radial_velocity: Astronoby::Velocity.from_kilometers_per_second(-13.5)
)

astrometric = dso.astrometric

astrometric.equatorial.right_ascension.str(:hms)
# => "18h 36m 56.7788s"

astrometric.equatorial.declination.str(:dms)
# => "+38° 47′ 8.65″"

astrometric.ecliptic.latitude.str(:dms)
# => "+61° 44′ 4.8773″"

astrometric.ecliptic.longitude.str(:dms)
# => "+285° 19′ 11.8989″"

Precision

Compared to other astronomy libraries such as Astropy or Skyfield, when provided the additional coordinates, the precision provided is below 10th of an arcsecond.

As you can see on the example below, the different in right ascension is around 0.4 hour arcseconds, while the difference in declination is around 7 degree arcseconds.
None of these differences can be seen with a naked eye and extremely hard to notice in an amateur telescope even with great magnification. But still, precision up to professional standards can be achieved.

Velocity

On this first version, the astrometric velocity is mathematically right but astronomically wrong.

Astronoby currently computed the object's intrinsic velocity, which is related to its actual motion. In Astronoby, an astrometric position is geocentric, which means the astrometric velocity is supposed to be observer-relative and corrected with the Earth's own motion in the Solar System.

To reduce the complexity and because an ephemeride would be necessary, I decided to only compute the intrinsic velocity for now and I will see how I could fix it in the future when DeepSkyObject will support apparent and topocentric positions.

@rhannequin rhannequin self-assigned this Oct 3, 2025
@rhannequin rhannequin force-pushed the deep-sky-object-astrometric-position branch 2 times, most recently from 86f6c49 to a3813b4 Compare October 3, 2025 13:45
@rhannequin rhannequin requested a review from Copilot October 3, 2025 13:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for deep sky objects such as stars, galaxies, clusters, and nebulae in Astronoby. The implementation focuses on computing astrometric positions from J2000 equatorial coordinates with optional proper motion, parallax, and radial velocity corrections.

Key changes:

  • Adds DeepSkyObject class for handling celestial objects with astrometric positioning
  • Implements StellarPropagation for computing propagated positions with proper motion corrections
  • Introduces AngularVelocity class for handling proper motion measurements

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/astronoby/bodies/deep_sky_object.rb Core DeepSkyObject class with astrometric positioning
lib/astronoby/stellar_propagation.rb Stellar propagation calculations for proper motion corrections
lib/astronoby/angular_velocity.rb New AngularVelocity class for proper motion measurements
lib/astronoby/angle.rb Added degree_milliarcseconds method and constant fixes
lib/astronoby/constants.rb Added astronomical constants for stellar calculations
lib/astronoby/distance.rb Added parsec unit support
lib/astronoby/velocity.rb Added astronomical units per day velocity support
spec/astronoby/bodies/deep_sky_object_spec.rb Comprehensive tests for DeepSkyObject functionality
spec/astronoby/stellar_propagation_spec.rb Tests for stellar propagation calculations
spec/astronoby/angular_velocity_spec.rb Tests for AngularVelocity class
spec/astronoby/angle_spec.rb Tests for new degree_milliarcseconds method
lib/astronoby.rb Updated require statements for new modules

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@rhannequin rhannequin force-pushed the deep-sky-object-astrometric-position branch 2 times, most recently from 3805378 to 025ba55 Compare October 3, 2025 13:52
@rhannequin rhannequin requested a review from Copilot October 3, 2025 14:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

lib/astronoby/constants.rb:1

  • The constant MINUTES_PER_DEGREE has been removed but is still referenced in the angle.rb file at lines 146 and 149. This will cause a NameError when the code is executed.
# frozen_string_literal: true

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@rhannequin rhannequin force-pushed the deep-sky-object-astrometric-position branch 2 times, most recently from dd59369 to 2612764 Compare October 10, 2025 09:46
@rhannequin rhannequin force-pushed the deep-sky-object-astrometric-position branch from 2612764 to 4f86015 Compare October 14, 2025 21:03
@rhannequin rhannequin merged commit 208346d into main Oct 20, 2025
43 checks passed
@rhannequin rhannequin deleted the deep-sky-object-astrometric-position branch October 20, 2025 09:09
@rhannequin rhannequin mentioned this pull request Oct 25, 2025
rhannequin added a commit that referenced this pull request Oct 31, 2025
## 0.9.0 - 2025-10-31

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

### Features

* Add `#approaching_primary?` and `#receding_from_primary?` to solar system bodies ([#211])
* Calculate apoapsis and periapsis events ([#213])
* Improve precision of ΔT ([#219])
* Deep Sky Object: Compute astrometric position ([#217])
* Deep Sky Object: Compute apparent position ([#220])
* Deep Sky Object: Handle velocities properly ([#222])
* Deep Sky Object: Compute topocentric position ([#226])
* Deep Sky Object: difference between the body and the position ([#227])
* Deep Sky Object: Add support for RiseTransitSetCalculator ([#228])

### Improvements

* Drop `Astronoby::Apparent#angular_diameter` ([#221])
* Bump rubyzip from 3.0.2 to 3.2.1 by @dependabot ([#210], [#215], [#223], [#233])
* Bump standard from 1.50.0 to 1.51.1 by @dependabot ([#212], [#214])
* Be proud about the precision achieved ([#218])
* Use local apparent instead of local mean sidereal time for hour angle ([#225])
* Bump rspec from 3.13.1 to 3.13.2 by @dependabot ([#229])
* Bump benchmark from 0.4.1 to 0.5.0 by @dependabot ([#230])
* Add documentation for deep-sky objects ([#232])
* Bump rake from 13.3.0 to 13.3.1 by @dependabot ([#235])

### Backward-incompatible changes

* Drop `Astronoby::Apparent#angular_diameter` ([#221])
* Use local apparent instead of local mean sidereal time for hour angle ([#225])

**Full Changelog**: v0.8.0...v0.9.0

[#210]: #210
[#211]: #211
[#212]: #212
[#213]: #213
[#214]: #214
[#215]: #215
[#217]: #217
[#218]: #218
[#219]: #219
[#220]: #220
[#221]: #221
[#222]: #222
[#223]: #223
[#225]: #225
[#226]: #226
[#227]: #227
[#228]: #228
[#229]: #229
[#230]: #230
[#232]: #232
[#233]: #233
[#235]: #235
[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.

2 participants