Пример #1
0
def omegac(Pot,R):
    """

    NAME:

       omegac

    PURPOSE:

       calculate the circular angular speed velocity at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius

    OUTPUT:

       circular angular speed

    HISTORY:

       2011-10-09 - Written - Bovy (IAS)

    """
    from galpy.potential import evaluateplanarRforces
    try:
        return nu.sqrt(-evaluateplanarRforces(R,Pot)/R)
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot= RZToplanarPotential(Pot)
        return nu.sqrt(-evaluateplanarRforces(R,Pot)/R)
Пример #2
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
Пример #3
0
def vcirc(Pot, R):
    """

    NAME:

       vcirc

    PURPOSE:

       calculate the circular velocity at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius

    OUTPUT:

       circular rotation velocity

    HISTORY:

       2011-10-09 - Written - Bovy (IAS)

    """
    from galpy.potential import evaluateplanarRforces
    from galpy.potential import PotentialError
    try:
        return nu.sqrt(-R * evaluateplanarRforces(R, Pot))
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot = RZToplanarPotential(Pot)
        return nu.sqrt(-R * evaluateplanarRforces(R, Pot))
Пример #4
0
def vcirc(Pot,R):
    """

    NAME:

       vcirc

    PURPOSE:

       calculate the circular velocity at R in potential Pot

    INPUT:

       Pot - Potential instance or list of such instances

       R - Galactocentric radius (can be Quantity)

    OUTPUT:

       circular rotation velocity

    HISTORY:

       2011-10-09 - Written - Bovy (IAS)

    """
    from galpy.potential import evaluateplanarRforces
    from galpy.potential import PotentialError
    try:
        return nu.sqrt(-R*evaluateplanarRforces(Pot,R,use_physical=False))
    except PotentialError:
        from galpy.potential import RZToplanarPotential
        Pot= RZToplanarPotential(Pot)
        return nu.sqrt(-R*evaluateplanarRforces(Pot,R,use_physical=False))
Пример #5
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
        )
Пример #6
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
Пример #7
0
def vcirc(Pot,R,phi=None,t=0.):
    """

    NAME:

       vcirc

    PURPOSE:

       calculate the circular velocity 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

       t= time (optional; can be Quantity)

    OUTPUT:

       circular rotation velocity

    HISTORY:

       2011-10-09 - Written - Bovy (IAS)

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

    """
    from galpy.potential import evaluateplanarRforces
    from galpy.potential import PotentialError
    try:
        return nu.sqrt(-R*evaluateplanarRforces(Pot,R,phi=phi,t=t,
                                                use_physical=False))
    except PotentialError:
        from galpy.potential import toPlanarPotential
        Pot= toPlanarPotential(Pot)
        return nu.sqrt(-R*evaluateplanarRforces(Pot,R,phi=phi,t=t,
                                                use_physical=False))
Пример #8
0
def vcirc(Pot, R, phi=None):
    """

    NAME:

       vcirc

    PURPOSE:

       calculate the circular velocity 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:

       circular rotation velocity

    HISTORY:

       2011-10-09 - Written - Bovy (IAS)

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

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

    try:
        return nu.sqrt(-R * evaluateplanarRforces(Pot, R, phi=phi, use_physical=False))
    except PotentialError:
        from galpy.potential import toPlanarPotential

        Pot = toPlanarPotential(Pot)
        return nu.sqrt(-R * evaluateplanarRforces(Pot, R, phi=phi, use_physical=False))
Пример #9
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))
Пример #10
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