diff --git a/README.rst b/README.rst index fd001f2581..da6dbd280d 100644 --- a/README.rst +++ b/README.rst @@ -78,8 +78,8 @@ Support and Communication ------------------------- If you have a problem or would like to ask a question about how to do something in Nipype please open an issue to -`NeuroStars.org `_ with a *nipype* tag. `NeuroStars.org `_ is a -platform similar to StackOverflow but dedicated to neuroinformatics. +`NeuroStars.org `_ with a *nipype* tag. `NeuroStars.org `_ is a +platform similar to StackOverflow but dedicated to neuroinformatics. To participate in the Nipype development related discussions please use the following mailing list:: diff --git a/nipype/algorithms/tests/test_auto_CompCor.py b/nipype/algorithms/tests/test_auto_CompCor.py deleted file mode 100644 index 12cec2ebb0..0000000000 --- a/nipype/algorithms/tests/test_auto_CompCor.py +++ /dev/null @@ -1,37 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..confounds import CompCor - - -def test_CompCor_inputs(): - input_map = dict(components_file=dict(usedefault=True, - ), - header=dict(), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - mask_file=dict(), - num_components=dict(usedefault=True, - ), - realigned_file=dict(mandatory=True, - ), - regress_poly_degree=dict(usedefault=True, - ), - use_regress_poly=dict(usedefault=True, - ), - ) - inputs = CompCor.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_CompCor_outputs(): - output_map = dict(components_file=dict(), - ) - outputs = CompCor.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py deleted file mode 100644 index f3d19c5690..0000000000 --- a/nipype/algorithms/tests/test_auto_ErrorMap.py +++ /dev/null @@ -1,35 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..metrics import ErrorMap - - -def test_ErrorMap_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_ref=dict(mandatory=True, - ), - in_tst=dict(mandatory=True, - ), - mask=dict(), - metric=dict(mandatory=True, - usedefault=True, - ), - out_map=dict(), - ) - inputs = ErrorMap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_ErrorMap_outputs(): - output_map = dict(distance=dict(), - out_map=dict(), - ) - outputs = ErrorMap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py deleted file mode 100644 index dcabbec296..0000000000 --- a/nipype/algorithms/tests/test_auto_Overlap.py +++ /dev/null @@ -1,47 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import Overlap - - -def test_Overlap_inputs(): - input_map = dict(bg_overlap=dict(mandatory=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - mask_volume=dict(), - out_file=dict(usedefault=True, - ), - vol_units=dict(mandatory=True, - usedefault=True, - ), - volume1=dict(mandatory=True, - ), - volume2=dict(mandatory=True, - ), - weighting=dict(usedefault=True, - ), - ) - inputs = Overlap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Overlap_outputs(): - output_map = dict(dice=dict(), - diff_file=dict(), - jaccard=dict(), - labels=dict(), - roi_di=dict(), - roi_ji=dict(), - roi_voldiff=dict(), - volume_difference=dict(), - ) - outputs = Overlap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_TSNR.py b/nipype/algorithms/tests/test_auto_TSNR.py deleted file mode 100644 index d906d39e3f..0000000000 --- a/nipype/algorithms/tests/test_auto_TSNR.py +++ /dev/null @@ -1,43 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import TSNR - - -def test_TSNR_inputs(): - input_map = dict(detrended_file=dict(hash_files=False, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(mandatory=True, - ), - mean_file=dict(hash_files=False, - usedefault=True, - ), - regress_poly=dict(), - stddev_file=dict(hash_files=False, - usedefault=True, - ), - tsnr_file=dict(hash_files=False, - usedefault=True, - ), - ) - inputs = TSNR.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_TSNR_outputs(): - output_map = dict(detrended_file=dict(), - mean_file=dict(), - stddev_file=dict(), - tsnr_file=dict(), - ) - outputs = TSNR.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/ants/tests/test_auto_CreateJacobianDeterminantImage.py b/nipype/interfaces/ants/tests/test_auto_CreateJacobianDeterminantImage.py index 4dd522a69b..f7aafb27be 100644 --- a/nipype/interfaces/ants/tests/test_auto_CreateJacobianDeterminantImage.py +++ b/nipype/interfaces/ants/tests/test_auto_CreateJacobianDeterminantImage.py @@ -11,7 +11,6 @@ def test_CreateJacobianDeterminantImage_inputs(): position=1, ), doLogJacobian=dict(argstr='%d', - mandatory=False, position=3, ), environ=dict(nohash=True, @@ -35,7 +34,6 @@ def test_CreateJacobianDeterminantImage_inputs(): terminal_output=dict(nohash=True, ), useGeometric=dict(argstr='%d', - mandatory=False, position=4, ), ) diff --git a/nipype/interfaces/ants/utils.py b/nipype/interfaces/ants/utils.py index ade303898c..b88ca57e14 100644 --- a/nipype/interfaces/ants/utils.py +++ b/nipype/interfaces/ants/utils.py @@ -145,9 +145,9 @@ class CreateJacobianDeterminantImageInputSpec(ANTSCommandInputSpec): outputImage = File(argstr='%s', mandatory=True, position=2, desc='output filename') - doLogJacobian = traits.Enum(0, 1, argstr='%d', mandatory=False, position=3, + doLogJacobian = traits.Enum(0, 1, argstr='%d', position=3, desc='return the log jacobian') - useGeometric = traits.Enum(0, 1, argstr='%d', mandatory=False, position=4, + useGeometric = traits.Enum(0, 1, argstr='%d', position=4, desc='return the geometric jacobian') class CreateJacobianDeterminantImageOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/base.py b/nipype/interfaces/base.py index b46712e701..62ea7851ac 100644 --- a/nipype/interfaces/base.py +++ b/nipype/interfaces/base.py @@ -1844,7 +1844,7 @@ def _filename_from_source(self, name, chain=None): # special treatment for files try: _, base, source_ext = split_filename(source) - except AttributeError: + except (AttributeError, TypeError): base = source else: if name in chain: diff --git a/nipype/interfaces/fsl/__init__.py b/nipype/interfaces/fsl/__init__.py index 58b7321416..b0a8b5a88e 100644 --- a/nipype/interfaces/fsl/__init__.py +++ b/nipype/interfaces/fsl/__init__.py @@ -8,7 +8,7 @@ """ from .base import (FSLCommand, Info, check_fsl, no_fsl, no_fsl_course_data) -from .preprocess import (FAST, FLIRT, ApplyXfm, ApplyXFM, BET, MCFLIRT, FNIRT, +from .preprocess import (FAST, FLIRT, ApplyXFM, BET, MCFLIRT, FNIRT, ApplyWarp, SliceTimer, SUSAN, PRELUDE, FUGUE, FIRST) from .model import (Level1Design, FEAT, FEATModel, FILMGLS, FEATRegister, FLAMEO, ContrastMgr, MultipleRegressDesign, L2Model, SMM, diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 5ede5fa1f8..8a00b44a76 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -49,7 +49,6 @@ class Level1DesignInputSpec(BaseInterfaceInputSpec): "{'dgamma': {'derivs': True}}")) orthogonalization = traits.Dict(traits.Int, traits.Dict(traits.Int, traits.Either(traits.Bool,traits.Int)), - mandatory=False, desc=("which regressors to make orthogonal e.g., " "{1: {0:0,1:0,2:0}, 2: {0:1,1:1,2:0}} to make the second " "regressor in a 2-regressor model orthogonal to the first."), diff --git a/nipype/interfaces/fsl/preprocess.py b/nipype/interfaces/fsl/preprocess.py index eaab2a830e..8f23699915 100644 --- a/nipype/interfaces/fsl/preprocess.py +++ b/nipype/interfaces/fsl/preprocess.py @@ -594,16 +594,6 @@ class ApplyXFM(FLIRT): """ input_spec = ApplyXFMInputSpec -class ApplyXfm(ApplyXFM): - """ - .. deprecated:: 0.12.1 - Use :py:class:`nipype.interfaces.fsl.ApplyXFM` instead - """ - def __init__(self, **inputs): - super(ApplyXfm, self).__init__(**inputs) - warn(('This interface has been renamed since 0.12.1, please use ' - 'nipype.interfaces.fsl.ApplyXFM'), - UserWarning) class MCFLIRTInputSpec(FSLCommandInputSpec): in_file = File(exists=True, position=0, argstr="-in %s", mandatory=True, @@ -751,7 +741,7 @@ class FNIRTInputSpec(FSLCommandInputSpec): inwarp_file = File(exists=True, argstr='--inwarp=%s', desc='name of file containing initial non-linear warps') in_intensitymap_file = traits.List(File(exists=True), argstr='--intin=%s', - copyfiles=False, minlen=1, maxlen=2, + copyfile=False, minlen=1, maxlen=2, desc=('name of file/files containing ' 'initial intensity mapping ' 'usually generated by previous ' diff --git a/nipype/interfaces/fsl/tests/test_auto_ApplyXfm.py b/nipype/interfaces/fsl/tests/test_auto_ApplyXfm.py index 3186317333..cf67b12b2b 100644 --- a/nipype/interfaces/fsl/tests/test_auto_ApplyXfm.py +++ b/nipype/interfaces/fsl/tests/test_auto_ApplyXfm.py @@ -1,9 +1,9 @@ # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals -from ..preprocess import ApplyXfm +from ..preprocess import ApplyXFM -def test_ApplyXfm_inputs(): +def test_ApplyXFM_inputs(): input_map = dict(angle_rep=dict(argstr='-anglerep %s', ), apply_isoxfm=dict(argstr='-applyisoxfm %f', @@ -145,19 +145,19 @@ def test_ApplyXfm_inputs(): min_ver='5.0.0', ), ) - inputs = ApplyXfm.input_spec() + inputs = ApplyXFM.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value -def test_ApplyXfm_outputs(): +def test_ApplyXFM_outputs(): output_map = dict(out_file=dict(), out_log=dict(), out_matrix_file=dict(), ) - outputs = ApplyXfm.output_spec() + outputs = ApplyXFM.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): diff --git a/nipype/interfaces/fsl/tests/test_auto_FNIRT.py b/nipype/interfaces/fsl/tests/test_auto_FNIRT.py index 7a93e351ed..8e4cf47fc3 100644 --- a/nipype/interfaces/fsl/tests/test_auto_FNIRT.py +++ b/nipype/interfaces/fsl/tests/test_auto_FNIRT.py @@ -48,7 +48,7 @@ def test_FNIRT_inputs(): sep=',', ), in_intensitymap_file=dict(argstr='--intin=%s', - copyfiles=False, + copyfile=False, ), inmask_file=dict(argstr='--inmask=%s', ), diff --git a/nipype/interfaces/fsl/tests/test_auto_Level1Design.py b/nipype/interfaces/fsl/tests/test_auto_Level1Design.py index cc6402fb1a..f5fcfe4093 100644 --- a/nipype/interfaces/fsl/tests/test_auto_Level1Design.py +++ b/nipype/interfaces/fsl/tests/test_auto_Level1Design.py @@ -14,8 +14,7 @@ def test_Level1Design_inputs(): ), model_serial_correlations=dict(mandatory=True, ), - orthogonalization=dict(mandatory=False, - ), + orthogonalization=dict(), session_info=dict(mandatory=True, ), ) diff --git a/nipype/interfaces/fsl/tests/test_maths.py b/nipype/interfaces/fsl/tests/test_maths.py index e2c6c93bb7..408a74712f 100644 --- a/nipype/interfaces/fsl/tests/test_maths.py +++ b/nipype/interfaces/fsl/tests/test_maths.py @@ -12,7 +12,7 @@ from nipype.interfaces.fsl import no_fsl import pytest -from nipype.testing.fixtures import create_files_in_directory_plus_output_type +from nipype.testing.fixtures import create_files_in_directory_plus_output_type @pytest.mark.skipif(no_fsl(), reason="fsl is not installed") diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index f9242c4b26..e2ef8962a7 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -569,10 +569,3 @@ def test_first_genfname(): value = first._gen_fname(name='original_segmentations') expected_value = os.path.abspath('segment_all_none_origsegs.nii.gz') assert value == expected_value - - -@pytest.mark.skipif(no_fsl(), reason="fsl is not installed") -def test_deprecation(): - interface = fsl.ApplyXfm() - assert isinstance(interface, fsl.ApplyXFM) - diff --git a/nipype/interfaces/tests/test_base.py b/nipype/interfaces/tests/test_base.py index b4d45c47f4..e27779ce02 100644 --- a/nipype/interfaces/tests/test_base.py +++ b/nipype/interfaces/tests/test_base.py @@ -209,7 +209,8 @@ class spec2(nib.CommandLineInputSpec): position=2) doo = nib.File(exists=True, argstr="%s", position=1) goo = traits.Int(argstr="%d", position=4) - poo = nib.File(name_source=['goo'], hash_files=False, argstr="%s", position=3) + poo = nib.File(name_source=['goo'], hash_files=False, argstr="%s", + position=3) class TestName(nib.CommandLine): _cmd = "mycommand" @@ -218,6 +219,7 @@ class TestName(nib.CommandLine): testobj.inputs.doo = tmp_infile testobj.inputs.goo = 99 assert '%s_generated' % nme in testobj.cmdline + assert '%d_generated' % testobj.inputs.goo in testobj.cmdline testobj.inputs.moo = "my_%s_template" assert 'my_%s_template' % nme in testobj.cmdline diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 32271799b8..43345bb8c6 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -326,14 +326,14 @@ def test_doubleconnect(): flow1 = pe.Workflow(name='test') flow1.connect(a, 'a', b, 'a') x = lambda: flow1.connect(a, 'b', b, 'a') - with pytest.raises(Exception) as excinfo: + with pytest.raises(Exception) as excinfo: x() assert "Trying to connect" in str(excinfo.value) c = pe.Node(IdentityInterface(fields=['a', 'b']), name='c') flow1 = pe.Workflow(name='test2') x = lambda: flow1.connect([(a, c, [('b', 'b')]), (b, c, [('a', 'b')])]) - with pytest.raises(Exception) as excinfo: + with pytest.raises(Exception) as excinfo: x() assert "Trying to connect" in str(excinfo.value) @@ -481,7 +481,7 @@ def func1(in1): name='n1') n2.inputs.in1 = [[1, [2]], 3, [4, 5]] - with pytest.raises(Exception) as excinfo: + with pytest.raises(Exception) as excinfo: n2.run() assert "can only concatenate list" in str(excinfo.value) @@ -518,7 +518,7 @@ def func2(a): # create dummy distributed plugin class from nipype.pipeline.plugins.base import DistributedPluginBase - # create a custom exception + # create a custom exception class EngineTestException(Exception): pass @@ -529,7 +529,7 @@ def _submit_job(self, node, updatehash=False): # check if a proper exception is raised with pytest.raises(EngineTestException) as excinfo: w1.run(plugin=RaiseError()) - assert 'Submit called' == str(excinfo.value) + assert 'Submit called' == str(excinfo.value) # rerun to ensure we have outputs w1.run(plugin='Linear') @@ -539,7 +539,7 @@ def _submit_job(self, node, updatehash=False): 'crashdump_dir': wd} w1.run(plugin=RaiseError()) - + def test_old_config(tmpdir): wd = str(tmpdir) @@ -607,7 +607,7 @@ def func1(in1): w1.config['execution'].update(**{'stop_on_first_rerun': True}) w1.run() - + def test_parameterize_dirs_false(tmpdir): from ....interfaces.utility import IdentityInterface @@ -665,7 +665,7 @@ def func1(in1): # test running the workflow on serial conditions w1.run(plugin='MultiProc') - + def test_write_graph_runs(tmpdir): os.chdir(str(tmpdir)) diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index 644a055f4b..bf321c5b9c 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -306,7 +306,7 @@ def touch(fname): else: assert False, "Should raise OSError on missing dependency" - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir) def test_json(): diff --git a/setup.py b/setup.py index 4bf982902f..79941f0625 100755 --- a/setup.py +++ b/setup.py @@ -97,6 +97,9 @@ def main(): pjoin('testing', 'data', 'dicomdir', '*'), pjoin('testing', 'data', 'bedpostxout', '*'), pjoin('testing', 'data', 'tbss_dir', '*'), + pjoin('testing', 'data', 'brukerdir', '*'), + pjoin('testing', 'data', 'brukerdir', 'pdata', '*'), + pjoin('testing', 'data', 'brukerdir', 'pdata', '1', '*'), pjoin('workflows', 'data', '*'), pjoin('pipeline', 'engine', 'report_template.html'), pjoin('external', 'd3.js'), @@ -130,7 +133,7 @@ def main(): install_requires=ldict['REQUIRES'], setup_requires=['future', 'configparser'], provides=ldict['PROVIDES'], - packages=find_packages(exclude=['*.tests']), + packages=find_packages(), package_data={'nipype': testdatafiles}, scripts=glob('bin/*'), cmdclass={'build_py': BuildWithCommitInfoCommand},