code: def ACF_scargle(t, y, dy, n_omega=2**10, omega_max=100):
      """Compute the Auto-correlation function via Scargle's 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.
      n_omega : int (optional)
          number of angular frequencies at which to evaluate the periodogram
          default is 2^10
      omega_max : float (optional)
          maximum value of omega at which to evaluate the periodogram
          default is 100
  
      Returns
      -------
      ACF, t : ndarrays
          The auto-correlation function and associated times
      """
      t = np.asarray(t)
      y = np.asarray(y)
  
      if y.shape != t.shape:
          raise ValueError("shapes of t and y must match")
  
      dy = np.asarray(dy) * np.ones(y.shape)
  
      d_omega = omega_max * 1.0 / (n_omega + 1)
      omega = d_omega * np.arange(1, n_omega + 1)
  
      # recall that P(omega = 0) = (chi^2(0) - chi^2(0)) / chi^2(0)
      #                          = 0
  
      # compute P and shifted full-frequency array
      P = lomb_scargle(t, y, dy, omega, generalized=True)
      P = np.concatenate([[0], P, P[-2::-1]])
  
      # compute PW, the power of the window function
      PW = lomb_scargle(
          t,
          np.ones(len(t)),
          dy,
          omega,
          generalized=False,
          subtract_mean=False,
      )
      PW = np.concatenate([[0], PW, PW[-2::-1]])
  
      # compute the  inverse fourier transform of P and PW
      rho = fftpack.ifft(P).real
      rhoW = fftpack.ifft(PW).real
  
      ACF = fftpack.fftshift(rho / rhoW) / np.sqrt(2)
      N = len(ACF)
      dt = 2 * np.pi / N / (omega[1] - omega[0])
      t = dt * (np.arange(N) - N // 2)
  
      return ACF, t
  
imports: import numpy
  from scipy import fftpack
  from .periodogram import lomb_scargle
label_desc: Use image node_id 1 for calling a global function with example usage: ACF_scargle(t, y, dy, n_omega, omega_max) and returns: ACF,  t