channels (CHOP) from table import?

   3738   10   2
User Avatar
Member
36 posts
Joined: 2月 2015
Offline
Hello guys!



i need to create a channel based on a table (csv file), the table looks like: (id can be ignored)


id    myvalue

1 509
2 514
3 519
4 524
5 529
6 534
7 540
8 544
9 550
10 555


i wish create a channel with a key value of 1 on every myvalue, and 0 in all other frames (basically a 0|1 toggle), this way:

frame  value

1          0

2          0



509      1

510      0



514      1



i try everything..but no sucess…

any ideas??? thanks in advance!
Rod Tebisx | Senior Creature FX TD | London
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
Hey,

If you just want to import values per frame, then a text file with a value per line saved as a .chan will be readable in chops. If you have more than one value per line these then each column will be imported as a separate channel. Which could be handy for retiming the values in the second column based upon the first.
Henry Dean
User Avatar
Member
8034 posts
Joined: 9月 2011
Offline
Since that looks like sparse keys, and not channel data, you would be better off writing a script to create keyframes by parsing the file in python. The keyframes can then be applied to a channel chop's value parameter.
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
Haha, that retiming I mentioned turned out to not be so straightforward
But got something working for fun…

Attachments:
chan_file_test.hip (34.7 KB)
test.chan (31 バイト)

Henry Dean
User Avatar
Member
36 posts
Joined: 2月 2015
Offline
friedasparagus
Hey,

If you just want to import values per frame, then a text file with a value per line saved as a .chan will be readable in chops. If you have more than one value per line these then each column will be imported as a separate channel. Which could be handy for retiming the values in the second column based upon the first.

i don't know how to do this in python, have you any idea?

i can import the table with tableimport node, so i have points and an attribute with my values, but i need read sparse data and create a channel, or keyframes…

still lost
Rod Tebisx | Senior Creature FX TD | London
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
Oh sorry, I was assuming you were using a ‘File’ CHOP node to read the file. That's what I was thinking of when I wrote that… have a go at renaming your some_file.csv to some_file.chan and then read it with a File chop and see what it gives you. I haven't tried it with a proper csv file, but the .chan format seems pretty tolerant towards things it can't understand (string, commas etc).

It doesn't feel like you should need to be using SOPs as a middle-man for importing this kind of thing.
For the toggling, you can try the logic in the example I put up. Although the interpolation there is not necessary for your task
Edited by friedasparagus - 2017年10月19日 13:35:48
Henry Dean
User Avatar
Member
36 posts
Joined: 2月 2015
Offline
friedasparagus
Oh sorry, I was assuming you were using a ‘File’ CHOP node to read the file. That's what I was thinking of when I wrote that… have a go at renaming your some_file.csv to some_file.chan and then read it with a File chop and see what it gives you. I haven't tried it with a proper csv file, but the .chan format seems pretty tolerant towards things it can't understand (string, commas etc).

It doesn't feel like you should need to be using SOPs as a middle-man for importing this kind of thing.
For the toggling, you can try the logic in the example I put up. Although the interpolation there is not necessary for your task


oh, i checked your solution,this can work! thanks man, anyway need one more thing.. for each empty sparse ranges, fill with 0 value.. is it possible??

and thanks again for the quick response!

***still trying to understand your code…
Edited by RodTebisx - 2017年10月19日 13:57:19
Rod Tebisx | Senior Creature FX TD | London
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
So for that we just need to check for equality between the current sample index and the relevant value in the original file.
Does this do it?

EDIT: blurp… didn't remove the sticky note.. please ignore
Edited by friedasparagus - 2017年10月19日 14:44:24

Attachments:
chan_file_test2.hip (31.1 KB)
test.chan (18 バイト)

Henry Dean
User Avatar
Member
36 posts
Joined: 2月 2015
Offline
friedasparagus
So for that we just need to check for equality between the current sample index and the relevant value in the original file.
Does this do it?

EDIT: blurp… didn't remove the sticky note.. please ignore




investigating your file!

by the way, where are you from?

thanks man!!!
Rod Tebisx | Senior Creature FX TD | London
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
No worries. Me? I'm from jolly old Eng(er)land
Henry Dean
User Avatar
Member
36 posts
Joined: 2月 2015
Offline
worked perfectly!

thanks english brother!
Rod Tebisx | Senior Creature FX TD | London
  • Quick Links