Skip to content

Commit 8ed5f74

Browse files
authored
Merge pull request #922 from effigies/nep29/numpy_1_14
NEP29: Set minimum numpy to 1.14
2 parents 2f86a4a + a371305 commit 8ed5f74

11 files changed

+32
-47
lines changed

min-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Auto-generated by tools/update_requirements.py
2-
numpy ==1.13
2+
numpy ==1.14
33
packaging ==14.3

nibabel/affines.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ def append_diag(aff, steps, starts=()):
205205
>>> aff = np.eye(4)
206206
>>> aff[:3,:3] = np.arange(9).reshape((3,3))
207207
>>> append_diag(aff, [9, 10], [99,100])
208-
array([[ 0., 1., 2., 0., 0., 0.],
209-
[ 3., 4., 5., 0., 0., 0.],
210-
[ 6., 7., 8., 0., 0., 0.],
211-
[ 0., 0., 0., 9., 0., 99.],
212-
[ 0., 0., 0., 0., 10., 100.],
213-
[ 0., 0., 0., 0., 0., 1.]])
208+
array([[ 0., 1., 2., 0., 0., 0.],
209+
[ 3., 4., 5., 0., 0., 0.],
210+
[ 6., 7., 8., 0., 0., 0.],
211+
[ 0., 0., 0., 9., 0., 99.],
212+
[ 0., 0., 0., 0., 10., 100.],
213+
[ 0., 0., 0., 0., 0., 1.]])
214214
"""
215215
aff = np.asarray(aff)
216216
steps = np.atleast_1d(steps)

nibabel/brikhead.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def get_data_scaling(self):
421421
>>> fname = os.path.join(datadir, 'scaled+tlrc.HEAD')
422422
>>> header = AFNIHeader(parse_AFNI_header(fname))
423423
>>> header.get_data_scaling()
424-
array([ 3.88336300e-08])
424+
array([3.883363e-08])
425425
"""
426426
# BRICK_FLOAT_FACS has one value per sub-brick, such that the scaled
427427
# values for sub-brick array [n] are the values read from disk *

nibabel/casting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def int_abs(arr):
585585
>>> int_abs(np.array([-128, 127], dtype=np.int8))
586586
array([128, 127], dtype=uint8)
587587
>>> int_abs(np.array([-128, 127], dtype=np.float32))
588-
array([ 128., 127.], dtype=float32)
588+
array([128., 127.], dtype=float32)
589589
"""
590590
arr = np.array(arr, copy=False)
591591
dt = arr.dtype

nibabel/conftest.py

-15
This file was deleted.

nibabel/nicom/dwiparams.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def nearest_pos_semi_def(B):
8989
--------
9090
>>> B = np.diag([1, 1, -1])
9191
>>> nearest_pos_semi_def(B)
92-
array([[ 0.75, 0. , 0. ],
93-
[ 0. , 0.75, 0. ],
94-
[ 0. , 0. , 0. ]])
92+
array([[0.75, 0. , 0. ],
93+
[0. , 0.75, 0. ],
94+
[0. , 0. , 0. ]])
9595
"""
9696
B = np.asarray(B)
9797
vals, vecs = npl.eigh(B)
@@ -146,11 +146,11 @@ def q2bg(q_vector, tol=1e-5):
146146
Examples
147147
--------
148148
>>> q2bg([1, 0, 0])
149-
(1.0, array([ 1., 0., 0.]))
149+
(1.0, array([1., 0., 0.]))
150150
>>> q2bg([0, 10, 0])
151-
(10.0, array([ 0., 1., 0.]))
151+
(10.0, array([0., 1., 0.]))
152152
>>> q2bg([0, 0, 0])
153-
(0.0, array([ 0., 0., 0.]))
153+
(0.0, array([0., 0., 0.]))
154154
"""
155155
q_vec = np.asarray(q_vector)
156156
norm = np.sqrt(np.sum(q_vec * q_vec))

nibabel/nifti1.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1879,10 +1879,10 @@ def set_qform(self, affine, code=None, strip_shears=True, **kwargs):
18791879
>>> aff = np.diag([2, 3, 4, 1])
18801880
>>> img = Nifti1Pair(data, aff)
18811881
>>> img.get_qform()
1882-
array([[ 2., 0., 0., 0.],
1883-
[ 0., 3., 0., 0.],
1884-
[ 0., 0., 4., 0.],
1885-
[ 0., 0., 0., 1.]])
1882+
array([[2., 0., 0., 0.],
1883+
[0., 3., 0., 0.],
1884+
[0., 0., 4., 0.],
1885+
[0., 0., 0., 1.]])
18861886
>>> img.get_qform(coded=True)
18871887
(None, 0)
18881888
>>> aff2 = np.diag([3, 4, 5, 1])
@@ -1962,16 +1962,16 @@ def set_sform(self, affine, code=None, **kwargs):
19621962
>>> aff = np.diag([2, 3, 4, 1])
19631963
>>> img = Nifti1Pair(data, aff)
19641964
>>> img.get_sform()
1965-
array([[ 2., 0., 0., 0.],
1966-
[ 0., 3., 0., 0.],
1967-
[ 0., 0., 4., 0.],
1968-
[ 0., 0., 0., 1.]])
1965+
array([[2., 0., 0., 0.],
1966+
[0., 3., 0., 0.],
1967+
[0., 0., 4., 0.],
1968+
[0., 0., 0., 1.]])
19691969
>>> saff, code = img.get_sform(coded=True)
19701970
>>> saff
1971-
array([[ 2., 0., 0., 0.],
1972-
[ 0., 3., 0., 0.],
1973-
[ 0., 0., 4., 0.],
1974-
[ 0., 0., 0., 1.]])
1971+
array([[2., 0., 0., 0.],
1972+
[0., 3., 0., 0.],
1973+
[0., 0., 4., 0.],
1974+
[0., 0., 0., 1.]])
19751975
>>> int(code)
19761976
2
19771977
>>> aff2 = np.diag([3, 4, 5, 1])

nibabel/quaternions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -466,13 +466,13 @@ def quat2angle_axis(quat, identity_thresh=None):
466466
>>> np.allclose(theta, np.pi)
467467
True
468468
>>> vec
469-
array([ 1., 0., 0.])
469+
array([1., 0., 0.])
470470
471471
If this is an identity rotation, we return a zero angle and an
472472
arbitrary vector
473473
474474
>>> quat2angle_axis([1, 0, 0, 0])
475-
(0.0, array([ 1., 0., 0.]))
475+
(0.0, array([1., 0., 0.]))
476476
477477
Notes
478478
-----

nibabel/volumeutils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ def int_scinter_ftype(ifmt, slope=1.0, inter=0.0, default=np.float32):
12001200
>>> arr = np.array([np.finfo(np.float32).max], dtype=np.float32)
12011201
>>> res = arr + np.iinfo(np.int16).max
12021202
>>> arr == res
1203-
array([ True], dtype=bool)
1203+
array([ True])
12041204
"""
12051205
ii = np.iinfo(ifmt)
12061206
tst_arr = np.array([ii.min, ii.max], dtype=ifmt)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Auto-generated by tools/update_requirements.py
2-
numpy >=1.13
2+
numpy >=1.14
33
packaging >=14.3

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ provides =
2929
[options]
3030
python_requires = >=3.6
3131
install_requires =
32-
numpy >=1.13
32+
numpy >=1.14
3333
packaging >=14.3
3434
zip_safe = False
3535
packages = find:

0 commit comments

Comments
 (0)