code: def average_patterson_fst(ac1, ac2, blen):
      
  
      # calculate per-variant values
      num, den = patterson_fst(ac1, ac2)
  
      # calculate overall estimate
      fst = np.nansum(num) / np.nansum(den)
  
      # compute the numerator and denominator within each block
      num_bsum = moving_statistic(num, statistic=np.nansum, size=blen)
      den_bsum = moving_statistic(den, statistic=np.nansum, size=blen)
  
      # calculate the statistic values in each block
      vb = num_bsum / den_bsum
  
      # estimate standard error
      _, se, vj = jackknife((num_bsum, den_bsum),
                            statistic=lambda n, d: np.sum(n) / np.sum(d))
  
      return fst, se, vb, vj
docs: Estimate average Fst between two populations and standard error using
      the block-jackknife.
  
      Parameters
      ----------
      ac1 : array_like, int, shape (n_variants, n_alleles)
          Allele counts array from the first population.
      ac2 : array_like, int, shape (n_variants, n_alleles)
          Allele counts array from the second population.
      blen : int
          Block size (number of variants).
  
      Returns
      -------
      fst : float
          Estimated value of the statistic using all data.
      se : float
          Estimated standard error.
      vb : ndarray, float, shape (n_blocks,)
          Value of the statistic in each block.
      vj : ndarray, float, shape (n_blocks,)
          Values of the statistic from block-jackknife resampling.