Skip to content

2 bugs in SpecifySPMModel with concatenate_runs = True? #2844

Open
@hstojic

Description

@hstojic

Summary

I get an error defining SPM model level 1, with multiple runs and concatenate_runs set to True. I made sure that I have the same regressors in each run. The culprit seems to be the nipype code that adds run specific dummy variables (code) - regressor_names are not updated with these added variables and then error is raised at this line as of course it cannot find the regressor name.

Here is the error part from stdout:

[Node] Error on "stimuli_LSA_test_pipeline.model" (/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/nipype_work/stimuli_LSA_test_pipeline/_subject_s057/model)
[Node] Error on "stimuli_LSA_test_pipeline.model" (/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/nipype_work/stimuli_LSA_test_pipeline/_subject_s057/model)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-9-a5adcf3b88b5> in <module>()
      2 pipeline.run(
      3     'MultiProc',
----> 4     plugin_args = {'n_procs': pars_gen['resources']['n_cores']}
      5 )

/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/engine/workflows.pyc in run(self, plugin, plugin_args, updatehash)
    593         if str2bool(self.config['execution']['create_report']):
    594             self._write_report_info(self.base_dir, self.name, execgraph)
--> 595         runner.run(execgraph, updatehash=updatehash, config=self.config)
    596         datestr = datetime.utcnow().strftime('%Y%m%dT%H%M%S')
    597         if str2bool(self.config['execution']['write_provenance']):

/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/plugins/base.pyc in run(self, graph, config, updatehash)
    160                         if result['traceback']:
    161                             notrun.append(
--> 162                                 self._clean_queue(jobid, graph, result=result))
    163                         else:
    164                             self._task_finished_cb(jobid)

/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/plugins/base.pyc in _clean_queue(self, jobid, graph, result)
    222 
    223         if str2bool(self._config['execution']['stop_on_first_crash']):
--> 224             raise RuntimeError("".join(result['traceback']))
    225         crashfile = self._report_crash(self.procs[jobid], result=result)
    226         if jobid in self.mapnodesubids:

RuntimeError: Traceback (most recent call last):
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 69, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 471, in run
    result = self._run_interface(execute=True)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 555, in _run_interface
    return self._run_command(execute)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/algorithms/modelgen.py", line 453, in _run_interface
    self._generate_design()
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/algorithms/modelgen.py", line 628, in _generate_design
    outliers=outliers)
  File "/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype/algorithms/modelgen.py", line 372, in _generate_standard_design
    info.regressor_names[j]
IndexError: list index out of range

If my interpretation is correct I can send a pull request, its an easy fix with a single line I think:

infoout.regressor_names.extend(['run' + str(i + 1)])

at this line. I already tested it and that seems to work.

Platform details:

{'commit_hash': '8690d55d9',
 'commit_source': 'installation',
 'networkx_version': '2.1',
 'nibabel_version': '2.3.0',
 'nipype_version': '1.1.2',
 'numpy_version': '1.15.4',
 'pkg_path': '/home/hstojic/.pyenv/nipy/local/lib/python2.7/site-packages/nipype',
 'scipy_version': '1.1.0',
 'sys_executable': '/home/hstojic/.pyenv/nipy/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.12 (default, Nov 20 2017, 18:23:56) \n[GCC 5.4.0 20160609]',
 'traits_version': '4.6.0'}

Execution environment

  • My python environment outside container

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions