code: def moving_garud_h(h, size, start=0, stop=None, step=None):
      
  
      gh = moving_statistic(values=h, statistic=garud_h, size=size, start=start,
                            stop=stop, step=step)
  
      h1 = gh[:, 0]
      h12 = gh[:, 1]
      h123 = gh[:, 2]
      h2_h1 = gh[:, 3]
  
      return h1, h12, h123, h2_h1
docs: Compute the H1, H12, H123 and H2/H1 statistics for detecting signatures
      of soft sweeps, as defined in Garud et al. (2015), in moving windows,
  
      Parameters
      ----------
      h : array_like, int, shape (n_variants, n_haplotypes)
          Haplotype array.
      size : int
          The window size (number of variants).
      start : int, optional
          The index at which to start.
      stop : int, optional
          The index at which to stop.
      step : int, optional
          The number of variants between start positions of windows. If not
          given, defaults to the window size, i.e., non-overlapping windows.
  
      Returns
      -------
      h1 : ndarray, float, shape (n_windows,)
          H1 statistics (sum of squares of haplotype frequencies).
      h12 : ndarray, float, shape (n_windows,)
          H12 statistics (sum of squares of haplotype frequencies, combining
          the two most common haplotypes into a single frequency).
      h123 : ndarray, float, shape (n_windows,)
          H123 statistics (sum of squares of haplotype frequencies, combining
          the three most common haplotypes into a single frequency).
      h2_h1 : ndarray, float, shape (n_windows,)
          H2/H1 statistics, indicating the "softness" of a sweep.