File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 4
4
casting. Others work round numpy casting to and from python ints
5
5
"""
6
6
7
+ import warnings
7
8
from numbers import Integral
8
9
from platform import processor , machine
9
10
@@ -349,8 +350,9 @@ def _check_maxexp(np_type, maxexp):
349
350
dt = np .dtype (np_type )
350
351
np_type = dt .type
351
352
two = np_type (2 ).reshape ((1 ,)) # to avoid upcasting
352
- return (np .isfinite (two ** (maxexp - 1 )) and
353
- not np .isfinite (two ** maxexp ))
353
+ with warnings .catch_warnings ():
354
+ warnings .simplefilter ("ignore" , RuntimeWarning ) # Expected overflow warning
355
+ return np .isfinite (two ** (maxexp - 1 )) and not np .isfinite (two ** maxexp )
354
356
355
357
356
358
def as_int (x , check = True ):
Original file line number Diff line number Diff line change @@ -300,8 +300,10 @@ def smooth_image(img,
300
300
fwhm = np .zeros ((n_dim ,))
301
301
fwhm [:3 ] = fwhm_scalar
302
302
# Voxel sizes
303
- RZS = img .affine [:- 1 , :n_dim ]
303
+ RZS = img .affine [:, :n_dim ]
304
304
vox = np .sqrt (np .sum (RZS ** 2 , 0 ))
305
+ # Avoid divisions by zero for 4+D images
306
+ vox [3 :] = 1
305
307
# Smoothing in terms of voxels
306
308
vox_fwhm = fwhm / vox
307
309
vox_sd = fwhm2sigma (vox_fwhm )
You can’t perform that action at this time.
0 commit comments