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

astropy Comparison Notebook #1

Merged
merged 31 commits into from
Aug 12, 2024
Merged

astropy Comparison Notebook #1

merged 31 commits into from
Aug 12, 2024

Conversation

afarah18
Copy link
Collaborator

Some comparisons with astropy. Will be changed to use the code in this repo

@ColmTalbot ColmTalbot mentioned this pull request May 15, 2024
5 tasks
@afarah18 afarah18 marked this pull request as ready for review May 17, 2024 16:44
@ColmTalbot
Copy link
Owner

This isn't rendering fully for me. One possibility is to make this run automatically and render in the docs in this PR for easier review. I'm happy to set this up, I have it running for gwpopulation the directory structure is just a little different here.

@ColmTalbot
Copy link
Owner

ColmTalbot commented May 20, 2024

It's now rendering for me, maybe I just had too many tabs open in chrome before.

The comparisons all look great and all of my comments are aesthetic, so feel free to take with a pinch of salt.

  • It would be good to have more preamble, describe what the notebook is going to do, the basics of how the approximation works (from A&K), how that differs from astropy. In general, it would be good to have a narrative flow so that people who aren't familiar can follow along.
  • We may as well use the exact version of the speed of light, just in case that is making the comparisons with A&K slightly unfair.
  • Set axis limits to zero where appropriate.
  • In the fractional comparisons why are some y-axes log scaled and others linear? It would be good to be consistent.
  • It looks like the fractional comparisons are showing the difference, maybe this is why some are linear scaled, I think we should go for absolute difference, unless you think the sign is important? We should at least do absolute value when the y-axis is log-scaled.
  • I would let black handle formatting. Again, this should improve readability (at least for people used to looking at black formatted code.)
  • I think In [35]: should be removed? (Also, we should rerun all of the cells in order.)

@afarah18
Copy link
Collaborator Author

Yes, some were linear scaled because the difference was negative! I guess you're right that the sign probably doesn't matter much, except for previous users of the A&K approximant so they know when it was an over-vs-under estimate of astropy. But that seems like a very small number of people, as well as a pretty minor detail, so I changed both panels on these plots to be log scaled by default, and the differences to be absolute.

@ColmTalbot
Copy link
Owner

This is looking good, a minor comments:

@afarah18
Copy link
Collaborator Author

I think I addressed everything with my most recent push - I had pushed before finishing completely. I just haven't integrated to the docs yet. Let me know if there's anything else I should change!

@ColmTalbot
Copy link
Owner

Great! and sorry about the premature comments. The new text is great, I think this is pretty ready to go.

  • "Accuracy" probably doesn't need to have a capital in the tital
  • there's a typo in "All fractional errors below 0.1%" -> All fractional errors are below 0.1%
  • is (1) correct? Shouldn't the integrated be in a denominator?
  • there's still a {w} that is messing up some titles.

Something that isn't worth commenting on in this notebook, but I don't think I mentioned it previously. I realised we can get more things, e.g., absorption distance by generalizing (3) a little more to add an arbitrary extra power of (1 + z) (see https://wcosmo.readthedocs.io/en/latest/api/wcosmo.taylor.analytic_integral.html.)

@afarah18
Copy link
Collaborator Author

Oops, thank you for catching these! Hopefully should be fixed now and in the docs. I also added it to readthedocs.yml since it seemed like it belonged there too? But I can undo that if its incorrect. Also, sorry for the many small commits - I'm still trying to figure out the best way to debug github actions.

I noticed that the index of the examples page has all 3 section headers (see screenshot below) but the section navigation just has the title of the notebook. I'm assuming we don't want this, so in a future commit I'll demote the other headers to subsections and hopefully that will fix this.
image

@afarah18
Copy link
Collaborator Author

As far as the extra powers of 1+z in the integral giving us more flexibility, that's very cool! I wonder if we can add a short example using different powers of 1+z directly to that page in the docs? I think I understand how to do that (I always see examples in very long docstrings when I look at scipy source code) so I can give it a shot.

@ColmTalbot
Copy link
Owner

Oops, thank you for catching these! Hopefully should be fixed now and in the docs. I also added it to readthedocs.yml since it seemed like it belonged there too? But I can undo that if its incorrect. Also, sorry for the many small commits - I'm still trying to figure out the best way to debug github actions.

I'm not sure there is a good way, the docs can be built locally, but that isn't always enough.

I noticed that the index of the examples page has all 3 section headers (see screenshot below) but the section navigation just has the title of the notebook. I'm assuming we don't want this, so in a future commit I'll demote the other headers to subsections and hopefully that will fix this.

Yes, we should make the other headings subheadings.

@ColmTalbot
Copy link
Owner

I managed to get around the builder-inited error by adding import wcosmo to doc/source/conf.py.

wcosmo/taylor.py Outdated

.. math::

t_L = t_H\int_0^z \frac{dz'}{(1+z)E(z')}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great and pretty much ready to go!

I'm going to leave notebook comments here, rather than inline comments:

  • I think (1) and (2) are inconsistent, is one of the integrands incorrect? It looks like the factors of a differ between the two.
  • We should define $x$ for (3).
  • Though the two methodologies are the same in the limit $w=-1$...
  • # In 4: has an unnecessary comment, same in some other cells

wcosmo/taylor.py Outdated Show resolved Hide resolved
wcosmo/taylor.py Show resolved Hide resolved
afarah18 and others added 4 commits August 12, 2024 14:09
Co-authored-by: Colm Talbot <[email protected]>
- remove unnecessary comments
- fix error in DL definition
- define all variables
Copy link
Owner

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ColmTalbot ColmTalbot merged commit 27358c6 into main Aug 12, 2024
5 checks passed
@ColmTalbot ColmTalbot mentioned this pull request Aug 12, 2024
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