Skip to content

PR: FIX Check that file exists in basedir, not current dir #2945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,13 @@
"affiliation": "MIT, HMS",
"name": "Ghosh, Satrajit",
"orcid": "0000-0002-5312-6729"
},
{
"affiliation": "Holland Bloorview Kids Rehabilitation Hospital",
"name": "Tilley II, Steven",
"orcid": "0000-0003-4853-5082"
}

],
"keywords": [
"neuroimaging",
Expand Down
4 changes: 2 additions & 2 deletions nipype/algorithms/tests/test_auto_ACompCor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def test_ACompCor_inputs():
realigned_file=dict(mandatory=True, ),
regress_poly_degree=dict(usedefault=True, ),
repetition_time=dict(),
save_metadata=dict(),
save_pre_filter=dict(),
save_metadata=dict(usedefault=True, ),
save_pre_filter=dict(usedefault=True, ),
use_regress_poly=dict(
deprecated='0.15.0',
new_name='pre_filter',
Expand Down
4 changes: 2 additions & 2 deletions nipype/algorithms/tests/test_auto_TCompCor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def test_TCompCor_inputs():
realigned_file=dict(mandatory=True, ),
regress_poly_degree=dict(usedefault=True, ),
repetition_time=dict(),
save_metadata=dict(),
save_pre_filter=dict(),
save_metadata=dict(usedefault=True, ),
save_pre_filter=dict(usedefault=True, ),
use_regress_poly=dict(
deprecated='0.15.0',
new_name='pre_filter',
Expand Down
7 changes: 3 additions & 4 deletions nipype/interfaces/afni/tests/test_auto_Cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ def test_Cat_inputs():
usedefault=True,
),
omitconst=dict(argstr='-nonconst', ),
out_cint=dict(
xor=[
'out_format', 'out_nice', 'out_double', 'out_fint', 'out_int'
], ),
out_cint=dict(xor=[
'out_format', 'out_nice', 'out_double', 'out_fint', 'out_int'
], ),
out_double=dict(
argstr='-d',
xor=['out_format', 'out_nice', 'out_int', 'out_fint', 'out_cint'],
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/ants/tests/test_auto_ANTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def test_ANTS_inputs():
regularization=dict(argstr='%s', ),
regularization_deformation_field_sigma=dict(
requires=['regularization'], ),
regularization_gradient_field_sigma=dict(
requires=['regularization'], ),
regularization_gradient_field_sigma=dict(requires=['regularization'
], ),
smoothing_sigmas=dict(
argstr='--gaussian-smoothing-sigmas %s',
sep='x',
Expand Down
9 changes: 4 additions & 5 deletions nipype/interfaces/ants/tests/test_auto_AntsJointFusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ def test_AntsJointFusion_inputs():
nohash=True,
usedefault=True,
),
out_atlas_voting_weight_name_format=dict(
requires=[
'out_label_fusion', 'out_intensity_fusion_name_format',
'out_label_post_prob_name_format'
], ),
out_atlas_voting_weight_name_format=dict(requires=[
'out_label_fusion', 'out_intensity_fusion_name_format',
'out_label_post_prob_name_format'
], ),
out_intensity_fusion_name_format=dict(argstr='', ),
out_label_fusion=dict(
argstr='%s',
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/ants/tests/test_auto_Atropos.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def test_Atropos_inputs():
prior_probability_threshold=dict(requires=['prior_weighting'], ),
prior_weighting=dict(),
save_posteriors=dict(),
use_mixture_model_proportions=dict(
requires=['posterior_formulation'], ),
use_mixture_model_proportions=dict(requires=['posterior_formulation'
], ),
use_random_seed=dict(
argstr='--use-random-seed %d',
usedefault=True,
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/base/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def _check_requires(self, spec, name, value):
]
if any(values) and isdefined(value):
if len(values) > 1:
fmt = ("%s requires values for inputs %s because '%s' is set. "
fmt = ("%s requires values for inputs %s because '%s' is set. "
"For a list of required inputs, see %s.help()")
else:
fmt = ("%s requires a value for input %s because '%s' is set. "
fmt = ("%s requires a value for input %s because '%s' is set. "
"For a list of required inputs, see %s.help()")
msg = fmt % (self.__class__.__name__,
', '.join("'%s'" % req for req in spec.requires),
Expand Down
9 changes: 4 additions & 5 deletions nipype/interfaces/fsl/tests/test_auto_AccuracyTester.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ def test_AccuracyTester_inputs():
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_AccuracyTester_outputs():
output_map = dict(
output_directory=dict(
argstr='%s',
position=1,
), )
output_map = dict(output_directory=dict(
argstr='%s',
position=1,
), )
outputs = AccuracyTester.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
11 changes: 5 additions & 6 deletions nipype/interfaces/fsl/tests/test_auto_FeatureExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ def test_FeatureExtractor_inputs():
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value
def test_FeatureExtractor_outputs():
output_map = dict(
mel_ica=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
output_map = dict(mel_ica=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
outputs = FeatureExtractor.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
22 changes: 10 additions & 12 deletions nipype/interfaces/fsl/tests/test_auto_TrainingSetCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@


def test_TrainingSetCreator_inputs():
input_map = dict(
mel_icas_in=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
input_map = dict(mel_icas_in=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
inputs = TrainingSetCreator.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_TrainingSetCreator_outputs():
output_map = dict(
mel_icas_out=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
output_map = dict(mel_icas_out=dict(
argstr='%s',
copyfile=False,
position=-1,
), )
outputs = TrainingSetCreator.output_spec()

for key, metadata in list(output_map.items()):
Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/spm/tests/test_auto_Level1Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_Level1Design_inputs():
mandatory=True,
),
factor_info=dict(field='fact', ),
flags=dict(),
global_intensity_normalization=dict(field='global', ),
interscan_interval=dict(
field='timing.RT',
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def modify_paths(object, relative=True, basedir=None):
out = tuple(out)
else:
if isdefined(object):
if isinstance(object, (str, bytes)) and os.path.isfile(object):
if isinstance(object, (str, bytes)) and os.path.isfile(os.path.join(basedir, object)):
Copy link
Contributor

@oesteban oesteban Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dismiss this comment.
Please check whether this:

Suggested change
if isinstance(object, (str, bytes)) and os.path.isfile(os.path.join(basedir, object)):
if isinstance(object, (str, bytes)) and os.path.isfile(os.path.join(basedir, os.path.basename(object))):

Does not bring us back to the original problem. My impression is that it will. I agree with @effigies this is a result of loosing track of the traits.

if relative:
if config.getboolean('execution', 'use_relative_paths'):
out = relpath(object, start=basedir)
Expand Down