def select_jplus_galaxies(fwhm, mr): seeing = get_seeing_from_data(fwhm, mr) fw2 = fwhm[mr < 19] galaxies = N.greater(fwhm, seeing + (U.std_mad(fw2) * 3.)) return galaxies
def select_jplus_stars(fwhm, mr): seeing = get_seeing_from_data(fwhm, mr) fw2 = fwhm[mr < 19] stars = N.less(fwhm, seeing + (U.std_mad(fw2) * 3.)) return stars
def get_sigma_z(ddz,vector,base): n_ele = len(base)-1 values = N.zeros(n_ele) base2 = base[:-1]+((base[1]-base[0])/2.) for ii in range(n_ele): good = N.greater_equal(vector,base[ii]) good *= N.less_equal(vector,base[ii+1]) values[ii] = U.std_mad(ddz[good]) return values,base2
def get_NMAD_vs_seeing(bpzfile, mmax): bpzs = U.get_str(bpzfile, 0) nb = len(bpzs) valor = N.zeros(nb) for ii in range(nb): zb, zs, mo = U.get_data(bpzs[ii], (1, 9, 10)) dz = (zb - zs) / (1. + zs) good = N.less(mo, mmax) valor[ii] = U.std_mad(dz[good]) return valor
def get_seeing_from_data_pro(fwhm, mr): """ :param fwhm: :param mr: :return: """ dm = 0.1 base = N.arange(0., 7, dm) stars = N.greater_equal(mr, 14) * N.less_equal(mr, 18) b1, b2 = N.histogram(fwhm[stars], base) pos = N.argmax(b1) seeing = b2[pos] + (dm / 2.) redu = N.less_equal( fwhm, U.mean_robust(fwhm[stars]) + U.std_mad(fwhm[stars]) * 2.) redu *= N.greater_equal( fwhm, U.mean_robust(fwhm[stars]) - U.std_mad(fwhm[stars]) * 2.) redu *= N.greater_equal(mr, 14) * N.less_equal(mr, 18) return seeing, redu
zb, zs, mo, ods = U.get_data(master_spz_auto, (1, 9, 10, 5)) dz = (zb - zs) / (1. + zs) plt.figure(1, figsize=(19, 12), dpi=80, facecolor='w', edgecolor='k') plt.clf() plt.subplot(131) for ii in range(n_m): print ' ' for jj in range(n_z): good = N.greater_equal(mo, base_m[ii]) good *= N.less_equal(mo, base_m[ii + 1]) good *= N.greater_equal(zs, base_z[jj]) good *= N.less_equal(zs, base_z[jj + 1]) good *= N.greater_equal(ods, 0.) if len(dz[good]) > min_ng: valor_auto[ii, jj] = U.std_mad(dz[good]) else: valor_auto[ii, jj] = -1. for ii in range(n_m): for jj in range(n_z): if valor_auto[ii, jj] > 0: plt.scatter(base_z2[jj], base_m2[ii], s=square_size, c=valor_auto[ii, jj], marker=u's', cmap=cm.PuOr, alpha=0.95, vmin=0.0, vmax=0.050)
alphas = [0.2, 0.4, 0.6, 0.8, 1.0] #AUTO apertures zb, zs, mo, ods = U.get_data(master_bpz_auto, (1, 9, 10, 5)) dz = (zb - zs) / (1. + zs) for ii in range(n_m): print ' ' for jj in range(n_z): good = N.greater_equal(mo, base_m[ii]) good *= N.less_equal(mo, base_m[ii + 1]) good *= N.greater_equal(zs, base_z[jj]) good *= N.less_equal(zs, base_z[jj + 1]) good *= N.greater_equal(ods, 0.) if len(dz[good]) > 100: valor_auto[ii, jj] = U.std_mad(dz[good]) else: valor_auto[ii, jj] = -1. # Plot plt.figure(1, figsize=(9, 8), dpi=80, facecolor='w', edgecolor='k') plt.clf() for ii in range(n_m): for jj in range(n_z): if valor_auto[ii, jj] > 0: plt.scatter(base_z2[jj], base_m2[ii], s=4000, c=valor_auto[ii, jj], marker=u's', cmap=cm.PuOr,
plt.xticks(fontsize=15) plt.yticks(fontsize=15) plt.ylabel('$m^{sp}_{z}$ - $m^{sd}_{z}$', size=25, labelpad=-1) plt.xlabel('$m^{z,sd}$', size=23, labelpad=-10) dos = plt.axes([.8, .12, .15, .87]) a1, a2, a3 = plt.hist(delta_z[::res] - (U.mean_robust(delta_z[z_sp < 19])), base_color, orientation='horizontal', color='grey', alpha=0.5, normed=True) plt.grid() plt.ylim(y_min, y_max) plt.xticks([]) plt.yticks([]) plt.savefig('/Users/albertomolino/Desktop/dm_z.png', dpi=100) print 'std_mad_U', U.std_mad(delta_u[u_sp < 19]) print 'std_mad_G', U.std_mad(delta_g[g_sp < 19]) print 'std_mad_R', U.std_mad(delta_r[r_sp < 19]) print 'std_mad_I', U.std_mad(delta_i[i_sp < 19]) print 'std_mad_Z', U.std_mad(delta_z[z_sp < 19]) """ std_mad_U 0.059304 std_mad_G 0.0474432 std_mad_R 0.0266868 std_mad_I 0.0474432 std_mad_Z 0.0311346 """
delta_z = 0.01 base_z = N.arange(z_min, z_max + delta_z, delta_z) base_z2 = base_z[:-1] + ((base_z[1] - base_z[0]) / 2.) #All bands ruta = '/Users/albertomolino/Postdoc/T80S_Pipeline/Commisioning/S82/Dec2017/splus_cats_NGSL/' b0 = ruta + 'COSMOSeB11new_recal/master.STRIPE82_Photometry.m21_COSMOSeB11new_recal_redu.bpz' zb0, zs0, m0, chi0, od0, tb0 = U.get_data(b0, (1, 9, 10, 8, 5, 4)) good0 = N.greater_equal(od0, 0.1) * N.less(chi0, 10) zb0, zs0, m0, tb0 = U.multicompress(good0, (zb0, zs0, m0, tb0)) dz0 = (zb0 - zs0) / (1. + zs0) valor0 = N.zeros(len(base_m) - 1) for ii in range(len(valor0)): good = N.greater_equal(m0, base_m[ii]) good *= N.less_equal(m0, base_m[ii + 1]) valor0[ii] = U.std_mad(dz0[good]) #valor0[2]=0.0039 valor0[1] = 0.0052 #5-bands b1 = ruta + 'using_5sdss_bands/master.STRIPE82_Photometry.m21_COSMOSeB11new_recal_5bands.bpz' zb1, zs1, m1, chi1, od1, tb1 = U.get_data(b1, (1, 9, 10, 8, 5, 4)) good1 = N.greater_equal(od1, 0.1) * N.less(chi1, 10) zb1, zs1, m1, tb1 = U.multicompress(good1, (zb1, zs1, m1, tb1)) dz1 = (zb1 - zs1) / (1. + zs1) valor1 = N.zeros(len(base_m) - 1) for ii in range(len(valor1)): good = N.greater_equal(m1, base_m[ii]) good *= N.less_equal(m1, base_m[ii + 1]) valor1[ii] = U.std_mad(dz1[good]) valor1[0] = 0.018
final_zpe_1[ii, :], final_zpo_1[ii, :] = U.get_data( cats_names1[ii], (3, 4), 12) for ii in range(n_cats_2): final_zpe_2[ii, :], final_zpo_2[ii, :] = U.get_data( cats_names2[ii], (3, 4), 12) av_zp_off_1 = U.sum(final_zpo_1, axis=0) / (1. * n_cats_1) av_zp_off_2 = U.sum(final_zpo_2, axis=0) / (1. * n_cats_2) #av_zp_err_1 = U.sum(final_zpe_1,axis=0)/(1.*n_cats_1) #av_zp_err_2 = U.sum(final_zpe_2,axis=0)/(1.*n_cats_2) av_zp_err_1 = N.zeros(12) av_zp_err_2 = N.zeros(12) for ii in range(12): av_zp_err_1[ii] = U.std_mad(final_zpo_1[ii, :]) av_zp_err_2[ii] = U.std_mad(final_zpo_2[ii, :]) plt.figure(2, figsize=(14, 8), dpi=80, facecolor='w', edgecolor='k') plt.clf() aaa = av_zp_off_1 - av_zp_off_1[7] bbb = av_zp_off_2 - av_zp_off_2[7] plt.errorbar(base_filtros, (av_zp_off_1 - N.mean(av_zp_off_1)) * 100., av_zp_err_1 * 100., fmt="-s", color='blue', alpha=0.5, ms=10, lw=7) plt.errorbar(base_filtros, (av_zp_off_2 - N.mean(av_zp_off_2)) * 100., av_zp_err_2 * 100.,