Previous generation survey: SDSS
Current generation survey: DES
LSST precursor survey: HSC
import jax.numpy as np
import tensorflow as tf
import flowpm
# Defines integration steps
stages = np.linspace(0.1, 1.0, 10, endpoint=True)
initial_conds = flowpm.linear_field(32, # size of the cube
100, # Physical size
ipklin, # Initial powerspectrum
batch_size=16)
# Sample particles and displace them by LPT
state = flowpm.lpt_init(initial_conds, a0=0.1)
# Evolve particles down to z=0
final_state = flowpm.nbody(state, stages, 32)
# Retrieve final density field
final_field = flowpm.cic_paint(tf.zeros_like(initial_conditions),
final_state[0])
import jax.numpy as np
import jax_cosmo as jc
# Defining a Cosmology
cosmo = jc.Planck15()
# Define a redshift distribution with smail_nz(a, b, z0)
nz = jc.redshift.smail_nz(1., 2., 1.)
# Build a lensing tracer with a single redshift bin
probe = probes.WeakLensing([nz])
# Compute angular Cls for some ell
ell = np.logspace(0.1,3)
cls = angular_cl(cosmo_jax, ell, [probe])
import jax
import jax.numpy as np
import jax_cosmo as jc
# .... define probes, and load a data vector
def gaussian_likelihood( theta ):
# Build the cosmology for given parameters
cosmo = jc.Planck15(Omega_c=theta[0], sigma8=theta[1])
# Compute mean and covariance
mu, cov = jc.angular_cl.gaussian_cl_covariance_and_mean(cosmo,
ell, probes)
# returns likelihood of data under model
return jc.likelihood.gaussian_likelihood(data, mu, cov)
# Fisher matrix in just one line:
F = - jax.hessian(gaussian_likelihood)(theta)
def log_posterior( theta ):
return gaussian_likelihood( theta ) + log_prior(theta)
score = jax.grad(log_posterior)(theta)