There must be some 'pythonic' way to do this, but I don't think np.place
, np.insert
, or np.put
are what I'm looking for. I want to replace the values inside of a large 3D array A
with those of a smaller 3D array B
, starting at location [i,j,k]
in the larger array. See drawing:
I want to type something like A[i+, j+, k+] = B, or np.embed(B, A, (i,j,k)) but of course those are not right.
EDIT: Oh, there is this. So I should modify the question to ask if this is the best way (where "best" means fastest for a 500x500x50 array of floats on a laptop):
s0, s1, s2 = B.shape
A[i:i+s0, j:j+s1, k:k+s2] = B