Skip to content

[ENH] Refactoring of nipype.interfaces.utility #1828

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 14 commits into from
Feb 22, 2017

Conversation

oesteban
Copy link
Contributor

This PR splits the interfaces in nipype.interfaces.utility to make this code easier to maintain. The new three sub-modules are:

  • nipype.interfaces.utility.base -> general concept of utilities (IdentityInterface, Merge, Select, Split, etc)
  • nipype.interfaces.utility.csv -> CSV handling. Now it only contains the ReadCSV interface, but we could move in here some of the csv handling interfaces in nipype.algorithms.misc
  • nipype.interfaces.utility.wrappers -> the Function interface for now. I am working on a Workflow wrapper that will be placed here.

All the interfaces are loaded at module import, so the new module should behave the same way it was doing before.

>>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data'))
>>> os.chdir(datadir)

.. testsetup::
Copy link
Member

Choose a reason for hiding this comment

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

is the older form not necessary anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we were printing those code-blocks in the documentation, but now I see we must be manually parsing them out, right?.

The .. testsetup:: directive just makes sure that the code is run before doctests but not printed out in the documentation.

I guess this would be more appropriate, since sphinx has a directive for this use case of docstrings. But I don't mind to roll it back if you want :).

Change directory to provide relative paths for doctests

.. testsetup::
import os
Copy link
Member

Choose a reason for hiding this comment

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

same question here.

@@ -25,12 +30,13 @@ def analyze_pair_image_files(outdir, filelist, shape):


def nifti_image_files(outdir, filelist, shape):
if not isinstance(filelist, (list, tuple)):
Copy link
Member

Choose a reason for hiding this comment

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

this could be replaced with filename2list from filemanip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, thanks!

@oesteban
Copy link
Contributor Author

Note: this can be merged after #1833 (actually, I'd say we should merge #1833 when ready, before any other PR since circle ci tests are failing silently right now)

@codecov-io
Copy link

codecov-io commented Feb 22, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@4d8fc36). Click here to learn what that means.
The diff coverage is 95.51%.

@@            Coverage Diff            @@
##             master    #1828   +/-   ##
=========================================
  Coverage          ?   72.71%           
=========================================
  Files             ?     1059           
  Lines             ?    52550           
  Branches          ?        0           
=========================================
  Hits              ?    38211           
  Misses            ?    14339           
  Partials          ?        0
Flag Coverage Δ
#unittests 72.71% <95.51%> (?)
Impacted Files Coverage Δ
...pe/interfaces/utility/tests/test_auto_CSVReader.py 84.61% <100%> (ø)
...ipype/interfaces/utility/tests/test_auto_Rename.py 92.3% <100%> (ø)
nipype/interfaces/utility/tests/test_base.py 100% <100%> (ø)
.../interfaces/utility/tests/test_auto_AssertEqual.py 100% <100%> (ø)
...ipype/interfaces/utility/tests/test_auto_Select.py 92.3% <100%> (ø)
nipype/interfaces/utility/tests/test_wrappers.py 86.27% <100%> (ø)
nipype/interfaces/utility/csv.py 100% <100%> (ø)
nipype/interfaces/utility/init.py 100% <100%> (ø)
nipype/testing/fixtures.py 100% <100%> (ø)
nipype/interfaces/utility/tests/test_auto_Merge.py 92.3% <100%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d8fc36...b107870. Read the comment docs.

@oesteban oesteban mentioned this pull request Feb 22, 2017
8 tasks
@satra satra merged commit 20f0444 into nipy:master Feb 22, 2017
@oesteban oesteban deleted the enh/WorkflowInterface branch February 22, 2017 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants