コード例 #1
0
ファイル: nmode_b.py プロジェクト: reedessick/nmodelte
        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:
    if opts.verbose: print "computing all possible couplings for %s" % new_logfilename
    new_systems[ind].network = ggg.intercouple_network(new_systems[ind].network, k_hat=k_hat, verbose=opts.verbose)

  if opts.verbose: print "writing newtork to %s" % new_logfilename
  nm_u.write_log(new_logfilename, new_systems[ind])
コード例 #2
0
#                                      generate a new network
#                                        (parent selection)
#
####################################################################################################
if opts.verbose: print "generating a new network (parent selection)"

wo = ms.compute_wo(opts.Mprim, opts.Rprim)

Oorb = 2*np.pi/opts.Porb
system = networks.system(opts.Mprim, opts.Mcomp, opts.Rprim, opts.Porb, opts.eccentricity)
network = system.network

min_w = opts.parent_min_frac_Oorb*Oorb
max_w = opts.parent_max_frac_Oorb*Oorb

if opts.verbose: print "computing parent modes using %s" % opts.parent_selection
if opts.parent_selection == "Elin":
  parents = ggg.compute_parents_Elin(Oorb, bounds, N=opts.num_parents, min_w=min_w, max_w=max_w, alpha=opts.alpha, c=opts.c, wo=wo, Mprim=opts.Mprim, Mcomp=opts.Mcomp, Porb=opts.Porb, eccentricity=opts.eccentricity)
elif opts.parent_selection == "detuning":
  parents = ggg.compute_parents_detuning(Oorb, bounds, N=opts.num_parents, min_w=min_w, max_w=max_w, alpha=opts.alpha, c=opts.c, wo=wo, forcing=True, Mprim=opts.Mprim, Mcomp=opts.Mcomp, Porb=opts.Porb, eccentricity=opts.eccentricity)
else:
  sys.exit("unknown parent selection algorithm: %s\nplease supply a parent selection algorithm from the following:\n\tEthr\n\tdetuning" % (opts.parent_selection) )

if opts.verbose: print "attempting to add %d parents to the network" % len(parents)
network = network.add_modes(parents, verbose=opts.verbose)

if opts.verbose: print "writing network to %s" % opts.new_logfilename
nm_u.write_log(opts.new_logfilename, system)