exgalsky / mockgen

Extragalactic mock sky generation
GNU General Public License v3.0
1 stars 0 forks source link

Validate kappa maps generated by mockgen for 2LPT #7

Open marcelo-alvarez opened 4 months ago

marcelo-alvarez commented 4 months ago

Verify that changes after merging https://github.com/exgalsky/mockgen/pull/6, https://github.com/exgalsky/xgfield/pull/8, and https://github.com/exgalsky/lpt/pull/10 result in the expected statistical properties of full sky kappa maps for the input cosmology, assuming 2LPT is used for the matter fluctuations.

@abaleato 1/2LPT maps for you to validate are being written to:

/global/cfs/cdirs/mp107d/exgal/users/malvarez/tests/mockgen/output/kappa_mockgen-5_135[79-88]-2048_nside-4096_[1,2]LPT.fits

These were generated by the commands

srun -n 16 mockgen mockgen-4 --N 2048 --Niter 10 --Nside 4096 --nlpt 1
srun -n 16 mockgen mockgen-4 --N 2048 --Niter 10 --Nside 4096 --nlpt 2

with the xgsmenv environment on 4 Perlmutter GPU nodes. The cosmological parameters passed to CAMB and the random seeds were the same as in https://github.com/exgalsky/mockgen/issues/2. The 1LPT maps match statistically at the power spectrum and cross correlation level, however are not perfectly identical pixel-by-pixel, for unknown reasons (@1cosmologist any idea what may have changed?).

A quick plot of the difference for the first random realization (seed=13579) is attached. The uptick at ell > 2000 in the power spectra and corresponding turnover in the relative differences is likely due to limited resolution combined with our treatment of resolution elements as point masses. I think for the purposes of this validation we can focus on ell < 2000 and leave the higher-resolution testing and a more well-behaved matter representation for the future. lpt1_v_lpt2

1cosmologist commented 4 months ago

@marcelo-alvarez I think that is the difference between the CAMB vs CLASS cosmology backend use in xgfield. As you discovered the cosmology class methods were not supported for CAMB backend (fixed in https://github.com/exgalsky/xgcosmo/pull/2). So the earlier run must have been using CLASS backend in the xgfield part. Unless we fix the CLASS vs CAMB precision issues there will be small differences in the numbers. One way would be to check consistency of the output of all class methods for different choices of cosmo_backend.

abaleato commented 4 months ago

Hi. I've been mulling over how to do this validation at 2LPT and so far have come up with no good ideas. The challenge is that (as far as I know) any code that computes the power spectra of matter or tracers beyond 1LPT (e.g. velocileptors) is conscious of the extensive cancellations taking place at 1-loop order between P^{1,3} and P^{2,2}, and actually computes these beyond-tree-level as a single integral. This avoids catastrophic numerical artifacts when differencing two large but very similar numbers. But unfortunately, it also means that we don't get access to just P^{2,2}, which is what we would want to do our 2LPT validation.

abaleato commented 4 months ago

Managed a quick and dirty hack of velocileptors following advice from Stephen Chen. The 2LPT sims roughly agree with theory up to ell~2000. We can discuss more tomorrow.

Screenshot 2024-02-13 at 8 40 09 PM
marcelo-alvarez commented 4 months ago

@abaleato thanks for all your work on this. As we discussed previously, we can keep this issue open and continue investigating at ell>1000 once we have higher resolution data and have checked that we are using the same matter power spectrum P(k,z).