Skip to content

Add TimeGPS class to Time (=seconds since 1980-01-01 00:00:00 UTC = TAI -19 s - #1164

Merged
taldcroft merged 2 commits into
astropy:masterfrom
mhvk:time/gps-time
Jun 8, 2013
Merged

taldcroft merged 2 commits into
astropy:masterfrom
mhvk:time/gps-time

Conversation

@mhvk

@mhvk mhvk commented Jun 7, 2013

Copy link
Copy Markdown
Contributor

@taldcroft - I was asked by David Kaplan whether it would be possible to add a gps format for Time, since this is used a lot at MWA, apparently by LIGO as well, and seems generally useful. The pull request implements the TimeGPS class following the TimeCxcSec example (aside: isn't that a bit Chandra-centric? What about poor XMM? ;-), and adds tests and documentation.

@mhvk

mhvk commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

Not sure why the travis build with sphinx failed. Suggestions?

@astrofrog

Copy link
Copy Markdown
Member

@mhvk - this is a known issue that I think @eteq fixed in master - I'll restart the Travis build

@taldcroft

Copy link
Copy Markdown
Member

@mhvk - From what I understand (http://en.wikipedia.org/wiki/Global_Positioning_System#Timekeeping) GPS time is really a time scale, not a time format (which is what you implemented). It is defined by TAI - GPS = 19 sec. I suspect that your colleague would want to the following behavior:

>>> t = Time('2000-01-01 12:00:19', scale='tai')
>>> t.gps
'2000-01-01 12:00:00'

What you implemented will instead give a float number. In the case of cxcsec or unix that float number is directly useful, but I'm not sure about GPS.

Implementing a new time scale should not be too difficult, particularly in this case.

@mhvk

mhvk commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

@taldcroft - OK, I may have misunderstood what was requested; I've asked David to comment, and also pinged one of our local LIGO people, Kipp Cannon.

@mhvk

mhvk commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

@taldcroft - my colleague answered (I'll get him to contribute himself yet ;-):

But specifically what we & LIGO want is something like that given at:
http://www.andrews.edu/~tzs/timeconv/timeconvert.php
I have tested that against the PHP version discussed at:
http://www.andrews.edu/~tzs/timeconv/timealgorithm.html
and our own python implementation, and they all match. We use gpstime as a unique way to label all events that will increment in a predictable way. The translation from gpstime <-> UTC is well defined, with the possible exception of during a leap second.

Our local LIGO expert wrote

We essentially use it as a monotonically increasing counter with which to label things. As such, we consider a "GPS time" to be a count of seconds since the GPS epoch. They are only useful to us in that format. Expressing a GPS time as a Gregorian year/month/day/hour/minute/second would create confusion.

So, happily it seems I managed to get the use case right!

Comment thread astropy/time/core.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially confused by the = 00:00:19 TAI part, so I would suggest removing that. The date of 1980-01-06 00:00:00 UTC is unique and corresponds to the definition that one sees everywhere.

It might be useful in the class docstring to include a reference to some fundamental page that defines GPS time, e.g. http://tycho.usno.navy.mil/gpstt.html. You should have the initial 'tagline' of GPS time: seconds ... and skip a line and then have more detailed explanation, which might include mentioning that this does include leap seconds.

@taldcroft

Copy link
Copy Markdown
Member

OK, looks like this is mostly good, just some minor documentation comments.

@mhvk

mhvk commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

@taldcroft - OK, thanks, all good changes - now implemented.

taldcroft added a commit that referenced this pull request Jun 8, 2013
Add TimeGPS class to Time (seconds since 1980-01-06 00:00:00 UTC)
@taldcroft
taldcroft merged commit ff568bf into astropy:master Jun 8, 2013
@mhvk
mhvk deleted the time/gps-time branch June 8, 2013 14:45
@taldcroft taldcroft mentioned this pull request Jan 22, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants