def clean( old_ctg_filename, new_ctg_filename, max_num_pairs, alpha, c, wo, k_hat, coupling_type="general", verbose=False ): """ reads in old_ctg_filename and writes a (shorter) list into new_ctg_filename """ if verbose: print "reading in %d pairs from : %s" % (max_num_pairs, old_ctg_filename) # load using mode_selection.coupling_list() if coupling_type == "general": this_list = coupling_list().load_unsorted_mode_lists( [old_ctg_filename], num_pairs=opts.max_num_pairs, min_n=False, max_n=False, min_l=False, max_l=False, min_w=False, max_w=False, ) # load using ggg.ggg_coupling_list() elif coupling_type == "ggg": if "heuristic" in old_ctg_filename: metric = "heuristic" elif "Ethr" in old_ctg_filename: metric = "Ethr" else: metric = raw_input( 'could not determine "metric" from filename : %s\n\tplease enter metric [heuristic/Ethr]' % old_ctg_filename ) this_list = ggg_coupling_list(alpha, c, wo, k_hat).load_unsorted_mode_lists( metric, [old_ctg_filename], num_pairs=max_num_pairs, min_n=False, max_n=False, min_l=False, max_l=False, min_w=False, max_w=False, ) # write if verbose: print "\twriting %d pairs to : %s" % (max_num_pairs, new_ctg_filename) this_list.write_mode_list(new_ctg_filename) return True
print "\t%s" % filename if "min_" == daughter_selection[0:4]: my_coupling_list = ggg.ggg_minima_coupling_list(alpha, c, wo, k_hat, parent_mode=mode).load_unsorted_mode_lists(daughter_selection, useful_filenames, min_n=False, max_n=False, min_l=daughter_min_l, max_l=daughter_max_l, min_w=min_w, max_w=max_w) if to_unique_couplings: if opts.verbose: print "checking for unique couplings" my_coupling_list = my_coupling_list.to_unique_couplings() for ind, npairs in enumerate(num_pairs): if opts.verbose: print "grabbing %d triples" % npairs my_triples = my_coupling_list.to_triples(npairs, min_n=False, max_n=False, min_l=daughter_min_l, max_l=daughter_max_l, min_w=min_w, max_w=max_w, parent_forcing=parent_forcing, daughter_forcing=daughter_forcing, Mprim=Mprim, Mcomp=Mcomp, Porb=Porb, eccentricity=eccentricity, Ialm_hat=Ialm_hat) ### add triples to the network new_systems[ind].network.add_couplings(my_triples, opts.verbose) else: my_coupling_list = ggg.ggg_coupling_list(alpha, c, wo, k_hat, parent_mode=mode).load_unsorted_mode_lists(daughter_selection, useful_filenames, num_pairs=max(num_pairs), min_n=False, max_n=False, min_l=daughter_min_l, max_l=daughter_max_l, min_w=min_w, max_w=max_w) if to_unique_couplings: if opts.verbose: print "checking for unique couplings" my_coupling_list = my_coupling_list.to_unique_couplings() for ind, npairs in enumerate(num_pairs): if opts.verbose: print "grabbing %d triples" % npairs my_triples = my_coupling_list.to_triples(npairs, parent_forcing=parent_forcing, daughter_forcing=daughter_forcing, Mprim=Mprim, Mcomp=Mcomp, Porb=Porb, eccentricity=eccentricity, Ialm_hat=Ialm_hat) ### add triples to the network new_systems[ind].network.add_couplings(my_triples, opts.verbose) # write new network to disk for ind, npairs in enumerate(num_pairs): new_logfilename = opts.new_logfilename+"_%d.log" % npairs if intercouple: