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[0] = [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.

Answers


It sounds like you are trying to do a convolution. Does scipy.ndimage.convolve work for you?


Need Your Help

Installing provisioning profile on device does nothing xcode 6

iphone xcode6 provisioning-profile

I have a valid provisioning profile, the program I'm running works fine on one of my iPhones. However, for some reason I cannot add it to my other iPhone. Here's how it looks:

Terraform and Updates

azure terraform

Being able to capture infrastructure in a single Terraform file has obvious benefits. However, I am not clear in my mind how - once, for example, a virtual machine has been created - subsequent upd...