Split tree in equal amount of grouped branches

Hello all,

I am working with a CSV file with hundreds of columns. I am first selecting the columns that I want to work with (0-142) and then picking up 4 columns at a time that are spread out evenly through the file. This is giving me the result I expect, that is all the columns I need. Those are quaternions values with the format (w,x,y,z) that I need to regroup at the end. I am trying to build my own cluster, I need all this all the time and I would like to avoid editing the CSV file before using it.

My question:

Is there a way to divide the list (quite long, I have 80 branches in the BANG!) in groups of 4 branches? As you can see, if I use the split I can get what I need, but to repeat this operation 20 times, it usually means that there is an easier way to do it.

I feel that as I am doing it now is silly, it works to check that all the data is in the right order but surely there is an easier way of thinking this.

I tried many many options but cannot find a solution, at the same time it seems like a really easy thing to do but cannot figure it out!

Thank you in advance!

Hello,

You may get away with this.

GroupBranches.gh (12.4 KB)

Hey Magicteddy,

thank you very much for your help! It seems to work fine, I’ve been trying to achieve that on my own and your thought is on point!
Now I finish with the values of w,x,y,z in a long list, that I need to split again to get as a result the values of each column as a different branch to get the right format (w,x,y,z). So I will need to add some extra operations after (calculate original list length and use that value to divide the final list, etc). I think then that there is no way around to do less calculations. I am working with mocap data and I have CSV files sometimes with 50000 rows just for a couple on minutes of movement, and small extra calculations have a great impact on performance.
Thank you for your time and help!

If you have some common operations to perform on all groups of 4 columns, try to do them with the whole tree. As soon as you Explode it you’ll have access to the individual queternions but each operation will have to be duplicated on all outputs.

Provide a csv sample if you need more help :smiley:

Maybe this could be helpful ?

QuaternionsSplit.gh (16.4 KB)

Thank you so much!
I am attaching here my solution (that is actually what I need) and a csv file for reference. I work with some data here and there, and I want to simplify how to find it and use it, I don’t perform common operations. Also the quaternions values in GH are quite different build, so I would like to keep my access to the w,x,y,z values through a Bang! when I need them.

Thank you again for your time and help!

Processed.csv (1.9 MB)
ROTATIONS.ghcluster (12.9 KB)