code: def interpf(x, z, method=None, extrap=False, arrays=False, **kwds):
      """interpolate ``(x,z)`` to generate ``f``, where ``z = f(*x)``
  
      Args:
        x (ndarray): an input array of shape ``(npts, dim)`` or ``(npts,)``
        z (ndarray): an output array of shape ``(npts, N)``
        method (str, default=None): string name of the kind of interpolator
        extrap (bool, default=False): if True, extrapolate a bounding box
        arrays (bool, default=False): return ``z = f(*x)`` as a numpy array
        axis (int, default=None): index of ``z`` upon which to interpolate
        axmap: (map, default=None): map instance to execute each axis in parallel
  
      Returns:
        interpolated function ``f``, where ``z = f(*x)``
  
      Notes:
        - if ``axis`` is None, then interpolate using all indicies of ``z``
        - if ``axmap`` is None, then use the (sequential) map from ``builtins``
        - if ``scipy`` is not installed, will use ``numpy.interp`` for 1D
          (non-rbf), or ``rbf`` from ``mystic`` otherwise. Default method is
          ``'nearest'`` for 1D, and is ``'linear'`` otherwise. ``method`` can
          be one of ``('rbf', 'linear', 'cubic', 'nearest', 'inverse',
          'gaussian', 'multiquadric', 'quintic', 'thin_plate')``.
        - if ``extrap`` is True, extrapolate using ``interpf`` with
          ``method='thin_plate'`` (or ``'rbf'`` if ``scipy`` is not installed).
          Alternately, any one of ``('rbf', 'linear', 'cubic', 'nearest',
          'inverse', 'gaussian', 'multiquadric', 'quintic', 'thin_plate')`` can
          be used. If ``extrap`` is a cost function ``z = f(x)``, then directly
          use it in the extrapolation. Using extrapolation can reduce the number
          of ``nan``.
        - additional keyword arguments ``(epsilon, smooth, norm)`` are avaiable
          for use with a Rbf interpolator. See ``mystic.math.interpolate.Rbf``
          for more details.
      """
      axis = kwds.get("axis", None)
      _map = kwds.get(
          "axmap", kwds.get("map", map)
      )  # backward compatibility
      if _map is None:
          _map = map
      _kwd = dict(method=method, extrap=extrap, arrays=arrays)
      if "norm" in kwds:
          _kwd["norm"] = kwds.pop("norm")
      if "smooth" in kwds:
          _kwd["smooth"] = kwds.pop("smooth")
      if "epsilon" in kwds:
          _kwd["epsilon"] = kwds.pop("epsilon")
      # interpolate for each member of tuple-valued data, unless axis provided
      if axis is None:
          if len(z) and hasattr(z[0], "__len__"):
              # zt = type(z[0])
              import numpy as np
  
              # if zt is np.ndarray: zt = np.array
              zt = (
                  np.array if arrays else list
              )  # XXX: tuple(zt(*xi)) or zt(*x) ?
  
              # iterate over each axis, build a 'combined' interpf
              def function(*args, **kwds):  # XXX: z = array(f(*x.T)).T
                  axis = kwds.get("axis", None)
                  fs = function.__axis__
                  if axis is None:
                      if hasattr(args[0], "__len__"):
                          return tuple(zt(fi(*args)) for fi in fs)
                      return tuple(fi(*args) for fi in fs)
                  return fs[axis](*args)
  
              def interpf_ax(i):
                  return interpf(x, z, axis=i, **_kwd)
  
              function.__axis__ = list(
                  _map(interpf_ax, range(len(z[0])))
              )
              # function.__axis__ = [interpf(x, z, axis=ax, **_kwd) for ax,val in enumerate(z[0])]
              return function
      else:
          z = _getaxis(z, axis)
      # XXX: what if dataset is empty? (i.e. len(data.values) == 0)
      # NOTE: the following is the same as Interpolator(...)._interpolate(...)
      import numpy as np
      import warnings
  
      with warnings.catch_warnings():
          warnings.filterwarnings("ignore")
          function = _interpf(x, z, **_kwd)
      # from mystic.math.interpolate import _to_objective
      # function = _to_objective(function)
      function.__axis__ = (
          axis  # XXX: bad idea: list of funcs, or int/None ?
      )
      return function
  
imports: from mystic.math import _rbf
label_desc: Use image node_id 21 for calling a global function with example usage: interpf(x, z, method, extrap, arrays) and returns: function, function, fs, interpf, tuple, tuple