def plot_hist(run_id, clus, MgII, title): """ Plot cluster and MgII redshift histograms. """ zbin = Bins(np.arange(-0.1, 1.2, 0.025)) fig = plt.figure(1, figsize=(4.5, 4.5)) fig.clf() ax = plt.gca() vals, _ = np.histogram(clus.z, bins=zbin.edges) y = np.where(vals == 0, -10, np.log10(vals)) ax.plot(zbin.cen, y, 'r', lw=2, ls='steps-mid', label='clusters (n=%i)' % len(clus), zorder=10) vals, _ = np.histogram(MgII['z'], bins=zbin.edges) label = 'MgII (n={})'.format(len(MgII)) y = np.where(vals == 0, -10, np.log10(vals)) ax.plot(zbin.cen, y, 'b', lw=2, ls='steps-mid', label=label) ax.set_xlabel('$\mathrm{Redshift}$') ax.set_ylabel('$\mathrm{Number}$') y0, y1 = ax.get_ylim() ax.set_ylim(-0.8, y1) ax.set_xlim(0.25, 1.05) make_log_ylabels(ax) ax.legend(frameon=0, fontsize=8) ax.set_title(title) plt.savefig(run_id + '/zhist.png', dpi=200, bbox_inches='tight')
def plot_hist(run_id, clus, MgII, title): """ Plot cluster and MgII redshift histograms. """ zbin = Bins(np.arange(-0.1, 1.2, 0.025)) fig = plt.figure(1, figsize=(4.5,4.5)) fig.clf() ax = plt.gca() vals,_ = np.histogram(clus.z, bins=zbin.edges) y = np.where(vals == 0, -10, np.log10(vals)) ax.plot(zbin.cen, y, 'r', lw=2, ls='steps-mid', label='clusters (n=%i)' % len(clus), zorder=10) vals,_ = np.histogram(MgII['z'], bins=zbin.edges) label = 'MgII (n={})'.format(len(MgII)) y = np.where(vals == 0, -10, np.log10(vals)) ax.plot(zbin.cen, y, 'b',lw=2, ls='steps-mid', label=label) ax.set_xlabel('$\mathrm{Redshift}$') ax.set_ylabel('$\mathrm{Number}$') y0,y1 = ax.get_ylim() ax.set_ylim(-0.8, y1) ax.set_xlim(0.25, 1.05) make_log_ylabels(ax) ax.legend(frameon=0, fontsize=8) ax.set_title(title) plt.savefig(run_id + '/zhist.png', dpi=200, bbox_inches='tight')
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)
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)