Skip to content

Conversation

@SixByNine
Copy link

The GPS correction in tempo2 was a bit strange, and recent (since about start of 2024) tempo2 has used a new system derived from this repository, but made compatible with tempo2.

gps2utc.clk used to be a correction that did not have a consistent definition of GPS time. This is because BIPM published two different corrections between their realisation of UTC and GPS, labeled as C0 and C0' in CircularT. Furthermore, gps2utc.clk was produced from old circularT files that had an error that was later corrected by BIPM.

The difference is that there is GPS time as directly read from the satellites (which I call GPST) and a time derived from this which better approximates UTC(UNSO), which I call (GPS(UNSO)).

Previously the IPTA clock repo tried to recreate the gps2utc.clk by switching between C0 and C0' at an arbitrary epoch. However, this is not extremely satisfactory.

Instead tempo2 has abandoned gps2utc.clk and instead we have two clock files:

gpst2utc.clk (which used C0 to go from GPST to UTC) and gps_unso2utc.clk (which uses C0' to go from GPS(UNSO) to UTC)

Note here, UTC means UTC as defined by BIPM, because that's what tempo2 implies right now.

For backwards compatibility there are two additional clock files, gps2gpst.clk and gps2gps_unso.clk, which have zero correction and fixed date ranges that basically replicate the old gps2utc behavior.

Ideally clock correction files from obervatories will change to specify which GPS time they really mean. Likely this is GPS(UNSO), but it may depend on exactly what is measured by the GPS reciever.

There is also a minor 'compatibility' fix - bipm.py previously produced duplicated entries a the start and end of circularT blocks. I think this can cause problems in tempo2, so I have updated it to avoid duplicated date entries.

If this change is merged, then tempo2 and the IPTA clock repo should agree and we can make tempo2 copy the files in from this repo (currently they are generated by a modified version of this code), and eliminate one duplication.

This means replacing gps_c0 and gps_c0p with gps_unso and gpst
and adding the correction from gps.

the old gps2utc.clk file should be deleted from any clock repos.
@dlakaplan
Copy link
Contributor

I can't merge this, but I'll look anyway. Probably we don't need to include the updated log files in the PR?

@paulray
Copy link
Contributor

paulray commented May 5, 2025

Shouldn't this PR get merged? I guess it needs some conflicts fixed and the log files removed.

@dlakaplan
Copy link
Contributor

@JPGlaser ?

@paulray paulray mentioned this pull request May 5, 2025
@paulray
Copy link
Contributor

paulray commented May 5, 2025

OK, I've read this a bit more closely and I do have a concern. Tempo2 no longer has any gps2utc.clk in the repo. PINT so far always uses gps2utc.clk for its GPS to UTC corrections. So, if this goes away, PINT needs to be updated to use different files.

@dlakaplan
Copy link
Contributor

I think PINT actually uses a file that is constructed by the clock repo itself out of BIPM data:
https://ipta.github.io/pulsar-clock-corrections/T2runtime/clock/gps2utc.clk.html

@paulray
Copy link
Contributor

paulray commented May 5, 2025

That looks like the same comment as the new gpst2utc.clk in Tempo2, so maybe they are the same thing?

No, they are slightly different, but the same idea I guess.

@paulray
Copy link
Contributor

paulray commented May 5, 2025

So that's good. PINT doesn't use the Tempo2 repo to get gps2utc.clk. It is confusing that in this repo it is stored in the T2runtime directory, but indeed it is constructed from BIPM itself.

So we just need to merge this in, along with #29 and #31 and we should be in better shape.

Might still need some more edits to the update script if we want the new files introduced in this PR to get updated automatically?

@paulray paulray mentioned this pull request May 5, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't delete this file. It is generated from BIPM and is used by PINT.

Copy link
Author

Choose a reason for hiding this comment

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

This is a problem though - if we leave this file then it will get into tempo2 and break tempo2. If pint just uses the tempo2 clock files, why won't it just use the new clock chain instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, this is an interesting problem. We should discuss this at a PINT telecon @dlakaplan . I guess you are saying that if we leave this file, and Tempo2 uses this repo for its clock corrections (which I think is a great idea to have as many codes as possible use this centralized repo of clock corrections), then Tempo2 might get this gps2utc.clk, rather than the other clock correction chain you prefer, right? I thought maybe Tempo2 had a way to specify the preferred clock correction chain for a particular situation? So, why doesn't PINT just do the clock correction chain that Tempo2 does? I'm not sure PINT can, currently. It has a much simpler clock correction logic than Tempo2 does and doesn't normally follow a path through multiple clock correction files to get from one time system to another. I think something like this was partially implemented for Nancay, but I don't know the specifics. This is worth looking into. We'd certainly need to add some tests to the CI to make sure it ends up doing what we want.

Copy link
Contributor

@paulray paulray left a comment

Choose a reason for hiding this comment

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

Would love to get this merged, once the conflicts are fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

The main branch here has gpst2utc.clk copied from Tempo2 bitbucket. See if that is what you want.

Copy link
Contributor

Choose a reason for hiding this comment

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

This will have conflicts.

Copy link
Author

Choose a reason for hiding this comment

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

Yes. There has also been several other changes since this was originally posted since e.g. the files from BIPM also changed. I have a version on my computer that I think "works", at least for tempo2, but I think I've now paralell fixed bugs that are also separately fixed in the main branch so all a bit complicated.

Perhaps best to try to make a new PR that merges together all the changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure a new PR based on the current main branch of this repo sounds like a good plan.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like the bipm.py changes might be separable, so maybe make a simple PR just for that?

@paulray
Copy link
Contributor

paulray commented May 7, 2025

@SixByNine I think all the instances of UNSO in your comment PR comment, and in the file name gps_unso2utc.clk should really be USNO (for United States Naval Observatory), right?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants