21 Jul
2010
21 Jul
'10
8 a.m.
Hi, I find myself often looking for a numpy function that would behave like an inverse compress. E.g. one that satisfies a.compress(mask) = b, given b and mask, creating a. Or like a createFromMask function, which would create an array with shape of a given boolean mask, and filling all elements that are True with values from b, b being a flat array the length of sum(mask). Currently I of course just first create a, then do a[mask] = b. Which works, but is ugly :-) So if anyone has a oneliner which I missed, please step forward... regards, Vincent Schut.
5274
Age (days ago)
5274
Last active (days ago)
0 comments
1 participants
participants (1)
-
Vincent Schut