Skip to content

Commit caf45d7

Browse files
author
William Triplett
authored
Merge pull request #1 from nipy/master
update to nipy/nipype master
2 parents 7e6c3c9 + 2d4726f commit caf45d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+526
-1317
lines changed

.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ source = nipype
44
include = */nipype/*
55
omit =
66
*/nipype/external/*
7-
*/nipype/workflows/*
87
*/nipype/fixes/*
98
*/setup.py

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,10 @@ install:
3636
conda install -y nipype &&
3737
rm -r /home/travis/miniconda/lib/python${TRAVIS_PYTHON_VERSION}/site-packages/nipype* &&
3838
pip install -r requirements.txt &&
39-
pip install -e .[$NIPYPE_EXTRAS] &&
40-
export COVERAGE_PROCESS_START=$(pwd)/.coveragerc &&
41-
export COVERAGE_DATA_FILE=$(pwd)/.coverage &&
42-
echo "data_file = ${COVERAGE_DATA_FILE}" >> ${COVERAGE_PROCESS_START}; }
39+
pip install -e .[$NIPYPE_EXTRAS]; }
4340
- travis_retry inst
4441
script:
45-
- py.test --doctest-modules --cov=nipype nipype
46-
after_success:
47-
- bash <(curl -s https://codecov.io/bash) -t ac172a50-8e66-42e5-8822-5373fcf54686 -cF unittests
42+
- py.test --doctest-modules nipype
4843
deploy:
4944
provider: pypi
5045
user: satra

circle.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ test:
4949
- docker run -v /etc/localtime:/etc/localtime:ro -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline :
5050
timeout: 1600
5151
- docker run -v /etc/localtime:/etc/localtime:ro -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /root/examples/ level1_workflow
52-
# Disabled until https://github.com/nipy/nipype/issues/1692 is resolved
53-
# - docker run -v /etc/localtime:/etc/localtime:ro -e NIPYPE_NUMBER_OF_CPUS=4 -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1
52+
- docker run -v /etc/localtime:/etc/localtime:ro -e NIPYPE_NUMBER_OF_CPUS=4 -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1
5453
- docker run -v /etc/localtime:/etc/localtime:ro -e NIPYPE_NUMBER_OF_CPUS=4 -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1
5554
- docker run -v /etc/localtime:/etc/localtime:ro -e NIPYPE_NUMBER_OF_CPUS=4 -v ~/examples:/root/examples:ro -v ~/scratch:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ l2pipeline
5655

doc/users/config_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Execution
134134
*poll_sleep_duration*
135135
This controls how long the job submission loop will sleep between submitting
136136
all pending jobs and checking for job completion. To be nice to cluster
137-
schedulers the default is set to 60 seconds.
137+
schedulers the default is set to 2 seconds.
138138

139139
*xvfb_max_wait*
140140
Maximum time (in seconds) to wait for Xvfb to start, if the _redirect_x parameter of an Interface is True.

nipype/__init__.py

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
STATUS as __status__,
1212
__version__)
1313
from .utils.config import NipypeConfig
14-
from .fixes.numpy.testing import nosetester
1514
from .utils.logger import Logging
1615
from .refs import due
16+
from .pkg_info import get_pkg_info as _get_pkg_info
1717

1818
try:
1919
import faulthandler
@@ -25,48 +25,26 @@
2525
logging = Logging(config)
2626

2727

28-
class _NoseTester(nosetester.NoseTester):
29-
""" Subclass numpy's NoseTester to add doctests by default
30-
"""
31-
32-
def _get_custom_doctester(self):
33-
return None
34-
35-
def test(self, label='fast', verbose=1, extra_argv=['--exe'],
36-
doctests=True, coverage=False):
37-
"""Run the full test suite
28+
class NipypeTester(object):
29+
def __call__(self, doctests=True):
30+
try:
31+
import pytest
32+
except:
33+
raise RuntimeError('py.test not installed, run: pip install pytest')
34+
params = {'args': []}
35+
if doctests:
36+
params['args'].append('--doctest-modules')
37+
nipype_path = os.path.dirname(__file__)
38+
params['args'].extend(['-x', '--ignore={}/external'.format(nipype_path),
39+
nipype_path])
40+
pytest.main(**params)
3841

39-
Examples
40-
--------
41-
This will run the test suite and stop at the first failing
42-
example
43-
>>> from nipype import test
44-
>>> test(extra_argv=['--exe', '-sx']) # doctest: +SKIP
45-
"""
46-
return super(_NoseTester, self).test(label=label,
47-
verbose=verbose,
48-
extra_argv=extra_argv,
49-
doctests=doctests,
50-
coverage=coverage)
51-
52-
try:
53-
test = _NoseTester(raise_warnings="release").test
54-
except TypeError:
55-
# Older versions of numpy do not have a raise_warnings argument
56-
test = _NoseTester().test
57-
del nosetester
42+
test = NipypeTester()
5843

