code: def moving_weir_cockerham_fst(g, subpops, size, start=0, stop=None, step=None,
                                max_allele=None):
      
  
      # calculate per-variant values
      a, b, c = weir_cockerham_fst(g, subpops, max_allele=max_allele)
  
      # compute the numerator and denominator in moving windows
      num = moving_statistic(a, statistic=np.nansum, size=size, start=start,
                             stop=stop, step=step)
      den = moving_statistic(a + b + c, statistic=np.nansum, size=size,
                             start=start, stop=stop, step=step)
  
      #  calculate fst in each window
      fst = num / den
  
      return fst
docs: Estimate average Fst in moving windows over a single chromosome/contig,
      following the method of Weir and Cockerham (1984).
  
      Parameters
      ----------
      g : array_like, int, shape (n_variants, n_samples, ploidy)
          Genotype array.
      subpops : sequence of sequences of ints
          Sample indices for each subpopulation.
      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.
      max_allele : int, optional
          The highest allele index to consider.
  
      Returns
      -------
      fst : ndarray, float, shape (n_windows,)
          Average Fst in each window.