feat: updated accuracy of TCB-->TDB conversion - #2040
Draft
vhaasteren wants to merge 9 commits into
Draft
vhaasteren wants to merge 9 commits into
vhaasteren wants to merge 9 commits into
Conversation
Member
Author
|
Extra comment:
|
Astropy 5.0.5 TCB<->TDB conversions land within a few ULPs of the two-part JD (~0.05 ns), which is still well below the 1 ns no-refit bound but exceeded the 0.01 ns checks.
conda osx-64 downcasts the tdbld/Quantity/Horner path to float64 (about 10 ns over 1250 d). Compare converted F0/F1 against Astropy Time intervals instead so the no-refit check stays sub-ns.
Multiplying F0 by K (~1+1.55e-8) rounds the correction into the last bits of a factor near 1. On conda osx-64 that is a ~10 ns phase error over 1250 d. Apply x + x*(K^n-1) with K^n-1 formed from L_B, and evaluate spindown closure from the same increments.
# Conflicts: # CHANGELOG-unreleased.md
80-bit x87 longdouble does not recover erfa.ELB from 1-(1-ELB), so the exact equality in test_k_power_minus_one failed on CI.
vhaasteren
marked this pull request as draft
September 17, 2026 06:52
The exponents were hard-coded to the undilated rule, but the flag that sets them is the one on the TCB side of the conversion, where the Einstein-rate divisor carries the full K rather than departing from 1 by ~5e-10. TEMPO2 defaults to DILATEFREQ Y and writes it into the TCB pars it produces, and validate() coerced it to N before the converter could see it, so the common case was off by K^2-1 = 3.1e-8 of the dispersion delay (~3 ns at 1.4 GHz, ~40 ns at 400 MHz for DM=50) -- chromatic, so no phase offset absorbs it. validate() now records the flag in meta["tcb_source_dilatefreq"], parameters declare their frequency power via tcb2tdb_freq_power, and a dilated source leaves the frequency-dependent components unaudited, since PINT evaluates undilated frequencies and cannot certify that branch by closure. Also states the no-refit contract explicitly -- residuals reproduced to better than 1 ns with nothing refitted, up to the phase offset each package fixes by its own convention -- and documents that TEMPO2's UNITS TDB is currently Teph, 64.5 ns plus a 2.8e-18 rate away from IAU 2006 TDB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
This PR updates PINT’s TCB<-->TDB converter to support auditable, no-refit conversion at approximately nanosecond accuracy for the deterministic components that PINT explicitly supports.
My motivation is automatic pulsar-data combination in MetaPulsar. Combining releases from different PTAs sometimes requires converting TCB and TDB par files across timing engines. Refitting during ingestion is undesirable: it changes the scientific product and makes automated combinations harder to reproduce. For supported models, conversion should instead preserve the same physical timing solution.
The old converter used the legacy IFTE common-origin mapping. In particular, its epoch conversion omitted the approximately 65.5 μs TDB offset and used a slightly different rate from the IAU 2006 definition. Its DM scaling also did not match PINT’s actual fixed-frequency forward model.
This implementation follows several requirements we set before writing the code:
DILATEFREQ Nbehavior.The resulting converter:
TDB0;TCBTDBConversionReport;accepted=Trueonly when the model lies within the tested no-refit surface;The documentation and CLI now state the convention and acceptance contract explicitly. The changelog notes that converted epochs and DM values differ from legacy-IFTE output.
MetaPulsar also ingests native tempo2 par files, some of which cannot initially be parsed by PINT. Therefore this PR is not intended to replace MetaPulsar’s tempo2 conversion path. What we actually need longer-term is a corresponding tempo2 PR: one that provides the same auditable, permissive-conversion/strict-acceptance structure, but derives its scaling rules from tempo2’s own forward model and
DILATEFREQsemantics. I plan to work on that or coordinate with Mike separately.Thanks to @tcromartie for bringing it to my attention again yesterday during the DWG; it had been on my radar for months. I enjoyed the discussions!
Verification performed: