exgalsky / xgfield

Generation of mocks from a field representation of LSS on the observer's past light cone.
GNU General Public License v3.0
0 stars 0 forks source link

Implementation of Euclidean position from 2LPT displacements #8

Closed 1cosmologist closed 9 months ago

1cosmologist commented 9 months ago

Now computes field quantities with 2LPT displacements instead of 1LPT. The main change is in the function eucild_i for calculating Euclidean positions of the particles. Appropriate API changes have been made to take the 2LPT displacements as inputs. Also changed the example script to match the API changes.

Note: doubled the peak_per_cell_memory to account for the extra displacement inputs.

The code is currently crashing with an Out of Memory error. The goal would be to get the code tested as a part of this PR.

1cosmologist commented 9 months ago

@marcelo-alvarez Now it runs on Perlmutter for the 768 cube using the sub-sampled 2LPT displacements from WebSky. Here is the 2LPT kappa map: image and power spectrum: image

Strangely this still runs using same peak_per_cell_memory (now called peak_per_cell_memory_in_MB) as before. So I'm confused why the code was throwing the out of memory error earlier.

Changes made: removed bytes_per_cell kwarg is removed in favor of is64bit flag to switch between 32bit float and 64bit float displacements. Also peak_per_cell_memory_in_MB (previously peak_per_cell_memory) and jax_overhead_factor are no longer hardcoded. They are kwargs for fieldmap and FieldSky, with values added to defaults.py.

1cosmologist commented 9 months ago

@marcelo-alvarez Do you have the 1LPT kappa map for the cube field example lying around? Would be good to document the difference the 2LPT makes to the kappa at map and spectrum level.

marcelo-alvarez commented 9 months ago

@1cosmologist not that I recall, but we should have a switch between 1LPT and 2LPT so that it's just a matter of running twice with --lpt [1,2] isn't it?

1cosmologist commented 9 months ago

We can do that but I'm not sure why we'd ever want to have a 1LPT version other than for testing purposes.

marcelo-alvarez commented 9 months ago

Yes for testing purposes. There are also some methods that use 1LPT instead of 2LPT. Can you implement this switch in the lpt interface as part of this PR?

1cosmologist commented 9 months ago

Implemeted a nlpt kwarg to swich between 1lpt and 2lpt. Here's the difference of the 2lpt and 1lpt kappa: image Almost no difference in spectra though: image

marcelo-alvarez commented 9 months ago

Looks good to me, merging now, thanks.