Three 2d Profiles To 3d Array
Is there a staking method available within numpy to convert three 2d profiles into a 3d array? Where x is the straight on view, y is the horizontal view and z is the birds eye view
Solution 1:
You can combine broadcasting and bitwise/logical operations to do this:
>>> x[np.newaxis, :, :] & y[:, np.newaxis, :] & z[:, :, np.newaxis]
array([[[0, 0, 0],
[0, 1, 1],
[0, 1, 1]],
[[0, 0, 0],
[0, 1, 1],
[0, 1, 1]],
[[0, 0, 0],
[0, 0, 0],
[0, 1, 1]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]])
>>>
Post a Comment for "Three 2d Profiles To 3d Array"