Skip to content

Commit cc1278a

Browse files
committed
Merge pull request #1939 from mhvk/time-correct-ut-in-tdb
Correct UT in calculation of TDB; closes #1938
2 parents 7fa981e + af6bdf6 commit cc1278a

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎CHANGES.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ API Changes
9696

9797
- ``astropy.time``
9898

99+
- Correct use of UT in TDB calculation [#1938, #1939].
100+
99101
- ``astropy.units``
100102

101103
- ``Quantity`` now converts input to float by default, as this is

‎astropy/time/core.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,13 @@ def _get_delta_tdb_tt(self, jd1=None, jd2=None):
810810
jd2 = self._time.jd2
811811

812812
# First go from the current input time (which is either
813-
# TDB or TT) to an approximate UTC. Since TT and TDB are
814-
# pretty close (few msec?), assume TT.
813+
# TDB or TT) to an approximate UT1. Since TT and TDB are
814+
# pretty close (few msec?), assume TT. Similarly, since the
815+
# UT1 terms are very small, use UTC instead of UT1.
815816
njd1, njd2 = erfa_time.tt_tai(jd1, jd2)
816817
njd1, njd2 = erfa_time.tai_utc(njd1, njd2)
817-
# TODO: actually need to go to UT1 which needs DUT.
818-
ut = njd1 + njd2
818+
# subtract 0.5, so UT is fraction of the day from midnight
819+
ut = day_frac(njd1 - 0.5, njd2)[1]
819820

820821
# Compute geodetic params needed for d_tdb_tt()
821822
elon = 0. if self.lon is None else self.lon.to(u.radian).value

‎astropy/time/tests/test_basic.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def test_transforms(self):
168168
assert t.tai.iso == '2006-01-15 21:25:10.500000'
169169
assert t.tt.iso == '2006-01-15 21:25:42.684000'
170170
assert t.tcg.iso == '2006-01-15 21:25:43.322690'
171-
assert t.tdb.iso == '2006-01-15 21:25:42.684372'
172-
assert t.tcb.iso == '2006-01-15 21:25:56.893951'
171+
assert t.tdb.iso == '2006-01-15 21:25:42.684373'
172+
assert t.tcb.iso == '2006-01-15 21:25:56.893952'
173173

174174
def test_creating_all_formats(self):
175175
"""Create a time object using each defined format"""

‎docs/time/index.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ TT, UT1, UTC). This requires auxilliary information (latitude and longitude).
572572
>>> t.tcg.iso
573573
'2006-01-15 21:25:43.322690'
574574
>>> t.tdb.iso
575-
'2006-01-15 21:25:42.684372'
575+
'2006-01-15 21:25:42.684373'
576576
>>> t.tcb.iso
577-
'2006-01-15 21:25:56.893951'
577+
'2006-01-15 21:25:56.893952'
578578

579579
Sidereal Time
580580
-------------

0 commit comments

Comments
 (0)