Skip to content

Commit 8db5111

Browse files
committed
Merge master
2 parents ffd0d8e + 3ec8065 commit 8db5111

File tree

10 files changed

+60
-16
lines changed

10 files changed

+60
-16
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ before_install:
8787

8888
- travis_retry pip install -r requirements.txt
8989
- travis_retry pip install grabbit==0.1.2
90-
- travis_retry git clone https://github.com/INCF/pybids.git ${HOME}/pybids && git checkout 0.6.5
91-
pip install -e ${HOME}/pybids
90+
- travis_retry git clone -b 0.6.5 https://github.com/INCF/pybids.git ${HOME}/pybids && pip install -e ${HOME}/pybids
9291

9392
install:
9493
- travis_retry pip install $EXTRA_PIP_FLAGS -e .[$NIPYPE_EXTRAS]

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
'sphinx.ext.autosummary',
5151
'numpydoc',
5252
'matplotlib.sphinxext.plot_directive',
53-
'matplotlib.sphinxext.only_directives',
53+
#'matplotlib.sphinxext.only_directives',
5454
'nipype.sphinxext.plot_workflow',
5555
#'IPython.sphinxext.ipython_directive',
5656
#'IPython.sphinxext.ipython_console_highlighting'

nipype/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def get_nipype_gitversion():
154154
if sys.version_info <= (3, 4):
155155
REQUIRES.append('configparser')
156156

157-
TESTS_REQUIRES = ['pytest-cov', 'codecov', 'pytest-env']
157+
TESTS_REQUIRES = ['pytest-cov', 'codecov', 'pytest-env', 'coverage<5']
158158

159159
EXTRA_REQUIRES = {
160160
'doc': ['Sphinx>=1.4', 'numpydoc', 'matplotlib', 'pydotplus', 'pydot>=1.2.3'],
@@ -164,7 +164,7 @@ def get_nipype_gitversion():
164164
'profiler': ['psutil>=5.0'],
165165
'duecredit': ['duecredit'],
166166
'xvfbwrapper': ['xvfbwrapper'],
167-
'pybids': ['pybids'],
167+
'pybids': ['pybids==0.6.5'],
168168
'ssh': ['paramiko'],
169169
# 'mesh': ['mayavi'] # Enable when it works
170170
}

nipype/interfaces/base/tests/test_resource_monitor.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@
1818
from ... import utility as niu
1919

2020
# Try to enable the resource monitor
21-
config.enable_resource_monitor()
2221
run_profile = config.resource_monitor
2322

2423

24+
@pytest.fixture(scope="module")
25+
def use_resource_monitor():
26+
config.enable_resource_monitor()
27+
yield
28+
config.disable_resource_monitor()
29+
30+
2531
class UseResourcesInputSpec(CommandLineInputSpec):
2632
mem_gb = traits.Float(
2733
desc='Number of GB of RAM to use', argstr='-g %f', mandatory=True)
@@ -51,7 +57,7 @@ class UseResources(CommandLine):
5157
os.getenv('CI_SKIP_TEST', False), reason='disabled in CI tests')
5258
@pytest.mark.parametrize("mem_gb,n_procs", [(0.5, 3), (2.2, 8), (0.8, 4),
5359
(1.5, 1)])
54-
def test_cmdline_profiling(tmpdir, mem_gb, n_procs):
60+
def test_cmdline_profiling(tmpdir, mem_gb, n_procs, use_resource_monitor):
5561
"""
5662
Test runtime profiler correctly records workflow RAM/CPUs consumption
5763
of a CommandLine-derived interface
@@ -73,7 +79,7 @@ def test_cmdline_profiling(tmpdir, mem_gb, n_procs):
7379
True, reason='test disabled temporarily, until funcion profiling works')
7480
@pytest.mark.parametrize("mem_gb,n_procs", [(0.5, 3), (2.2, 8), (0.8, 4),
7581
(1.5, 1)])
76-
def test_function_profiling(tmpdir, mem_gb, n_procs):
82+
def test_function_profiling(tmpdir, mem_gb, n_procs, use_resource_monitor):
7783
"""
7884
Test runtime profiler correctly records workflow RAM/CPUs consumption
7985
of a Function interface

nipype/interfaces/mrtrix3/base.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,39 @@
44
from __future__ import (print_function, division, unicode_literals,
55
absolute_import)
66

7-
from ... import logging
8-
from ..base import (CommandLineInputSpec, CommandLine, traits, File, isdefined)
7+
from ... import logging, LooseVersion
8+
from ...utils.filemanip import which
9+
from ..base import (CommandLineInputSpec, CommandLine, traits, File, isdefined, PackageInfo)
910
iflogger = logging.getLogger('nipype.interface')
1011

