Skip to content

more concise and flexible parameter passing, increased parametrization #1749

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

Merged
merged 1 commit into from
Jan 6, 2017

Conversation

TheChymera
Copy link
Collaborator

@TheChymera TheChymera commented Dec 13, 2016

The FSL model parameter passing to substitute the variables in the template EV files is very clunky and difficult to extend. I have streamlined parameter passing by putting all the EV file variable parameters in a dict. Also, using this new and easier paremeterization system, I have added parameters for gammadelay and gammasigma.

After this PR more even parameters can be added very easily and without cluttering the code.

@satra
Copy link
Member

satra commented Dec 14, 2016

@TheChymera - you should be able to run the test locally. we have updated the testing framework to use pytest. can you merge with master and try?

simply pytest nipype in the source directory

@TheChymera TheChymera force-pushed the fsl_model_waveform branch 2 times, most recently from 963e0da to 204cb1d Compare December 14, 2016 02:32
@TheChymera
Copy link
Collaborator Author

TheChymera commented Dec 14, 2016

@satra , that's nice. I ran the tests locally, but again, the errors I get locally, with circleci, and travis, don't even remotely correspond to each other:

  1. Travis passes
  2. Circleci gives me this.
  3. pytest gives me this.

At least with pytest, I think I can understand why it gives me these errors - because it checks dependencies, which on my system are different than what it expects to find in the container.

Ideally, however, I would like to reproduce the circleci error locally. Perhaps you can help me out with it? It really sounds like the inputs are wrong :-/ but why then isn't this failing on master?

@satra
Copy link
Member

satra commented Dec 14, 2016

@TheChymera - i found a few things to fix - give me a couple of days and i'll clarify the full testing on all platforms. some of the errors have to do with what dependencies are installed.

  • circle actually runs real workflows which neither travis or pytest runs. the error you are receiving is because of a workflow - specifically the fsl_feeds one. you will have to run that workflow locally with the data to replicate the error. it looks like a contrast specification error is showing up.
  • pytest errors are dependent on FSL version - it's interesting that on your system it cannot find the version info even though it considers fsl installed. the rest of the errors need to be fixed.

@TheChymera
Copy link
Collaborator Author

Thanks for helping me out with this. Could you show me how to run this particular test? Also, how exactly do I get the data, and where do I have t place it for nipype to find it?

Regarding FSL, as you may recall from brainhack, I'm the package's maintainer on Gentoo. Please let me know if you figure out what I might have forgotten to make the package install. I guess something like that must be the issue.

@djarecka
Copy link
Collaborator

djarecka commented Dec 15, 2016

I understand that @satra is writing about the last py.test failure in test_fslversion. I've never seen it and also don't understand, why ver[0]=' ' if you have fsl.
I can comment on other failures:

  • Two failures are due to raises_regexp dependencies. You have to install pytest-raisesregexp locally to fix it (pip will work).

  • The problem in test_ICC_rep_anova is a "proper" assert failure. I haven't seen it, but it looks like you're having slightly different numbers. The difference in (2.5555555555555536 / (2.5555555555555536 + 1.019444444444445)) == 0.71484071484071454 is very small

@satra
Copy link
Member

satra commented Dec 15, 2016

@djarecka - the test_ICC_rep_anova should use np.allclose, which is what i've also used for some other failures i'm seeing locally.

@djarecka
Copy link
Collaborator

@satra : ok, can change it

@satra
Copy link
Member

satra commented Dec 18, 2016

