If you interpolate an integer array, you'll get integer output, which may or may not be what you want. If you want to specify the interpolated coordinates similar to matlab's interp3then you'll need to convert your intput coordinates into "index" coordinates. The interface to it seems a bit clunky at first, but it does give you a lot of flexibility. When making multiple interpolation calls on the same grid it is preferable to use the interpolation object RegularGridInterpolatoras in the accepted answer above.īasically, ndimage. Note that only linear and nearest-neighbor interpolation is supported by interpn for 3 dimensions and above, unlike MATLAB which supports cubic and spline interpolation as well. So you see some slight differences: Scipy uses x,y,z index order while MATLAB uses y,x,z strangely In Scipy you define a function in a separate step and when you call it, the coordinates are grouped like x1,y1,z1x2,y2,z2The default method for both MATLAB and scipy is linear interpolation, and this can be changed with the method argument. RegularGridInterpolator which closely resembles interp3. What is the exact equivalent of this using scipy's ndimage. I am extremely frustrated because after several hours I can't seem to be able to do a seemingly easy 3D interpolation in python. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |