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

Angular lightcone #313

Merged
merged 61 commits into from
Feb 19, 2024
Merged

Angular lightcone #313

merged 61 commits into from
Feb 19, 2024

Conversation

steven-murray
Copy link
Member

@steven-murray steven-murray commented Nov 24, 2022

This PR adds the ability to create lightcones in Angular coordinates (as well as a more flexible lightconing interface).

In total, it does the following:

  • Makes it possible to checkpoint lightcones.
  • Adds a new Lightconer base class, and two implementations: a RectilinearLightconer (equivalent to the old way) and an AngularLightconer.
  • Removes some excess warnings we were producing
  • Makes a small fix to the lightcone_coords attribute of the LightCone class.
  • Adds an AngularLightcone class to deal with the outputs of these lightcones.

@andreimesinger
Copy link
Contributor

andreimesinger commented Nov 24, 2022 via email

@steven-murray
Copy link
Member Author

@andreimesinger Ah, yes that was always my intention. I'll get to that ASAP.

@JulianBMunoz
Copy link
Member

I feel like adding a new section to the lightcone tutorial (or a new tutorial entirely) would also be great

@steven-murray
Copy link
Member Author

@JulianBMunoz that's a great section. In fact, I'm currently updating the lightcone tutorial with this (that was the notebook we were looking at last week with the weird aspect ratio plot).

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@steven-murray
Copy link
Member Author

OK @andreimesinger and @JulianBMunoz, I'm gonna post some plots here, but also these plots are all available in the updated documentation here.

First, I made an angular grid that was suppose to closely match the rectilinear grid (at least at the lowest redshift), and looking directly at the face of the lightcone, we get:

image

Then, looking at the redshift evolution (top is rectilinear, bottom is angular):

image

Of course, the angular lightcone in the above is plotted as if it were rectilinear, so we can also plot it in polar coords:

image

And, just to prove that we're not limited to doing small areas of the sky corresponding to the rectilinear lightcone, I simulated a "lightplane" -- i.e. a single strip along the horizon, extending into the line of sight. Plotting that in polar coords:

image

@andreimesinger
Copy link
Contributor

andreimesinger commented Dec 13, 2022 via email

@andreimesinger
Copy link
Contributor

The "face" slices you posted look a bit weird.. The angular one looks smoothed and is missing some large structures compared to the rectilinear one....

@steven-murray
Copy link
Member Author

Yeah -- so I think it's all as expected. At the top left corner, the match is very very close, because the (0,0) pixel of the angular lightcone perfectly corresponds to the rectilinear. However, moving away from there, the angular lightcone bends away from the rectilinear, and so it is showing effectively a different slice at the bottom right. The smoothing I'm not quite sure -- probably an interpolation thing. Probably if I created the angular lightcone at double the resolution, it would look more crisp.

@BradGreig
Copy link
Member

This is unavoidable. An interpolated 21-cm signal will always be blurry as there is no way to interpolate between the sharp edges of the ionised regions. It inevitably always leads to blurry features around ionised regions. Increasing the resolution will not help this.

@steven-murray
Copy link
Member Author

In terms of power spectrum, though, this shouldn't be a big deal as it should only affect very small scales, right? I guess it's something we should test.

@JulianBMunoz
Copy link
Member

JulianBMunoz commented Dec 19, 2022 via email

@steven-murray
Copy link
Member Author

@JulianBMunoz I can take the (cartesian) power spectrum of the angular lightcone, which is slightly the wrong thing to do because the coordinates aren't exactly rectilinear. OR I can compute the angular power spectrum after tiling onto a full healpix map (this is a bit more compute heavy, obviously). For the latter, I can never remember exactly how to relate the angular PS back to the 3D PS in a simple way, so I'm less sure it'll be useful.

@JulianBMunoz
Copy link
Member

I think in order to compare more fairly it may make sense to compare angular power spectra, so C_\ells. In the case of the rectilinear lightcone one can take the flat-sky approximation or similar to compute the C_ells. Ping me on Slack if you want to chat more

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 46 lines in your changes are missing coverage. Please review.

Comparison is base (adf1d76) 86.58% compared to head (346e23e) 82.42%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/py21cmfast/outputs.py 74.66% 13 Missing and 6 partials ⚠️
src/py21cmfast/_utils.py 52.17% 9 Missing and 2 partials ⚠️
src/py21cmfast/lightcones.py 95.76% 4 Missing and 4 partials ⚠️
src/py21cmfast/wrapper.py 94.56% 1 Missing and 4 partials ⚠️
src/py21cmfast/cache_tools.py 88.46% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #313      +/-   ##
==========================================
- Coverage   86.58%   82.42%   -4.17%     
==========================================
  Files          12       13       +1     
  Lines        2811     3106     +295     
  Branches        0      841     +841     
==========================================
+ Hits         2434     2560     +126     
- Misses        377      391      +14     
- Partials        0      155     +155     

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

@steven-murray
Copy link
Member Author

@andreimesinger + @JulianBMunoz this PR is now ready for final review/approval. It's kinda large and unwieldy, but all tests are passing and I've even added tests of the documentation tutorials. The validation of the new lightconing method is in the lightcone tutorial.

@steven-murray steven-murray merged commit 2cf3c88 into master Feb 19, 2024
14 of 15 checks passed
@steven-murray steven-murray deleted the angular-lightcone branch February 19, 2024 13:38
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.

4 participants