Skip to content

NEP29: Set minimum numpy to 1.14 #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion min-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Auto-generated by tools/update_requirements.py
numpy ==1.13
numpy ==1.14
packaging ==14.3
12 changes: 6 additions & 6 deletions nibabel/affines.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ def append_diag(aff, steps, starts=()):
>>> aff = np.eye(4)
>>> aff[:3,:3] = np.arange(9).reshape((3,3))
>>> append_diag(aff, [9, 10], [99,100])
array([[ 0., 1., 2., 0., 0., 0.],
[ 3., 4., 5., 0., 0., 0.],
[ 6., 7., 8., 0., 0., 0.],
[ 0., 0., 0., 9., 0., 99.],
[ 0., 0., 0., 0., 10., 100.],
[ 0., 0., 0., 0., 0., 1.]])
array([[ 0., 1., 2., 0., 0., 0.],
[ 3., 4., 5., 0., 0., 0.],
[ 6., 7., 8., 0., 0., 0.],
[ 0., 0., 0., 9., 0., 99.],
[ 0., 0., 0., 0., 10., 100.],
[ 0., 0., 0., 0., 0., 1.]])
"""
aff = np.asarray(aff)
steps = np.atleast_1d(steps)
Expand Down
2 changes: 1 addition & 1 deletion nibabel/brikhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def get_data_scaling(self):
>>> fname = os.path.join(datadir, 'scaled+tlrc.HEAD')
>>> header = AFNIHeader(parse_AFNI_header(fname))
>>> header.get_data_scaling()
array([ 3.88336300e-08])
array([3.883363e-08])
"""
# BRICK_FLOAT_FACS has one value per sub-brick, such that the scaled
# values for sub-brick array [n] are the values read from disk *
Expand Down
2 changes: 1 addition & 1 deletion nibabel/casting.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def int_abs(arr):
>>> int_abs(np.array([-128, 127], dtype=np.int8))
array([128, 127], dtype=uint8)
>>> int_abs(np.array([-128, 127], dtype=np.float32))
array([ 128., 127.], dtype=float32)
array([128., 127.], dtype=float32)
"""
arr = np.array(arr, copy=False)
dt = arr.dtype
Expand Down
15 changes: 0 additions & 15 deletions nibabel/conftest.py

This file was deleted.

12 changes: 6 additions & 6 deletions nibabel/nicom/dwiparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def nearest_pos_semi_def(B):
--------
>>> B = np.diag([1, 1, -1])
>>> nearest_pos_semi_def(B)
array([[ 0.75, 0. , 0. ],
[ 0. , 0.75, 0. ],
[ 0. , 0. , 0. ]])
array([[0.75, 0. , 0. ],
[0. , 0.75, 0. ],
[0. , 0. , 0. ]])
"""
B = np.asarray(B)
vals, vecs = npl.eigh(B)
Expand Down Expand Up @@ -146,11 +146,11 @@ def q2bg(q_vector, tol=1e-5):
Examples
--------
>>> q2bg([1, 0, 0])
(1.0, array([ 1., 0., 0.]))
(1.0, array([1., 0., 0.]))
>>> q2bg([0, 10, 0])
(10.0, array([ 0., 1., 0.]))
(10.0, array([0., 1., 0.]))
>>> q2bg([0, 0, 0])
(0.0, array([ 0., 0., 0.]))
(0.0, array([0., 0., 0.]))
"""
q_vec = np.asarray(q_vector)
norm = np.sqrt(np.sum(q_vec * q_vec))
Expand Down
24 changes: 12 additions & 12 deletions nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,10 +1879,10 @@ def set_qform(self, affine, code=None, strip_shears=True, **kwargs):
>>> aff = np.diag([2, 3, 4, 1])
>>> img = Nifti1Pair(data, aff)
>>> img.get_qform()
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
[ 0., 0., 0., 1.]])
array([[2., 0., 0., 0.],
[0., 3., 0., 0.],
[0., 0., 4., 0.],
[0., 0., 0., 1.]])
>>> img.get_qform(coded=True)
(None, 0)
>>> aff2 = np.diag([3, 4, 5, 1])
Expand Down Expand Up @@ -1962,16 +1962,16 @@ def set_sform(self, affine, code=None, **kwargs):
>>> aff = np.diag([2, 3, 4, 1])
>>> img = Nifti1Pair(data, aff)
>>> img.get_sform()
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
[ 0., 0., 0., 1.]])
array([[2., 0., 0., 0.],
[0., 3., 0., 0.],
[0., 0., 4., 0.],
[0., 0., 0., 1.]])
>>> saff, code = img.get_sform(coded=True)
>>> saff
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
[ 0., 0., 0., 1.]])
array([[2., 0., 0., 0.],
[0., 3., 0., 0.],
[0., 0., 4., 0.],
[0., 0., 0., 1.]])
>>> int(code)
2
>>> aff2 = np.diag([3, 4, 5, 1])
Expand Down
4 changes: 2 additions & 2 deletions nibabel/quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ def quat2angle_axis(quat, identity_thresh=None):
>>> np.allclose(theta, np.pi)
True
>>> vec
array([ 1., 0., 0.])
array([1., 0., 0.])

If this is an identity rotation, we return a zero angle and an
arbitrary vector

>>> quat2angle_axis([1, 0, 0, 0])
(0.0, array([ 1., 0., 0.]))
(0.0, array([1., 0., 0.]))

Notes
-----
Expand Down
2 changes: 1 addition & 1 deletion nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def int_scinter_ftype(ifmt, slope=1.0, inter=0.0, default=np.float32):
>>> arr = np.array([np.finfo(np.float32).max], dtype=np.float32)
>>> res = arr + np.iinfo(np.int16).max
>>> arr == res
array([ True], dtype=bool)
array([ True])
"""
ii = np.iinfo(ifmt)
tst_arr = np.array([ii.min, ii.max], dtype=ifmt)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Auto-generated by tools/update_requirements.py
numpy >=1.13
numpy >=1.14
packaging >=14.3
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ provides =
[options]
python_requires = >=3.6
install_requires =
numpy >=1.13
numpy >=1.14
packaging >=14.3
zip_safe = False
packages = find:
Expand Down