Skip to content

Commit f1e19a5

Browse files
committed
working on parameterization encoding
1 parent 6c6cd78 commit f1e19a5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

nipype/pipeline/engine/nodes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ def output_dir(self):
209209
if not str2bool(self.config['execution']['parameterize_dirs']):
210210
params_str = [self._parameterization_dir(p) for p in params_str]
211211
outputdir = op.join(outputdir, *params_str)
212-
return op.abspath(op.join(outputdir,
213-
self.name))
212+
return op.abspath(op.join(outputdir, self.name))
214213

215214
def set_input(self, parameter, val):
216215
""" Set interface input value"""

nipype/pipeline/engine/utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import print_function, division, unicode_literals, absolute_import
88
from builtins import str, open, map, next, zip, range
99

10+
import sys
1011
from future import standard_library
1112
standard_library.install_aliases()
1213
from collections import defaultdict
@@ -330,6 +331,9 @@ def _get_valid_pathstr(pathstr):
330331
Replaces: ',' -> '.'
331332
"""
332333
pathstr = pathstr.replace(os.sep, '..')
334+
if sys.version_info[0] < 3:
335+
# Remove those u'string' patterns
336+
pathstr = re.sub(r'''([^\w])u['"]([\w\d -\.:;,]*)['"]''', r'\1\2', pathstr)
333337
pathstr = re.sub(r'''[][ (){}?:<>#!|"';]''', '', pathstr)
334338
pathstr = pathstr.replace(',', '.')
335339
return pathstr
@@ -515,9 +519,11 @@ def _merge_graphs(supergraph, nodes, subgraph, nodeid, iterables,
515519
rootnode = Gc.nodes()[nodeidx]
516520
paramstr = ''
517521
for key, val in sorted(params.items()):
518-
paramstr = '_'.join((paramstr, _get_valid_pathstr(key),
519-
_get_valid_pathstr(str(val))))
522+
paramstr = '{}_{}_{}'.format(
523+
paramstr, _get_valid_pathstr(key), _get_valid_pathstr(str(val)))
520524
rootnode.set_input(key, val)
525+
526+
logger.debug('Parameterization: paramstr=%s', paramstr)
521527
levels = get_levels(Gc)
522528
for n in Gc.nodes():
523529
"""

0 commit comments

Comments
 (0)