AstroPY BJD calculation from JD UTC including relatavistic correction for pulsar timing.

577 views
Skip to first unread message

John Mallett

unread,
Jun 2, 2018, 4:25:04 AM6/2/18
to astropy-dev
Hi,

I have written some python code to convert a file of JD and magnitudes to BJD but I am not sure how to include the relativistic correction.
Since I have used coord.SkyCoord I think the relativistic correction should be included.  I certainly seems to be very close to the OHIO university BJD which includes relativity effects.


from astropy import time, coordinates as coord, units as u
latitude = 50.725037
longitude = -0.792017
elv = 5
loc = coord.EarthLocation(lat = latitude*u.deg, lon = longitude*u.deg, height=elv*u.m)
V470Cam = coord.SkyCoord("07:10:42.07", "+66:55:43.6", unit=(u.hourangle, u.deg), frame='icrs')
f = open("C:/users/user/desktop/temp/save/V0470CAMVs.txt")
g = open("C:/users/user/desktop/temp/save/V0470CAMBJDVs.txt","w")
opf = f.readline()
ctr = 0
while opf:
    print("_______________")
    ctr = ctr + 1
    print (str(ctr))
    print(opf[0:14])
    tx = float(opf[0:14])
    print(str(tx))
    times = time.Time([tx] , format='jd', scale='utc', location=loc)
    ltt_bary = times.light_travel_time(V470Cam)
    print(repr(ltt_bary))
    ty = times.tdb + ltt_bary
    print(str(ltt_bary))
    ops = str(ty)
    ops = ops.replace("[","")
    ops = ops.replace("]","")
    jlen = len(ops)
    print(str(jlen))
    g.write(ops)
    for i in range (0 , (16-jlen)):
        g.write("0")
    print(ops)
    g.write("  " + opf[15:22] )
    g.write("\n")
    opf = f.readline()
f.close()
g.close()

Thanks for any assistance.

John

Marten van Kerkwijk

unread,
Jun 2, 2018, 9:17:42 AM6/2/18
to astro...@googlegroups.com
Hi John,

The coordinate transformations in astropy are all based on the "Standards of Astronomy" library (via its ERFA clone), and indeed include relativistic corrections - the Time routines in particular are used for pulsar timing, so should be good. Nevertheless, it is always good to check, and it is gratifying to know the results are consistent with the nice routines made available by the Ohio State group.

But: given that you asked here, the documentation of light_travel_time, or the coordinates section, was perhaps not as clear as it could have been. Could you perhaps raise an issue about that on the github page? It would be particularly helpful to know where *you* would have expected to find this information. (Even better of course if you can make a PR with a suggested change, but don't feel obliged!)

All the best,

Marten

John Mallett

unread,
Jun 2, 2018, 11:42:37 AM6/2/18
to astropy-dev
Marten,

Thanks for the confirmation.  I did find reference to it under Coordinate system.

Maybe just in the time section in the example or where SkyCoord is used in the example a note to say "the conversion to BJD will then include the relatavistic correction."

I will take a look on the GitHub..

Very good job on this Python code though!!  Saves me hours of hand entry.

All the best
John Mallett
BAA VSS & AAVSO also FRAS
Reply all
Reply to author
Forward
0 new messages