model_catalog_filename=pro_path + "data/laes/mock_cat/model_"+str(w)+".txt" np.savetxt(model_catalog_filename,(x_laes,y_laes,x_rand,y_rand)) #RR,bins=correlation.RR_histogram(x_laes,y_laes,x_random,y_random,distance,theta_min,theta_max,theta_bins,cat_number=random_cat_number) print "computing DD" DD,bins=correlation.DD_histogram(x_laes,y_laes,distance,theta_min,theta_max,theta_bins) print "computed DD" print "computing DR" DR,bins=correlation.DR_histogram(x_laes,y_laes,x_drand,y_drand,distance,theta_min,theta_max,theta_bins,cat_number=1) print "DR computed" corr[j,:]=correlation.peebles_correlation(DD,DR) max_density_index=np.argmax(n_laes) number_laes=n_laes[max_density_index] lae_pos_ini=np.sum( n_laes[ 0 : max_density_index ] ) lae_pos_end=lae_pos_ini + number_laes x_laes_max = x_laes[lae_pos_ini:lae_pos_end] y_laes_max = y_laes[lae_pos_ini:lae_pos_end] x_random_max = x_random[lae_pos_ini:lae_pos_end] y_random_max = y_random[lae_pos_ini:lae_pos_end] x_drand_max = x_drand[lae_pos_ini:lae_pos_end] y_drand_max = y_drand[lae_pos_ini:lae_pos_end] model_catalog_filename=pro_path + "data/laes/mock_cat/maxden_model_"+str(w)+".txt" np.savetxt(model_catalog_filename,(x_laes,y_laes,x_rand,y_rand))
#random-survey histogram generation Xmin=x_width*i_s[i] Xmax=Xmin + x_width Ymin=y_width*j_s[i] Ymax=Ymin + y_width x_random= Xmin + ( Xmax - Xmin )*np.random.random_sample(n_laes) y_random=Ymin + ( Ymax - Ymin )*np.random.random_sample(n_laes) DR,bins=correlation.DR_histogram(x_laes,y_laes,x_random,y_random,distance,theta_min,theta_max,theta_bins,cat_number=1) #survey histogram generation DD,bins=correlation.DD_histogram(x_laes,y_laes,distance,theta_min,theta_max,theta_bins) corr[i,:]=correlation.landy_correlation(DD,RR,DR) print "CORR_landy=",corr[i,:] corr_laes=np.mean(corr,axis=0) std_corr=np.std(corr,axis=0) print "corr_landy=",corr_laes, "std_landy=",std_corr best_correlation[w,:]=corr_laes std_correlation[w,:]=std_corr dtheta=(theta_max - theta_min)/theta_bins correlation_data=np.empty(( np.size(corr_laes) , 3 ) ) model='(Mmin,Mmax,focc)=({0},{1},{2})'.format(m_min, m_max, f_occ) model_name = 'model_{0}_{1}_{2}'.format(m_min, m_max, f_occ) filename=pro_path + "data/mock_survey/" + "correlation_best_models/" + survey_type + "_correlation_" + model_name + ".dat"