59-
# Set up package information function
60-
from .pkg_info import get_pkg_info as _get_pkg_info
61-
get_info = lambda: _get_pkg_info(os.path.dirname(__file__))
62-
63-
# If this file is exec after being imported, the following lines will
64-
# fail
65-
try:
66-
del Tester
67-
except:
68-
pass
6944

45+
def get_info():
46+
"""Returns package information"""
47+
return _get_pkg_info(os.path.dirname(__file__))
7048

7149
from .pipeline import Node, MapNode, JoinNode, Workflow
7250
from .interfaces import (DataGrabber, DataSink, SelectFiles,

nipype/algorithms/confounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def compute_dvars(in_file, in_mask, remove_zerovariance=False):
668668
warnings.filterwarnings('error')
669669

670670
# voxelwise standardization
671-
diff_vx_stdz = func_diff / np.array([diff_sdhat] * func_diff.shape[-1]).T
671+
diff_vx_stdz = func_diff / np.array([diff_sdhat] * func_diff.shape[-1]).T
672672
dvars_vx_stdz = diff_vx_stdz.std(axis=0, ddof=1)
673673

674674
return (dvars_stdz, dvars_nstd, dvars_vx_stdz)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ..confounds import ACompCor
3+
4+
5+
def test_ACompCor_inputs():
6+
input_map = dict(components_file=dict(usedefault=True,
7+
),
8+
header=dict(),
9+
ignore_exception=dict(nohash=True,
10+
usedefault=True,
11+
),
12+
mask_file=dict(),
13+
num_components=dict(usedefault=True,
14+
),
15+
realigned_file=dict(mandatory=True,
16+
),
17+
regress_poly_degree=dict(usedefault=True,
18+
),
19+
use_regress_poly=dict(usedefault=True,
20+
),
21+
)
22+
inputs = ACompCor.input_spec()
23+
24+
for key, metadata in list(input_map.items()):
25+
for metakey, value in list(metadata.items()):
26+
assert getattr(inputs.traits()[key], metakey) == value
27+
28+
29+
def test_ACompCor_outputs():
30+
output_map = dict(components_file=dict(),
31+
)
32+
outputs = ACompCor.output_spec()
33+
34+
for key, metadata in list(output_map.items()):
35+
for metakey, value in list(metadata.items()):
36+
assert getattr(outputs.traits()[key], metakey) == value

nipype/algorithms/tests/test_auto_TCompCor.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,22 @@ def test_TCompCor_inputs():
2929

3030

3131
def test_TCompCor_outputs():
32-
output_map = dict(components_file=dict(),
33-
high_variance_mask=dict()
32+
output_map = dict(components_file=dict(usedefault=True,
33+
),
34+
header=dict(),
35+
high_variance_mask=dict(),
36+
ignore_exception=dict(nohash=True,
37+
usedefault=True,
38+
),
39+
mask_file=dict(),
40+
num_components=dict(usedefault=True,
41+
),
42+
realigned_file=dict(mandatory=True,
43+
),
44+
regress_poly_degree=dict(usedefault=True,
45+
),
46+
use_regress_poly=dict(usedefault=True,
47+
),
3448
)
3549
outputs = TCompCor.output_spec()
3650

nipype/algorithms/tests/test_compcor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TestCompCor():
1616
filenames = {'functionalnii': 'compcorfunc.nii',
1717
'masknii': 'compcormask.nii',
1818
'components_file': None}
19-
19+
2020
@pytest.fixture(autouse=True)
2121
def setup_class(self, tmpdir):
2222
# setup
@@ -83,13 +83,13 @@ def test_compcor_bad_input_shapes(self):
8383
for data_shape in (shape_less_than, shape_more_than):
8484
data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii')
8585
interface = CompCor(realigned_file=data_file, mask_file=self.mask_file)
86-
with pytest.raises_regexp(ValueError, "dimensions"): interface.run()
86+
with pytest.raises(ValueError, message="Dimension mismatch"): interface.run()
8787

8888
def test_tcompcor_bad_input_dim(self):
8989
bad_dims = (2, 2, 2)
9090
data_file = utils.save_toy_nii(np.zeros(bad_dims), 'temp.nii')
9191
interface = TCompCor(realigned_file=data_file)
92-
with pytest.raises_regexp(ValueError, '4-D'): interface.run()
92+
with pytest.raises(ValueError, message='Not a 4D file'): interface.run()
9393

9494
def run_cc(self, ccinterface, expected_components, expected_header='CompCor'):
9595
# run

nipype/algorithms/tests/test_icc_anova.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ def test_ICC_rep_anova():
1919
assert round(icc, 2) == 0.71
2020
assert dfc == 3
2121
assert dfe == 15
22-
assert r_var / (r_var + e_var) == icc
22+
assert np.isclose(r_var / (r_var + e_var), icc)

nipype/algorithms/tests/test_mesh_ops.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_ident_distances(tmpdir):
2525
dist_ident.inputs.out_file = os.path.join(tempdir, 'distance.npy')
2626
res = dist_ident.run()
2727
assert res.outputs.distance == 0.0
28-
28+
2929
dist_ident.inputs.weighting = 'area'
3030
res = dist_ident.run()
3131
assert res.outputs.distance == 0.0
@@ -34,33 +34,31 @@ def test_ident_distances(tmpdir):
3434
@pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
3535
def test_trans_distances(tmpdir):
3636
tempdir = str(tmpdir)
37-
os.chdir(tempdir)
38-
3937
from ...interfaces.vtkbase import tvtk
40-
38+
4139
in_surf = example_data('surf01.vtk')
4240
warped_surf = os.path.join(tempdir, 'warped.vtk')
43-
41+
4442
inc = np.array([0.7, 0.3, -0.2])
45-
43+
4644
r1 = tvtk.PolyDataReader(file_name=in_surf)
4745
vtk1 = VTKInfo.vtk_output(r1)
4846
r1.update()
4947
vtk1.points = np.array(vtk1.points) + inc
50-
48+
5149
writer = tvtk.PolyDataWriter(file_name=warped_surf)
5250
VTKInfo.configure_input_data(writer, vtk1)
5351
writer.write()
54-
52+
5553
dist = m.ComputeMeshWarp()
5654
dist.inputs.surface1 = in_surf
5755
dist.inputs.surface2 = warped_surf
5856
dist.inputs.out_file = os.path.join(tempdir, 'distance.npy')
5957
res = dist.run()
60-
npt.assert_almost_equal(res.outputs.distance, np.linalg.norm(inc), 4)
58+
assert np.allclose(res.outputs.distance, np.linalg.norm(inc), 4)
6159
dist.inputs.weighting = 'area'
6260
res = dist.run()
63-
npt.assert_almost_equal(res.outputs.distance, np.linalg.norm(inc), 4)
61+
assert np.allclose(res.outputs.distance, np.linalg.norm(inc), 4)
6462

6563

6664
@pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
@@ -79,10 +77,10 @@ def test_meshwarpmaths(tmpdir):
7977

8078
@pytest.mark.skipif(not VTKInfo.no_tvtk(), reason="tvtk is installed")
8179
def test_importerror():
82-
with pytest.raises(ImportError):
80+
with pytest.raises(ImportError):
8381
m.ComputeMeshWarp()
8482

85-
with pytest.raises(ImportError):
83+
with pytest.raises(ImportError):
8684
m.WarpPoints()
8785

8886
with pytest.raises(ImportError):

nipype/algorithms/tests/test_modelgen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def test_modelgen_sparse(tmpdir):
152152
assert len(res.outputs.session_info[0]['regress']) == 1
153153
s.inputs.use_temporal_deriv = True
154154
res = s.run()
155-
155+
156156
assert len(res.outputs.session_info[0]['regress']) == 2
157157
npt.assert_almost_equal(res.outputs.session_info[0]['regress'][0]['val'][0], 0.016675298129743384)
158158
npt.assert_almost_equal(res.outputs.session_info[1]['regress'][1]['val'][5], 0.007671459162258378)
159-
159+

nipype/algorithms/tests/test_overlap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check_close(val1, val2):
2626
overlap.inputs.volume2 = in1
2727
res = overlap.run()
2828
check_close(res.outputs.jaccard, 1.0)
29-
29+
3030
overlap = Overlap()
3131
overlap.inputs.volume1 = in1
3232
overlap.inputs.volume2 = in2

nipype/fixes/README.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

nipype/fixes/__init__.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

nipype/fixes/numpy/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

nipype/fixes/numpy/testing/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)