Esempio n. 1
0
def load_fisher_data(froot):
    """
    Load Fisher forecast data.
    """
    f_fisher = "%s.dat" % froot
    f_zbins = "%s.zbins" % froot

    # Load header
    f = open(f_fisher, 'r')
    hdr = f.readline()
    f.close()
    names = hdr[2:-1].split(' ')

    # Load Fisher matrix and bin centre redshifts
    F = np.genfromtxt(f_fisher)
    zbinc = np.genfromtxt(f_zbins)

    # Calculate mean values of H and D_A in LCDM model
    abinc = 1. / (1. + zbinc)
    #plcdm = model.pdict(h=0.6731, omegaM=0.315, omegaK=0.0, omegaB=0.045,
    #                    w0=-1., winf=-1., zc=1e5, deltaz=0.5)
    plcdm = model.pdict(h=0.6727,
                        omegaM=0.3166,
                        omegaK=0.0,
                        omegaB=0.04941,
                        w0=-1.,
                        winf=-1.,
                        zc=1e5,
                        deltaz=0.5)

    # Convert units to same as Fisher matrix: H ~ (100 km/s/Mpc); D_A ~ Gpc
    Hc = model.Hz(abinc, plcdm) / 1e2  # 100 km/s/Mpc
    DAc = model.DAz(abinc, plcdm) / 1e3  # Gpc

    # Construct mean vector and list of parameter names
    mean_vec = np.concatenate((Hc, DAc))
    lbls = ["H%d" % i for i in range(zbinc.size)] \
         + ["DA%d" % i for i in range(zbinc.size)]

    # Invert Fisher matrix to get the covariance
    cov = np.linalg.inv(F)

    # Select only certain parameters from the covariance
    new_cov = np.zeros((len(lbls), len(lbls)))
    for i, pni in enumerate(lbls):
        for j, pnj in enumerate(lbls):
            new_cov[i, j] = cov[names.index(pni), names.index(pnj)]

    # Return the inverse covariance for this subset of parameters
    icov = np.linalg.inv(new_cov)
    return zbinc, mean_vec, icov
Esempio n. 2
0
        # Save results
        np.save("%s.pctcache" % fn, pct)
    
    # Plot 95% percentiles
    lbl = labels[j]
    print(lbl)
    if j == 0:
        P.fill_between(z, pct[0], pct[-1], color=colours[j], alpha=0.6, 
                       label=lbl, lw=2.5)
    else:
        dashes = [1.5,1.5] if dash[j] else []
        P.plot(z, pct[0], color=colours[j], lw=LW, label=lbl, dashes=dashes)
        P.plot(z, pct[-1], color=colours[j], lw=LW, dashes=dashes)

# LCDM curves
plcdm = model.pdict(h=0.6727, omegaM=0.3166, omegaK=0.0, omegaB=0.04941, 
                    w0=-1., winf=-1., zc=1e5, deltaz=0.5)
OmegaDE0 = 1. - plcdm['omegaM'] - model.omegaR(plcdm) - 0.
P.plot(z, OmegaDE0*model.omegaDE(a, plcdm), 'k-', lw=1.8, alpha=1.)

#P.plot(z, plcdm['omegaM'] * a**-3., 'k-', lw=1.8)
#P.plot(z, 0.10 * plcdm['omegaM'] * a**-3., 'k--', lw=1.8, alpha=0.4)
#P.plot(z, 0.01 * plcdm['omegaM'] * a**-3., 'k--', lw=1.8, alpha=0.4)

#P.text(0.1, 0.17, r"$1\% \times \rho_M(z)/\rho_{{\rm crit}, 0}$", fontsize=13, alpha=0.85)


if MODE == 'lowz':
    P.xlim((0., 2.2))
    P.ylim((0.5, 0.9))
    
    P.gca().xaxis.set_major_locator(ticker.MultipleLocator(0.5))
Esempio n. 3
0
                       pct[0],
                       pct[-1],
                       color=colours[j],
                       alpha=0.6,
                       label=lbl,
                       lw=2.5)
    else:
        dashes = [1.5, 1.5] if 'DESI' in lbl else []
        P.plot(z, pct[0], color=colours[j], lw=2.5, label=lbl, dashes=dashes)
        P.plot(z, pct[-1], color=colours[j], lw=2.5, dashes=dashes)

# LCDM curves
plcdm = model.pdict(h=0.6731,
                    omegaM=0.315,
                    omegaK=0.0,
                    omegaB=0.045,
                    w0=-1.,
                    winf=-1.,
                    zc=1e5,
                    deltaz=0.5)
OmegaDE0 = 1. - plcdm['omegaM'] - model.omegaR(plcdm) - 0.
P.plot(z, OmegaDE0 * model.omegaDE(a, plcdm), 'k-', lw=1.8, alpha=1.)

#P.plot(z, plcdm['omegaM'] * a**-3., 'k-', lw=1.8)
#P.plot(z, 0.10 * plcdm['omegaM'] * a**-3., 'k--', lw=1.8, alpha=0.4)
#P.plot(z, 0.01 * plcdm['omegaM'] * a**-3., 'k--', lw=1.8, alpha=0.4)

#P.text(0.1, 0.17, r"$1\% \times \rho_M(z)/\rho_{{\rm crit}, 0}$", fontsize=13, alpha=0.85)

P.xlim((0., 7.))
P.ylim((0., 1.8))
Esempio n. 4
0
DAz = np.array(DAz)
wz = np.array(wz)

pcts = [2.5, 16., 50., 84., 97.5]
print(dat['h'].size)

pct = np.percentile(Hz / (1. + z), pcts, axis=0)
pct_da = np.percentile(DAz, pcts, axis=0)
pct_wz = np.percentile(wz, pcts, axis=0)
#for i in range(pct.shape[0]):
#    P.plot(z, pct[i], 'b-', lw=1.8, alpha=1. - np.abs(pcts[i] - 50.)/70.)

plcdm = model.pdict(h=0.6727,
                    omegaM=0.3166,
                    omegaK=0.0,
                    omegaB=0.04941,
                    w0=-1.,
                    winf=-1.,
                    zc=1e5,
                    deltaz=0.5)
#OmegaDE0 = 1. - plcdm['omegaM'] - model.omegaR(plcdm) - omegaK
#P.plot(z, OmegaDE0*model.omegaDE(a, plcdm), 'k-', lw=1.8, alpha=1.)

# Some other model (within bounds)
ptanh = model.pdict(h=0.6731,
                    omegaM=0.315,
                    omegaK=0.0,
                    omegaB=0.045,
                    w0=-1.,
                    winf=-0.9,
                    zc=3,
                    deltaz=2.5)