99###############################################################################
1010import numpy
1111
12- from galpy .util import coords
12+ from galpy .util import conversion , coords
1313
1414from .Potential import (
1515 _APY_LOADED ,
@@ -57,10 +57,10 @@ def __init__(self, amp=1.0, pot=None, delta=0.5, u0=0.0, ro=None, vo=None):
5757 Amplitude to be applied to the potential. Default is 1.0.
5858 pot : Potential or list
5959 Potential instance or list thereof; this potential is made into an oblate Staeckel potential.
60- delta : float or astropy.units. Quantity, optional
60+ delta : float or Quantity, optional
6161 The focal length. Default is 0.5.
62- u0 : float, optional
63- Reference u value. Default is 0.0 .
62+ u0 : float or tuple or tuple of Quantity
63+ Reference u value; if a tuple is given, this is assumed to be a (R,z) value to be converted to u .
6464 ro : float or Quantity, optional
6565 Distance scale for translation into internal units (default from configuration file).
6666 vo : float or Quantity, optional
@@ -70,14 +70,19 @@ def __init__(self, amp=1.0, pot=None, delta=0.5, u0=0.0, ro=None, vo=None):
7070 -----
7171 - 2017-12-15 - Started - Bovy (UofT)
7272 """
73- if _APY_LOADED and isinstance (delta , units .Quantity ):
74- delta = delta .to (units .kpc ).value / self ._ro
75- self ._delta = delta
73+ self ._delta = conversion .parse_length (delta , ro = ro )
7674 if u0 is None : # pragma: no cover
7775 raise ValueError (
7876 "u0= needs to be given to setup OblateStaeckelWrapperPotential"
7977 )
80- self ._u0 = u0
78+ if isinstance (u0 , (tuple , list , numpy .ndarray )):
79+ self ._u0 = coords .Rz_to_uv (
80+ conversion .parse_length (u0 [0 ], ro = ro ),
81+ conversion .parse_length (u0 [1 ], ro = ro ),
82+ delta = self ._delta ,
83+ )[0 ]
84+ else :
85+ self ._u0 = u0
8186 self ._v0 = numpy .pi / 2.0 # so we know when we're using this
8287 R0 , z0 = coords .uv_to_Rz (self ._u0 , self ._v0 , delta = self ._delta )
8388 self ._refpot = (
0 commit comments