Skip to content

Commit 281276b

Browse files
Merge pull request #427 from matthew-brett/test-pre-wheels
MRG: test against pre-release numpy / scipy Use pre-release numpy / scipy wheels for testing.
2 parents d09cb68 + 0679948 commit 281276b

File tree

10 files changed

+36
-27
lines changed

10 files changed

+36
-27
lines changed

.travis.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
# - There can't be any leading "-"s - All newlines will be removed, so use
66
# ";"s
77
sudo: false # To use travis container infrastructure
8-
addons:
9-
apt:
10-
packages:
11-
- libblas-dev
12-
- liblapack-dev
138
language: python
149
cache:
1510
directories:
@@ -18,6 +13,10 @@ env:
1813
global:
1914
- DEPENDS="numpy scipy sympy matplotlib nibabel"
2015
- INSTALL_TYPE="setup"
16+
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
17+
- PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
18+
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
19+
- PRE_PIP_FLAGS="--pre $EXTRA_PIP_FLAGS --find-links $PRE_WHEELS"
2120
python:
2221
- 3.4
2322
- 3.5
@@ -38,6 +37,11 @@ matrix:
3837
- python: 3.4
3938
env:
4039
- NIPY_EXTERNAL_LAPACK=1
40+
addons:
41+
apt:
42+
packages:
43+
- libblas-dev
44+
- liblapack-dev
4145
- python: 2.7
4246
env:
4347
- INSTALL_TYPE=sdist
@@ -51,6 +55,10 @@ matrix:
5155
- INSTALL_TYPE=requirements
5256
- DEPENDS=
5357
- python: 3.6
58+
# test 3.5 against pre-release builds of everything
59+
- python: 3.5
60+
env:
61+
- EXTRA_PIP_FLAGS="$PRE_PIP_FLAGS"
5462

