# print 'setting up the classes' # print 'getting matter randoms' # theta_g, phi_g = pcc.eq2ang(ra_g, dec_g) # nside_mask = 128 # ind_g_f = hp.ang2pix(nside_mask, theta_g, phi_g) # mask_d = np.zeros(hp.nside2npix(nside_mask)) # mask_d[ind_g_f] = 1 # plt.figure() # hp.mollview(mask_d) # plt.savefig('/global/project/projectdirs/des/shivamp/actxdes/data_set/buzzard_sims/measurements/' + 'data_m_sky.png') # pdb.set_trace() # ra_rand_m, dec_rand_m, z_rand_m = CF_m.create_random_cat_masked(0.0, zmax_hrlum,ind_g_f,nside_mask) if do_m: CF_m = pcc.Catalog_funcs(ra_m, dec_m, z_m ,cosmo_params_dict,other_params_dict) print 'getting matter jk' bin_n_all_m,jk_all_m = CF_m.get_jk_stats() CF_m.save_cat(ra_m, dec_m, z_m,bin_n_all_m,jk_all_m,save_dir,save_filename_matter) if do_rm: ra_rand_m, dec_rand_m, z_rand_m = ra_rand_g, dec_rand_g, z_rand_g print ' nrand_g: ',len(ra_rand_g), ', ng:',len(ra_g),' nrand_m: ',len(ra_rand_m), ', nm:',len(ra_m) CF_rand_m = pcc.Catalog_funcs(ra_rand_m, dec_rand_m, z_rand_m ,cosmo_params_dict,other_params_dict) print 'getting matter randoms jk' bin_n_all_rand_m,jk_all_rand_m = CF_rand_m.get_jk_stats() CF_rand_m.save_cat(ra_rand_m, dec_rand_m, z_rand_m,bin_n_all_rand_m,jk_all_rand_m,save_dir,save_filename_matter_randoms) if do_g: CF_g = pcc.Catalog_funcs(ra_g, dec_g, z_g ,cosmo_params_dict,other_params_dict) print 'getting galaxy jk'
if os.path.isfile(save_dir + save_filename_jk_obj): jkobj_map_radec_centers = pk.load( open(save_dir + save_filename_jk_obj, 'rb'))['jkobj_map_radec_centers'] jkobj_map_radec = KMeans(jkobj_map_radec_centers) else: ind_jk_g = np.where((z_g_hdens > other_params_dict['zmin_bins'][0]) & ( z_g_hdens < (other_params_dict['zmin_bins'][0] + 0.1)))[0] jkobj_map_radec = pcc.get_jkobj( np.transpose([ra_g_hdens[ind_jk_g], dec_g_hdens[ind_jk_g]]), njk_radec) jk_dict = {'jkobj_map_radec_centers': jkobj_map_radec.centers} pk.dump(jk_dict, open(save_dir + save_filename_jk_obj, 'wb'), protocol=2) other_params_dict['jkobj_map_radec'] = jkobj_map_radec CF_hdens_all = pcc.Catalog_funcs(ra_g_hdens_all, dec_g_hdens_all, z_g_hdens_all, cosmo_params_dict, other_params_dict) nz_unnorm, z_edge = np.histogram(z_g_hdens_all, zarray_edges) nz_unnorm_smooth = spsg.savgol_filter(nz_unnorm, 21, 5) nz_normed = nz_unnorm / (integrate.simps(nz_unnorm, zarray)) nz_normed_smooth = nz_unnorm_smooth / (integrate.simps(nz_unnorm_smooth, zarray)) ra_rand_g_hdens_all, dec_rand_g_hdens_all, z_rand_g_hdens_all = CF_hdens_all.create_random_cat_uniform_esutil( zarray=zarray, nz_normed=nz_normed_smooth, nrand_fac=10, ra_min=0, ra_max=90, dec_min=0, dec_max=90) ind_hdens = np.where((z_rand_g_hdens_all > zmin_hdens)