Overlay nd array at different locations in python
Suppose I have an 3d array with the size of (100,100,100), I would like to overlay or copy this array centered at various points (with the range of 0-100 in all directions) in space and the resulting 3d array has a size of (100,100,100). Any point near the edges of the array will be concatenated to maintain the resulting size of the array
I wrote this manually, by finding the range of the array index and coping it over but I suspect there is a easier way.
arr1.shape (100, 100, 100)
point = [5.5, 45.32, 35.0] ... point[n] = [85.0, 15,2, 90.1]
arr2 = np.zeros((100,100,100),float) for each point I will mannualy find and copy over arr2[minx:maxx,miny:maxy,minz,maxz] = arr1[minx:maxx,miny:maxy,minz,maxz] where min and max are index of the arrays.
Yes I am trying to convolve this kernel to the points. I looked into numpy.convolve but don't know how I would go about doing it with scipy.
It sounds like you are trying to do a convolution. Does scipy.ndimage.convolve work for you?