title: Interpolate class objects
body: <p>I have a simple <code>Point</code> class as follows</p>
  
  <pre><code>class Point(object):
      def __init__(self, x=0.0, y=0.0, z=0.0):
          self.x = x
          self.y = y
          self.z = z
  </code></pre>
  
  <p>I would like to use <a href="https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.interpolate.interp1d.html#scipy.interpolate.interp1d" rel="nofollow"><code>scipy.interpolate.interp1d</code></a> to interpolate these points as a function of time, e.g.</p>
  
  <pre><code>x,y,z = f(t)
  </code></pre>
  
  <p>However when I try the following small example</p>
  
  <pre><code>import numpy as np
  from scipy.interpolate import interp1d
  
  times = np.array([0.0, 0.1, 0.2])
  points = np.array([Point(0.0, 0.0, 0.0),
                     Point(1.0, 1.0, 1.0),
                     Point(2.0, 2.0, 2.0)])
  
  function = interp1d(times, points)
  
  new_point = function(0.05)
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/example.py", line 31, in &lt;module&gt;
      function = interp1d(times, points)
    File "C:\long_path\scipy\interpolate\interpolate.py", line 439, in __init__
      y = y.astype(np.float_)
  TypeError: float() argument must be a string or a number, not 'Point'
  </code></pre>
  
  <p>I've also tried overloading the arithmetic operators for the <code>Point</code> class (e.g. <code>__add__</code>, <code>__sub__</code>, <code>__truediv__</code>) though that doesn't seem to help.</p>
  
  <p>Is there a way I can use <code>scipy.interpolate.interp1d</code> with my class?</p>