Skip to content

Commit 16d655e

Browse files
committed
Avoid issues with multi-dimensional, single-element arrays
1 parent 7f31779 commit 16d655e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

galpy/potential/AnySphericalPotential.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
lambda r: 4.0
8484
* numpy.pi
8585
* integrate.quad(
86-
lambda a: a**2 * self._rawdens(a), 0, numpy.atleast_1d(r)[0]
86+
lambda a: a**2 * self._rawdens(a), 0, numpy.atleast_1d(r).flatten()[0]
8787
)[0]
8888
)
8989
# The potential at zero, try to figure out whether it's finite
@@ -125,7 +125,9 @@ def _revaluate(self, r, t=0.0):
125125
- 4.0
126126
* numpy.pi
127127
* integrate.quad(
128-
lambda a: self._rawdens(a) * a, numpy.atleast_1d(r)[0], numpy.inf
128+
lambda a: self._rawdens(a) * a,
129+
numpy.atleast_1d(r).flatten()[0],
130+
numpy.inf,
129131
)[0]
130132
)
131133

0 commit comments

Comments
 (0)