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

Correction to docstring for pbprime functions #1606

Merged
merged 2 commits into from
Aug 30, 2023
Merged

Conversation

coclar
Copy link
Contributor

@coclar coclar commented Jul 18, 2023

While going through the binary orbit classes to implement a new model, I found that the docstrings for the pbprime() methods had an incorrect description. These should calculate the orbital period as a function of time, but the docstrings said that they compute the time-derivative of the orbital period (this is actually computed in pbdot_orbit()).

@dlakaplan
Copy link
Contributor

Thanks for the fix. Do you think that this is used correctly otherwise?

@coclar
Copy link
Contributor Author

coclar commented Jul 28, 2023

In binary_orbits.py, yes - pbprime() is always correctly used as the orbital period.

However, after digging a bit deeper, there are some lines that I am unsure about in binary_generic.py:

The pb() and pbdot() methods are used by the binary models (ELL1model, BTmodel, etc.) obtain pbprime() and pbdot_orbit() from the relevant orbits_cls:
https://github.com/nanograv/PINT/blob/40dec33c013096096dd335c221393945033a3a66/src/pint/models/stand_alone_psr_binaries/binary_generic.py#L424C1-L425C41

https://github.com/nanograv/PINT/blob/40dec33c013096096dd335c221393945033a3a66/src/pint/models/stand_alone_psr_binaries/binary_generic.py#L447C1-L448C45

but then the PSR_BINARY class also has its own pbprime() method:
https://github.com/nanograv/PINT/blob/40dec33c013096096dd335c221393945033a3a66/src/pint/models/stand_alone_psr_binaries/binary_generic.py#L681C5-L682C51
I'm really not sure what this is supposed to be doing!

self.pb() retrieves self.orbits_cls.pbprime(), which should already account for any PBDOT, but then self.pbdot() * self.tt0 is subtracted from it, which would presumably "undo" the PBDOT effects to arrive back at the initial orbital period? But even this is incorrect if there are higher-order orbital frequency derivatives (i.e. pbdot_orbit() is not a constant value).

I'm struggling to follow the flow here though - it's possible that this method is always overwritten by the inheriting classes in binary_orbits.py that implement their own pbprime()s, and is therefore never used.

@dlakaplan
Copy link
Contributor

Sorry for the delay in dealing with this. Do you think you could rebase it on the latest master and put in an entry in CHANGELOG-unreleased.md?

@coclar
Copy link
Contributor Author

coclar commented Aug 29, 2023

No worries, done!

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (7275528) 68.25% compared to head (5e701fa) 68.25%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1606   +/-   ##
=======================================
  Coverage   68.25%   68.25%           
=======================================
  Files          99       99           
  Lines       22791    22791           
  Branches     3920     3920           
=======================================
  Hits        15556    15556           
  Misses       6274     6274           
  Partials      961      961           
Files Changed Coverage Δ
...t/models/stand_alone_psr_binaries/binary_orbits.py 88.40% <ø> (ø)

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

@dlakaplan dlakaplan merged commit fd5d4f0 into nanograv:master Aug 30, 2023
8 checks passed
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.

2 participants