5563
before_install:
5664
- source tools/travis_tools.sh
@@ -62,9 +70,9 @@ before_install:
6270
- pip install -U pip
6371
- pip install nose mock # always
6472
- if [ -n "$PRE_DEPENDS" ]; then
65-
pip install $PRE_DEPENDS;
73+
pip install $EXTRA_PIP_FLAGS $PRE_DEPENDS;
6674
fi
67-
- pip install $DEPENDS
75+
- pip install $EXTRA_PIP_FLAGS $DEPENDS
6876
- if [ "${COVERAGE}" == "1" ]; then
6977
pip install coverage;
7078
pip install coveralls codecov;
@@ -78,12 +86,13 @@ install:
7886
elif [ "$INSTALL_TYPE" == "sdist" ]; then
7987
python setup_egg.py egg_info # check egg_info while we're here
8088
python setup_egg.py sdist
81-
pip install dist/*.tar.gz
89+
pip install $EXTRA_PIP_FLAGS dist/*.tar.gz
8290
elif [ "$INSTALL_TYPE" == "wheel" ]; then
8391
pip install wheel
8492
python setup_egg.py bdist_wheel
85-
pip install dist/*.whl
93+
pip install $EXTRA_PIP_FLAGS dist/*.whl
8694
elif [ "$INSTALL_TYPE" == "requirements" ]; then
95+
pip install $EXTRA_PIP_FLAGS -r requirements.txt
8796
pip install -r requirements.txt
8897
python setup.py install
8998
fi

nipy/algorithms/diagnostics/tsdiffplot.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ def xmax_labels(ax, val, xlabel, ylabel):
6868

6969
# slice plots min max mean
7070
ax = axes[3]
71-
ax.hold(True)
7271
ax.plot(np.mean(scaled_slice_diff, 0), 'k')
7372
ax.plot(np.min(scaled_slice_diff, 0), 'b')
7473
ax.plot(np.max(scaled_slice_diff, 0), 'r')
75-
ax.hold(False)
7674
xmax_labels(ax, S+1,
7775
'Slice number',
7876
'Max/mean/min \n slice variation')

nipy/algorithms/group/parcel_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _gaussian_filter(x, msk, sigma):
4646
x[msk] = 0.
4747
gx = nd.gaussian_filter(x, sigma)
4848
norma = 1 - nd.gaussian_filter(msk.astype(float), sigma)
49-
gx[True - msk] /= norma[True - msk]
49+
gx[~msk] /= norma[~msk]
5050
gx[msk] = 0.
5151
return gx
5252

nipy/algorithms/segmentation/tests/test_segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def _test_brain_seg(model, niters=3, beta=0, ngb_size=6, init_params=None,
4444
_check_dims(S.sigma, 1, S.mixmat.shape[0])
4545
# Check that probabilities are zero outside the mask and sum up to
4646
# one inside the mask
47-
assert_almost_equal(S.ppm[True - S.mask].sum(-1).max(), 0)
47+
assert_almost_equal(S.ppm[~S.mask].sum(-1).max(), 0)
4848
assert_almost_equal(S.ppm[S.mask].sum(-1).min(), 1)
4949
# Check that labels are zero outside the mask and > 1 inside the
5050
# mask
51-
assert_almost_equal(S.label[True - S.mask].max(), 0)
51+
assert_almost_equal(S.label[~S.mask].max(), 0)
5252
assert_almost_equal(S.label[S.mask].min(), 1)
5353

5454

nipy/algorithms/statistics/formula/formulae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ def _setup_design(self):
734734

735735
# This renaming is here principally because of the intercept.
736736

737-
random_offset = np.random.random_integers(low=0, high=2**30)
737+
random_offset = np.random.randint(low=0, high=2**30)
738738

739739
terms = getterms(self.mean)
740740

nipy/algorithms/statistics/tests/test_intrinsic_volumes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def randombox(shape):
3939
"""
4040
Generate a random box, returning the box and the edge lengths
4141
"""
42-
edges = [np.random.random_integers(0, shape[j], size=(2,))
42+
edges = [np.random.randint(0, shape[j] + 1, size=(2,))
4343
for j in range(len(shape))]
4444

4545
for j in range(len(shape)):

nipy/algorithms/tests/test_kernel_smooth.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
""" Test for smoothing with kernels """
44
from __future__ import absolute_import
55
import numpy as np
6-
from numpy.random import random_integers as randint
6+
from numpy.random import randint
77

88
from ... import load_image
99
from ..kernel_smooth import LinearFilter, sigma2fwhm, fwhm2sigma
@@ -76,20 +76,21 @@ def test_kernel():
7676
tol = 0.9999
7777
sdtol = 1.0e-8
7878
for x in range(6):
79-
shape = randint(30,60,(3,))
79+
shape = randint(30, 60 + 1, (3,))
8080
# pos of delta
81-
ii, jj, kk = randint(11,17, (3,))
81+
ii, jj, kk = randint(11, 17 + 1, (3,))
8282
# random affine coordmap (diagonal and translations)
83-
coordmap = AffineTransform.from_start_step('ijk', 'xyz',
84-
randint(5,20,(3,))*0.25,
85-
randint(5,10,(3,))*0.5)
83+
coordmap = AffineTransform.from_start_step(
84+
'ijk', 'xyz',
85+
randint(5, 20 + 1, (3,)) * 0.25,
86+
randint(5, 10 + 1, (3,)) * 0.5)
8687
# delta function in 3D array
8788
signal = np.zeros(shape)
8889
signal[ii,jj,kk] = 1.
8990
signal = Image(signal, coordmap=coordmap)
9091
# A filter with coordmap, shape matched to image
91-
kernel = LinearFilter(coordmap, shape,
92-
fwhm=randint(50,100)/10.)
92+
kernel = LinearFilter(coordmap, shape,
93+
fwhm=randint(50, 100 + 1) / 10.)
9394
# smoothed normalized 3D array
9495
ssignal = kernel.smooth(signal).get_data()
9596
ssignal[:] *= kernel.norms[kernel.normalization]

nipy/core/image/image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ def __iter__(self):
402402

403403
def __eq__(self, other):
404404
return (isinstance(other, self.__class__)
405+
and self.shape == other.shape
405406
and np.all(self.get_data() == other.get_data())
406407
and np.all(self.affine == other.affine)
407408
and (self.axes.coord_names == other.axes.coord_names))

nipy/labs/datasets/volumes/tests/test_volume_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_trivial_grid():
6262
img = VolumeGrid(data=data,
6363
transform=identity,
6464
)
65-
x, y, z = np.random.random_integers(N, size=(3, 10)) - 1
65+
x, y, z = np.random.randint(1, N + 1, size=(3, 10)) - 1
6666
data_ = img.values_in_world(x, y, z)
6767
# Check that passing in arrays with different shapes raises an error
6868
yield np.testing.assert_raises, ValueError, \

nipy/modalities/fmri/hemodynamic_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _gamma_difference_hrf(tr, oversampling=16, time_length=32., onset=0.,
3434
hrf sampling on the oversampled time grid
3535
"""
3636
dt = tr / oversampling
37-
time_stamps = np.linspace(0, time_length, float(time_length) / dt)
37+
time_stamps = np.linspace(0, time_length, int(float(time_length) / dt))
3838
time_stamps -= onset / dt
3939
hrf = gamma.pdf(time_stamps, delay / dispersion, dt / dispersion) - \
4040
ratio * gamma.pdf(
@@ -177,7 +177,7 @@ def _sample_condition(exp_condition, frametimes, oversampling=16,
177177

178178
hr_frametimes = np.linspace(frametimes.min() + min_onset,
179179
frametimes.max() * (1 + 1. / (n - 1)),
180-
n_hr)
180+
int(n_hr))
181181

182182
# Get the condition information
183183
onsets, durations, values = tuple(map(np.asanyarray, exp_condition))

0 commit comments

Comments
 (0)