def ff(a, gamma=0.55): # RSD function to be used for numerical derivatives c = copy.deepcopy(rf.experiments.cosmo) c['gamma'] = gamma H, r, D, f = rf.background_evolution_splines(c) z = 1. / a - 1. return f(z)
def Frsd(a, gamma=0.55, mu=1.): # RSD function to be used for numerical derivatives c = copy.deepcopy(rf.experiments.cosmo) c['gamma'] = gamma H, r, D, f = rf.background_evolution_splines(c) z = 1. / a - 1. # F_RSD b = 1. #np.sqrt(1.+z) Frsd = (b + mu**2. * f(z))**2. * D(z)**2. return Frsd
def Frsd_deriv(a, gamma=0.55, mu=1.): # Analytic deriv. used in baofisher code H, r, D, f = rf.background_evolution_splines(rf.experiments.cosmo) z = 1. / a - 1. b = 1. #np.sqrt(1.+z) #ff = np.poly1d( np.polyfit(a, f(z), deg=6) ) #df_da = ff.deriv(1)(a) df_da = np.gradient(f(z), a[1] - a[0]) #dD_da = D(z)*f(z)/a dD_da = np.gradient(D(z), a[1] - a[0]) # Get derivative of F_RSD w.r.t. f(z) dD_df = dD_da / df_da #dD_df = np.log(a) dF_df = 2. * (b + f(z)*mu**2.) * mu**2. * D(z)**2. \ + 2. * (b + f(z)*mu**2.)**2. * D(z) * dD_df # Chain rule, for deriv. w.r.t. gamma logOma = np.log(f(z)) / gamma return dF_df, dF_df * f(z) * logOma
#!/usr/bin/python """ Re-bin Euclid n(z) """ import numpy as np import pylab as P import scipy.integrate import radiofisher as rf # Precompute cosmo fns. cosmo_fns = rf.background_evolution_splines(rf.experiments.cosmo) HH, rr, DD, ff = cosmo_fns expt = rf.experiments_galaxy.EuclidRef def vol(zmin, zmax): """ Calculate volume of redshift bin. """ C = 3e5 _z = np.linspace(zmin, zmax, 1000) vol = C * scipy.integrate.simps(rr(_z)**2. / HH(_z), _z) vol *= 4. * np.pi return vol # Load Euclid n(z) and b(z) e = rf.experiments_galaxy.load_expt(expt) nz = expt['nz'] zmin = expt['zmin']
zmin = dat[0] bias = dat[4] #zs = np.concatenate((zmin, [zmin[1] - zmin[0],])) #zc = 0.5 * (zs[:-1] + zs[1:]) # Single bin between 800 - 1000 MHz zs = np.array([1420. / 1000. - 1., 1420. / 800. - 1.]) zc = 0.5 * (zs[:-1] + zs[1:]) # Define kbins (used for output) kbins = np.arange(0., 5. * cosmo['h'], 0.1 * cosmo['h']) # Bins of 0.1 h/Mpc ################################################################################ # Precompute cosmological functions and P(k) cosmo_fns = rf.background_evolution_splines(cosmo) # Load P(k) and split into smooth P(k) and BAO wiggle function k_in, pk_in = np.genfromtxt("slosar_pk_z0.dat").T # Already in non-h^-1 units cosmo['pk_nobao'], cosmo['fbao'] = rf.spline_pk_nobao(k_in, pk_in) cosmo['k_in_max'] = np.max(k_in) cosmo['k_in_min'] = np.min(k_in) # Switch-off massive neutrinos, fNL, MG etc. mnu_fn = None transfer_fn = None Neff_fn = None switches = [] H, r, D, f = cosmo_fns
#!/usr/bin/python """ Project a Fisher matrix for f, H etc. to alpha = f.H, used for the KSZ paper. """ import numpy as np import pylab as P import radiofisher as rf import os # Precompute cosmo fns. H, r, D, f = rf.background_evolution_splines(rf.experiments.cosmo) # Load precomputed Fisher matrix fname = "/home/phil/oslo/bao21cm/fisher_bao_EuclidRef.dat" F0 = np.genfromtxt(fname).T # Get parameter names from header ff = open(fname, 'r') line = ff.readline()[2:-1] ff.close() pnames = line.split(", ") # Load redshift bin array zc = np.array([ 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25,