Repository: nipy/nipype

Issue:
ENH: ICA_AROMA: make current working directory default output directory
Changes proposed in this pull request
- Make the default output directory the current working directory so you don't have to specify an out_dir, which I believe makes ICA_AROMA more Node friendly.




Discussion:
I was a little hasty getting this up. ~~Please ignore until I fix it.~~ Fixed.
# [Codecov](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@9d63943`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `25%`.

[![Impacted file tree graph](https://codecov.io/gh/nipy/nipype/pull/2056/graphs/tree.svg?height=150&token=Tu0EnSSGVZ&width=650&src=pr)](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master    #2056   +/-   ##
=========================================
  Coverage          ?   72.16%           
=========================================
  Files             ?     1137           
  Lines             ?    57194           
  Branches          ?     8194           
=========================================
  Hits              ?    41276           
  Misses            ?    14629           
  Partials          ?     1289
```

| Flag | Coverage Δ | |
|---|---|---|
| #smoketests | `72.16% <25%> (?)` | |
| #unittests | `69.78% <25%> (?)` | |

| [Impacted Files](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [nipype/interfaces/fsl/tests/test\_auto\_ICA\_AROMA.py](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnNsL3Rlc3RzL3Rlc3RfYXV0b19JQ0FfQVJPTUEucHk=) | `85.71% <ø> (ø)` | |
| [nipype/interfaces/fsl/ICA\_AROMA.py](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=tree#diff-bmlweXBlL2ludGVyZmFjZXMvZnNsL0lDQV9BUk9NQS5weQ==) | `68.42% <25%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=footer). Last update [9d63943...48fcf86](https://codecov.io/gh/nipy/nipype/pull/2056?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@jdkent - could you please resolve conflicts with master? relative imports should always be used in nipype - we stopped being careful during review.
@satra: you've probably answered this a thousand times, but why use relative versus absolute imports? Not that I abide by PEP for everything, but [PEP 328](https://docs.python.org/2.5/whatsnew/pep-328.html) wants to make absolute imports standard. Does it have to do with making sure we are importing the right packages if we have multiple versions of nipype installed? Sorry for badgering, but I am curious.
@jdkent I think you may be misreading PEP 328, which is about interpretation of import statements. Pre-PEP328, `import x` would look for `x` in the local package, *i.e.* all imports were assumed relative. PEP328 moved to implicit absolute imports and explicit relative imports.

But yes, using relative imports does ensure that we use a package-local version, rather than one found in the PYTHONPATH. (It also helps with [including nipype as a submodule](https://github.com/nipy/nipype/pull/2059) in [other packages](https://github.com/poldracklab/niworkflows/pull/174).)

Incidentally, @oesteban it looks like `from __future__ import absolute_import` was only necessary pre-2.6? Nipype doesn't support before 2.7, so that's probably why all the missing `absolute_import` requirements haven't had any effect.

Resolving patch:
diff --git a/nipype/interfaces/fsl/ICA_AROMA.py b/nipype/interfaces/fsl/ICA_AROMA.py
--- a/nipype/interfaces/fsl/ICA_AROMA.py
+++ b/nipype/interfaces/fsl/ICA_AROMA.py
@@ -13,7 +13,7 @@
 
 from __future__ import print_function, division, unicode_literals, absolute_import
 from ..base import (TraitedSpec, CommandLineInputSpec, CommandLine,
-                    File, Directory, traits)
+                    File, Directory, traits, isdefined)
 import os
 
 
@@ -109,7 +109,7 @@ def _list_outputs(self):
         else:
             outputs['out_dir'] = self._gen_filename('out_dir')
         out_dir = outputs['out_dir']
-        
+
         if self.inputs.denoise_type in ('aggr', 'both'):
             outputs['aggr_denoised_file'] = os.path.join(out_dir, 'denoised_func_data_aggr.nii.gz')
         if self.inputs.denoise_type in ('nonaggr', 'both'):
@@ -119,5 +119,3 @@ def _list_outputs(self):
     def _gen_filename(self, name):
         if name == 'out_dir':
             return os.getcwd()
-
-    


Test patch: