code: def moving_patterson_f3(acc, aca, acb, size, start=0, stop=None, step=None,
                          normed=True):
      
  
      # calculate per-variant values
      T, B = patterson_f3(acc, aca, acb)
  
      # calculate value of statistic within each block
      if normed:
          T_bsum = moving_statistic(T, statistic=np.nansum, size=size,
                                    start=start, stop=stop, step=step)
          B_bsum = moving_statistic(B, statistic=np.nansum, size=size,
                                    start=start, stop=stop, step=step)
          f3 = T_bsum / B_bsum
  
      else:
          f3 = moving_statistic(T, statistic=np.nanmean, size=size,
                                start=start, stop=stop, step=step)
  
      return f3
docs: Estimate F3(C; A, B) in moving windows.
  
      Parameters
      ----------
      acc : array_like, int, shape (n_variants, 2)
          Allele counts for the test population (C).
      aca : array_like, int, shape (n_variants, 2)
          Allele counts for the first source population (A).
      acb : array_like, int, shape (n_variants, 2)
          Allele counts for the second source population (B).
      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.
      normed : bool, optional
          If False, use un-normalised f3 values.
  
      Returns
      -------
      f3 : ndarray, float, shape (n_windows,)
          Estimated value of the statistic in each window.