Open JohannesWiesner opened 3 years ago
I ran the same script using Singularity on an Linux-Server. Again, everything worked fine until the SpecifySPMModel
node. Strangely enough, this time I got a different error message. Also the SpecifySPMModel
node folder was empty (so no files, which is probably the same as having 0KB files).
File: /home/neuro/nipype_tutorial/crash-20210213-163639-johannes.wiesner-model_specifier.a0-4ab02ae5-ad19-4833-9304-6925b05da769.pklz
Node: nback_first_level_analysis.model_specifier
Working directory: /output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier
Node inputs:
bids_amplitude_column = <undefined>
bids_condition_column = trial_type
bids_event_file = ['/output/workflow_files/nback_first_level_analysis/_subject_id_952863/events_tsv_getter/mapflow/_events_tsv_getter0/sub-952863_tfMRI_WM_LR_events.tsv', '/output/workflow_files/nback_first_level_analysis/_subject_id_952863/events_tsv_getter/mapflow/_events_tsv_getter1/sub-952863_tfMRI_WM_RL_events.tsv']
concatenate_runs = True
event_files = <undefined>
functional_runs = ['/output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier/sub-952863_tfMRI_WM_LR_smoothed.nii', '/output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier/sub-952863_tfMRI_WM_RL_smoothed.nii']
high_pass_filter_cutoff = 200.0
input_units = secs
outlier_files = <undefined>
output_units = secs
parameter_source = SPM
realignment_parameters = <undefined>
subject_info = <undefined>
time_repetition = 0.72
Traceback:
Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py", line 46, in run
node.run(updatehash=updatehash)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
result = self._run_interface(execute=True)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
return self._run_command(execute)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
result = self._interface.run(cwd=outdir)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 419, in run
runtime = self._run_interface(runtime)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/algorithms/modelgen.py", line 523, in _run_interface
self._generate_design()
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/algorithms/modelgen.py", line 662, in _generate_design
infolist = gen_info(self.inputs.event_files)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/algorithms/modelgen.py", line 195, in gen_info
for i, event_files in enumerate(run_event_files):
TypeError: '_Undefined' object is not iterable
Rerunning node
210213-16:51:26,395 nipype.workflow INFO:
[Node] Setting-up "nback_first_level_analysis.model_specifier" in "/output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier".
210213-16:51:26,558 nipype.workflow WARNING:
[Node] Error on "nback_first_level_analysis.model_specifier" (/output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier)
Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/bin/nipypecli", line 8, in <module>
sys.exit(cli())
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/scripts/cli.py", line 96, in crash
display_crash_file(crashfile, rerun, debug, dir)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/scripts/crash_files.py", line 81, in display_crash_file
node.run()
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
result = self._run_interface(execute=True)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
return self._run_command(execute)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 715, in _run_command
self._copyfiles_to_wd(execute=execute)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 811, in _copyfiles_to_wd
infiles, [outdir], copy=info["copy"], create_new=True
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/utils/filemanip.py", line 518, in copyfiles
destfile = copyfile(f, destfile, copy, create_new=create_new)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/site-packages/nipype/utils/filemanip.py", line 440, in copyfile
shutil.copyfile(originalfile, newfile)
File "/opt/miniconda-latest/envs/neuro/lib/python3.7/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/output/workflow_files/nback_first_level_analysis/_subject_id_952863/model_specifier/sub-952863_tfMRI_WM_LR_smoothed.nii'
@JohannesWiesner - this is because this interface was not updated when bids_event_files
was introduced. you can use standard event_files
- this would be FSL event files, which i believe already exist with the HCP data or this interface needs to be updated (a PR is most welcome. to switch between the two types of event files.
this is the place where an undefined set of files is being processed: https://github.com/nipy/nipype/blob/47fe00b38/nipype/algorithms/modelgen.py#L662
it would need to follow a pattern similar to this section:
https://github.com/nipy/nipype/blob/47fe00b38/nipype/algorithms/modelgen.py#L501
@satra Thanks for the answer! Okay, so if I got that right, one should use subject_info
or event_files
for SpecifySPMModel
at this moment. This would also mean that the documentation for SpecifySPMModel
w.r. to bids_event_files
currently is incorrect right?
I can try to update _generate_design
in SpecfifySPMModel
so that it can handle the bids_event_files
attribute. But just to get at the same page here (because I am new to nipype
). Why does SpecifySPMModel
model add this functionality to _generate_design
when the function is inherited from SpecifyModel
, as one also would expect when reading the docs?:
Add SPM specific options to SpecifyModel
Adds:
concatenate_runs output_units
Shouldn't everything 'event-related' be handled in SpecifyModel
only and (as expected from the docs), SpecifySPMModel
only takes care of handling concatenate_runs
and output_units
?
since SPM inherits from the base class, the field gets added to its inputspec, which is why the documentation lists it. indeed that is incorrect.
the generic model indeed handles most things, but concatenating information is a very specific option that only applies to SPM and it changes how the information needs to be structured for it. i haven't looked at those functions closely in a long time. i'm sure there are things that could be refactored.
Summary
When using
nipype.algorithms.modelgen.SpecifySPMModel
, the respective node-folder contains empty files (0 KB) and therefore raises antraits.trait_errors.TraitError
Actual behavior
I set up a workflow using the HCP dataset, where for each subject I select the LR/RL files, standardize and smooth them (using MapNodes) and then I pass them over to
nipype.algorithms.modelgen.SpecifySPMModel
(settingconcatenate_runs
toTrue
). However, I am getting the following error message;When looking inside the 'node'-folder, one can see that the files are of no size:
All other prior nodes work as expected (also when checking the last node before
SpecifySPMModel
(smoothing) it contains both smoothed files).Script/Workflow details
Here's the output from the
crash.pklz
file:Here's my script:
Platform details:
Execution environment
Using Michael Notter's
nipype_tutorial
(most-recent versionmiykael/nipype_tutorial:2020
) running as a docker container on Windows 10