Get multi digit/index @wedgenum with "Preserve Wedge Numbers"

   3032   6   1
User Avatar
Member
36 posts
Joined: July 2013
Offline
Hi,
I have several TOP wedges connected to each other, each set to “Preserve Wedge Numbers”.
So at lets say with 4 wedges in the last wedge I get for example a wedgenum attribute of 1,1,2,0 for 1 work item.
I now want to reference this unique wedgenum in my fileoutput ROP.
It seems to be somethinh like a tuple, if I try to refrence it by `@wedgenum` I only get the first digit.

`@wedgenum.x`_`@wedgenum.y`_`@wedgenum.z`_`@wedgenum.w` This will give me what I need, but it is completely hardcoded and if I add another wedge I am missing the last digit/index.

Any idea how to get this properly?

Thanks a lot!

Attachments:
pdg_wedgenum.JPG (92.3 KB)

User Avatar
Member
36 posts
Joined: July 2013
Offline
I also noticed that the random samples behaviour with the wedge TOP is not quite what you (or I :-P) would expect.
It think it creates random values based on @wedgenum, but only taking the first number of the array.
Thus the samples are really not random, but repeat over @wedgenum.x, which is very repetitive in effect.

I solved this by always unchecking random samples, and manually using expressions like:
fit01(rand(@wedgeindex+123), 0.05, 0.7)

So making this based on @wedgeindex really makes it random, and with the fit function I generate my kind of “bracketing”.

Any thoughts on this?
If I don't get anything wrong here, I think this should really be implemented this way, or at least to have an option where “random samples” are based on.


Looking forward to hear any thoughts on this.
Best
Adrian
User Avatar
Staff
585 posts
Joined: May 2014
Offline
Can you attach a .hip file that demonstrates the issues you have with the random samples?
User Avatar
Member
36 posts
Joined: July 2013
Offline
Adrian Meyer
Hi,
I have several TOP wedges connected to each other, each set to “Preserve Wedge Numbers”.
So at lets say with 4 wedges in the last wedge I get for example a wedgenum attribute of 1,1,2,0 for 1 work item.
I now want to reference this unique wedgenum in my fileoutput ROP.
It seems to be somethinh like a tuple, if I try to refrence it by `@wedgenum` I only get the first digit.

`@wedgenum.x`_`@wedgenum.y`_`@wedgenum.z`_`@wedgenum.w` This will give me what I need, but it is completely hardcoded and if I add another wedge I am missing the last digit/index.

Any idea how to get this properly?

Thanks a lot!


Solved this one.
Guess right now it's only possible with Python, might be handy to have a HScript shortcut for this in the future.
Put this into a String parameter somewhere inside the Topnet, could be on a null…

import pdg

work_item = pdg.workItem()
wdg_idx_l = pdg.intDataArray(work_item, "wedgenum")

wdg_idx_s = ""
for wdg_idx in wdg_idx_l:
    wdg_idx_s += str(wdg_idx) + "_"
    
wdg_idx_s = wdg_idx_s[0:-1]


return wdg_idx_s
User Avatar
Member
36 posts
Joined: July 2013
Offline
tpetrick
Can you attach a .hip file that demonstrates the issues you have with the random samples?

Hi,
sorry for the late reply, was on vacation for a while.

Hipfile attached…
Check the parm values in the wedges when cooked.
wedge2 has 8 work items.
parm “var2” evaluates to 1,2,1,2,1,2,1,2.
So it repeats its “random values” only based on each input work item wedgenum. This is not really random to me.
I think there should be an option to base the random values on “wedgeindex” instead of “wedgenum”, that would produce random values without repetition.
Edited by adrianmeyerart - June 3, 2019 04:14:36

Attachments:
pdg_randomsamples.hipnc (57.9 KB)

User Avatar
Staff
585 posts
Joined: May 2014
Offline
That makes sense and should be a farily easy thing for us to add. In the mean time, you can set the Random Seed parameter to something like 5623+@wedgeindex as a temporary work around. That will seed each pair of wedges in wedge2 based on the index of the upstream item wedge from wedge1, which creates different values for var2 throughout the wedge2 node.
Edited by tpetrick - June 3, 2019 10:55:29
User Avatar
Member
36 posts
Joined: July 2013
Offline
Thanks for the quick reply.
Yep, thats what I'm doing right now. But ist a bit tedious having to put a different seed manually in all parms, add fit function etc.
Example:
fit01(rand(@wedgeindex+123), 0.05, 0.7)

Would be more convinient if this was wrapped up nicely.

Thanks!
  • Quick Links