@TheChymera - the instructions for the test data are in the circle.yml file. the initial part assigns URLs to environment variables (https://github.com/nipy/nipype/blob/master/circle.yml#L3). then, this section downloads and puts the data in specific locations (https://github.com/nipy/nipype/blob/master/circle.yml#L24). then running the tests is a matter of calling the relevant workflow pointing to each relevant location. so the fsl workflow needs the feeds data for example.

regarding fsl version check, this is what nipype is doing: https://github.com/nipy/nipype/blob/master/nipype/interfaces/fsl/base.py#L70

@satra
Copy link
Member

satra commented Dec 24, 2016

@TheChymera - could you please merge with current master. re the circle error this is the relevant bit:

feat_model run0 
Standard output:
Warning: at least one EV is (close to) a linear combination of the others. You probably need to alter your design.
(Design matrix is rank deficient - ratio of min:max eigenvalues in SVD of matrix is 0)
 Contrasts involving these combinations will be set to zero.

F-test 1 isn't valid - each included contrast cannot be a linear combination of the others.
Standard error:

@codecov-io
Copy link

codecov-io commented Dec 27, 2016

Current coverage is 70.87% (diff: 100%)

Merging #1749 into master will decrease coverage by 1.56%

@@             master      #1749   diff @@
==========================================
  Files          1056       1028     -28   
  Lines         52745      50631   -2114   
  Methods           0          0           
  Messages          0          0           
  Branches       7663       7331    -332   
==========================================
- Hits          38208      35883   -2325   
- Misses        13326      13624    +298   
+ Partials       1211       1124     -87   

Powered by Codecov. Last update 7b5201d...96d760b

@TheChymera
Copy link
Collaborator Author

@satra I downloaded and extracted the data into the correct location, but the example script won't start. I am guessing this requires some magick to happen with my PYTHONPAHT? But I can't find which part of nipype does that. It's certainly not in the circle.yml file.

chymera@quiethost ~ $ python src/nipype/tools/run_examples.py
Traceback (most recent call last):
  File "src/nipype/tools/run_examples.py", line 60, in <module>
    example = sys.argv[1]
IndexError: list index out of range

@satra
Copy link
Member

satra commented Jan 3, 2017

if you look at the command that failed on circle there are a few more parameters:

/usr/bin/run_examples.sh fmri_fsl_feeds Linear /root/examples/ l1pipeline

/root/examples/ should be replaced by where you put the feeds data. so if you have a directory called:

/path/to/feeds/data then /root/examples should be replaced by /path/to/

@TheChymera
Copy link
Collaborator Author

TheChymera commented Jan 3, 2017

I think it's looking for /etc files which are not installed on my system. What can I do about this?

chymera@quiethost ~/src/nipype $ python tools/run_examples.py fmri_fsl_feeds Linear /home/chymera/examples/ l1pipeline
running example: fmri_fsl_feeds with plugin: Linear
Traceback (most recent call last):
  File "tools/run_examples.py", line 64, in <module>
    run_examples(example, pipelines, data_path, plugin)
  File "tools/run_examples.py", line 25, in run_examples
    __import__(example)
  File "/home/chymera/src/nipype/examples/fmri_fsl_feeds.py", line 100, in <module>
    registration = create_reg_workflow()
  File "/home/chymera/src/nipype/nipype/workflows/fmri/fsl/preprocess.py", line 1194, in create_reg_workflow
    'etc/flirtsch/bbr.sch')
  File "/home/chymera/src/nipype/nipype/interfaces/traits_extension.py", line 89, in validate
    self.error(object, name, value)
  File "/usr/lib64/python3.4/site-packages/traits/trait_handlers.py", line 173, in error
    value )
traits.trait_errors.TraitError: The 'schedule' trait of a FLIRTInputSpec instance must be an existing file name, but a value of '/usr/etc/flirtsch/bbr.sch' <class 'str'> was specified.

@satra
Copy link
Member

satra commented Jan 3, 2017

@TheChymera - those are part of fsl.

@satra
Copy link
Member

satra commented Jan 3, 2017

that file should be at: $FSLDIR/etc/flirtsch/bbr.sch if FSL is installed appropriately.

@TheChymera
Copy link
Collaborator Author

@satra I updated the Gentoo package accordingly. Now, however, it seems to be looking for the MNI atlas?

Where should that be coming from?

chymera@quiethost ~/src/nipype $ python tools/run_examples.py fmri_fsl_feeds Linear /home/chymera/examples/ l1pipeline
running example: fmri_fsl_feeds with plugin: Linear
170103-20:01:23,815 workflow INFO:
	 Workflow level1 settings: ['check', 'execution', 'logging']
