Exemplo n.º 1
0
def load_log(filename, enforce_float=False):
    """
  loads system from pickled file
  """
    import networks
    import gmodes, pmodes
    from mode_selection import compute_wo

    network = networks.network()

    f = open(filename, "r")

    Porb = pickle.load(f)
    eccentricity = pickle.load(f)
    Mprim = pickle.load(f)
    Mcomp = pickle.load(f)
    Rprim = pickle.load(f)

    wo = compute_wo(Mprim, Rprim)

    for mode_tuple, mode_type in pickle.load(f):
        if mode_type == "generic":
            mode = networks.mode().from_tuple(mode_tuple)
        elif mode_type == "gmode":
            mode = gmodes.gmode().from_tuple(mode_tuple, wo=wo)
        elif mode_type == "pmode":
            mode = pmodes.pmode().from_tuple(mode_tuple)
        else:
            sys.exit("unknown mode_type : %s" % mode_type)
        network.modes.append(mode)

    network.K = pickle.load(f)
    if enforce_float:
        network.K = [[(i, j, float(k)) for i, j, k in coup] for coup in network.K]
    network._update()

    f.close()

    system = networks.system(Mprim, Mcomp, Rprim, Porb, eccentricity, net=network)

    return system
Exemplo n.º 2
0
def compute_U(mode, Mprim, Mcomp, Rprim, Porb, Ialm_hat=2.5e-3):
  """
  computes linear tidal forcing amplitude for this mode (an instance of networks.mode())
   only includes the dependence on this particular mode. All other dependencies are subsumed into U_hat

  U = U_hat * ((2*pi/w) / (1dy) )**(-11/6)
  where
  U_hat = 10**-8 * (Mcomp/(Mcomp+Mprime)) * (Porb / 10dy)**-2

  should be valid for sun-like stars with l=2
  """
  n, l, m, w, y = mode.get_nlmwy()
  if l == 2:
    ### DEPRECATED: old result that assumes constant Ialm_hat
    ### maintained for sanity checking, but the new implementation appears to be consistent
#    Uhat = 1.0e-8 * (Mcomp*nm_u.Mjup / (Mcomp*nm_u.Mjup + Mprim*nm_u.Msun) ) * (Porb / 864000.)**-2 ### old result 
#    return Uhat*(2*np.pi/(abs(w)*86400.))**(-11./6)

    wo = ms.compute_wo(Mprim, Rprim)
    Wlm = (3*np.pi/10)**0.5 ### from Nevin's paper, related to Ylm(theta=pi/2, phi=0)
    return Mcomp*nm_u.Mjup*(Rprim*nm_u.Rsun)**3 / (nm_u.G*Mprim*nm_u.Msun*(Mprim*nm_u.Msun + Mcomp*nm_u.Mjup)) * (2*np.pi/Porb)**2 * Wlm * Ialm_hat*(abs(w)/wo)**(11./6)

  else:
    sys.exit("no analytic expression exists for gmode linear forcing coefficients with l=$d" % l)
Exemplo n.º 3
0
		if opts.verbose:
			print label
			print "\tedot sedot p sp"
			for A, B, C, D in zip(np.exp(logedot), sedot, p, sp):
				print "\t", A, B, C, D

		p = np.linspace(np.min(p), np.max(p), opts.n_pts)
		logp = np.log( nmu.convert_time(p, time_unit, nmu.units["time"]) )
		ax.plot(p, np.exp(m*logp + b), marker="none", linestyle="-", color=color, label=label)

	### inset clusters (for zoom of a particular region)
	if opts.inset_clusters:
		iax = fig.add_axes(iax_pos)
		### compute linear expectation
	        wo = ms.compute_wo(opts.Mprim, opts.Rprim)

		if opts.verbose: print "determining frequency range"
		minO = np.infty
		maxO = -np.infty
		Mcomp = False
		for filename in opts.inset_clusters:
			file_obj = open(filename, "r")
                        clusters = pickle.load( file_obj )
                        file_obj.close()

                        for cluster in clusters:
                                cluster.load(verbose=opts.vverbose)
				for sdata, _ in cluster.data:
					O = 2*np.pi / sdata["system"]["Porb"]
					if minO > O:
Exemplo n.º 4
0
#
#                              grow the network based on integration data
#                                        (daughter selection)
#
####################################################################################################

if opts.verbose: print "reading in network parameters from %s" % opts.logfilename
system = nm_u.load_log(opts.logfilename)
Mprim = system.Mprim
Mcomp = system.Mcomp
Rprim = system.Rprim
Porb = system.Porb
Oorb = 2*np.pi/Porb
eccentricity = system.eccentricity

wo = ms.compute_wo(Mprim, Rprim)

### general parameters
alpha = config.getfloat("general", "alpha")
c = config.getfloat("general", "c")
k_hat = config.getfloat("general", "k_hat")
Ialm_hat = config.getfloat("general", "Ialm_hat")

if opts.outfilename and require_outfile:
  if opts.verbose: print "reading integration data from ", opts.outfilename
  t_P, q, N_m = nm_u.load_out_f(opts.outfilename)
else:
  q = False

### new parent selection
modes = new_parent_selection(config, system, q=q, verbose=opts.verbose)