Abstract
Code is presented that computes and exploits orbital tori for any axisymmetric gravitational potential. The code is a development of the agama software package for action-based galaxy modelling and can be downloaded as the agama b code library. Although coded in C++, most of its functions can be accessed from Python. We add to the package functions that facilitate confronting models with data, which involve sky coordinates, lines of sight, distances, extinction, etc. The new torus generator can produce tori for both highly eccentric and nearly circular orbits that lie beyond the range of the earlier torus-mapping code. Tori can be created by interpolation between tori at very low cost. Tori are fundamentally devices for computing ordinary phase-space coordinates from angle-action coordinates, but agama b includes an action finder that returns angle-action coordinates from any given phase-space location. This action finder yields the torus through the given point, so it includes the functionality of an orbit integrator. The action finder is more accurate and reliable but computationally more costly than the widely used Stäckel Fudge. We show how agama b can be used to generate sophisticated but cheap models of tidal streams and use it to analyse data for the GD1 stream. With the most recently published distances to the stream, energy and angular momentum imply that the end that must be leading is trailing, but extremely small changes to the distances rectify the problem.