Exemplo n.º 1
0
import matplotlib.pyplot as p

# mass function theory
from hmf import MassFunction
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206)

#lib.covariance_factor
#lib.f_BH(sigma, 0.333, 0.788, 0.807, 1.795)
A0=0.333
a0=0.786
p0=0.807
q0=1.795
bias = lambda sigma, a0, p0, q0 : lib.b_BH(sigma, a0, p0, q0)
fsigma = lambda sigma : lib.f_BH(sigma, A0, a0, p0, q0)

# diagonal error
dn_L04 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[0]))**2. + lib.shot_noise(sigma, 400.**3.)  )**0.5
dn_L10 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[1]) )**2. + lib.shot_noise(sigma, 1000.**3.) )**0.5  
dn_L25 = lambda sigma, a, p, q : (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[2]) )**2. + lib.shot_noise(sigma, 2500.**3.) )**0.5  
dn_L40 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[3]) )**2. + lib.shot_noise(sigma, 4000.**3.) )**0.5  

# off diagonal error 
dn_cov_L04 = lambda s1, s2, a, p, q : (dn_L04(s1, a, p, q)*dn_L04(s2, a, p, q))**0.5 
dn_cov_L10 = lambda s1, s2, a, p, q : (dn_L10(s1, a, p, q)*dn_L10(s2, a, p, q) )**0.5
dn_cov_L25 = lambda s1, s2, a, p, q : (dn_L25(s1, a, p, q)*dn_L25(s2, a, p, q) )**0.5
dn_cov_L40 = lambda s1, s2, a, p, q : (dn_L40(s1, a, p, q)*dn_L40(s2, a, p, q) )**0.5

# opens the data 
Exemplo n.º 2
0
# mass function theory
from hmf import MassFunction
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=67.77 * u.km / u.s / u.Mpc,
                      Om0=0.307115,
                      Ob0=0.048206)

#lib.covariance_factor
#lib.f_BH(sigma, 0.333, 0.788, 0.807, 1.795)
A0 = 0.333
a0 = 0.786
p0 = 0.807
q0 = 1.795
bias = lambda sigma, a0, p0, q0: lib.b_BH(sigma, a0, p0, q0)
fsigma = lambda sigma: lib.f_BH(sigma, A0, a0, p0, q0)

# diagonal error
dn_L04 = lambda sigma, a, p, q: (
    ((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. *
     (lib.covariance_factor[0]))**2. + lib.shot_simple(sigma, 400.**3.))**0.5
dn_L10 = lambda sigma, a, p, q: (
    ((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. *
     (lib.covariance_factor[1]))**2. + lib.shot_simple(sigma, 1000.**3.))**0.5
dn_L25 = lambda sigma, a, p, q: (
    ((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. *
     (lib.covariance_factor[2]))**2. + lib.shot_simple(sigma, 2500.**3.))**0.5
dn_L40 = lambda sigma, a, p, q: (
    ((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. *
     (lib.covariance_factor[3]))**2. + lib.shot_simple(sigma, 4000.**3.))**0.5
dn_L80 = lambda sigma, a, p, q: (
Exemplo n.º 3
0
import matplotlib.pyplot as p

# mass function theory
from hmf import MassFunction
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206)

#lib.covariance_factor
#lib.f_BH(sigma, 0.333, 0.788, 0.807, 1.795)
A0=0.333
a0=0.786
p0=0.807
q0=1.795
bias = lambda sigma, a0, p0, q0 : lib.b_BH(sigma, a0, p0, q0)
fsigma = lambda sigma : lib.f_BH(sigma, A0, a0, p0, q0)

# diagonal error
dn_L04 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[0]))**2. + lib.shot_simple(sigma, 400.**3.)  )**0.5
dn_L10 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[1]) )**2. + lib.shot_simple(sigma, 1000.**3.) )**0.5  
dn_L25 = lambda sigma, a, p, q : (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[2]) )**2. + lib.shot_simple(sigma, 2500.**3.) )**0.5  
dn_L40 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[3]) )**2. + lib.shot_simple(sigma, 4000.**3.) )**0.5  
dn_L80 = lambda sigma, a, p, q :  (((bias(sigma, a, p, q) * lib.hmf.growth_factor)**2. * (lib.covariance_factor[3]) )**2. + lib.shot_simple(sigma, 8000.**3.) )**0.5  

