Skip to content

Commit 324dd9e

Browse files
committed
remove hstacking of solitary inputs
1 parent 5248d07 commit 324dd9e

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

nipype/interfaces/utility/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ class Merge(IOBase):
139139
>>> out.outputs.out
140140
[1, 2, 5, 3]
141141
142-
>>> merge = Merge() # Or Merge(1)
142+
>>> merge = Merge(1)
143143
>>> merge.inputs.in1 = [1, [2, 5], 3]
144144
>>> out = merge.run()
145145
>>> out.outputs.out
146146
[1, [2, 5], 3]
147147
148-
>>> merge = Merge() # Or Merge(1)
148+
>>> merge = Merge(1)
149149
>>> merge.inputs.in1 = [1, [2, 5], 3]
150150
>>> merge.inputs.ravel_inputs = True
151151
>>> out = merge.run()
152152
>>> out.outputs.out
153153
[1, 2, 5, 3]
154154
155-
>>> merge = Merge() # Or Merge(1)
155+
>>> merge = Merge(1)
156156
>>> merge.inputs.in1 = [1, [2, 5], 3]
157157
>>> merge.inputs.no_flatten = True
158158
>>> out = merge.run()
@@ -162,7 +162,7 @@ class Merge(IOBase):
162162
input_spec = MergeInputSpec
163163
output_spec = MergeOutputSpec
164164

165-
def __init__(self, numinputs=1, **inputs):
165+
def __init__(self, numinputs=0, **inputs):
166166
super(Merge, self).__init__(**inputs)
167167
self._numinputs = numinputs
168168
if numinputs >= 1:

nipype/interfaces/utility/tests/test_base.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,20 @@ def test_split(tmpdir, args, expected):
5656
([3], {}, [0, [1, 2], [3, 4, 5]], [0, 1, 2, 3, 4, 5]),
5757
([0], {}, None, None),
5858
([], {}, [], []),
59-
([], {}, [0, [1, 2], [3, 4, 5]], [0, 1, 2, 3, 4, 5]),
59+
([], {}, [0, [1, 2], [3, 4, 5]], [0, [1, 2], [3, 4, 5]]),
6060
([3], {'axis': 'hstack'}, [[0], [1, 2], [3, 4, 5]], [[0, 1, 3]]),
6161
([3], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
6262
[[0, 2, 4], [1, 3, 5]]),
6363
([3], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
6464
[[0, 2, 4], [1, 3, 5]]),
65-
([1], {'axis': 'hstack'}, [[0], [1, 2], [3, 4, 5]], [[0, 1, 3]]),
66-
([1], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
67-
[[0, 2, 4], [1, 3, 5]]),
6865
])
6966
def test_merge(tmpdir, args, kwargs, in_lists, expected):
7067
os.chdir(str(tmpdir))
7168

7269
node = pe.Node(utility.Merge(*args, **kwargs), name='merge')
7370

74-
numinputs = args[0] if args else 1
75-
if numinputs == 1:
76-
node.inputs.in_lists = in_lists
77-
elif numinputs > 1:
71+
numinputs = args[0] if args else 0
72+
if numinputs >= 1:
7873
for i in range(1, numinputs + 1):
7974
setattr(node.inputs, 'in{:d}'.format(i), in_lists[i - 1])
8075

0 commit comments

Comments
 (0)