cosmotool/python_sample/build_nbody_skymap.py
2014-06-06 09:42:44 +02:00

20 lines
434 B
Python

import cosmotool as ct
import h5py as h5
L=600.
Nside=128
with h5.File("fields.h5", mode="r") as f:
density = f["density"][:]
N = density.shape[0]
ix = (np.arange(N)-0.5)*L/N - 0.5 * L
dist2 = (ix[:,None,None]**2 + ix[None,:,None]**2 + ix[None,None,:]**2)
flux = density / dist2
projsky1 = ct.spherical_projection(Nside, flux, 0, 52, integrator_id=1)
projsky0 = ct.spherical_projection(Nside, flux, 0, 52, integrator_id=0)