Traceback (most recent call last):
  File "tools/run_examples.py", line 64, in <module>
    run_examples(example, pipelines, data_path, plugin)
  File "tools/run_examples.py", line 48, in run_examples
    wf.run(plugin=plugin, plugin_args=plugin_args)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/workflows.py", line 568, in run
    execgraph = generate_expanded_graph(deepcopy(flatgraph))
  File "/home/chymera/src/nipype/nipype/pipeline/engine/utils.py", line 684, in generate_expanded_graph
    graph_in = _remove_nonjoin_identity_nodes(graph_in, keep_iterables=True)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/utils.py", line 575, in _remove_nonjoin_identity_nodes
    _remove_identity_node(graph, node)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/utils.py", line 598, in _remove_identity_node
    portinputs)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/utils.py", line 672, in _propagate_internal_output
    destnode.set_input(inport, value)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/nodes.py", line 218, in set_input
    setattr(self.inputs, parameter, deepcopy(val))
  File "/home/chymera/src/nipype/nipype/interfaces/traits_extension.py", line 89, in validate
    self.error(object, name, value)
  File "/usr/lib64/python3.4/site-packages/traits/trait_handlers.py", line 173, in error
    value )
traits.trait_errors.TraitError: The 'ref_file' trait of an ApplyWarpInputSpec instance must be an existing file name, but a value of '/usr/data/standard/MNI152_T1_2mm.nii.gz' <class 'str'> was specified.

@satra
Copy link
Member

satra commented Jan 3, 2017

that should be in: $FSLDIR/data/standard/MNI152_T1_2mm.nii.gz

@TheChymera
Copy link
Collaborator Author

TheChymera commented Jan 4, 2017

@satra ok, now that (ans all other files) should be in place. But now I get an entirely different error, which is again, not the one I am trying to reproduce:

chymera@quiethost ~/src/nipype $ python tools/run_examples.py fmri_fsl_feeds Linear /home/chymera/examples/ l1pipeline
running example: fmri_fsl_feeds with plugin: Linear
170104-01:21:45,769 workflow INFO:
	 Workflow level1 settings: ['check', 'execution', 'logging']
170104-01:21:45,798 workflow INFO:
	 Running serially.
170104-01:21:45,798 workflow INFO:
	 Executing node datasource in dir: /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/datasource
170104-01:21:46,231 workflow INFO:
	 Executing node stripper in dir: /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/stripper
170104-01:21:46,234 workflow INFO:
	 Running: bet /home/chymera/examples/feeds/data/structural.nii.gz /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/stripper/structural_brain.nii.gz
170104-01:21:49,579 workflow INFO:
	 Executing node anat2target_linear in dir: /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_linear
170104-01:21:49,583 workflow INFO:
	 Running: flirt -in /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/stripper/structural_brain.nii.gz -ref /usr/share/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -out structural_brain_flirt.nii.gz -omat structural_brain_flirt.mat -searchrx -180 180 -searchry -180 180 -searchrz -180 180
170104-01:22:34,310 workflow INFO:
	 Executing node anat2target_nonlinear in dir: /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear
170104-01:22:34,315 workflow INFO:
	 Running: fnirt --aff=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_linear/structural_brain_flirt.mat --config=T1_2_MNI152_2mm --cout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_fieldwarp.nii.gz --in=/home/chymera/examples/feeds/data/structural.nii.gz --logout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_log.txt --ref=/usr/share/fsl/data/standard/MNI152_T1_2mm.nii.gz --iout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_warped.nii.gz
170104-01:22:45,78 interface INFO:
	 stderr 2017-01-04T01:22:45.077971:terminate called after throwing an instance of 'NEWMAT::SingularException'
