print "-" * 50 # Invert matrix cov_pl = np.linalg.inv(Fpl) # Calculate FOM print "1D sigma(Mnu) = %3.4f" % np.sqrt(cov_pl[pMnu, pMnu]) print "1D sigma(n_s) = %3.4f" % np.sqrt(cov_pl[pNeff, pNeff]) x = 0.1 #rf.experiments.cosmo['w0'] # Mnu y = rf.experiments.cosmo['ns'] #3.046 #rf.experiments.cosmo['wa'] # Neff # Plot contours for w0, wa; omega_k free transp = [1., 0.85] w, h, ang, alpha = rf.ellipse_for_fisher_params(pMnu, pNeff, None, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.5, alpha=transp[kk]) for kk in [1, 0] ] for e in ellipses: ax.add_patch(e) # Centroid
x = 1. y = 1. alpha = [1.52, 2.48, 3.44] cmap = matplotlib.cm.get_cmap("spectral") ZMAX = 1.39 print "Max:", np.max(zc) ax = P.subplot(111) Nused = np.where(zc <= ZMAX)[0].size # No. of z bins that are actually used zvals = [] for i in range(len(p1)): #if i % 2 == 0: continue if zc[i] > ZMAX: continue zvals.append(zc[i]) a, b, ang = rf.ellipse_for_fisher_params(p1[i], p2[i], F_b) a /= rf.bias_HI(zc[i], cosmo) b /= fc[i] c = i * 0.97 / float(Nused - 1) # Colour (must be 0 <= c <= 1) print c # Get 1,2,3-sigma ellipses and plot ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[k] * b, height=alpha[k] * a, angle=ang, fc='none', ec=cmap(c), lw=1.5) for k in [ 0,
print names[k] print "-" * 50 # Invert matrix cov_pl = np.linalg.inv(F) for jj in range(pf.size): #if jj % 2 == 0: continue print jj, lbls[pb[jj]], lbls[pf[jj]] x = rf.bias_HI(zc[jj], cosmo) * cosmo['sigma_8'] y = fc[jj] * cosmo['sigma_8'] # Plot contours for w0, wa; omega_k free w, h, ang, alpha = rf.ellipse_for_fisher_params(pb[jj], pf[jj], None, Finv=cov_pl) transp = [1., 0.85] ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.3, alpha=0.85) for kk in [ 1, ] ] for e in ellipses:
print "-" * 50 print names[k] print "-" * 50 # Invert matrix cov_pl = np.linalg.inv(Fpl) # Print 1D marginals print "1D sigma(%s) = %3.4f" % (param1, np.sqrt(cov_pl[p1, p1])) #print "1D sigma(%s) = %3.4f" % (param2, np.sqrt(cov_pl[p2,p2])) # Plot contours for gamma, w0 #transp = [1., 0.85] transp = [0.98, 0.8] w, h, ang, alpha = rf.ellipse_for_fisher_params(p1, p2, None, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.5, alpha=transp[kk]) for kk in [1, 0] ] for e in ellipses: ax.add_patch(e) # Centroid if k == 1: ax.plot(x, y, 'ko')
# Invert matrix cov_pl = np.linalg.inv(Fpl) # Print 1D marginals print "1D sigma(w_0) = %3.4f" % np.sqrt(cov_pl[pw0,pw0]) print "1D sigma(gamma) = %3.4f" % np.sqrt(cov_pl[pgam,pgam]) print lbls x = rf.experiments.cosmo['gamma'] y = rf.experiments.cosmo['w0'] # Plot contours for gamma, w0 transp = [1., 0.85] if k == 1: transp = [1., 0.95] w, h, ang, alpha = rf.ellipse_for_fisher_params(pgam, pw0, None, Finv=cov_pl) ellipses = [matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk]*w, height=alpha[kk]*h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.5, alpha=transp[kk]) for kk in [1,0]] for e in ellipses: ax.add_patch(e) # Centroid if k == 0: ax.plot(x, y, 'ko') # Report on what options were used print "-"*50 s1 = "Marginalised over Omega_K" if MARGINALISE_CURVATURE else "Fixed Omega_K" s2 = "Marginalised over ns, sigma8" if MARGINALISE_INITIAL_PK else "Fixed ns, sigma8" s3 = "Marginalised over Omega_b" if MARGINALISE_OMEGAB else "Fixed Omega_b" print "NOTE:", s1 print "NOTE:", s2
# Calculate FOM fom = rf.figure_of_merit(pw0, pwa, None, cov=cov_pl) print "%s: FOM = %3.2f" % (names[k], fom) print "1D sigma(w_0) = %3.4f" % np.sqrt(cov_pl[pw0, pw0]) print "1D sigma(w_a) = %3.4f" % np.sqrt(cov_pl[pwa, pwa]) x = rf.experiments.cosmo['w0'] y1 = rf.experiments.cosmo['omega_lambda_0'] y2 = rf.experiments.cosmo['wa'] transp = [1., 0.85] # Plot contours for w0, omega_DE w, h, ang, alpha = rf.ellipse_for_fisher_params(pw0, pode, None, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y1), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.5, alpha=transp[kk]) for kk in [1, 0] ] for e in ellipses: ax1.add_patch(e) ax1.plot(x, y1, 'kx', mew=1.2)
F_eos2, lbls2 = rf.combined_fisher_matrix( F_eos_list, exclude=[2,4,5,6,7,8, 9,12], expand=zfns, names=pnames) Finv2 = np.linalg.inv(F_eos2) # Pre-invert, for efficiency px2 = rf.indexes_for_sampled_fns(6, zc.size, zfns) # x py2 = rf.indexes_for_sampled_fns(4, zc.size, zfns) # y """ # Fiducial point x = rf.experiments.cosmo['w0'] y = rf.experiments.cosmo['wa'] if k == 0: ax.plot(x, y, 'kx', ms=10) # Marginalise over omega_k w, h, ang, alpha = rf.ellipse_for_fisher_params(px[0], py[0], F_eos, Finv=Finv) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k], lw=2., alpha=0.9) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) """ # Fix omega_k
# Invert matrices cov = np.linalg.inv(F) cov_pl = np.linalg.inv(Fpl) # Indices of fns. of z pok = rf.indexes_for_sampled_fns(3, zc.size, zfns) pw0 = rf.indexes_for_sampled_fns(5, zc.size, zfns) # Fiducial point x = rf.experiments.cosmo['omega_k_0'] y = rf.experiments.cosmo['w0'] if k == 0: ax.plot(x, y, 'kx', ms=10) # w0, omega_K w, h, ang, alpha = rf.ellipse_for_fisher_params(pok, pw0, cov, Finv=cov) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k], lw=2.5, alpha=1.) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) # w0, omega_K, plus Planck prior w, h, ang, alpha = rf.ellipse_for_fisher_params(pok, pw0, cov, Finv=cov_pl)
print "-" * 50 # Invert matrix cov_pl = np.linalg.inv(Fpl) # Calculate FOM print "2*sigma(M_nu) = %3.4f" % (2. * np.sqrt(cov_pl[pmnu, pmnu])) x = 0.06 #rf.experiments.cosmo['Mnu'] y = rf.experiments.cosmo['sigma_8'] transp = [1., 0.85] # Plot contours for w0, omega_DE w, h, ang, alpha = rf.ellipse_for_fisher_params(pmnu, psig8, None, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc=colours[k][kk], ec=colours[k][0], lw=1.5, alpha=transp[kk]) for kk in [1, 0] ] for e in ellipses: ax1.add_patch(e) ax1.plot(x, y, 'kx', mew=1.2)
# Overlay error ellipses as a fn. of z p1 = rf.indexes_for_sampled_fns(4, zc.size, zfns) # w0 # y #p2 = rf.indexes_for_sampled_fns(5, zc.size, zfns) # # x p3 = rf.indexes_for_sampled_fns(5, zc.size, zfns) # h p4 = rf.indexes_for_sampled_fns(6, zc.size, zfns) # gamma Finv = np.linalg.inv(F_eos) # Pre-invert, for efficiency i = 0 ################################## # w0 - h ################################## x = rf.experiments.cosmo['w0'] y = rf.experiments.cosmo['h'] w, h, ang, alpha = rf.ellipse_for_fisher_params(p1[i], p3[i], F_eos, Finv=Finv) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k], lw=2., alpha=0.85) for kk in range(0, 2) ] for e in ellipses: ax1.add_patch(e) if k == 0: ax1.plot(x, y, 'kx')
#exclude=[2,4,5,6,7,8,9,12], exclude=[2, 4, 5, 6, 7, 8, 11, 12, 14], expand=zfns, names=pnames) Finv3 = np.linalg.inv(F_eos3) # Pre-invert, for efficiency px3 = rf.indexes_for_sampled_fns(3, zc.size, zfns) # x py3 = rf.indexes_for_sampled_fns(4, zc.size, zfns) # y # Fiducial point x = rf.experiments.cosmo['omega_k_0'] y = rf.experiments.cosmo['omega_lambda_0'] if k == 0: ax.plot(x, y, 'kx', ms=10) # omega_k, omega_DE (wa fixed) w, h, ang, alpha = rf.ellipse_for_fisher_params(px2[0], py2[0], F_eos2, Finv=Finv2) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='y', ec='y', lw=2., alpha=0.25) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) # omega_k, omega_DE (w0,wa fixed)
Finv2 = np.linalg.inv(F_eos2) # Pre-invert, for efficiency px2 = rf.indexes_for_sampled_fns(6, zc.size, zfns) # x py2 = rf.indexes_for_sampled_fns(4, zc.size, zfns) # y print "sigma(Mnu) =", np.sqrt( Finv[rf.indexes_for_sampled_fns(7, zc.size, zfns), rf.indexes_for_sampled_fns(7, zc.size, zfns)]) # Fiducial point x = rf.experiments.cosmo['gamma'] y = rf.experiments.cosmo['w0'] if k == 0: ax.plot(x, y, 'kx', ms=10) # Marginalise over omega_k w, h, ang, alpha = rf.ellipse_for_fisher_params(px[0], py[0], F_eos, Finv=Finv) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k], lw=2., alpha=0.9) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) # Fix omega_k
# Fiducial point x = rf.experiments.cosmo['w0'] y = rf.experiments.cosmo['wa'] if k == 0: ax.plot(x, y, 'kx', ms=10) """ # omega_k, gamma fixed w, h, ang, alpha = rf.ellipse_for_fisher_params(pw0, pwa, cov, Finv=cov) ellipses = [matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk]*w, height=alpha[kk]*h, angle=ang, fc='none', ec=colours[k], lw=2.5, alpha=1.) for kk in range(0, 2)] for e in ellipses: ax.add_patch(e) """ # omega_k, gamma fixed, plus Planck prior w, h, ang, alpha = rf.ellipse_for_fisher_params(pw0, pwa, cov, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k], lw=2.5, alpha=1.) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) """ # Fix omega_k w, h, ang, alpha = rf.ellipse_for_fisher_params(px2[0], py2[0], F_eos2, Finv=Finv2)
# Overlay error ellipses as a fn. of z p1 = rf.indexes_for_sampled_fns(4, zc.size, zfns_base) # omega_k # y p2 = rf.indexes_for_sampled_fns(5, zc.size, zfns_base) # omega_de # x # 1D marginals cov = np.linalg.inv(F_wa) print "sigma(ok) =", np.sqrt(cov[p1, p1]) print "sigma(oDE) =", np.sqrt(cov[p2, p2]) y = rf.experiments.cosmo['omega_k_0'] x = rf.experiments.cosmo['omega_lambda_0'] Fs = [F_base, F_wa, F_w0wa] for i in range(len(Fs)): FF = Fs[i] a, b, ang = rf.ellipse_for_fisher_params(p1, p2, FF) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * b, height=alpha[kk] * a, angle=ang, fc='none', ec=colours[i], lw=2., alpha=0.85) for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) ax.plot(x, y, 'kx') ax.set_ylabel(r"$\Omega_K$", fontdict={'fontsize': '20'})
pns = rf.indexes_for_sampled_fns(3, zc.size, zfns) x = 0.15 #rf.experiments.cosmo['mnu'] y = rf.experiments.cosmo['n'] """ # Mnu, n_s w, h, ang, alpha = rf.ellipse_for_fisher_params(pmnu, pns, cov, Finv=cov) ellipses = [matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk]*w, height=alpha[kk]*h, angle=ang, fc='none', ec=colours[k], lw=2.5, alpha=1.) for kk in range(0, 2)] for e in ellipses: ax.add_patch(e) """ # Mnu, n_s + Planck w, h, ang, alpha = rf.ellipse_for_fisher_params(pmnu, pns, None, Finv=cov_pl) ellipses = [ matplotlib.patches.Ellipse(xy=(x, y), width=alpha[kk] * w, height=alpha[kk] * h, angle=ang, fc='none', ec=colours[k + 1], lw=2.5, alpha=1., ls='solid') for kk in range(0, 2) ] for e in ellipses: ax.add_patch(e) """