Exemplo n.º 1
0
def dvcircdR(Pot,R):
    """

    NAME:

       dvcircdR

    PURPOSE:

       calculate the derivative of the circular velocity wrt R at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius

    OUTPUT:

       derivative of the circular rotation velocity wrt R

    HISTORY:

       2013-01-08 - Written - Bovy (IAS)

    """
    from galpy.potential import evaluateplanarRforces, evaluateplanarR2derivs
    from galpy.potential import PotentialError
    tvc= vcirc(Pot,R)
    try:
        return 0.5*(-evaluateplanarRforces(R,Pot)+R*evaluateplanarR2derivs(R,Pot))/tvc
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot= RZToplanarPotential(Pot)
        return 0.5*(-evaluateplanarRforces(R,Pot)+R*evaluateplanarR2derivs(R,Pot))/tvc
Exemplo n.º 2
0
def dvcircdR(Pot, R, phi=None):
    """

    NAME:

       dvcircdR

    PURPOSE:

       calculate the derivative of the circular velocity wrt R at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius (can be Quantity)

       phi= (None) azimuth to use for non-axisymmetric potentials

    OUTPUT:

       derivative of the circular rotation velocity wrt R

    HISTORY:

       2013-01-08 - Written - Bovy (IAS)

       2016-06-28 - Added phi= keyword for non-axisymmetric potential - Bovy (UofT)

    """
    from galpy.potential import evaluateplanarRforces, evaluateplanarR2derivs
    from galpy.potential import PotentialError

    tvc = vcirc(Pot, R, phi=phi, use_physical=False)
    try:
        return (
            0.5
            * (
                -evaluateplanarRforces(Pot, R, phi=phi, use_physical=False)
                + R * evaluateplanarR2derivs(Pot, R, phi=phi, use_physical=False)
            )
            / tvc
        )
    except PotentialError:
        from galpy.potential import RZToplanarPotential

        Pot = RZToplanarPotential(Pot)
        return (
            0.5
            * (
                -evaluateplanarRforces(Pot, R, phi=phi, use_physical=False)
                + R * evaluateplanarR2derivs(Pot, R, phi=phi, use_physical=False)
            )
            / tvc
        )
Exemplo n.º 3
0
def dvcircdR(Pot, R, phi=None):
    """

    NAME:

       dvcircdR

    PURPOSE:

       calculate the derivative of the circular velocity wrt R at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius (can be Quantity)

       phi= (None) azimuth to use for non-axisymmetric potentials

    OUTPUT:

       derivative of the circular rotation velocity wrt R

    HISTORY:

       2013-01-08 - Written - Bovy (IAS)

       2016-06-28 - Added phi= keyword for non-axisymmetric potential - Bovy (UofT)

    """
    from galpy.potential import evaluateplanarRforces, evaluateplanarR2derivs
    from galpy.potential import PotentialError
    tvc = vcirc(Pot, R, phi=phi, use_physical=False)
    try:
        return 0.5 * (
            -evaluateplanarRforces(Pot, R, phi=phi, use_physical=False) + R *
            evaluateplanarR2derivs(Pot, R, phi=phi, use_physical=False)) / tvc
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot = RZToplanarPotential(Pot)
        return 0.5 * (
            -evaluateplanarRforces(Pot, R, phi=phi, use_physical=False) + R *
            evaluateplanarR2derivs(Pot, R, phi=phi, use_physical=False)) / tvc
Exemplo n.º 4
0
def epifreq(Pot,R):
    """
    
    NAME:
    
        epifreq
    
    PURPOSE:
    
        calculate the epicycle frequency at R in the potential Pot
    
    INPUT:

        Pot - Potential instance or list thereof
    
        R - Galactocentric radius
    
    OUTPUT:
    
        epicycle frequency
    
    HISTORY:
    
        2012-07-25 - Written - Bovy (IAS)
    
    """
    from galpy.potential_src.planarPotential import planarPotential
    if isinstance(Pot,(Potential,planarPotential)):
        return Pot.epifreq(R)
    from galpy.potential import evaluateplanarRforces, evaluateplanarR2derivs
    from galpy.potential import PotentialError
    try:
        return nu.sqrt(evaluateplanarR2derivs(R,Pot)-3./R*evaluateplanarRforces(R,Pot))
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot= RZToplanarPotential(Pot)
        return nu.sqrt(evaluateplanarR2derivs(R,Pot)-3./R*evaluateplanarRforces(R,Pot))
Exemplo n.º 5
0
def dvcircdR(Pot, R):
    """

    NAME:

       dvcircdR

    PURPOSE:

       calculate the derivative of the circular velocity wrt R at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius

    OUTPUT:

       derivative of the circular rotation velocity wrt R

    HISTORY:

       2013-01-08 - Written - Bovy (IAS)

    """
    from galpy.potential import evaluateplanarRforces, evaluateplanarR2derivs
    from galpy.potential import PotentialError
    tvc = vcirc(Pot, R)
    try:
        return 0.5 * (-evaluateplanarRforces(R, Pot) +
                      R * evaluateplanarR2derivs(R, Pot)) / tvc
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot = RZToplanarPotential(Pot)
        return 0.5 * (-evaluateplanarRforces(R, Pot) +
                      R * evaluateplanarR2derivs(R, Pot)) / tvc