code: def lomb_scargle(
      t,
      y,
      dy,
      omega,
      generalized=True,
      subtract_mean=True,
      significance=None,
  ):
      """
      (Generalized) Lomb-Scargle Periodogram with Floating Mean
  
      Parameters
      ----------
      t : array_like
          sequence of times
      y : array_like
          sequence of observations
      dy : array_like
          sequence of observational errors
      omega : array_like
          frequencies at which to evaluate p(omega)
      generalized : bool
          if True (default) use generalized lomb-scargle method
          otherwise, use classic lomb-scargle.
      subtract_mean : bool
          if True (default) subtract the sample mean from the data before
          computing the periodogram.  Only referenced if generalized is False
      significance : None or float or ndarray
          if specified, then this is a list of significances to compute
          for the results.
  
      Returns
      -------
      p : array_like
          Lomb-Scargle power associated with each frequency omega
      z : array_like
          if significance is specified, this gives the levels corresponding
          to the desired significance (using the Scargle 1982 formalism)
  
      Notes
      -----
      The algorithm is based on reference [1]_.  The result for generalized=False
      is given by equation 4 of this work, while the result for generalized=True
      is given by equation 20.
  
      Note that the normalization used in this reference is different from that
      used in other places in the literature (e.g. [2]_).  For a discussion of
      normalization and false-alarm probability, see [1]_.
  
      To recover the normalization used in Scargle [3]_, the results should
      be multiplied by (N - 1) / 2 where N is the number of data points.
  
      References
      ----------
      .. [1] M. Zechmeister and M. Kurster, A&A 496, 577-584 (2009)
      .. [2] W. Press et al, Numerical Recipes in C (2002)
      .. [3] Scargle, J.D. 1982, ApJ 263:835-853
      """
      # delegate to astropy's Lomb-Scargle
      ls = LombScargle(
          t, y, dy, fit_mean=generalized, center_data=subtract_mean
      )
      frequency = np.asarray(omega) / (2 * np.pi)
      p_omega = ls.power(frequency, method="cython")
  
      if significance is not None:
          N = t.size
          M = 2 * N
          z = (
              -2.0
              / (N - 1.0)
              * np.log(1 - (1 - np.asarray(significance)) ** (1.0 / M))
          )
          return p_omega, z
      else:
          return p_omega
  
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 1 for calling a global function with example usage: lomb_scargle(t, y, dy, omega, generalized, subtract_mean, significance) and returns: p_omega,  z, p_omega