galpy
galpy copied to clipboard
``estimateDeltaStaeckel`` at z=0
🐛 Bug
estimateDeltaStaeckel
returns NaN when evaluated at z=0. This is a real, physical issue, not a bug per se, because for a location in the mid-plane, one cannot know anything about the vertical extent of the potential and, thus, cannot determine whether or not the potential is of Staeckel form and what its focal length would be.
Because this is a real effect, it's not entirely clear how to fix this. Options include
- Evaluated at a small, positive z instead. However, it's unclear what this positive z should be. Some investigation of the gradient of the estimated Delta as a function of z for, e.g.,
MWPotential2014
orMcMillan17
would be useful in deciding this - Raise an error or a warning (error is annoying when using this to estimate actions/... for an Orbit)
Reproducible example
from galpy.orbit import Orbit
from astropy import units
from galpy.potential.mwpotentials import McMillan17
from galpy.actionAngle import estimateDeltaStaeckel
o = Orbit(vxvv=[8.462* units.kpc, 0.6 * units.km / units.s, 236.1* units.km / units.s, 0.0 * units.kpc, -7.5 * units.km / units.s],ro=8.21,vo=233.1)
estimateDeltaStaeckel(McMillan17,o.R(),o.z())
(from https://github.com/jobovy/galpy/issues/495#issuecomment-1245001187)
Expected behavior
A non-NaN value.
Additional context
Originally reported here: https://github.com/jobovy/galpy/issues/495#issuecomment-1245001187