def compute_projmass(args): """ Main function Input - Output - #FIXME - finish documentation """ radius = args.radius / 3600.0 k_map = pyfits.open(args.kappa_map) k_data = k_map[0].data k_data_tmp = k_data pix_dim = math.fabs(k_map[0].header["CDELT1"]) pix_unit = k_map[0].header["CUNIT1"] shape = k_map[0].data.shape x_axis = np.linspace(-(shape[0] - 1.0)/2.0*pix_dim , \ (shape[0] - 1.0)/2.0*pix_dim, shape[0]) y_axis = np.linspace(-(shape[1] - 1.0)/2.0*pix_dim , \ (shape[1] - 1.0)/2.0*pix_dim, shape[1]) if pix_unit != "deg": print "Error, pixel unit not in deg" if (x_axis.max() - x_axis.min()) / 2.0 < radius: print "Error, the radius is larger than the image limits" proj_mass = 0.0 for i_x in range(shape[0]): for i_y in range(shape[1]): if x_axis[i_x]**2.0 + y_axis[i_y]**2.0 <= radius**2.0: #k_data_tmp[i_x][i_y] = 0.0 proj_mass += k_data_tmp[i_x][i_y] print "%e M_sol" % (proj_mass * 1E12) if args.plot_cont: circ = fc.make_circunference(radius * 3600, 0, 0) plt.plot(circ[0], circ[1], "k--", linewidth=2) plt.contour(x_axis * 3600.0, y_axis * 3600.0, k_data) plt.show() return proj_mass ################################################################################
def main_redmapper_members(): """ Main function Input - Output - #FIXME - finish documentation """ redm_data, redm_names = rc.read_catalog("cs82_redmapper_members") s82_ra(redm_data["RA"]) sogr_data, sogr_names = rc.read_catalog("sogras_cris") s82_ra(sogr_data["RA"]) red_data, red_names = rc.read_catalog("cs82_redmapper") ecgmm_data, ecgmm_names = rc.read_catalog("bcg_r200_old") s82_ra(ecgmm_data["RA"]) # print redm_names # print red_names ids = np.unique(redm_data["MEM_MATCH_ID"]) selec_reg = [] for i in range(len(sogr_data["RA"])): selec_reg.append( fc.select_region(redm_data["RA"], redm_data["DEC"], \ sogr_data["RA"][i], sogr_data["DEC"][i], \ 3) ) # print i, len(selec_reg[i]) """ for i in range(len(selec_reg)): if len(selec_reg[i]) != 0: file_reg = open(sogr_data["ID"][i] + ".reg", "w") for j in range(len(selec_reg[i])): print i, j file_reg.close() """ """ msk_id = (redm_data["MEM_MATCH_ID"] == ids[7]) plt.scatter(redm_data["RA"][msk_id], redm_data["DEC"][msk_id], \ s = np.exp(redm_data["MODEL_MAG"][msk_id] - \ redm_data["MODEL_MAG"][msk_id].min()), alpha = 0.7) plt.plot(red_data["RA"][7], red_data["DEC"][7], "r", markersize = 10, \ marker = "H", alpha = 0.5) plt.show() """ for i_ids in np.unique(redm_data["MEM_MATCH_ID"]): msk = (redm_data["MEM_MATCH_ID"] == i_ids) plt.plot(redm_data["RA"][msk], redm_data["DEC"][msk], ".") plt.plot(ecgmm_data["RA"], ecgmm_data["DEC"], 'mv', markersize = 7, \ label = "ecgmm clusters") plt.plot(sogr_data["RA"], sogr_data["DEC"], "b^", \ markersize = 7, label = "SOGRAS") for i in range(len(sogr_data["RA"])): circ = fc.make_circunference(2.0/60.0, sogr_data["RA"][i], \ sogr_data["DEC"][i]) if sogr_data["ID"][i][:1] == "S": plt.plot(circ[0], circ[1], 'b-') else: plt.plot(circ[0], circ[1], 'r-') plt.legend() plt.xlim(-51, 61) plt.ylim(-1.25, 1.25) plt.show() print sogr_data["ID"]