cluster_list = np.unique(c_id) for clt in cluster_list: index = (c_id == clt) clusters.append(Cluster(cluster_count)) clusters[cluster_count].extend(g_num[index], g_id[index], g_ra[index], g_dec[index], g_z[index]) clusters[cluster_count].props(opts.bg_expect) cluster_count += 1 # Find matches and merge clusters: print 'Original number of clusters:', len(clusters) print 'Original number of cluster members:', gal_count(clusters) print 'Finding cluster matches and merging:' merge.merge_clusters(clusters, opts.progress, opts.bg_expect, 0.5, 0.2) print 'Final number of merged clusters:', len(clusters) print 'Final number of merged cluster members:', gal_count(clusters) # Output merged clusters: ngals = [] for i in range(len(clusters)): ngals.append(clusters[i].ngal) ngals = np.array(ngals) index = ngals.argsort()[::-1] if opts.output_type == 'ascii': clt_file = opts.output_file + '_clusters.dat' gal_file = opts.output_file + '_galaxies.dat'
for i in range(loop_over_zbins): clusters.extend(friends_of_friends(i, gal, tree, opts.mode, len(clusters))) print '>>', z_bins[i].z, len(clusters) #assign properties to detected clusters assign_cluster_props(clusters) print 'Found', len(clusters), 'clusters.' ################## # MERGE CLUSTERS # ################## #merge clusters with galaxies in common print 'Merge clusters...' merge.merge_clusters(clusters, opts.progress, opts.bg_expect, opts.tree_dist) print 'Merged into', len(clusters), 'clusters.' ################### # OUTPUT CLUSTERS # ################### ngal_list = [] for x in clusters: ngal_list.append(x.ngal) index = np.array(ngal_list).argsort()[::-1] clusters = np.array(clusters)[index] if opts.output_type == 'ascii':
for i in range(loop_over_zbins): clusters.extend(friends_of_friends(i, gal, tree, opts.tree_dist, opts.mode, len(clusters))) print '>>', z_bins[i].z, len(clusters) #assign properties to detected clusters assign_cluster_props(clusters) print 'Found', len(clusters), 'clusters.' ################## # MERGE CLUSTERS # ################## #merge clusters with galaxies in common print 'Merge clusters...' merge.merge_clusters(clusters, opts.progress, opts.bg_expect, 1.0, 0.2) print 'Merged into', len(clusters), 'clusters.' ################### # OUTPUT CLUSTERS # ################### ngal_list = [] for x in clusters: ngal_list.append(x.ngal) index = np.array(ngal_list).argsort()[::-1] clusters = np.array(clusters)[index] output = open(opts.output_file, 'w')
clusters.extend( friends_of_friends(i, gal, opts.tree_dist, opts.mode, len(clusters))) print '>>', z_bins[i].z, len(clusters) #assign properties to detected clusters assign_cluster_props(clusters) print 'Found', len(clusters), 'clusters.' ################## # MERGE CLUSTERS # ################## #merge clusters with galaxies in common print 'Merge clusters...' merge.merge_clusters(clusters, opts.progress, opts.bg_expect, opts.tree_dist) print 'Merged into', len(clusters), 'clusters.' ################### # OUTPUT CLUSTERS # ################### ngal_list = [] for x in clusters: ngal_list.append(x.ngal) index = np.array(ngal_list).argsort()[::-1] clusters = np.array(clusters)[index] if opts.output_type == 'ascii':