code: def stft(
      frames,
      window,
      fft_size=None,
      circular_shift=False,
      include_nyquist=False,
      fftw=None,
  ):
      """
      Calculates the complex Short-Time Fourier Transform (STFT) of the given
      framed signal.
  
      Parameters
      ----------
      frames : numpy array or iterable, shape (num_frames, frame_size)
          Framed signal (e.g. :class:`FramedSignal` instance)
      window : numpy array, shape (frame_size,)
          Window (function).
      fft_size : int, optional
          FFT size (should be a power of 2); if 'None', the 'frame_size' given
          by `frames` is used; if the given `fft_size` is greater than the
          'frame_size', the frames are zero-padded, if smaller truncated.
      circular_shift : bool, optional
          Circular shift the individual frames before performing the FFT;
          needed for correct phase.
      include_nyquist : bool, optional
          Include the Nyquist frequency bin (sample rate / 2) in returned STFT.
      fftw : :class:`pyfftw.FFTW` instance, optional
          If a :class:`pyfftw.FFTW` object is given it is used to compute the
          STFT with the FFTW library. Requires 'pyfftw'.
  
      Returns
      -------
      stft : numpy array, shape (num_frames, frame_size)
          The complex STFT of the framed signal.
  
      """
      # check for correct shape of input
      if frames.ndim != 2:
          # TODO: add multi-channel support
          raise ValueError(
              "frames must be a 2D array or iterable, got %s with "
              "shape %s." % (type(frames), frames.shape)
          )
  
      # shape of the frames
      num_frames, frame_size = frames.shape
  
      # FFT size to use
      if fft_size is None:
          fft_size = frame_size
      # number of FFT bins to return
      num_fft_bins = fft_size >> 1
      if include_nyquist:
          num_fft_bins += 1
  
      # size of the FFT circular shift (needed for correct phase)
      if circular_shift:
          fft_shift = frame_size >> 1
  
      # init objects
      data = np.empty((num_frames, num_fft_bins), STFT_DTYPE)
  
      # iterate over all frames
      for f, frame in enumerate(frames):
          if circular_shift:
              # if we need to circular shift the signal for correct phase, we
              # first multiply the signal frame with the window (or just use it
              # as it is if no window function is given)
              if window is not None:
                  signal = np.multiply(frame, window)
              else:
                  signal = frame
              # then swap the two halves of the windowed signal; if the FFT size
              # is bigger than the frame size, we need to pad the (windowed)
              # signal with additional zeros in between the two halves
              fft_signal = np.zeros(fft_size)
              fft_signal[:fft_shift] = signal[fft_shift:]
              fft_signal[-fft_shift:] = signal[:fft_shift]
          else:
              # multiply the signal frame with the window and or save it directly
              # to fft_signal (i.e. bypass the additional copying step above)
              if window is not None:
                  fft_signal = np.multiply(frame, window)
              else:
                  fft_signal = frame
          # perform DFT
          if fftw:
              data[f] = fftw(fft_signal)[:num_fft_bins]
          else:
              data[f] = fftpack.fft(fft_signal, fft_size, axis=0)[
                  :num_fft_bins
              ]
      # return STFT
      return data
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  import numpy
  import scipy.fftpack
  from ..processors import Processor
  from .signal import Signal, FramedSignal
label_desc: Use image node_id 2 for calling a global function with example usage: stft(frames, window, fft_size, circular_shift, include_nyquist, fftw) and returns: data