code: def lomb_scargle_AIC(P, y, dy, n_harmonics=1):
      """Compute the AIC for a Lomb-Scargle Periodogram
  
      Parameters
      ----------
      P : array_like
          lomb-scargle power
      y : array_like
          observations
      dy : array_like
          errors
      n_harmonics : int (optional)
          the number of harmonics used in the Lomb-Scargle fit. Default is 1
  
      Returns
      -------
      AIC : ndarray
          AIC value corresponding to values in P
      """
      P, y, dy = map(np.asarray(P, y, dy))
      w = 1.0 / dy**2
      mu = np.dot(w, y) / w.sum()
      return (
          np.sum(((y - mu) / dy) ** 2) * P - (2 * n_harmonics + 1) * 2
      )
  
file_path: astroML/astroML/time_series/periodogram.py
imports: import numpy
  from sklearn.utils import check_random_state
  from ..utils.decorators import deprecated
  from ..utils.exceptions import AstroMLDeprecationWarning
label_desc: Use image node_id 3 for calling a global function with example usage: lomb_scargle_AIC(P, y, dy, n_harmonics) and returns: unknown