# off diagonal error 
dn_cov_L04 = lambda s1, s2, a, p, q : (dn_L04(s1, a, p, q)*dn_L04(s2, a, p, q))**0.5 
dn_cov_L10 = lambda s1, s2, a, p, q : (dn_L10(s1, a, p, q)*dn_L10(s2, a, p, q) )**0.5
dn_cov_L25 = lambda s1, s2, a, p, q : (dn_L25(s1, a, p, q)*dn_L25(s2, a, p, q) )**0.5
dn_cov_L40 = lambda s1, s2, a, p, q : (dn_L40(s1, a, p, q)*dn_L40(s2, a, p, q) )**0.5
dn_cov_L80 = lambda s1, s2, a, p, q : (dn_L80(s1, a, p, q)*dn_L80(s2, a, p, q) )**0.5
Exemplo n.º 4
0
from hmf import MassFunction
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=67.77 * u.km / u.s / u.Mpc,
                      Om0=0.307115,
                      Ob0=0.048206)

#lib.covariance_factor
#lib.f_BH(sigma, 0.333, 0.788, 0.807, 1.795)
A0 = 0.290
a0 = 0.8915
p0 = 0.5524
q0 = 1.578
#bias = lambda sigma, a0, p0, q0 : lib.b_BH(sigma, a0, p0, q0)
bias = lambda sigma: lib.b_BH(sigma, a=0.8915, p=0.5524, q=1.578)
fsigma = lambda sigma: lib.f_BH(sigma, A0, a0, p0, q0)

#Quantity studied
qty = "mvir"
# working directory
dir = join(os.environ['MVIR_DIR'])
# loads summary file
data = fits.open(join(dir, qty + "_summary.fits"))[1].data

NminCount = 10000
logNpmin = 4.1

zmin = -0.01
zmax = 0.001

# x coordinates definition
MD25NW = (ok) & (data["boxName"] == 'MD_2.5GpcNW')
MD40NW = (ok) & (data["boxName"] == 'MD_4GpcNW')
DS80 = (ok) & (data["boxName"] == 'DS_8Gpc')

ok = (zSel) & (mSel) & (mSel2) & (nSelCen) & (data["boxName"] != 'DS_8Gpc')

# NOW PLOTTING ALL THE DATA
#lib.plot_mvir_function_data(log_mvir[ok], logsig[ok], lognu[ok], log_MF[ok], log_MF_c[ok], data['redshift'][ok], zmin, zmax, cos = cos)

# ERROR PLOT: JK vs. POISSON
x = data["std90_pc_" + cos]
y = data["dN_counts_" + cos]**(-0.5)
#lib.plot_jackknife_poisson_error(x, y, MD04, MD10, MD25, MD25NW, MD40, MD40NW, DS80, cos = cos, dir=join(os.environ['MVIR_DIR']))

bias_all = n.array([
    lib.f_BH(lib.hmf.sigma, 0.28074 + 0.00151, 0.90343 + 0.00724,
             0.64031 + 0.02639, 1.69561 + 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 + 0.00151, 0.90343 + 0.00724,
             0.64031 + 0.02639, 1.69561 - 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 + 0.00151, 0.90343 - 0.00724,
             0.64031 + 0.02639, 1.69561 - 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 + 0.00151, 0.90343 - 0.00724,
             0.64031 + 0.02639, 1.69561 + 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 - 0.00151, 0.90343 - 0.00724,
             0.64031 + 0.02639, 1.69561 - 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 - 0.00151, 0.90343 - 0.00724,
             0.64031 + 0.02639, 1.69561 + 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 - 0.00151, 0.90343 + 0.00724,
             0.64031 + 0.02639, 1.69561 - 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 - 0.00151, 0.90343 + 0.00724,
             0.64031 + 0.02639, 1.69561 + 0.03826),
    lib.f_BH(lib.hmf.sigma, 0.28074 + 0.00151, 0.90343 + 0.00724,