//  [python]
def test_actionAngleTorus_basic():
    from galpy.actionAngle import actionAngleTorus
    from galpy.potential import (
        FlattenedPowerPotential,
        MWPotential,
        PlummerPotential,
        rl,
        vcirc,
    )

    tol = -4.0
    jr = 10.0**-10.0
    jz = 10.0**-10.0
    aAT = actionAngleTorus(pot=MWPotential)
    # at R=1, Lz=1
    jphi = 1.0
    angler = numpy.linspace(0.0, 2.0 * numpy.pi, 101)
    anglephi = numpy.linspace(0.0, 2.0 * numpy.pi, 101) + 1.0
    anglez = numpy.linspace(0.0, 2.0 * numpy.pi, 101) + 2.0
    RvR = aAT(jr, jphi, jz, angler, anglephi, anglez).T
    assert numpy.all(
        numpy.fabs(RvR[0] - rl(MWPotential, jphi)) < 10.0**tol
    ), "circular orbit does not have constant radius for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[1]) < 10.0**tol
    ), "circular orbit does not have zero radial velocity for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[2] - vcirc(MWPotential, rl(MWPotential, jphi))) < 10.0**tol
    ), "circular orbit does not have constant vT=vc for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[3]) < 10.0**tol
    ), "circular orbit does not have zero vertical height for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[4]) < 10.0**tol
    ), "circular orbit does not have zero vertical velocity for actionAngleTorus"
    # at Lz=1.5, using Plummer
    tol = -3.25
    pp = PlummerPotential(normalize=1.0)
    aAT = actionAngleTorus(pot=pp)
    jphi = 1.5
    RvR = aAT(jr, jphi, jz, angler, anglephi, anglez).T
    assert numpy.all(
        numpy.fabs(RvR[0] - rl(pp, jphi)) < 10.0**tol
    ), "circular orbit does not have constant radius for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[1]) < 10.0**tol
    ), "circular orbit does not have zero radial velocity for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[2] - vcirc(pp, rl(pp, jphi))) < 10.0**tol
    ), "circular orbit does not have constant vT=vc for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[3]) < 10.0**tol
    ), "circular orbit does not have zero vertical height for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[4]) < 10.0**tol
    ), "circular orbit does not have zero vertical velocity for actionAngleTorus"
    # at Lz=0.5, using FlattenedPowerPotential
    tol = -4.0
    fp = FlattenedPowerPotential(normalize=1.0)
    aAT = actionAngleTorus(pot=fp)
    jphi = 0.5
    RvR = aAT(jr, jphi, jz, angler, anglephi, anglez).T
    assert numpy.all(
        numpy.fabs(RvR[0] - rl(fp, jphi)) < 10.0**tol
    ), "circular orbit does not have constant radius for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[1]) < 10.0**tol
    ), "circular orbit does not have zero radial velocity for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[2] - vcirc(fp, rl(fp, jphi))) < 10.0**tol
    ), "circular orbit does not have constant vT=vc for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[3]) < 10.0**tol
    ), "circular orbit does not have zero vertical height for actionAngleTorus"
    assert numpy.all(
        numpy.fabs(RvR[4]) < 10.0**tol
    ), "circular orbit does not have zero vertical velocity for actionAngleTorus"
    return None