Traceback (most recent call last):
  File "tools/run_examples.py", line 64, in <module>
    run_examples(example, pipelines, data_path, plugin)
  File "tools/run_examples.py", line 48, in run_examples
    wf.run(plugin=plugin, plugin_args=plugin_args)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/workflows.py", line 578, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/home/chymera/src/nipype/nipype/pipeline/plugins/linear.py", line 43, in run
    node.run(updatehash=updatehash)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/nodes.py", line 367, in run
    self._run_interface()
  File "/home/chymera/src/nipype/nipype/pipeline/engine/nodes.py", line 477, in _run_interface
    self._result = self._run_command(execute)
  File "/home/chymera/src/nipype/nipype/pipeline/engine/nodes.py", line 607, in _run_command
    result = self._interface.run()
  File "/home/chymera/src/nipype/nipype/interfaces/base.py", line 1085, in run
    runtime = self._run_wrapper(runtime)
  File "/home/chymera/src/nipype/nipype/interfaces/base.py", line 1728, in _run_wrapper
    runtime = self._run_interface(runtime)
  File "/home/chymera/src/nipype/nipype/interfaces/base.py", line 1762, in _run_interface
    self.raise_exception(runtime)
  File "/home/chymera/src/nipype/nipype/interfaces/base.py", line 1686, in raise_exception
    **runtime.dictcopy()))
RuntimeError: Command:
fnirt --aff=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_linear/structural_brain_flirt.mat --config=T1_2_MNI152_2mm --cout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_fieldwarp.nii.gz --in=/home/chymera/examples/feeds/data/structural.nii.gz --logout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_log.txt --ref=/usr/share/fsl/data/standard/MNI152_T1_2mm.nii.gz --iout=/home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_nonlinear/structural_warped.nii.gz
Standard output:

Standard error:
terminate called after throwing an instance of 'NEWMAT::SingularException'
Return code: -6
Interface FNIRT failed to run. 
Inputs:
affine_file = /home/chymera/src/nipype/output/fmri_fsl_feeds/Linear/level1/registration/anat2target_linear/structural_brain_flirt.mat
apply_inmask = <undefined>
apply_intensity_mapping = <undefined>
apply_refmask = <undefined>
args = <undefined>
bias_regularization_lambda = <undefined>
biasfield_resolution = <undefined>
config_file = T1_2_MNI152_2mm
derive_from_ref = <undefined>
environ = {'FSLOUTPUTTYPE': 'NIFTI_GZ'}
field_file = <undefined>
fieldcoeff_file = True
hessian_precision = <undefined>
ignore_exception = False
in_file = /home/chymera/examples/feeds/data/structural.nii.gz
in_fwhm = <undefined>
in_intensitymap_file = <undefined>
inmask_file = <undefined>
inmask_val = <undefined>
intensity_mapping_model = <undefined>
intensity_mapping_order = <undefined>
inwarp_file = <undefined>
jacobian_file = <undefined>
jacobian_range = <undefined>
log_file = <undefined>
max_nonlin_iter = <undefined>
modulatedref_file = <undefined>
out_intensitymap_file = <undefined>
output_type = NIFTI_GZ
ref_file = /usr/share/fsl/data/standard/MNI152_T1_2mm.nii.gz
ref_fwhm = <undefined>
refmask_file = <undefined>
refmask_val = <undefined>
regularization_lambda = <undefined>
regularization_model = <undefined>
skip_implicit_in_masking = <undefined>
skip_implicit_ref_masking = <undefined>
skip_inmask = <undefined>
skip_intensity_mapping = <undefined>
skip_lambda_ssq = <undefined>
skip_refmask = <undefined>
spline_order = <undefined>
subsampling_scheme = <undefined>
terminal_output = stream
warp_resolution = <undefined>
warped_file = <undefined>

I can't really see what is going wrong here, is it that this file config_file = T1_2_MNI152_2mm is missing a path? I checked, and all the other files exist.

Running the command from the command line gives me basically the same error:

terminate called after throwing an instance of 'NEWMAT::SingularException'
Aborted (core dumped)

@satra
Copy link
Member

satra commented Jan 4, 2017

@TheChymera - to ensure this is not an issue with your packaging, can you try it with a downloaded version of FSL binaries?

@TheChymera
Copy link
Collaborator Author

@satra finally!

@satra satra merged commit 29b4597 into nipy:master Jan 6, 2017
@TheChymera
Copy link
Collaborator Author

Also, apparently this was an issue with =fsl-5.0.8 it works with the newer =fsl-5.0.9.

@TheChymera TheChymera deleted the fsl_model_waveform branch January 8, 2017 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants