title: Evaluate the output from scipy 2D interpolation along a curve
body: <p>I have data <code>z</code> sampled from a 2D function <code>f</code> at grid points <code>x, y</code>, as in <code>z = f(x, y)</code>.</p>
  
  <p>It is easy to interpolate <code>f</code> with <code>scipy.interp2d</code> via <code>f = interp2d(x, y, z</code>).</p>
  
  <p>However, evaluating <code>f(x, y)</code> returns an entire 2D grid as if I had done</p>
  
  <pre><code>xx, yy = np.meshgrid(x, y)
  f(xx, yy)
  </code></pre>
  
  <p>The behaviour I want is to simply return the values <code>[f(x[i], y[i]) for i in range(len(x))]</code>, which I believe is the behaviour for pretty much any other method in numpy.</p>
  
  <p>The reason I want this behaviour is that I'm looking for the path traced out along the surface of <code>f</code> over "time" by the pair <code>(t, u(t))</code>.</p>
  
  <p>It is also surprising that <code>np.diag(f(t, u(t)))</code> differs from <code>np.array([f(ti, u(ti)) for ti in t])</code>, so It's not clear to me how to get at the path <code>f(t, u(t))</code> from what is returned via <code>interp2d</code>.</p>
  
  <p>EDIT: About <code>diag</code>, I just thought it seemed we should have <code>np.diag(f(t, u(t))) == np.array([f(ti, u(ti)) for ti in t])</code>, but that isn't the case.</p>
  
  <p>Complete example:</p>
  
  <pre><code>def f(t, u):
      return (t**2) * np.exp((u**2) / (1 + u**2))
  
  x = np.linspace(0, 1, 250)
  xx, yy = np.meshgrid(x, x)
  
  z = f(xx, yy)
  f = scipy.interpolate.interp2d(x, y, z)
  
  print(f(x, y))
  print(np.array([f(xi, yi)[0] for xi, yi in zip(x, y)]))
  </code></pre>
  
  <p>I would like the output of both <code>print</code> statements to be the same.</p>