1112

13+
class Info(PackageInfo):
14+
version_cmd = 'mrconvert --version'
15+
16+
@staticmethod
17+
def parse_version(raw_info):
18+
# info is like: "== mrconvert 0.3.15-githash"
19+
for line in raw_info.splitlines():
20+
if line.startswith('== mrconvert '):
21+
v_string = line.split()[2]
22+
break
23+
else:
24+
return None
25+
26+
# -githash may or may not be appended
27+
v_string = v_string.split('-')[0]
28+
29+
return '.'.join(v_string.split('.')[:3])
30+
31+
@classmethod
32+
def looseversion(cls):
33+
""" Return a comparable version object
34+
35+
If no version found, use LooseVersion('0.0.0')
36+
"""
37+
return LooseVersion(cls.version() or '0.0.0')
38+
39+
1240
class MRTrix3BaseInputSpec(CommandLineInputSpec):
1341
nthreads = traits.Int(
1442
argstr='-nthreads %d',
@@ -78,3 +106,7 @@ def _parse_inputs(self, skip=None):
78106
pass
79107

80108
return super(MRTrix3Base, self)._parse_inputs(skip=skip)
109+
110+
@property
111+
def version(self):
112+
return Info.version()

nipype/interfaces/mrtrix3/reconst.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class FitTensorInputSpec(MRTrix3BaseInputSpec):
3939
argstr='-method %s',
4040
desc=('select method used to perform the fitting'))
4141
reg_term = traits.Float(
42-
5.e3, usedefault=True,
4342
argstr='-regularisation %f',
43+
max_ver='0.3.13',
4444
desc=('specify the strength of the regularisation term on the '
4545
'magnitude of the tensor elements (default = 5000). This '
4646
'only applies to the non-linear methods'))
@@ -64,8 +64,7 @@ class FitTensor(MRTrix3Base):
6464
>>> tsr.inputs.in_mask = 'mask.nii.gz'
6565
>>> tsr.inputs.grad_fsl = ('bvecs', 'bvals')
6666
>>> tsr.cmdline # doctest: +ELLIPSIS
67-
'dwi2tensor -fslgrad bvecs bvals -mask mask.nii.gz \
68-
-regularisation 5000.000000 dwi.mif dti.mif'
67+
'dwi2tensor -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif dti.mif'
6968
>>> tsr.run() # doctest: +SKIP
7069
"""
7170

nipype/interfaces/mrtrix3/tests/test_auto_FitTensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_FitTensor_inputs():
3434
),
3535
reg_term=dict(
3636
argstr='-regularisation %f',
37-
usedefault=True,
37+
max_ver='0.3.13',
3838
),
3939
)
4040
inputs = FitTensor.input_spec()

nipype/pipeline/engine/tests/test_engine.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,12 @@ def test_deep_nested_write_graph_runs(tmpdir):
484484
except OSError:
485485
pass
486486

487+
import networkx
488+
# Format of the graph has slightly changed
489+
graph_str = '""' if int(networkx.__version__.split('.')[0]) == 1 else ''
487490

488491
# examples of dot files used in the following test
489-
dotfile_orig = ['strict digraph {\n',
492+
dotfile_orig = ['strict digraph ' + graph_str + ' {\n',
490493
'"mod1 (engine)";\n',
491494
'"mod2 (engine)";\n',
492495
'"mod1 (engine)" -> "mod2 (engine)";\n',

nipype/pipeline/engine/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,8 @@ def clean_working_directory(outputs,
14731473
needed_files += [path for path, type in input_files if type == 'f']
14741474
for extra in [
14751475
'_0x*.json', 'provenance.*', 'pyscript*.m', 'pyjobs*.mat',
1476-
'command.txt', 'result*.pklz', '_inputs.pklz', '_node.pklz'
1476+
'command.txt', 'result*.pklz', '_inputs.pklz', '_node.pklz',
1477+
'.proc-*',
14771478
]:
14781479
needed_files.extend(glob(os.path.join(cwd, extra)))
14791480
if files2keep:

nipype/utils/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ def enable_resource_monitor(self):
291291
"""Sets the resource monitor on"""
292292
self.resource_monitor = True
293293

294+
def disable_resource_monitor(self):
295+
"""Sets the resource monitor off"""
296+
self.resource_monitor = False
297+
294298
def get_display(self):
295299
"""Returns the first display available"""
296300

0 commit comments

Comments
 (0)