split Joinnode outputs list of lists

10 views
Skip to first unread message

thomas.nickson

unread,
May 26, 2014, 9:11:23 AM5/26/14
to nipy...@googlegroups.com
Hi All,

I use a joinnode in my code (https://gist.github.com/thelxinoe/4df88d01a60967a7e331) to collate results before doing a group ICA over subsets of the input formed by a split node. When I do this instead of getting a list as the output of the split function I get a list of lists and I can't use this as the input to the ica. Is there anyway to specify the out of the split node or what's the easiest way to collapse the lists in to one. Could I use a function node and normal python list functions?

Thanks,

Tom

Satrajit Ghosh

unread,
May 29, 2014, 4:57:36 PM5/29/14
to nipy-user
hi tom,

are you trying to run ica on both parts of the split or just on one part?

if both, then the next part would probably be a mapnode.

if one part, you could do something as trivial as:

select_split = lambda x, y: return x[y]

or 

def select_split(listoflists, index):
    return listoflists[index]
wf.connect(myjoinnode, ('output', select_split, 0), nextnode, 'input')

cheers,

satra

--

---
You received this message because you are subscribed to the Google Groups "NiPy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nipy-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

thomas.nickson

unread,
May 30, 2014, 5:27:04 AM5/30/14
to nipy...@googlegroups.com
I have the split function in the join node so that I can now access the splits with out1 or out2 etc but they are lists of lists. If I want to access the first three of a [3,3,3] split with out1 then I get [[1],[1],[1]] but the ICA wants just one list that contains [1,1,1].

I think can modify your example of a function node to collapse the list in to one list but the result of the split struck me as a bit odd in general. I'm not sure how useful it is to do it this way. If I have a list of inputs then it's easy to map or iterate over them but this way, a list of lists, I need to write a custom function to get the result that I want.

Thanks,

Tom
Reply all
Reply to author
Forward
0 new messages