Skip to content

Commit 2c3350b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into enh/cifti2
* upstream/master: BF: adapt sphinx doctests to numpy 1.12 MAINT: update numpy dependency; add Python 3.6 Addressed @matthew-brett's comments DOC: better warning when nibabel not on path RF: add bottom left 1 to affine for tests PEP8 TST: add test for fix in PR 500 Supports extending empty tractograms PEP8 RF: Add function to easily make fake streamline for testing purposes. Addressed @matthew-brett's comments Support __add__. Remove unnecessary syntatic sugar. Add docstrings Add Tractogram concatenation PEP8 BF: boolean indexing now requires matching dimension
2 parents 6591cf4 + b8017c9 commit 2c3350b

File tree

14 files changed

+397
-82
lines changed

14 files changed

+397
-82
lines changed

.travis.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ env:
2323
- DEPENDS="numpy scipy matplotlib h5py pillow"
2424
- PYDICOM=1
2525
- INSTALL_TYPE="setup"
26+
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
27+
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
2628
python:
27-
- 3.3
2829
- 3.4
2930
- 3.5
31+
- 3.6
3032
matrix:
3133
include:
3234
- python: 2.7
@@ -35,19 +37,19 @@ matrix:
3537
# Absolute minimum dependencies
3638
- python: 2.7
3739
env:
38-
- DEPENDS=numpy==1.5.1 PYDICOM=0
40+
- DEPENDS=numpy==1.6.0 PYDICOM=0
3941
# Absolute minimum dependencies plus oldest MPL
4042
# Check these against:
43+
# nibabel/info.py
4144
# doc/source/installation.rst
4245
# requirements.txt
43-
# .travis.yml
4446
- python: 2.7
4547
env:
46-
- DEPENDS="numpy==1.5.1 matplotlib==1.3.1" PYDICOM=0
48+
- DEPENDS="numpy==1.6.0 matplotlib==1.3.1" PYDICOM=0
4749
# Minimum pydicom dependency
4850
- python: 2.7
4951
env:
50-
- DEPENDS="numpy==1.5.1 pydicom==0.9.7 pillow==2.6"
52+
- DEPENDS="numpy==1.6.0 pydicom==0.9.7 pillow==2.6"
5153
# test against numpy 1.7
5254
- python: 2.7
5355
env:
@@ -59,7 +61,7 @@ matrix:
5961
# test against pre-release builds
6062
- python: 2.7
6163
env:
62-
- EXTRA_PIP_FLAGS="--pre"
64+
- EXTRA_PIP_FLAGS="--pre --find-links=$EXTRA_WHEELS"
6365
# Documentation doctests
6466
- python: 2.7
6567
env:
@@ -84,12 +86,14 @@ matrix:
8486
- DOC_DOC_TEST=1
8587
before_install:
8688
- source tools/travis_tools.sh
89+
- python -m pip install --upgrade pip
90+
- pip install --upgrade virtualenv
8791
- virtualenv --python=python venv
8892
- source venv/bin/activate
8993
- python --version # just to check
90-
- pip install -U pip wheel # upgrade to latest pip find 3.5 wheels; wheel to avoid errors
94+
- pip install -U pip wheel # needed at one point
9195
- retry pip install nose flake8 mock # always
92-
- wheelhouse_pip_install $EXTRA_PIP_FLAGS $DEPENDS
96+
- pip install $EXTRA_PIP_FLAGS $DEPENDS
9397
# pydicom <= 0.9.8 doesn't install on python 3
9498
- if [ "${TRAVIS_PYTHON_VERSION:0:1}" == "2" ]; then
9599
if [ "$PYDICOM" == "1" ]; then
@@ -111,13 +115,13 @@ install:
111115
elif [ "$INSTALL_TYPE" == "sdist" ]; then
112116
python setup_egg.py egg_info # check egg_info while we're here
113117
python setup_egg.py sdist
114-
wheelhouse_pip_install $EXTRA_PIP_FLAGS dist/*.tar.gz
118+
pip install $EXTRA_PIP_FLAGS dist/*.tar.gz
115119
elif [ "$INSTALL_TYPE" == "wheel" ]; then
116120
pip install wheel
117121
python setup_egg.py bdist_wheel
118-
wheelhouse_pip_install $EXTRA_PIP_FLAGS dist/*.whl
122+
pip install $EXTRA_PIP_FLAGS dist/*.whl
119123
elif [ "$INSTALL_TYPE" == "requirements" ]; then
120-
wheelhouse_pip_install $EXTRA_PIP_FLAGS -r requirements.txt
124+
pip install $EXTRA_PIP_FLAGS -r requirements.txt
121125
python setup.py install
122126
fi
123127
# Point to nibabel data directory

doc/source/conf.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import sys
2323
import os
2424

25-
import nibabel
26-
2725
# Check for external Sphinx extensions we depend on
2826
try:
2927
import numpydoc
@@ -34,6 +32,13 @@
3432
except ImportError:
3533
raise RuntimeError('Need to install "texext" package for doc build')
3634

35+
# Need nibabel installed as well
36+
try:
37+
import nibabel
38+
except ImportError:
39+
raise RuntimeError('Need nibabel on Python PATH; consider "make htmldoc" '
40+
'from nibabel root directory')
41+
3742
# If extensions (or modules to document with autodoc) are in another directory,
3843
# add these directories to sys.path here. If the directory is relative to the
3944
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -82,7 +87,7 @@
8287

8388
# General information about the project.
8489
project = u'NiBabel'
85-
copyright = u'2006-2016, %(MAINTAINER)s <%(AUTHOR_EMAIL)s>' % rel
90+
copyright = u'2006-2017, %(MAINTAINER)s <%(AUTHOR_EMAIL)s>' % rel
8691

8792
# The version info for the project you're documenting, acts as replacement for
8893
# |version| and |release|, also used in various other places throughout the

doc/source/coordinate_systems.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ middle voxel in the EPI data array like this:
9797
:nofigs:
9898

9999
>>> n_i, n_j, n_k = epi_img_data.shape
100-
>>> center_i = (n_i - 1) / 2.
101-
>>> center_j = (n_j - 1) / 2.
102-
>>> center_k = (n_k - 1) / 2.
100+
>>> center_i = (n_i - 1) // 2 # // for integer division
101+
>>> center_j = (n_j - 1) // 2
102+
>>> center_k = (n_k - 1) // 2
103103
>>> center_i, center_j, center_k
104-
(26.0, 30.0, 16.0)
104+
(26, 30, 16)
105105
>>> center_vox_value = epi_img_data[center_i, center_j, center_k]
106106
>>> center_vox_value
107107
81.549287796020508

doc/source/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ Requirements
8686
requirements.txt
8787
.travis.yml
8888
89-
* Python_ 2.7 or greater
90-
* NumPy_ 1.5 or greater
89+
* Python_ 2.7, or >= 3.4
90+
* NumPy_ 1.6 or greater
9191
* SciPy_ (optional, for full SPM-ANALYZE support)
9292
* PyDICOM_ 0.9.7 or greater (optional, for DICOM support)
9393
* `Python Imaging Library`_ (optional, for PNG conversion in DICOMFS)

doc/source/nifti_images.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Now we save the image and load it again:
401401
The data array has the scaling applied:
402402

403403
>>> scaled_img.get_data()
404-
memmap([[[ 10., 12., 14., 16.],
404+
...([[[ 10., 12., 14., 16.],
405405
[ 18., 20., 22., 24.],
406406
[ 26., 28., 30., 32.]],
407407
<BLANKLINE>

nibabel/benchmarks/bench_streamlines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,6 @@ def bench_load_trk():
9191
for s1, s2 in zip(scalars_new, scalars_old):
9292
assert_array_equal(s1, s2)
9393

94+
9495
if __name__ == '__main__':
9596
bench_load_trk()

nibabel/casting.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def shared_range(flt_type, int_type):
165165
_SHARED_RANGES[key] = (mn, mx)
166166
return mn, mx
167167

168+
168169
# ----------------------------------------------------------------------------
169170
# Routines to work out the next lowest representable integer in floating point
170171
# types.

nibabel/imageclasses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class ClassMapDict(dict):
4242
def __getitem__(self, *args, **kwargs):
4343
return super(ClassMapDict, self).__getitem__(*args, **kwargs)
4444

45+
4546
class_map = ClassMapDict(
4647
analyze={'class': AnalyzeImage, # Image class
4748
'ext': '.img', # characteristic image extension
@@ -97,6 +98,7 @@ class ExtMapRecoder(Recoder):
9798
def __getitem__(self, *args, **kwargs):
9899
return super(ExtMapRecoder, self).__getitem__(*args, **kwargs)
99100

101+
100102
# mapping of extensions to default image class names
101103
ext_map = ExtMapRecoder((
102104
('nifti_single', '.nii'),

nibabel/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
186186
# doc/source/installation.rst
187187
# requirements.txt
188188
# .travis.yml
189-
NUMPY_MIN_VERSION = '1.5.1'
189+
NUMPY_MIN_VERSION = '1.6.0'
190190
PYDICOM_MIN_VERSION = '0.9.7'
191191

192192
# Main setup parameters

nibabel/orientations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def io_orientation(affine, tol=None):
6363
RS = RZS / zooms
6464
# Transform below is polar decomposition, returning the closest
6565
# shearless matrix R to RS
66-
P, S, Qs = npl.svd(RS)
66+
P, S, Qs = npl.svd(RS, full_matrices=False)
6767
# Threshold the singular values to determine the rank.
6868
if tol is None:
6969
tol = S.max() * max(RS.shape) * np.finfo(S.dtype).eps

0 commit comments

Comments
 (0)