Potential (galpy.potential)

3D potentials

General instance routines

Use as Potential-instance.method(...)

In addition to these, the NFWPotential also has methods to calculate virial quantities

General 3D potential routines

Use as method(...)

In addition to these, the following methods are available to compute expansion coefficients for the SCFPotential class for a given density

Specific potentials

All of the following potentials can also be modified by the specific WrapperPotentials listed below.

Spherical potentials

Spherical potentials in galpy can be implemented in two ways: a) directly by inheriting from Potential and implementing the usual methods (_evaluate, _Rforce, etc.) or b) by inheriting from the general SphericalPotential class and implementing the functions _revaluate(self,r,t=0.), _rforce(self,r,t=0.), _r2deriv(self,r,t=0.), and _rdens(self,r,t=0.) that evaluate the potential, radial force, (minus the) radial force derivative, and density as a function of the (here natural) spherical radius. For adding a C implementation when using method b), follow similar steps in C (use interpSphericalPotential as an example to follow). For historical reasons, most spherical potentials in galpy are directly implemented (option a above), but for new spherical potentials it is typically easier to follow option b).

Additional spherical potentials can be obtained by setting the axis ratios equal for the triaxial potentials listed in the section on ellipsoidal triaxial potentials below.

Axisymmetric potentials

Additional axisymmetric potentials can be obtained by setting the x/y axis ratio equal to 1 for the triaxial potentials listed in the section on ellipsoidal triaxial potentials below.

Ellipsoidal triaxial potentials

galpy has very general support for implementing triaxial (or the oblate and prolate special cases) of ellipsoidal potentials through the general EllipsoidalPotential class. These potentials have densities that are uniform on ellipsoids, thus only functions of \(m^2 = x^2 + \frac{y^2}{b^2}+\frac{z^2}{c^2}\). New potentials of this type can be implemented by inheriting from this class and implementing the _mdens(self,m), _psi(self,m), and _mdens_deriv functions for the density, its integral with respect to \(m^2\), and its derivative with respect to m, respectively. For adding a C implementation, follow similar steps (use PerfectEllipsoidPotential as an example to follow).

Note that the Ferrers potential listed below is a potential of this type, but it is currently not implemented using the EllipsoidalPotential class. Further note that these potentials can all be rotated in 3D using the zvec and pa keywords; however, more general support for the same behavior is available through the RotateAndTiltWrapperPotential discussed below and the internal zvec/pa keywords will likely be deprecated in a future version.

Spiral, bar, other triaxial, and miscellaneous potentials

All galpy potentials can also be made to rotate using the SolidBodyRotationWrapperPotential listed in the section on wrapper potentials below.

General Poisson solvers for disks and halos

Dissipative forces

Fictitious forces in non-inertial frames

Helper classes

2D potentials

General instance routines

Use as Potential-instance.method(...)

General axisymmetric potential instance routines

Use as Potential-instance.method(...)

General 2D potential routines

Use as method(...)

Specific potentials

All of the 3D potentials above can be used as two-dimensional potentials in the mid-plane.

In addition, a two-dimensional bar potential, two spiral potentials, the Henon & Heiles (1964) potential, and some static non-axisymmetric perturbations are included

1D potentials

General instance routines

Use as Potential-instance.method(...)

General 1D potential routines

Use as method(...)

Specific potentials

One-dimensional potentials can also be derived from 3D axisymmetric potentials as the vertical potential at a certain Galactocentric radius

Potential wrappers

Gravitational potentials in galpy can also be modified using wrappers, for example, to change their amplitude as a function of time. These wrappers can be applied to any galpy potential (although whether they can be used in C depends on whether the wrapper and all of the potentials that it wraps are implemented in C). Multiple wrappers can be applied to the same potential.

Specific wrappers