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

Chromatic delay similar to dispersion delay #1616

Merged
merged 59 commits into from
Jun 4, 2024

Conversation

abhisrkckl
Copy link
Contributor

@abhisrkckl abhisrkckl commented Aug 10, 2023

This PR defines a chromatic delay (ChromaticCM) using CM, CM1, CM2, etc. similar to DispersionDM.

The delay is given by the following expression (consistent with tempo2):

cm * DMconst * (freq / 1 MHz)**(-alpha)

The chromatic index alpha is called TNCHROMIDX and it is a constant in time in this model.

I have also defined an abstract base class Chromatic similar to Dispersion so that piecewise-constant CM similar to DispersionDMX can be implemented in the future.

Partially implements #1661

@abhisrkckl abhisrkckl changed the title Chromatic delay similar to dispersion delay WIP: Chromatic delay similar to dispersion delay Aug 10, 2023
@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Attention: Patch coverage is 65.89595% with 59 lines in your changes missing coverage. Please review.

Project coverage is 69.17%. Comparing base (178002e) to head (7f8a21b).
Report is 107 commits behind head on master.

Current head 7f8a21b differs from pull request most recent head d767f0b

Please upload reports for the commit d767f0b to get more accurate results.

Files Patch % Lines
src/pint/models/chromatic_model.py 65.29% 52 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1616      +/-   ##
==========================================
- Coverage   69.43%   69.17%   -0.26%     
==========================================
  Files         107      107              
  Lines       24925    25028     +103     
  Branches     4430     4455      +25     
==========================================
+ Hits        17306    17314       +8     
- Misses       6510     6591      +81     
- Partials     1109     1123      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dlakaplan
Copy link
Contributor

Should there be a DMX version of this?

@abhisrkckl
Copy link
Contributor Author

Yes. I am also planning to do a piecewise model (like DMX), a Fourier model (like DMWaveX). and a GP model (like PLDMNoise).

@dlakaplan
Copy link
Contributor

Good. Will those be separate or part of this?

@abhisrkckl
Copy link
Contributor Author

I'll do them separately.

@abhisrkckl abhisrkckl changed the title WIP: Chromatic delay similar to dispersion delay Chromatic delay similar to dispersion delay Nov 2, 2023
@abhisrkckl abhisrkckl added the awaiting review This PR needs someone to review it so it can be merged label Nov 2, 2023
@abhisrkckl abhisrkckl changed the title WIP: Chromatic delay similar to dispersion delay Chromatic delay similar to dispersion delay May 22, 2024
@abhisrkckl
Copy link
Contributor Author

OK... I have compared the code carefully with TEMPO2 and it matches as far as I can tell.

Unfortunately, I couldn't actually do the comparison with tempo2 due to what I suspect is a bug in tempo2. Basically, the post-fit values for CM are not displayed on the terminal or written into an output par file. I have raised this issue in the IPTA slack.

For the time being I think this is ready for review.

@abhisrkckl abhisrkckl added the awaiting review This PR needs someone to review it so it can be merged label May 22, 2024
@abhisrkckl
Copy link
Contributor Author

Also, I have removed the chromatic index fitting code since it was not working consistently. This is probably because there is too much covariance with DM when the chromatic index is allowed to vary.

@abhisrkckl
Copy link
Contributor Author

abhisrkckl commented May 26, 2024

Example application on InPTA DR1 data of J1939+2134

Before fitting CM & CM1
image
CHI2R 3.2021938751881196
TRES 1.3759850757276195468

================

After fitting CM & CM1
image
CHI2R 1.5363535810916809
TRES 0.9524124603021290128

@dlakaplan
Copy link
Contributor

Looks good. I don't see a test with a fit for CM1, though. Is that possible?

Similarly, would it make sense to do a fit for CM with alpha=-2 and show that it reproduces the DM fit?

@abhisrkckl
Copy link
Contributor Author

Looks good. I don't see a test with a fit for CM1, though. Is that possible?
Similarly, would it make sense to do a fit for CM with alpha=-2 and show that it reproduces the DM fit?

Added both.

tests/test_chromatic.py Outdated Show resolved Hide resolved
@abhisrkckl
Copy link
Contributor Author

@dlakaplan I am done unless there is any other suggestion.

@dlakaplan dlakaplan merged commit 8303f90 into nanograv:master Jun 4, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review This PR needs someone to review it so it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants