There must be some kind of "pufonic" way to do this, but I don’t think that np.place
, np.insert
or np.put
is what I am looking for. I want to replace the values inside a large 3D array A
with the values of a smaller 3D array B
, starting at the location [i,j,k]
in the larger array. See Figure:
I want to print something like A [i +, j +, k +] = B or np.embed (B, A, (i, j, k)), but of course this is not true.
EDIT: Oh, that is so. So I have to change the question to ask if this is the best way (where “best” means the fastest for an array of pots at 500x500x50 on a laptop):
s0, s1, s2 = B.shape
A[i:i+s0, j:j+s1, k:k+s2] = B
