code: def pdf_single(z, N, normalization, dH=1, dK=3):
      
      if dK - dH != 2:
          raise NotImplementedError("Degrees of freedom != 2")
      Nk = N - dK
  
      if normalization == 'psd':
          return np.exp(-z)
      elif normalization == 'standard':
          return 0.5 * Nk * (1 - z) ** (0.5 * Nk - 1)
      elif normalization == 'model':
          return 0.5 * Nk * (1 + z) ** (-0.5 * Nk - 1)
      elif normalization == 'log':
          return 0.5 * Nk * np.exp(-0.5 * Nk * z)
      else:
          raise ValueError("normalization='{0}' is not recognized"
                           "".format(normalization))
docs: Probability density function for Lomb-Scargle periodogram
  
      Compute the expected probability density function of the periodogram
      for the null hypothesis - i.e. data consisting of Gaussian noise.
  
      Parameters
      ----------
      z : array-like
          the periodogram value
      N : int
          the number of data points from which the periodogram was computed
      normalization : string
          The periodogram normalization. Must be one of
          ['standard', 'model', 'log', 'psd']
      dH, dK : integers (optional)
          The number of parameters in the null hypothesis and the model
  
      Returns
      -------
      pdf : np.ndarray
          The expected probability density function
  
      Notes
      -----
      For normalization='psd', the distribution can only be computed for
      periodograms constructed with errors specified.
      All expressions used here are adapted from Table 1 of Baluev 2008 [1]_.
  
      References
      ----------
      .. [1] Baluev, R.V. MNRAS 385, 1279 (2008)