Unable to interprete MATLAB interp2d in Python scipy.interp
<p>The following code is just to understand the context. My question doesn't require much understanding of this. It need a simple translation of one line of MATLAB code in to Python.  </p>

<pre><code>us = np.linspace(-(1023)/2,(1023)/2,1024)
vs = np.linspace(-(1023)/2,(1023)/2,1024)
uu,vv = np.meshgrid(-us,vs)
pu = ((((rx*SDD)/(ry+SOD))+us[0])/(-du))+1

xs = np.linspace(-(360-1)/2,(nx-1)/2,360)
ys = np.linspace(-(360-1)/2,(ny-1)/2,360)
zs = np.linspace(-(360-1)/2,(ny-1)/2,360)

xx,yy = np.meshgrid(xs,ys)

angle_rad = np.linspace(0,359,360)
angle_rad = angle_rad*np.pi/180

for i in range(0,360) :
    vol = np.zeros((360,360,360))
    rx = xx*np.cos(angle_rad[i]-np.pi/2) + yy*np.sin(angle_rad[i]-np.pi/2)
    ry = -xx*np.sin(angle_rad[i]-np.pi/2) + yy*np.cos(angle_rad[i]-np.pi/2)
    pu = ((((rx*370)/(ry+9))+us[0])/(-51.2/1024))+1

    for iz in range(0,360) :
        pv = ((((zs[iz]*370)/(ry+9))-vs[0])/(51.2/1024)) +1
</code></pre>

<p>So after this step the code should do interpolation and in MATLAB it's like this:</p>

<pre><code>vol(:,:,iz) = interp2(uu,vv ,proj',pu,pv,'linear'); This is in MATLAB
</code></pre>

<p>My proj, uu and vv are (1024,1024) and pu, pv are (360,360). I need to convert the above line to Python. I tried using scipy.interpolate but it gives the following errors on trying these :</p>

<pre><code>vol[:,:,iz] = Ratio*(interp2d(uu,vv,proj,pu,pv,'cubic'))
</code></pre>

<p>TypeError: unhashable type: 'numpy.ndarray'</p>

<pre><code>vol[:,:,iz] = Ratio*(interp2d(uu,vv,proj,'cubic'))
</code></pre>

<p>OverflowError: Too many data points to interpolate</p>

<pre><code>vol[:,:,iz] = Ratio*(interp2d(proj,pu,pv,'cubic'))
</code></pre>

<p>ValueError: x and y must have equal lengths for non rectangular grid</p>

<pre><code>vol[:,:,iz] = Ratio*(interp2d(pu,pv,proj,'cubic'))
</code></pre>

<p>ValueError: Invalid length for input z for non rectangular grid</p>

<p>I have read all the scipy.interpolate documentations and none seemed to help. Could anyone figure out what's wrong?</p>