code: def ACF_EK(t, y, dy, bins=20):
      """Auto-correlation function via the Edelson-Krolik method
  
      Parameters
      ----------
      t : array_like
          times of observation.  Assumed to be in increasing order.
      y : array_like
          values of each observation.  Should be same shape as t
      dy : float or array_like
          errors in each observation.
      bins : int or array_like (optional)
          if integer, the number of bins to use in the analysis.
          if array, the (nbins + 1) bin edges.
          Default is bins=20.
  
      Returns
      -------
      ACF : ndarray
          The auto-correlation function and associated times
      err : ndarray
          the error in the ACF
      bins : ndarray
          bin edges used in computation
      """
      t = np.asarray(t)
      y = np.asarray(y)
  
      if y.shape != t.shape:
          raise ValueError("shapes of t and y must match")
  
      if t.ndim != 1:
          raise ValueError("t should be a 1-dimensional array")
  
      dy = np.asarray(dy) * np.ones(y.shape)
  
      # compute mean and standard deviation of y
      w = 1.0 / dy / dy
      w /= w.sum()
      mu = np.dot(w, y)
      sigma = np.std(y, ddof=1)
  
      dy2 = dy[:, None]
  
      dt = t - t[:, None]
      UDCF = (
          (y - mu)
          * (y - mu)[:, None]
          / np.sqrt((sigma**2 - dy**2) * (sigma**2 - dy2**2))
      )
  
      # determine binning
      bins = np.asarray(bins)
      if bins.size == 1:
          dt_min = dt.min()
          dt_max = dt.max()
          bins = np.linspace(dt_min, dt_max + 1e-10, bins + 1)
  
      ACF = np.zeros(len(bins) - 1)
      M = np.zeros(len(bins) - 1)
      for i in range(len(bins) - 1):
          flag = (dt >= bins[i]) & (dt < bins[i + 1])
          M[i] = flag.sum()
          ACF[i] = np.sum(UDCF[flag])
  
      ACF /= M
  
      return ACF, np.sqrt(2.0 / M), bins
  
imports: import numpy
  from scipy import fftpack
  from .periodogram import lomb_scargle
label_desc: Use image node_id 2 for calling a global function with example usage: ACF_EK(t, y, dy, bins) and returns: ACF,  np,  bins