Skip to content

fixed fsl.Level1Design gamma convoluion #1500

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 6 commits into from
Jun 13, 2016
Merged

fixed fsl.Level1Design gamma convoluion #1500

merged 6 commits into from
Jun 13, 2016

Conversation

TheChymera
Copy link
Collaborator

This also provides a framework that is easily extensible to other convolution methods which we do not yet provide.

Fixes issue #1498

this also provides a framework easily extensible t other convolution
methods that we do not yet provide
@coveralls
Copy link

coveralls commented Jun 8, 2016

Coverage Status

Coverage increased (+0.003%) to 72.076% when pulling f28665b on TheChymera:ld into 124a850 on nipy:master.

@satra
Copy link
Member

satra commented Jun 8, 2016

thanks @TheChymera - could we add two more pieces?

  1. an updated CHANGES file
  2. a small test for the function that ensures that the hrf is set to the correct basis_key. the test could create a fake condition.

@TheChymera
Copy link
Collaborator Author

  1. where do I add a line to the CHANGES file?

Presumably not under the following header - right? Do I create a new header?

Release 0.12.0-rc1 (April 20, 2016)
============
  1. Can you provide an example of how such a test should be formatted and where it should be put? On a side note, this might be a bit difficult - as the Level1Design node requires a session_info argument, which has to contain a path to an existing 4D NIfTI file. nipype doesn't ship with any of those - right?

@satra
Copy link
Member

satra commented Jun 8, 2016

@TheChymera - under Release 0.12.0-rc1 is fine, we will be updating that for the full release soon.

re: the test, i was thinking that the test could go into ../interfaces/fsl/tests/test_model

this test would specifically use the _create_ev_files function of the interface, for which all i think you need to do is sth along the lines of:

from ...base import undefined
runinfo = dict(cond=[{'name': 'test_condition', 'onsets': [0, 10], durations=[10, 10]}])
runidx = 0
contrasts = undefined
usetd = False
do_tempfilter = False

basis_key will change for each type of hrf

and then check that the return from the function contains the right basis_key.

this doesn't check the actual interface, which will be a separate repo of tests we will be developing.

@@ -144,8 +144,9 @@ def _create_ev_files(
"""
conds = {}
evname = []
ev_hrf = load_template('feat_ev_hrf.tcl')
ev_none = load_template('feat_ev_none.tcl')
Copy link
Member

Choose a reason for hiding this comment

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

ev_none is still needed for the regressors

@coveralls
Copy link

coveralls commented Jun 10, 2016

Coverage Status

Coverage increased (+0.02%) to 72.089% when pulling 79c71f1 on TheChymera:ld into 124a850 on nipy:master.

@TheChymera
Copy link
Collaborator Author

@satra I can't test my test script because no matter how I call it I get ValueErrors somewhere down the line due to the relative imports, e.g.:

chymera@quiethost ~/src/nipype/nipype/interfaces $ python -m fsl.tests.test_Level1Design.test_level1design
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib64/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "/usr/lib64/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "/usr/lib64/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "/usr/lib64/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "fsl/__init__.py", line 9, in <module>
    from .base import (FSLCommand, Info, check_fsl, no_fsl, no_fsl_course_data)
  File "fsl/base.py", line 28, in <module>
    from builtins import object
  File "/usr/lib64/python2.7/site-packages/builtins/__init__.py", line 8, in <module>
    from future.builtins import *
  File "/usr/lib64/python2.7/site-packages/future/builtins/__init__.py", line 13, in <module>
    from future.builtins.misc import (ascii, chr, hex, input, isinstance, next,
  File "/usr/lib64/python2.7/site-packages/future/builtins/misc.py", line 43, in <module>
    from io import open
  File "io.py", line 38, in <module>
    from .base import (TraitedSpec, traits, File, Directory,
ValueError: Attempted relative import in non-package

Hoe do you do it?

@satra
Copy link
Member

satra commented Jun 10, 2016

you can use:

nosetests nipype.interfaces.fsl.tests.test_maths:test_meanimage

but this requires nipype to be installed (python setup.py install or python setup.py develop)

@satra
Copy link
Member

satra commented Jun 10, 2016

the current updates still use ev_none here:

https://github.com/nipy/nipype/pull/1500/files#diff-eade534f1c2e76b62be0e071aae3324cR195

@TheChymera
Copy link
Collaborator Author

TheChymera commented Jun 10, 2016

the current updates still use ev_none here:

Yes, isn't that supposed to happen for the regressors? I never used this feature, so I didn't even realize ev_none was still needed before you pointed it out. Now I reintroduced it.

@coveralls
Copy link

coveralls commented Jun 10, 2016

Coverage Status

Coverage increased (+0.02%) to 72.088% when pulling 34c43e6 on TheChymera:ld into 124a850 on nipy:master.

contrasts = Undefined
usetd = False
do_tempfilter = False
return Level1Design._create_ev_files(l,os.getcwd(),runinfo,runidx,usetd,contrasts,do_tempfilter,"hrf")
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't really test it. the following would run a test. something would need to be replaced with the expected string

output = Level1Design._create_ev_files(l,os.getcwd(),runinfo,runidx,usetd,contrasts,do_tempfilter,"none")
yield assert_true, 'something' in output
output = Level1Design._create_ev_files(l,os.getcwd(),runinfo,runidx,usetd,contrasts,do_tempfilter,"dgamma")
yield assert_true, 'something' in output
output = Level1Design._create_ev_files(l,os.getcwd(),runinfo,runidx,usetd,contrasts,do_tempfilter,"gamma")
yield assert_true, 'something' in output

@coveralls
Copy link

coveralls commented Jun 13, 2016

Coverage Status

Coverage increased (+0.1%) to 72.201% when pulling f75efb6 on TheChymera:ld into 124a850 on nipy:master.

@TheChymera
Copy link
Collaborator Author

@satra could you please pul?

@satra satra merged commit 3abf131 into nipy:master Jun 13, 2016
@TheChymera TheChymera deleted the ld branch June 26, 2016 18:46
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.

3 participants