Created
October 8, 2014 16:28
-
-
Save satra/a6e2d373671867b4977c to your computer and use it in GitHub Desktop.
passing pythonic outputs in nipype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nipype import Workflow, Node, Function | |
def myrandomfunc(N): | |
import numpy as np | |
return np.random.random_integers(1, 10, N) | |
def mysumfunc(X): | |
return X.sum() | |
wf = Workflow(name='test') | |
node1 = Node(Function(input_names='N', output_names='out', function=myrandomfunc), | |
name='randomgenerator') | |
node2 = Node(Function(input_names='X', output_names='out', function=mysumfunc), | |
name='add') | |
wf.connect(node1, 'out', node2, 'X') | |
node1.inputs.N = 10 | |
eg = wf.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment