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 "OMEGA_HI", omegaHI[0] p_omegaHI = np.polyfit(zz, omegaHI, deg=2) print "B_HI", bHI[0] p_bHI = np.polyfit(zz, bHI, deg=2) print "T_B", Tb[0] p_Tb = np.polyfit(zz, Tb, deg=2) # Omega_HI P.subplot(311) P.plot(z, rf.omega_HI(z, e.cosmo), 'r-', lw=1.5) P.plot(zz, omegaHI, 'bo') P.plot(zz, poly(p_omegaHI[::-1], zz), 'g-') P.ylabel("$\Omega_{HI}(z)$") # b_HI P.subplot(312) P.plot(z, rf.bias_HI(z, e.cosmo), 'r-', lw=1.5) P.plot(zz, bHI, 'bo') P.plot(zz, poly(p_bHI[::-1], zz), 'g-') P.ylabel("$b_{HI}(z)$") # T_b P.subplot(313) P.plot(z, rf.Tb(z, e.cosmo, formula='powerlaw'), 'r-', lw=1.5) P.plot(z, rf.Tb(z, e.cosmo, formula='santos'), 'b-', lw=1.5) P.plot(zz, poly(p_Tb[::-1], zz), 'g-') P.plot(zz, Tb, 'bo') P.ylabel("$T_b(z)$") P.show()
""" # FIXME: Disable to get redshift markers #marker[k] = None print lbls2 print errs2 # Load bias for experiment try: print names[k] expt = rf.experiments_galaxy.load_expt(expts[k]) b = expt['b'] print b except: print "IM survey!" b = rf.bias_HI(zc, e.cosmo) pass bs8 = cosmo['sigma_8']*b*Dc # (1) Plot bs8 errors as fn. of redshift (b_1 fixed) err2 = errs2[pbs8_2] print err2/bs8 line = ax[2].plot( zc, err2/bs8, color=colours[k], label=labels[k], lw=2.4, ls='solid', marker='None', markersize=ms[k], markeredgecolor=colours[k] ) ax[2].set_ylabel('$\sigma(b \sigma_8) / (b \sigma_8)$', labelpad=15., fontdict={'fontsize':'xx-large'}) # (2) Plot fs8 errors as fn. of redshift (b_1 fixed) #err2 = errs2[pfs8_2] / (cosmo['sigma_8']*fc*Dc) #line = ax[1].plot( zc, err2, color=colours[k], label=labels[k], lw=1.8,
for jj in pf: print jj, lbls[jj] print "-" * 50 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],
for j in range(len(fNL)): zc = np.load("Xnongauss-fnl-zc-%d.npy"%j) sigmas.append(np.load("tmp/Xnongauss-fnl-%d.npy" % j)) sigmas_bz.append(np.load("tmp/nongauss-fnl-zbias-%d.npy" % j)) sigma_fNL.append(sigmas[j][-zc.size:]) sigma_fNL_bz.append(sigmas_bz[j][-zc.size:]) sigma_bias.append(sigmas_bz[j][1:zc.size+1]) col = ['r', 'b', 'y'] name = ["f_NL = " + str(int(_fNL)) for _fNL in fNL] # Get bias as fn. of z cosmo = rf.experiments.cosmo cosmo['bHI0'] = 0.702 bias = rf.bias_HI(zc, cosmo) P.subplot(111) for i in range(len(fNL)): #P.errorbar(zc, fNL[i]*np.ones(zc.size), yerr=sigma_fNL[i], marker='.', color=col[i], lw=1.5, label=name[i]) P.plot(zc, sigma_fNL[i], lw=1.5, color=col[i], marker='.', label=name[i]) #P.plot(zc, sigma_fNL_bz[i], lw=1.5, color=col[i], marker='.', ls='dashed') #P.plot(zc, bias - 1., 'k-') #P.axhline(0., ls='dotted', color='k') #P.xlim((np.min(zs), np.max(zs))) P.ylim((0., 150.)) P.xlim((0., 3.6)) # Display options P.legend(loc='upper right', prop={'size':'x-large'})
import pylab as P from rfwrapper import rf from radiofisher.experiments import cosmo def rho_c(z): """ Critical density, in units of Msun Mpc^-2 """ E2 = cosmo['omega_M_0'] * (1. + z)**3. + cosmo['omega_lambda_0'] return 2.76e7 * (100. * cosmo['h'])**2. * E2 z = np.linspace(-0.1, 5., 1000) oHI = rf.omega_HI(z, cosmo) bHI = rf.bias_HI(z, cosmo) # Load Prochaska & Wolfe data (10^8 Msun Mpc^-3) pw_zmin, pw_zmax, pw_rhoHI, pw_errp, pw_errm = np.genfromtxt( "HI_evolution/prochaska_wolfe_rhoHI.dat").T pw_zc = 0.5 * (pw_zmin + pw_zmax) pw_dz = 0.5 * (pw_zmax - pw_zmin) pw_omegaHI = pw_rhoHI * 1e8 / rho_c(0.) / 1e-3 pw_err_omegaHI_p = pw_errp * 1e8 / rho_c(0.) / 1e-3 pw_err_omegaHI_m = pw_errm * 1e8 / rho_c(0.) / 1e-3 # Load Noterdaeme et al. data (omega_HI / 10^-3) n_zmin, n_zmax, n_omegaHI, n_err = np.genfromtxt( "HI_evolution/noterdaeme_omegaHI.dat").T n_zc = 0.5 * (n_zmin + n_zmax) n_dz = 0.5 * (n_zmax - n_zmin)