Skip to content

Time scale conversion violates |jd2|<=0.5 #9533

Description

@aarchiba

Description

Upon construction, all Time objects contain two double-precision values, jd1 and jd2. These satisfy, and are tested to satisfy, the invariant that jd1 is an integer, abs(jd2)<=0.5, and if abs(jd2)==0.5 then jd1 is even. This is enforced by application of the not-publicly-documented function day_frac.

When a Time object is converted from one timescale to another, though, under some circumstances abs(jd2)>0.5.

>>> from astropy.time import Time
>>> t = Time(2441316.5, 0, scale='tai', format='jd')
>>> t.tcb.jd2
0.500344155968967

This was revealed by #9532 .

Expected behavior

t.tcb.jd2 should be made less than 0.5 by calling day_frac.

Actual behavior

The value violates the invariant.

System Details

$ python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; print(platform.platform())
Linux-5.0.0-31-generic-x86_64-with-Ubuntu-19.04-disco
>>> import sys; print("Python", sys.version)
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0]
>>> import numpy; print("Numpy", numpy.__version__)
Numpy 1.17.1
>>> import scipy; print("Scipy", scipy.__version__)
Scipy 1.3.1
>>> import astropy; print("astropy", astropy.__version__)
astropy 4.0.dev26770
>>>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions