Class: Horologium::Scales::TDB

Inherits:
Base
  • Object
show all
Defined in:
lib/horologium/scales/tdb.rb,
sig/horologium/scales/tdb.rbs

Overview

Barycentric Dynamical Time, the scale the planetary ephemerides are written in. It keeps almost the rate of TT, apart from periodic relativistic terms worth at most about two milliseconds; Data::BarycentricModel gives the difference. TDB is defined on TT, so this conversion goes through TT, which is a fixed 32.184 seconds from TAI.

The difference is a floating-point model, so unlike the constant offsets of TAI and TT this edge is not exact, even at :exact. Reading the model at :exact stores its result faithfully, but the model itself stays a float computation.

Examples:

instant = Horologium::Instant.from_julian_date(2_460_796.5, scale: :tt)
instant.to(:tdb).as(:julian_date) # => 2460796.5000000168

Class Method Summary collapse

Methods inherited from Base

provenance, seconds_in_day, si_seconds_in_day, zone_designator

Class Method Details

.from_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact

A TAI Julian Date, read in TDB. It reads TAI in TT first, then adds the TDB - TT difference the model gives.

Parameters:

Returns:

Raises:



31
32
33
34
# File 'lib/horologium/scales/tdb.rb', line 31

def from_reference(value, precision)
  in_tt = TT.from_reference(value, precision)
  Numeric::Precision.add(in_tt, correction(in_tt, precision))
end

.to_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact

A TDB Julian Date, read back in TAI. It removes the TDB - TT difference, then reads the TT Julian Date back in TAI.

Parameters:

Returns:

Raises:



45
46
47
48
49
50
51
# File 'lib/horologium/scales/tdb.rb', line 45

def to_reference(value, precision)
  in_tt = Numeric::Precision.subtract(
    value,
    correction(value, precision)
  )
  TT.to_reference(in_tt, precision)
end