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 1LPT #2

Closed marcelo-alvarez closed 10 months ago

marcelo-alvarez commented 10 months ago

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

marcelo-alvarez commented 10 months ago

@abaleato the first kappa maps are obviously wrong, it looks like there is only the particle shot noise present in the maps (i.e. Cl \propto 1/N^3 where N is the cube root of the number of particles in the simulation, as labeled in the plot below; don't mind the noise at high-ell, these maps were only binned to Nside=1024, unlike the map used for websky-6144 which was binned at Nside=4096).

I suspect there is some normalization factor off in the transfer function that makes the displacements negligible so there is no clustering in the matter. I will investigate further and may involve getting started on https://github.com/exgalsky/lpt/issues/5.

Image

abaleato commented 10 months ago

I see. No worries. Just let me know when you've got something I can validate.

marcelo-alvarez commented 10 months ago

@abaleato the first batch of (10) kappa maps for you to validate are being written to:

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

These were generated by the command

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

with the xgsmenv environment on 4 Perlmutter GPU nodes.

The cosmological parameters passed to CAMB were:

            'T_cmb': 2.72548,
            'h': 0.68,
#=================Omegas========================
            'Omega_m': 0.31,      # Matter density fraction
            'Omega_b': 0.0493890, # baryon density fraction
            'Omega_k': 0.,
#=============Spectral params===================
            'A_s': 2.10058e-9,   # scalar amplitude
            'n_s': 0.96605,      # scalar spectral index
            'alpha_s': 0.,       # scalar spectral running
            'k_pivot': 0.05,     # pivot scale for scalar perturbations
            'r': 0.,             # tensor to scalar ratio
            'n_t': 0.,           # tensor spectral index
            'alpha_t': 0.,       # tensor spectral running

#=============reionization========================
            'tau_reion': 0.0543,    # optical depth at reionization
            'YHe': 0.2454,          # Helium fraction
#=============Light relics===========================
            'N_ur': 2.0328,     # Ultra-relativistic species (ultra-light neutrinos)
            'N_ncdm': 1,        # Light massive relics including massive neutrinos
            'm_ncdm': 0.06,     # mass of non-cold light relics
#===========DE EOS===================================
            'w0': -1.,         
            'wa': 0.

Box size = 7700 Mpc at 2048^3 resolution. The redshift range integrated over was 0.05 < z < 4.5. Note that the lensing kernel used is for a comoving distance to the last scattering surface of 13.8 Gpc.

This is a moderate-to-low resolution run, with 10 independent realizations (one kappa map per) so as not to waste Perlmutter GPU cycles. If necessary at this stage higher resolutions can be done. Please let me know if you have any questions. Thanks!

abaleato commented 10 months ago

Got it. Thanks! I'll let you know when I have something to show.

abaleato commented 10 months ago

@marcelo-alvarez I don't seem to have permission to read /global/cfs/cdirs/mp107d/exgal/users/malvarez/tests/mockgen/output/

marcelo-alvarez commented 10 months ago

@marcelo-alvarez I don't seem to have permission to read /global/cfs/cdirs/mp107d/exgal/users/malvarez/tests/mockgen/output/

@abaleato should be fixed now.

abaleato commented 10 months ago

@marcelo-alvarez Did you check these against Websky? I just did a preliminary check against theory and see some significant divergences. Though of course I may have put some bugs in somewhere! Screenshot 2024-02-05 at 3 03 06 PM

marcelo-alvarez commented 10 months ago

@abaleato I did a quick check, yes. Is this integrating from z=0.05 to z=4.5 (which is the interval used in the maps)?

abaleato commented 10 months ago

Yep, 0.05<z<4.5. I'll dig deeper to make sure I haven't messed up somewhere.

P.S. Here's an updated plot where I've fixed the low-ell issues in 1LPT (I wasn't going low enough in k).

Screenshot 2024-02-05 at 4 22 28 PM

marcelo-alvarez commented 10 months ago

That's a bummer. Would it help to compare the z=0 matter power spectrum used? I wrote it to the file

$CFS/mp107d/exgal/users/malvarez/tests/mockgen/matterpower.npz

by adding

        if self.mpiproc == 0:
            np.savez('matterpower.npz',k_Mpc=k,pk_Mpc3=pk)

after line 41 of mockgen/sky.py. Units are in $1/{\rm Mpc}$ and ${\rm Mpc}^3$ i.e. without factors of $h$.

The plot below was generated with

python $CFS/mp107d/exgal/users/malvarez/tests/mockgen/showmatterpower.py

matterpower

abaleato commented 10 months ago

Your Plin(z=0) is actually 5% higher than mine across all ks, but I think that difference would pull us away from reconciliation...

abaleato commented 10 months ago

Again, let me double check things on my end, because it's quite likely I have a bug

marcelo-alvarez commented 10 months ago

Your Plin(z=0) is actually 5% higher than mine across all ks, but I think that difference would pull us away from reconciliation...

At least that indicates there is some kind of mismatch in cosmology. So it's still possible that the difference in evolution towards higher z would go in the right direction.

I will see about having CAMB output the exact parameters used (what I copied above was actually based on the default values in our own interface to CAMB as well as those that we modified with our own defaults (omegam=0.31 and h=0.68).

marcelo-alvarez commented 10 months ago

Again, let me double check things on my end, because it's quite likely I have a bug

Sure, no problem, thanks for double checking!

I will hold off on having CAMB output the exact parameters then, until I hear back...

abaleato commented 10 months ago

Ta-daaa. It was a bug of mine, of course. Looks great! :)

(Note that the CAMB result is fully non-linear and goes up to z=1100, where the 1LPT curve covers 0.05<z<4.5.)

Screenshot 2024-02-05 at 5 48 27 PM

marcelo-alvarez commented 10 months ago

Excellent. There are many more tests we could do, but I think they would also be applicable to 2lpt, fully nonlinear, etc, so let's consider this done and move on. Thanks!