Ejemplo n.º 1
0
def rootfind_dimless_alt(m,
                         k,
                         qlist,
                         ecc=0.,
                         chi=0.,
                         gravfunc=grav.chi_gravity_deriv,
                         verbose=False,
                         inc=1.0033,
                         saving=False):
    """
    For a given m, k and qlist, and potentially for different radius, mass and
    period as well, determines the wave mode and calculates the eigenvalues
    from the asymptotically calculated values.
    """
    dlngrav = partial(gravfunc, chi)
    mode_admin = Property.Mode_admin(m, k)
    mode_admin.set_qlist(qlist)
    mode_admin.set_curvilinear(ecc, chi, dlngrav)

    qlist, found_lamlist = roots.multi_rootfind_fromguess_dimless(
        mode_admin, verbose=verbose, inc=inc)
    #    roots.multi_rootfind_fromguess_dimless(m, qlist, is_even, guesslist, ecc, dlngrav, verbose=verbose, inc=inc)
    if saving:
        savestring = "data/Curvilinear/range_{}_{}_steps_{}_kval_{}_ecc_{}_chi_{}.txt"\
                                    .format(qlist[0],qlist[-1],len(qlist),str(k), str(ecc), str(chi))
        print "\nSaving to: {}\n\n".format(savestring)
        np.savetxt(savestring, found_lamlist)
    if ecc == .25:
        ls = "dotted"
    elif ecc == .5:
        ls = "dashed"
    else:
        ls = "solid"
    plt.plot(qlist, found_lamlist, ls=ls)
Ejemplo n.º 2
0
def rootfind_dimless(mode_admin, verbose=False, inc=1.0033, rsearch=False):
    """
    For a given m, k and qlist, and potentially for different radius, mass and
    period as well, determines the wave mode and calculates the eigenvalues
    from the asymptotically calculated values.
    """
    qlist, found_lamlist = roots.multi_rootfind_fromguess_dimless(
        mode_admin, verbose=False, inc=inc, rsearch=rsearch)
    return mode_admin.guess, found_lamlist, mode_admin.mode.split(
        "_")[0], mode_admin.direction
Ejemplo n.º 3
0
def rootfind_dimless_new(mode_admin, verbose=False, inc=1.0033):
    """
    For a given m, k and qlist, and potentially for different radius, mass and
    period as well, determines the wave mode and calculates the eigenvalues
    from the asymptotically calculated values.
    """
    qlist, found_lamlist = roots.multi_rootfind_fromguess_dimless(mode_admin, verbose=verbose, inc=inc)  # if the mode is an argument here it can figure out how to normalize in a proper way ...
    if mode_admin.ecc == .25:
        ls="dotted"
    elif mode_admin.ecc == .5:
        ls="dashed"
    else:
        ls="solid"
    plt.plot(qlist, found_lamlist, ls=ls)
Ejemplo n.º 4
0
def rootfind_dimless(m,
                     k,
                     qlist,
                     ecc=0.,
                     dlngrav=partial(grav.chi_gravity_deriv, 0.),
                     verbose=False,
                     inc=1.0033):
    """
    For a given m, k and qlist, and potentially for different radius, mass and
    period as well, determines the wave mode and calculates the eigenvalues
    from the asymptotically calculated values.
    """
    mode_admin = Property.Mode_admin(m, k)
    mode_admin.validate_values()
    is_even = mode_admin.is_even()
    l = mode_admin.get_l()

    if np.average(qlist) * m < 0:
        direction = "pro"
    else:
        direction = "retro"

    wavemode = mode_admin.get_wavemode(direction)
    print is_even, l, wavemode

    wavemode += "s"
    if wavemode[0] == "g":
        wavemode += "_list"
    wavemode = wavemode.replace(" ", "_")
    if wavemode[0] == "y" or wavemode[
            0] == "k":  # yanai and kelvin modes only have two arguments
        args = m, qlist
    else:
        args = m, k, qlist
    guesslist = getattr(asym, wavemode)(*args)

    qlist, found_lamlist = roots.multi_rootfind_fromguess_dimless(
        m, qlist, is_even, guesslist, ecc, dlngrav, verbose=verbose, inc=inc)
    plt.plot(qlist, found_lamlist)
Ejemplo n.º 5
0
def rootfind_dimless_alt(m, k, qlist, ecc=0., chi=0., gravfunc=grav.chi_gravity_deriv, verbose=False, inc=1.0033):
    """
    For a given m, k and qlist, and potentially for different radius, mass and
    period as well, determines the wave mode and calculates the eigenvalues
    from the asymptotically calculated values.
    """
    dlngrav=partial(gravfunc, chi)
    mode_admin = Property.Mode_admin(m, k)
    mode_admin.set_qlist(qlist)
    mode_admin.set_curvilinear(ecc, chi, dlngrav)

    if np.average(qlist)*m < 0:
        direction = "pro"
    else:
        direction = "retro"

    wavemode = mode_admin.get_wavemode(direction)
    print mode_admin.is_even, mode_admin.l, mode_admin.mode

    wavemode += "s"
    if wavemode[0] == "g":
        wavemode += "_list"
    wavemode = wavemode.replace(" ", "_")
    if wavemode[0] == "y" or wavemode[0] == "k":  # yanai and kelvin modes only have two arguments
        args = m, qlist, ecc, chi
    else:
        args = m, k, qlist, ecc, chi
    guesslist = getattr(curvasym, wavemode)(*args)

    qlist, found_lamlist = roots.multi_rootfind_fromguess_dimless(mode_admin, verbose=verbose, inc=inc)  # if the mode is an argument here it can figure out how to normalize in a proper way ...
    if ecc == .25:
        ls="dotted"
    elif ecc == .5:
        ls="dashed"
    else:
        ls="solid"
    plt.plot(qlist, found_lamlist, ls=ls)