Class: Astronoby::Apparent

Inherits:
ReferenceFrame show all
Defined in:
lib/astronoby/reference_frames/apparent.rb

Overview

Apparent reference frame. Represents a body's geocentric position as it appears from Earth, corrected for aberration, precession, and nutation.

Instance Attribute Summary

Attributes inherited from ReferenceFrame

#center, #instant, #position, #target_body, #velocity

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReferenceFrame

#distance, #equatorial, #initialize, #separation_from

Constructor Details

This class inherits a constructor from Astronoby::ReferenceFrame

Class Method Details

.build_from_astrometric(instant:, target_astrometric:, earth_geometric:, target_body:) ⇒ Astronoby::Apparent

Builds an apparent frame from an astrometric frame by applying aberration in GCRS, then rotating by nutation * precession (with ICRS frame bias).

Parameters:

  • the time instant

  • target's astrometric frame

  • Earth's geometric frame

  • the target body

Returns:

  • a new apparent frame



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/astronoby/reference_frames/apparent.rb', line 17

def self.build_from_astrometric(
  instant:,
  target_astrometric:,
  earth_geometric:,
  target_body:
)
  position = target_astrometric.position
  velocity = target_astrometric.velocity
  precession_matrix = Precession.matrix_for(instant)
  nutation_matrix = Nutation.matrix_for(instant)

  corrected_position = Aberration.new(
    astrometric_position: position,
    observer_velocity: earth_geometric.velocity
  ).corrected_position

  # In theory, here we should also apply light deflection. However, so far
  # the deflection algorithm hasn't shown any significant changes to the
  # apparent position. Therefore, for now, we are saving some computation
  # time by not applying it, and we will investigate if the algorithm is
  # correct or if the deflection is indeed negligible.

  corrected_position = Distance.vector_from_meters(
    nutation_matrix * precession_matrix * corrected_position.map(&:m)
  )

  corrected_velocity = Velocity.vector_from_mps(
    nutation_matrix * precession_matrix * velocity.map(&:mps)
  )

  new(
    position: corrected_position,
    velocity: corrected_velocity,
    instant: instant,
    center: Center.geocentric,
    target_body: target_body
  )
end

Instance Method Details

#eclipticAstronoby::Coordinates::Ecliptic

Returns ecliptic coordinates at the current instant (true ecliptic and equinox of date).

Returns:

  • ecliptic coordinates at the current instant (true ecliptic and equinox of date)



58
59
60
61
62
63
64
65
66
67
# File 'lib/astronoby/reference_frames/apparent.rb', line 58

def ecliptic
  @ecliptic ||= begin
    return Coordinates::Ecliptic.zero if distance.zero?

    equatorial.to_ecliptic(
      instant: @instant,
      obliquity: TrueObliquity.at(@instant)
    )
  end
end