dy2 = -dy2 valign = 'top' color='b' if tr_wrest[i] > 1215.67: color = 'r' elif tr_wrest[i] > 912.: color = 'g' ax.text(xvals[i] + dx, y[i]+ dy2, t, fontsize=9, rotation=90, ha=halign, va=valign, color=color) ax.plot([xvals[i]]*2, [y[i] + dy0, y[i] + dy1], lw=0.5, color='0.5') c = 'k' ax.set_xlabel('$\mathrm{Energy\ (Rydbergs)}$') ax.set_ylabel(r'$\log_{10}\ [J_{\nu}\ \mathrm{(erg/s/cm^2/Hz/ster)}]$') ax.set_xlim(-0.6, 1.6) make_log_xlabels(ax) ax.set_ylim(-24.3, -16.8) puttext(0.95, 0.85, '$\mathrm{Haardt\ & \ Madau}$\n$2012,\ z=2.5$', ax=ax, ha='right') puttext(0.95, 0.75, '$\mathrm{Strongest\ }\lambda_0>\ 1216\ \AA$', ax=ax, ha='right',color='r',fontsize=10) puttext(0.95, 0.7, '$\mathrm{Strongest\ }\lambda_0>\ 912\ \AA$', ax=ax, ha='right',color='g' ,fontsize=10) puttext(0.95, 0.65, '$\mathrm{Strongest\ }\lambda_0>\ 600\ \AA$', ax=ax, ha='right',color='b' ,fontsize=10) puttext(0.95, 0.55, '$\mathrm{Verner\ }P\ >\ %g$' % prob, ax=ax, ha='right',fontsize=10) fig1.savefig('incident_field_trans.pdf')
dNdz, dNdz_er, n = find_dndz_vs_rho( rho, ab['MgII'], iMgII_from_id, ewbins.edges[i], ewbins.edges[i+1]) y = np.log10(dNdz) ylo = np.log10(dNdz - dNdz_er) yhi = np.log10(dNdz + dNdz_er) errplot(rbin.cen + offsets[i], y, (ylo, yhi), ax=ax, fmt=colors[i]+symbols[i], label=labels[i]) for j in range(len(n)): puttext(rbin.cen[j], 0.03 + i*0.03, str(n[j]), ax, color=colors[i], fontsize=10, xcoord='data', ha='center') ax.legend(frameon=0) ax.set_xlabel('Cluster-absorber impact par. (proper Mpc)') ax.set_ylabel(r'$dN/dz\ (MgII)$') # skip last bin, where not all pairs are measured. ax.set_xlim(rbin.edges[0] - rbin.halfwidth[0], rbin.edges[-2] + rbin.halfwidth[-1]) make_log_xlabels(ax) make_log_ylabels(ax) #fig3.savefig(run_id + '/dNdz_vs_rho.png') plt.show() if 0: # check whether QSO properties are consistent across bins qso_orig = append_QSO_props(ab) ab['qso'] = qso_orig fig = plt.figure(figsize=(20,5)) plot_rho_QSO_prop(fig, rho, ab, iqso_from_id)
coords3 = [(NHI_, nH, Z_, aUV_) for nH in nHvals] color = 'b' iontext = [] text = [] lines = [] figs = [] for k in range(3): fig = plt.figure(figsize=(5.4, 3.2)) figs.append(fig) ax = fig.add_subplot(111) ax.set_ylabel('$\log_{10}\ (\mathrm{N/cm}^{-2})$') ax.set_xlabel('$\mathrm{Ionization\ potential\ (Ryd)}$') ax.set_xlim(np.log10(0.9), np.log10(12)) make_log_xlabels(ax, yoff=-0.07) ax.set_xticks([np.log10(1), np.log10(10)]) ax.set_xticklabels(['1', '10']) fig.subplots_adjust(bottom=0.17, left=0.11, right=0.97, top=0.96) ax.set_ylim(4.5, 14.9) plt.autoscale(0) itexts = [] m0 = model(coords1[k], for_plot=1) for i in range(len(m0)): dy = 0 dx = 0 if usepot: if tr_plot[i] == 'SiII': dy = 0.1 elif tr_plot[i] == 'MgII': dx = -0.02
rvals = np.logspace(-1, 4) * u.kpc R_M = (rvals / M['rs']).to(u.dimensionless_unscaled).value rho_m_M = M['rho_s'] * rho_nfw(R_M) if PLOT: fig = plt.figure(1, figsize=FIGSIZE) fig.clf() ax = fig.add_subplot(111) ax.plot(np.log10(rvals.to(u.kpc).value), np.log10(rho_m_M.to(u.M_sun/u.kpc**3).value)) ax.set_xlabel(r'$r$ (physical kpc)') ax.set_ylabel(r'$\log_{10}\,\rho(r)\ (M_\odot/\mathrm{kpc}^3)$') ax.set_xlim(-0.9,3.9) #make_log_ylabels(ax) make_log_xlabels(ax) fig.savefig('check_rho.png', bbox_inches='tight') plt.show() if PLOT: # test plot of the surface density for a NFW profile. rp_vals = np.logspace(-1, 4) xcorr1h = Sigma_1h(rp_vals, M).to(u.M_sun/u.kpc**2) if 1: # test plot fig = plt.figure(2, figsize=FIGSIZE) fig.clf() ax = fig.add_subplot(111) ax.plot(np.log10(rp_vals), np.log10(xcorr1h.value)) ax.set_xlabel(r'Impact parameter $r_p$(physical kpc)')
# if 1: from barak.plot import hist_xedge, make_log_xlabels, draw_arrows xvals = np.linspace(8,11) fig = plt.figure(figsize=(4.2,7)) fig.subplots_adjust(top=0.97, left=0.2, bottom=0.12, hspace=1e-3) ax1 = plt.subplot(211) ax1.fill_between(xvals, 25.9-0.08, y2=25.9+0.08, lw=0, color='0.8') ax1.axhline(25.9, ls='--', color='k') ax1.plot(d0.mstar, Rmag0, 'ro') ax1.set_ylim(25.38, 26.39) ax1.set_xlim(8.3, 10.1) make_log_xlabels(ax1) ax1.set_xticklabels('') ax1.set_ylabel('$r$') ax1.text(8.6, 25.58, '$2.3 < z < 2.7$', fontsize=18) ax2 = plt.subplot(212) ax2.fill_between(xvals, rmg-0.16, y2=rmg+0.16, lw=0, color='0.8') ax2.axhline(rmg, ls='--', color='k') ax2.plot(d0.mstar, Rmag0-Gmag0, 'go') c2 = Rmag0-Gmag0 > 0.5 #draw_arrows(d0.mstar[c2], 0.02, ax=ax2, ms=1, capsize=5, direction='up') ax2.plot([M16, M84],[-0.62]*2, color='0.5', lw=2) ax2.plot(M50, -0.62,'o', color='0.5', ms=10, mew=0) hist_xedge(d0.mstar, ax2,color='k',bins=10, height=0.35) ax2.set_ylim(-0.66, 0.095) ax2.set_xlim(8.3, 10.1) make_log_xlabels(ax2, yoff=-0.08)
# if 1: from barak.plot import hist_xedge, make_log_xlabels, draw_arrows xvals = np.linspace(8, 11) fig = plt.figure(figsize=(4.2, 7)) fig.subplots_adjust(top=0.97, left=0.2, bottom=0.12, hspace=1e-3) ax1 = plt.subplot(211) ax1.fill_between(xvals, 25.9 - 0.08, y2=25.9 + 0.08, lw=0, color='0.8') ax1.axhline(25.9, ls='--', color='k') ax1.plot(d0.mstar, Rmag0, 'ro') ax1.set_ylim(25.38, 26.39) ax1.set_xlim(8.3, 10.1) make_log_xlabels(ax1) ax1.set_xticklabels('') ax1.set_ylabel('$r$') ax1.text(8.6, 25.58, '$2.3 < z < 2.7$', fontsize=18) ax2 = plt.subplot(212) ax2.fill_between(xvals, rmg - 0.16, y2=rmg + 0.16, lw=0, color='0.8') ax2.axhline(rmg, ls='--', color='k') ax2.plot(d0.mstar, Rmag0 - Gmag0, 'go') c2 = Rmag0 - Gmag0 > 0.5 #draw_arrows(d0.mstar[c2], 0.02, ax=ax2, ms=1, capsize=5, direction='up') ax2.plot([M16, M84], [-0.62] * 2, color='0.5', lw=2) ax2.plot(M50, -0.62, 'o', color='0.5', ms=10, mew=0) hist_xedge(d0.mstar, ax2, color='k', bins=10, height=0.35) ax2.set_ylim(-0.66, 0.095) ax2.set_xlim(8.3, 10.1) make_log_xlabels(ax2, yoff=-0.08)