-
Notifications
You must be signed in to change notification settings - Fork 101
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
Clock corrections applied to TZRMJD even if TZRSITE is BAT #1691
Comments
I think the solution you mentioned is correct. Can you open a pull request? |
Hi Abhimanyu, I am having difficulties installing the PINT development environment to prepare a branch with the modification, following https://nanograv-pint.readthedocs.io/en/latest/contributing.html#pull-request-guidelines . Conda (miniconda 23.11.0) doesn't find the package flake8-diff>=0.2.2 in the conda-forge channel, and I had to install it manually with pip. It also doesn't recognize the syntax "black~=23.0" used in requirements_dev.txt , I had to replace it with black>=23.0,<=24.0 . If I install PINT from the master branch and run the tests (before modifying any code at all), they fail:
I get similar results using tox. Everything has been run in a clean environment, as suggested on the previously linked page. To be sure, I ran the entire thing twice in different servers with different systems, and got more or less the same result. Shall I carry on regardless of these errors, or do you have a suggestion on what should be done? Cheers, Giovanni |
These errors look like they are due to some kind of OS permission issue. I think you can ignore these.
I think you can proceed regardless of these errors. As long as the github CI tests pass, it should be fine. |
Hi again,
This is not the case for PINT: none of pint.toa methods have such a check, thus including clock corrections also for already barycentered TOAs. This results in a difference in the BATs computed by PINT and tempo2, whenever they are provided a tim file with already barycentered TOAs. I understand the use case for running PINT on already barycentered TOAs is quite narrow, however, this seems to be another inconsistency between the behaviour of tempo2 and PINT. The issue can be tested using the same minimal working example I uploaded at the beginning, the first TOA in the tim file is a barycentered one. I can try and modify the functions in pint.toa to include a check there as well, but it seems me this would have more far-reaching consequences than just the TZRMJD issue. Before proceeding, I would like to ask your opinion. Cheers, Giovanni |
I am not sure what "STL" and "STL_FBAT" are, but they are not supported by PINT. So the rest of the checks are not required for now. |
Hi, OK, Let's leave out "STL" and "STL_FBAT". But still tempo2 treats any barycentered TOA just as in TZR case, that means, skipping clock corrections, whereas PINT doesn't. Shall I try and implement the check for the TOA's site in toa.py as well, besides the one in absolute_phase.py? |
From what I can see, what you say is the intended behaviour. It doesn't happen that way due to a bug in |
I am sorry, but #1711 does NOT fix the issue in this problem. The clock corrections are still applied to TZRMJD even if get_observatory() does not overwrite the values it passed, as discussed in this comment: #1707 (comment). The issue is still present, and I would like to reopen this. |
Can you post a code snippet that shows this? |
Hi @abhisrkckl , |
Thanks. I am able to see the issue. I'll investigate this. |
Thank you for finding this! I think I'm seeing this bug in some of my NICER pulsar timing work. It would be great to get it fixed! I see there have been some attempts but evidently it is complicated! |
Dear all, PS: congratulations on the submission of the Likelihood fitting paper! I've seen it on Arxiv the other day. |
I agree this is a high priority. I just passed some big deadlines so I have a bit more time to think about this. For now, you could just run with CLK TT(TAI) instead of TT(BIPMxx), right? |
Perhaps the fix should be in the
I suggest that the GPS and BIPM corrections should not be applied if this site has a scale of 'tdb' already. |
Yes, just adding |
Looking at this more, I really don't like the way PINT handles BIPM and GPS corrections. They are kind of "tacked on" rather than being a part of a real clock correction chain like Tempo2 does. More specifically, we carry around See this code in toa.py:
The And the Bottom line: I think my tiny fix will work above, but it might be better to do the larger change as well and remove |
I think this line is buggy (L361 of topo_obs.py):
The |
Dear all,
I am in the field of very-high energy pulsars with imaging Cherenkov telescopes such as MAGIC and CTA. Since we typically have to integrate tens of hours of observations (scattered across many months) to detect the pulsed gamma rays and build a TOA, we are forced to apply the barycenter corrections to each single event we record, with most of them being just background cosmic rays, and obtain the pulse profile from already barycentered data. I find convenient for me to produce par files where TZRSITE is set to "@" or "bat", so that I can manipulate the phase=0 definition in a relatively easy way by changing TZRMJD, and adapt it to various different references present in literature.
I think I've found an inconsistency between the behaviour of PINT and tempo2 in the specific case in which TZRSITE is set to "@" and the clock is set to TT(BIPM****). Specifically, PINT applies the clock corrections to TZRMJD, whereas tempo2 doesn't. This causes the absolute phases calculated by tempo2 and PINT to differ by ~(-27us/F0), even when the BATs are identical down to the precision of np.longdouble. I was suggested to report it here by Paul Ray over the facebook pulsar group.
I believe I've identified the origin of the discrepancy in the definition of get_TZR_toa(self, toas) in $PINT/src/pint/models/absolute_phase.py and the respective function refphs_init(pulsar* psr, int npsr) in $TEMPO2/refphs.C .
The tempo2 function contains:
whereas the PINT function does not have such a check. The docstring of get_TZR_toa() even mentions that "We are treating the TZRMJD as a special TOA. Note that any observatory clock corrections will be applied to this TOA, as with any other TOA. This does not affect the value of the TZRMJD parameter, however." Indeed, if I add such a check on the value of self.TZRSITE in get_TZR_toa() of absolute_phase.py, the discrepancy in the phases disappears:
To compare the results, both PINT and tempo2 need to be run with the same .par and .tim files. Unfortunately I do not know a way to print the absolute phases in a human-readable format with tempo2. I've written a patch to the "general2" plugin of tempo2, that allows the fractional part of the phase to be printed using a "{phasefrac}" token (the integer part can already be printed with the {npulse} token). I've checked that the phases produced in this way are compatible with the ones produced by MAGIC's own tempo2 plugin (that writes to some horrible .root file format). Please find attached an archive with the patch and some example scripts.
Summary
Expected behaviour: tempo2 and PINT phases and barycentered times should be the same when ran on the same .tim and .par files
Observed behaviour: PINT phases differ by an amount of ~ (-27us/F0) when TZRSITE is "@" or "BAT" and CLK is "TT(BIPM2021)".
Steps to reproduce:
PINT version: 0.9.8+5.g0227e13c.dirty
tempo2 version: 2023.05.1 (commit 3610511302af0f6f62d2a9806177301516a9babf)
output of pint.print_info():
PINT-tempo2__TZRSITE-BAT.tar.gz
Thank you in advance for your help and patience, and sorry for the long message!
--
Dr. Giovanni Ceribella
Max-Planck-Institut für Physik
Boltzmannstr. 8
85748 Garching
ceribell@mpp.mpg.de
The text was updated successfully, but these errors were encountered: