Exemplo n.º 1
0
	cat = {}

	dz_all = cat_all['redshift'] - zt_all
	#dz_all = (cat_all['redshift'] - zt_all) / (1 + cat_all['redshift'])

	mask = od_all > o 	
	dz = dz_all[mask]
	

	sigma68_all = tls.Sigma68(dz)
	errsigma68_all = tls.errsigma68(dz)
	bias_all = tls.Median(dz)
	errbias_all = tls.errmedian(dz)
	comp_all, errcomp1_all, errcomp2_all = tls.Completeness(0,len(dz),len(dz_all))
	out_frac_all, errout_frac1_all, errout_frac2_all = tls.out_fract(dz, sigma68_all, 3)

	print "\nResults using the entire catalog:"
	print "Sigma68 = %.5f +/- %.5f" %(sigma68_all,errsigma68_all)
	print "Bias = %.5f +/- %.5f" %(bias_all,errbias_all)
	print "Completeness = %.5f +%.5f/-%.5f" %(comp_all, errcomp1_all, errcomp2_all)
	print "Outliers fraction = %.5f +%.5f/-%.5f\n" %(out_frac_all, errout_frac1_all, errout_frac2_all)
	print "Generation of plots...\n"

	
	i = 1
	for l in col_list:
		print "  %s" % l	
		cat[l] = cat_all[l][mask]
		dz_bin_all = tls.binsplit(dz_all, cat_all[l], binning[l])
		dz_bin = tls.binsplit(dz, cat[l], binning[l])
Exemplo n.º 2
0
ax.yaxis.set_major_locator(MaxNLocator(prune = 'both'))
plt.ylabel(estim_label['sigma'])
plt.xlim(xmin = 100, xmax = 0)
plt.ylim(ymin = 0., ymax = val_max['sigma'])
plt.yticks(ytick['sigma'])
plt.axhline(val_req['sigma'], lw = 0.5, ls = 'solid', color = 'black')
plt.grid()

ax = plt.subplot(gs1[2])
i = 0
for o in od_cut:

	mask = od > o 	

	sig68 = pztls.Sigma68(dz[mask])
	of_sig68, err1_of_sig68, err2_of_sig68 = pztls.out_fract(dz[mask], sig68, 3)
	print eff[i], 100 * of_sig68
	plt.errorbar(eff[i], 100 * of_sig68, [[100 * err1_of_sig68, 100 * err2_of_sig68]], c = cmap(tls.cmapind(eff_cut[i], eff_lim, id_lim)), mec = cmap(tls.cmapind(eff_cut[i], eff_lim, id_lim)), markersize = 3, fmt = 'o')
	i +=1

ax.yaxis.set_major_locator(MaxNLocator(prune = 'both'))
plt.xlabel('Completeness (\%)')
plt.ylabel(estim_label['outliers'])
plt.xlim(xmin = 100, xmax = 0)
plt.ylim(ymin = 0., ymax = val_max['outliers'])
plt.yticks(ytick['outliers'])
plt.axhline(val_req['outliers'], lw = 0.5, ls = 'solid', color = 'black')
plt.grid()

#Remove extension...................
i=0
Exemplo n.º 3
0
import os as os
import numpy as np
import pz_tools as pt

#Gencat_nonobs............................................
folder = "./"
files = os.listdir(folder)

for name in files:
	zp, zs = np.loadtxt(folder + name, usecols = (1,9), unpack = True)
	dz = zp - zs
	len_before = len(dz)

	mask = dz < 0.5 
	dz = dz[mask]
	len_after = len(dz)

	sig = np.std(dz)
	#sig68 = pt.Sigma68(dz)
	of, _, _ = pt.out_fract(dz, 0.02, 1)

	print "\nName = ", name
	print "Percentage lost = %.3f%%" % (float((len_before - len_after) * 100) / float(len_before))
	print "sig = %.5f" % sig 
	#print "sig68 = %.5f" % sig68
	print "of = %.2f%%" % (of * 100)