code: def FT_continuous(t, h, axis=-1, method=1):
      r"""Approximate a continuous 1D Fourier Transform with sampled data.
  
      This function uses the Fast Fourier Transform to approximate
      the continuous fourier transform of a sampled function, using
      the convention
  
      .. math::
  
         H(f) = \int h(t) exp(-2 \pi i f t) dt
  
      It returns f and H, which approximate H(f).
  
      Parameters
      ----------
      t : array_like
          regularly sampled array of times
          t is assumed to be regularly spaced, i.e.
          t = t0 + Dt * np.arange(N)
      h : array_like
          real or complex signal at each time
      axis : int
          axis along which to perform fourier transform.
          This axis must be the same length as t.
  
      Returns
      -------
      f : ndarray
          frequencies of result.  Units are the same as 1/t
      H : ndarray
          Fourier coefficients at each frequency.
      """
      assert t.ndim == 1
      assert h.shape[axis] == t.shape[0]
      N = len(t)
      if N % 2 != 0:
          raise ValueError("number of samples must be even")
  
      Dt = t[1] - t[0]
      Df = 1.0 / (N * Dt)
      t0 = t[N // 2]
  
      f = Df * (np.arange(N) - N // 2)
  
      shape = np.ones(h.ndim, dtype=int)
      shape[axis] = N
  
      phase = np.ones(N)
      phase[1::2] = -1
      phase = phase.reshape(shape)
  
      if method == 1:
          H = Dt * fft(h * phase, axis=axis)
      else:
          H = Dt * fftshift(fft(h, axis=axis), axes=axis)
  
      H *= phase
      H *= np.exp(-2j * np.pi * t0 * f.reshape(shape))
      H *= np.exp(-1j * np.pi * N / 2)
  
      return f, H
  
file_path: astroML/astroML/fourier.py
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: FT_continuous(t, h, axis, method) and returns: f,  H