Skip to content

Commit 840f022

Browse files
committed
Ensure cenfunc and stdfunc scalars are np.float64
1 parent 5078f0b commit 840f022

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎astropy/stats/sigma_clipping.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,18 @@ def _compute_bounds(self, data, axis=None):
315315
# NaNs
316316
with warnings.catch_warnings():
317317
warnings.simplefilter("ignore", category=RuntimeWarning)
318-
self._max_value = self._cenfunc_parsed(data, axis=axis)
318+
cen = self._cenfunc_parsed(data, axis=axis)
319+
if np.isscalar(cen) and not isinstance(cen, np.float64):
320+
# change bottleneck float scalar to np.float64
321+
cen = np.float64(cen)
322+
319323
std = self._stdfunc_parsed(data, axis=axis)
320-
self._min_value = self._max_value - (std * self.sigma_lower)
321-
self._max_value += std * self.sigma_upper
324+
if np.isscalar(std) and not isinstance(std, np.float64):
325+
# change bottleneck float scalar to np.float64
326+
std = np.float64(std)
327+
328+
self._min_value = cen - (std * self.sigma_lower)
329+
self._max_value = cen + (std * self.sigma_upper)
322330

323331
def _sigmaclip_fast(
324332
self, data, axis=None, masked=True, return_bounds=False, copy=True

0 commit comments

Comments
 (0)