code: def stft(x, wsize, tstep=None, verbose=None):
      """STFT Short-Term Fourier Transform using a sine window.
  
      The transformation is designed to be a tight frame that can be
      perfectly inverted. It only returns the positive frequencies.
  
      Parameters
      ----------
      x : array, shape (n_signals, n_times)
          Containing multi-channels signal.
      wsize : int
          Length of the STFT window in samples (must be a multiple of 4).
      tstep : int
          Step between successive windows in samples (must be a multiple of 2,
          a divider of wsize and smaller than wsize/2) (default: wsize/2).
      %(verbose)s
  
      Returns
      -------
      X : array, shape (n_signals, wsize // 2 + 1, n_step)
          STFT coefficients for positive frequencies with
          ``n_step = ceil(T / tstep)``.
  
      See Also
      --------
      istft
      stftfreq
      """
      if not np.isrealobj(x):
          raise ValueError("x is not a real valued array")
  
      if x.ndim == 1:
          x = x[None, :]
  
      n_signals, T = x.shape
      wsize = int(wsize)
  
      # Errors and warnings
      if wsize % 4:
          raise ValueError("The window length must be a multiple of 4.")
  
      if tstep is None:
          tstep = wsize / 2
  
      tstep = int(tstep)
  
      if (wsize % tstep) or (tstep % 2):
          raise ValueError(
              "The step size must be a multiple of 2 and a "
              "divider of the window length."
          )
  
      if tstep > wsize / 2:
          raise ValueError(
              "The step size must be smaller than half the "
              "window length."
          )
  
      n_step = int(ceil(T / float(tstep)))
      n_freq = wsize // 2 + 1
      logger.info("Number of frequencies: %d" % n_freq)
      logger.info("Number of time steps: %d" % n_step)
  
      X = np.zeros((n_signals, n_freq, n_step), dtype=np.complex128)
  
      if n_signals == 0:
          return X
  
      # Defining sine window
      win = np.sin(np.arange(0.5, wsize + 0.5) / wsize * np.pi)
      win2 = win**2
  
      swin = np.zeros((n_step - 1) * tstep + wsize)
      for t in range(n_step):
          swin[t * tstep : t * tstep + wsize] += win2
      swin = np.sqrt(wsize * swin)
  
      # Zero-padding and Pre-processing for edges
      xp = np.zeros(
          (n_signals, wsize + (n_step - 1) * tstep), dtype=x.dtype
      )
      xp[:, (wsize - tstep) // 2 : (wsize - tstep) // 2 + T] = x
      x = xp
  
      for t in range(n_step):
          # Framing
          wwin = win / swin[t * tstep : t * tstep + wsize]
          frame = x[:, t * tstep : t * tstep + wsize] * wwin[None, :]
          # FFT
          X[:, :, t] = rfft(frame)
  
      return X
  
file_path: mne-python/mne/time_frequency/_stft.py
imports: from math import ceil
  import numpy
  from scipy.fft import irfft, rfft, rfftfreq
  from ..utils import logger, verbose
label_desc: Use image node_id 1 for calling a global function with example usage: stft(x, wsize, tstep, verbose) and returns: X, X