code: def arbitrarypoint(xyz, distance):
      """Select an arbitrary point along distance on the track (curve)
  
      Parameters
      ----------
      xyz : array-like shape (N,3)
         array representing x,y,z of N points in a track
      distance : float
          float representing distance travelled from the xyz[0] point of
          the curve along the curve.
  
      Returns
      -------
      ap : array shape (3,)
          Arbitrary point of line, such that, if the arbitrary point is not
          a point in `xyz`, then we take the interpolation between the two
          nearest `xyz` points.  If `xyz` is empty, return a ValueError
  
      Examples
      --------
      >>> import numpy as np
      >>> from dipy.tracking.metrics import arbitrarypoint, length
      >>> theta=np.pi*np.linspace(0,1,100)
      >>> x=np.cos(theta)
      >>> y=np.sin(theta)
      >>> z=0*x
      >>> xyz=np.vstack((x,y,z)).T
      >>> ap=arbitrarypoint(xyz,length(xyz)/3)
      """
      xyz = np.asarray(xyz)
      n_pts = xyz.shape[0]
      if n_pts == 0:
          raise ValueError("xyz array cannot be empty")
      if n_pts == 1:
          return xyz.copy().squeeze()
      cumlen = np.zeros(n_pts)
      cumlen[1:] = length(xyz, along=True)
      if cumlen[-1] < distance:
          raise ValueError(
              "Given distance is bigger than " "the length of the curve"
          )
      ind = np.where((cumlen - distance) > 0)[0][0]
      len0 = cumlen[ind - 1]
      len1 = cumlen[ind]
      Ds = distance - len0
      Lambda = Ds / (len1 - len0)
      return Lambda * xyz[ind] + (1 - Lambda) * xyz[ind - 1]
  
imports: from dipy.utils.deprecator import deprecate_with_version
  from dipy.tracking.streamline import set_number_of_points
  import numpy
  from scipy.interpolate import splprep, splev
label_desc: Use image node_id 19 for calling a global function with example usage: arbitrarypoint(xyz, distance) and returns: unknown, xyz