Description
I'm not sure if this is worth an issue, but it's something that can make debugging a complicated pipeline a little difficult: if you have forget to add an input for a function node to its input_names
at initialization, a function node will still allow you to set it using node.inputs.in1 = 'foo'
and this in1
will show up in the node's report in the working directory, even though the node itself, when it runs, will be unable to see this input (and so it will either use a default value, if it's provided, or fail because there aren't enough inputs).
For example:
def func(in1,in2=0):
return in1+in2
f_node = pe.Node(interface=util.Function(input_names=['in1'],output_names=['sum'],function=func),name='node')
f_node.inputs.in1 = 1
f_node.inputs.in2 = 1
Then, if you try to run this node, it will run without any errors and return a 1
, instead of the expected 2
. Furthermore, if you look in the report in the node's directory, in2 = 1
will be listed as an input; loading the node using node=loadpkl(_node.pklz)
and checking node.inputs
will show the same thing. It's only if you run the node and debug it will you notice that in2=0
.
Doesn't it make sense to prevent users from being able to add values to node.inputs
that aren't listed in input_names
? Why does this behavior happen?
This was with nipype version 0.10.0