diff --git a/src/galax/potential/_potential/base.py b/src/galax/potential/_potential/base.py index a897374c..2050880f 100644 --- a/src/galax/potential/_potential/base.py +++ b/src/galax/potential/_potential/base.py @@ -403,8 +403,38 @@ def evaluate_orbit( # ========================================================================= # Interoperability - def as_interop(self, library: AbstractInteroperableLibrary) -> object: - """Convert the potential to an object of a different library.""" + def as_interop(self, library: type[AbstractInteroperableLibrary], /) -> object: + """Convert the potential to an object of a different library. + + Parameters + ---------- + library : :class:`~galax.potential.io.AbstractInteroperableLibrary` + The library type to convert the potential to. + + Examples + -------- + .. invisible-code-block: python + + from galax.utils._optional_deps import HAS_GALA + + .. skip: start if(not HAS_GALA, reason="requires gala") + + >>> import galax.potential as gp + >>> pot = gp.MilkyWayPotential() + + Convert the potential to a :mod:`gala` potential + >>> gala_pot = pot.as_interop(gp.io.GalaLibrary) + >>> gala_pot + + + Now converting back to a :mod:`galax` potential + + >>> pot2 = gp.io.convert_potential(gp.io.GalaxLibrary, gala_pot) + >>> pot2 == pot + True + + .. skip: end + """ return convert_potential(library, self)