Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve clock file handling #1239

Merged
merged 57 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
b0234d9
Import TEMPO2 clock files and use them
aarchiba May 11, 2022
de310d5
No longer use time.dat for observatories in TEMPO
aarchiba May 11, 2022
984d277
Blacken
aarchiba May 11, 2022
79feebd
Handle missing clock corrections
aarchiba May 11, 2022
fa77aef
Add limits argument to get_TOAs and the like
aarchiba May 11, 2022
ec2ae01
Fix slip-up with limits argument
aarchiba May 11, 2022
11547cf
Initial implementation of last MJD reporting
aarchiba May 11, 2022
927f50d
Tests for last MJD
aarchiba May 11, 2022
139c63a
Blacken
aarchiba May 11, 2022
2d8cd46
Observatories can note if they have bogus corrections at the end
aarchiba May 11, 2022
18b1751
Add utility function to check status of clock corrections
aarchiba May 11, 2022
855e327
Document new function
aarchiba May 11, 2022
6e1fdef
Document behaviour when extrapolating
aarchiba May 12, 2022
a948240
Document clock corrections better
aarchiba May 13, 2022
7959826
Implement and document convenience functions
aarchiba May 13, 2022
1d3d556
Add Parameters section
aarchiba May 13, 2022
c3cb725
Changelog and cleanup
aarchiba May 17, 2022
3f05a23
Removed clock corrections as sransom requested
aarchiba May 18, 2022
8776a2c
Remove spurious test ouput
aarchiba May 18, 2022
b703f68
Fix changelog to reflect no new corrections
aarchiba May 18, 2022
bb41524
Fix handling of missing environment variables
aarchiba May 18, 2022
4915cc6
These changes go in the new version section
aarchiba May 19, 2022
7d87a0c
Removed if False sections
aarchiba May 25, 2022
a0a2384
Add demo showing PINT's clock correction status
aarchiba May 25, 2022
ddeb9c5
Blacken
aarchiba May 25, 2022
b0ea5a2
Changelog
aarchiba May 25, 2022
48fe259
Restore BIPM versions and remove bogus GPS value
aarchiba May 25, 2022
cb157d9
Import TEMPO2 clock files and use them
aarchiba May 11, 2022
695c802
No longer use time.dat for observatories in TEMPO
aarchiba May 11, 2022
523c054
Blacken
aarchiba May 11, 2022
14da616
Handle missing clock corrections
aarchiba May 11, 2022
48a0409
Add limits argument to get_TOAs and the like
aarchiba May 11, 2022
a6c4d13
Fix slip-up with limits argument
aarchiba May 11, 2022
0acaeff
Initial implementation of last MJD reporting
aarchiba May 11, 2022
90e4c2d
Tests for last MJD
aarchiba May 11, 2022
619eb67
Blacken
aarchiba May 11, 2022
947a81b
Observatories can note if they have bogus corrections at the end
aarchiba May 11, 2022
a0f17ff
Add utility function to check status of clock corrections
aarchiba May 11, 2022
879c7ff
Document new function
aarchiba May 11, 2022
9eeeddf
Document behaviour when extrapolating
aarchiba May 12, 2022
4fa00e8
Document clock corrections better
aarchiba May 13, 2022
2d754cb
Implement and document convenience functions
aarchiba May 13, 2022
eed4c62
Add Parameters section
aarchiba May 13, 2022
4459e95
Changelog and cleanup
aarchiba May 17, 2022
b4af0ce
Removed clock corrections as sransom requested
aarchiba May 18, 2022
149a52c
Remove spurious test ouput
aarchiba May 18, 2022
98842d7
Fix changelog to reflect no new corrections
aarchiba May 18, 2022
650cd06
Fix handling of missing environment variables
aarchiba May 18, 2022
c4b97d3
These changes go in the new version section
aarchiba May 19, 2022
fc38ab7
Removed if False sections
aarchiba May 25, 2022
c89c28a
Add demo showing PINT's clock correction status
aarchiba May 25, 2022
adc45d8
Blacken
aarchiba May 25, 2022
86ca3ab
Changelog
aarchiba May 25, 2022
706371a
Restore BIPM versions and remove bogus GPS value
aarchiba May 25, 2022
9d4d4ec
Improve out-of-order error reporting
aarchiba May 26, 2022
9d98345
Merge branch 'clock-search' of github.com:aarchiba/PINT into clock-se…
aarchiba May 26, 2022
cd431fb
Merge branch 'master' into clock-search
scottransom May 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ and this project, at least loosely, adheres to [Semantic Versioning](https://sem
## Unreleased
### Added
- Warning when A1DOT parameter used with DDK model
- Added the limits="warn" or limits="error" to get_TOAs to select handling of uncorrected TOAs
- Added functions in pint.observatory to request the status of PINT's available clock corrections
- Added the ability to query clock correction files or observatories for their last corrected MJD
### Fixed
### Changed
- Clock correction files that are entirely missing are handled the same way as TOAs past the end of a clock correction file
- Observatory objects can now note that their clock correction files include a bogus "99999" (or similar) entry at the end
- Clock correction files are now checked for being in order (necessary for PINT's interpolation to function)
- Observatories using TEMPO-format clock files now refer to the clock file (for example time_ao.dat) rather than via time.dat
- Observatories that don't use clock corrections (for example CHIME uses GPS time directly) just use an empty list of clock correction files rather than files containing only zeros
- Updated Jodrell clock corrections to include post-1997

## [0.8.6 == 0.8.7] 2022-05-10
### Added
Expand Down
63 changes: 48 additions & 15 deletions docs/explanation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,54 @@ accuracy.
Clock corrections
'''''''''''''''''

Not all the data that PINT uses is easily accessible for programs to
download. Observatory clock corrections, for example, may need to be
obtained from the observatory through various means (often talking to a
support scientist). We intend that PINT should notify you when this is
necessary, but be aware that you may obtain reduced accuracy if you
have old clock correction files.

The PINT distribution includes some clock files, but these are not necessarily
up-to-date enough. They normally live in the ``src/datafiles/`` directory with
names like ``time_gbt.dat``. There is a ``README.md`` in there describing some
ways to update your clock files. PINT is also capable of using clock files from
a TEMPO or TEMPO2 installation, if you have the ``TEMPO`` or ``TEMPO2``
environment variables set. You can see what clock file your corrections are
coming from with a command like
``pint.observatory.get_observatory("GBT").clock_fullpath``.
Not all the data that PINT uses is easily accessible for programs to download.
Observatory clock corrections, for example, may need to be obtained from the
observatory through various means (often talking to a support scientist). PINT
tries to include all clock correction files from the TEMPO and TEMPO2
repositories, and we intend to update the PINT source as these are updated.
PINT should notify you when your clock files are out of date for the data you
are using; be aware that you may obtain reduced accuracy if you have old clock
correction files.

Normally, if you try to do some operation that requires unavailable clock
corrections, PINT will emit a warning but continue. If you want to be stricter,
you can specify ``limit="error"`` to various functions like
:func:`pint.toa.get_TOAs`.

If you need to check how up to date your clock corrections are, you can use
something like ``get_observatory("gbt").last_clock_correction_mjd()``: the
function :func:`pint.observatory.Observatory.last_clock_correction_mjd` checks
when clock corrections are valid for. For most telescopes, this combines the
per-telescope clock correction with PINT's global GPS and BIPM clock
corrections (both of which cannot be reliably extrapolated too far into the
future). PINT provides two convenience functions,
:func:`pint.observatory.list_last_correction_mjds` and
:func:`pint.observatory.check_for_new_clock_files_in_tempo12_repos`, that will
help you check the state of your clock corrections.

If you need clock files that are not in PINT, either more recent versions or
clock files for telescopes not included in PINT, you will have to modify PINT's
source code. (This is not an ideal situation!) You have two options:

#. Simply replace a clock correction file in the PINT version you are using.
The file PINT is using may be deep in a virtualenv directory somewhere, but
you should be able to locate it with
``get_observatory("gbt").clock_fullpath``. If you replace this file, you
should see updated clock corrections.

#. Modify ``src/pint/observatory/observatories.py`` so that the observatory you
are interested in points to the correct clock file. (You may have to redo
``pip install`` for PINT to make this take effect.) If you set
``clock_dir="TEMPO"`` or ``clock_dir="TEMPO2"`` then PINT will look in the
clock directory referenced by your environment variables ``$TEMPO`` or
``$TEMPO2`` (and nowhere else; it will no longer find clock corrections for
this observatory that are included with PINT). You can also specify a
specific directory as ``clock_dir="/home/burnell/clock-files/"``. Editing
this file also allows you to choose between TEMPO- and TEMPO2-format clock
corrections with the ``clock_fmt`` argument.

The PINT developers recognize that the situation regarding clock corrections is
not ideal. Possible more flexible and powerful options are under discussion.

Structure of Pulsar Timing Data Formats
---------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions src/pint/data/runtime/time_ao.dat
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,12 @@
49683.40 88.861 88.704 3 f 26-NOV-94
49684.38 89.092 88.856 3 f 27-NOV-94
49685.39 89.309 89.039 3 f 28-NOV-94
49528.1 73.492 71.487 3 f 25-JUN-94 raw readouts
49544.9 72.0 73.0 3 f 11-JUL-94 no data, rough interp.-->
49545.9 72.0 73.1 3 f 12-JUL-94 --> need more precision
49557.79 74.213 74.287 3 f 24-JUL-94 your time.dat
# Zapped these as they are out of order and the comments suggest they
# are invalid. Anne Archibald, 2022 May 11
# 49528.1 73.492 71.487 3 f 25-JUN-94 raw readouts
# 49544.9 72.0 73.0 3 f 11-JUL-94 no data, rough interp.-->
# 49545.9 72.0 73.1 3 f 12-JUL-94 --> need more precision
# 49557.79 74.213 74.287 3 f 24-JUL-94 your time.dat
50155.0 0.000 -0.007 3 13-Mar-1996 post-upgrade data from
50156.0 0.000 -0.060 3 14-Mar-1996 aosun:~joe/tac/aoclk.1
50157.0 0.000 -0.103 3 15-Mar-1996 12 October 1999
Expand Down
5 changes: 3 additions & 2 deletions src/pint/data/runtime/time_gb140.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,9 @@
51206.500 0.0 24.086 a 28-Jan-99
51207.500 0.0 24.123 a 29-Jan-99
51208.500 0.0 24.150 a 30-Jan-99
51209.500 0.0 24.172 a 31-Jan-99
51210.500 0.0 24.197 a 1-Feb-99
# These seem to be repeated. Anne Archibald, 2022 May 11
# 51209.500 0.0 24.172 a 31-Jan-99
# 51210.500 0.0 24.197 a 1-Feb-99
51209.500 0.0 24.190 a 31-Jan-99
51210.500 0.0 24.218 a 1-Feb-99
51211.500 0.0 24.272 a 2-Feb-99
Expand Down