code: def resample(x, num, t=None, axis=0, window=None):
      """
      Resample `x` to `num` samples using Fourier method along the given axis.
  
      The resampled signal starts at the same value as `x` but is sampled
      with a spacing of ``len(x) / num * (spacing of x)``.  Because a
      Fourier method is used, the signal is assumed to be periodic.
  
      Parameters
      ----------
      x : array_like
          The data to be resampled.
      num : int
          The number of samples in the resampled signal.
      t : array_like, optional
          If `t` is given, it is assumed to be the sample positions
          associated with the signal data in `x`.
      axis : int, optional
          The axis of `x` that is resampled.  Default is 0.
      window : array_like, callable, string, float, or tuple, optional
          Specifies the window applied to the signal in the Fourier
          domain.  See below for details.
  
      Returns
      -------
      resampled_x or (resampled_x, resampled_t)
          Either the resampled array, or, if `t` was given, a tuple
          containing the resampled array and the corresponding resampled
          positions.
  
      See Also
      --------
      decimate : Downsample the signal after applying an FIR or IIR filter.
      resample_poly : Resample using polyphase filtering and an FIR filter.
  
      Notes
      -----
      The argument `window` controls a Fourier-domain window that tapers
      the Fourier spectrum before zero-padding to alleviate ringing in
      the resampled values for sampled signals you didn't intend to be
      interpreted as band-limited.
  
      If `window` is a function, then it is called with a vector of inputs
      indicating the frequency bins (i.e. fftfreq(x.shape[axis]) ).
  
      If `window` is an array of the same length as `x.shape[axis]` it is
      assumed to be the window to be applied directly in the Fourier
      domain (with dc and low-frequency first).
  
      For any other type of `window`, the function `scipy.signal.get_window`
      is called to generate the window.
  
      The first sample of the returned vector is the same as the first
      sample of the input vector.  The spacing between samples is changed
      from ``dx`` to ``dx * len(x) / num``.
  
      If `t` is not None, then it represents the old sample positions,
      and the new sample positions will be returned as well as the new
      samples.
  
      As noted, `resample` uses FFT transformations, which can be very
      slow if the number of input or output samples is large and prime;
      see `scipy.fftpack.fft`.
  
      Examples
      --------
      Note that the end of the resampled data rises to meet the first
      sample of the next cycle:
  
      >>> from scipy import signal
  
      >>> x = np.linspace(0, 10, 20, endpoint=False)
      >>> y = np.cos(-x**2/6.0)
      >>> f = signal.resample(y, 100)
      >>> xnew = np.linspace(0, 10, 100, endpoint=False)
  
      >>> import matplotlib.pyplot as plt
      >>> plt.plot(x, y, 'go-', xnew, f, '.-', 10, y[0], 'ro')
      >>> plt.legend(['data', 'resampled'], loc='best')
      >>> plt.show()
      """
      x = asarray(x)
      X = fftpack.fft(x, axis=axis)
      Nx = x.shape[axis]
      if window is not None:
          if callable(window):
              W = window(fftpack.fftfreq(Nx))
          elif isinstance(window, ndarray):
              if window.shape != (Nx,):
                  raise ValueError(
                      "window must have the same length as data"
                  )
              W = window
          else:
              W = fftpack.ifftshift(get_window(window, Nx))
          newshape = [1] * x.ndim
          newshape[axis] = len(W)
          W.shape = newshape
          X = X * W
          W.shape = (Nx,)
      sl = [slice(None)] * x.ndim
      newshape = list(x.shape)
      newshape[axis] = num
      N = int(np.minimum(num, Nx))
      Y = zeros(newshape, "D")
      sl[axis] = slice(0, (N + 1) // 2)
      Y[tuple(sl)] = X[tuple(sl)]
      sl[axis] = slice(-(N - 1) // 2, None)
      Y[tuple(sl)] = X[tuple(sl)]
  
      if (
          N % 2 == 0
      ):  # special treatment if low number of points is even. So far we have set Y[-N/2]=X[-N/2]
          if N < Nx:  # if downsampling
              sl[axis] = slice(
                  N // 2, N // 2 + 1, None
              )  # select the component at frequency N/2
              Y[tuple(sl)] += X[
                  tuple(sl)
              ]  # add the component of X at N/2
          elif N < num:  # if upsampling
              sl[axis] = slice(
                  num - N // 2, num - N // 2 + 1, None
              )  # select the component at frequency -N/2
              Y[tuple(sl)] /= 2  # halve the component at -N/2
              temp = Y[tuple(sl)]
              sl[axis] = slice(
                  N // 2, N // 2 + 1, None
              )  # select the component at +N/2
              Y[
                  tuple(sl)
              ] = temp  # set that equal to the component at -N/2
  
      y = fftpack.ifft(Y, axis=axis) * (float(num) / float(Nx))
  
      if x.dtype.char not in ["F", "D"]:
          y = y.real
  
      if t is None:
          return y
      else:
          new_t = (
              arange(0, num) * (t[1] - t[0]) * Nx / float(num) + t[0]
          )
          return y, new_t
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import threading
  import sys
  import timeit
  from scipy.spatial import cKDTree
  from .None import sigtools, dlti
  from ._upfirdn import upfirdn, _output_len
  from scipy._lib.six import callable
  from scipy._lib._version import NumpyVersion
  from scipy import fftpack, linalg
  from scipy.fftpack.helper import _init_nd_shape_and_axes_sorted
  from numpy import allclose, angle, arange, argsort, array, asarray, atleast_1d, atleast_2d, cast, dot, exp, expand_dims, iscomplexobj, mean, ndarray, newaxis, ones, pi, poly, polyadd, polyder, polydiv, polymul, polysub, polyval, product, r_, ravel, real_if_close, reshape, roots, sort, take, transpose, unique, where, zeros, zeros_like
  import numpy
  import math
  from scipy.special import factorial
  from .windows import get_window
  from ._arraytools import axis_slice, axis_reverse, odd_ext, even_ext, const_ext
  from .filter_design import cheby1, _validate_sos
  from .fir_filter_design import firwin
label_desc: Use image node_id 32 for calling a global function with example usage: resample(x, num, t, axis, window) and returns: y, y,  new_t