code: def _loglr(self):
          r
          params = self.current_params
          try:
              wfs = self._waveform_generator.generate(**params)
          except NoWaveformError:
              return self._nowaveform_loglr()
          lr = 0.
          for det, h in wfs.items():
              # the kmax of the waveforms may be different than internal kmax
              kmax = min(len(h), self._kmax)
              if self._kmin >= kmax:
                  # if the waveform terminates before the filtering low frequency
                  # cutoff, then the loglr is just 0 for this detector
                  cplx_hd = 0j
                  hh = 0.
              else:
                  slc = slice(self._kmin, kmax)
                  # whiten the waveform
                  h[self._kmin:kmax] *= self._weight[det][slc]
                  # the inner products
                  cplx_hd = self.data[det][slc].inner(h[slc])  # <h, d>
                  hh = h[slc].inner(h[slc]).real  # < h, h>
              cplx_loglr = cplx_hd - 0.5*hh
              # store
              setattr(self._current_stats, '{}_optimal_snrsq'.format(det), hh)
              setattr(self._current_stats, '{}_cplx_loglr'.format(det),
                      cplx_loglr)
              lr += cplx_loglr.real
          # also store the loglikelihood, to ensure it is populated in the
          # current stats even if loglikelihood is never called
          self._current_stats.loglikelihood = lr + self.lognl
          return float(lr)
docs: r"""Computes the log likelihood ratio,
  
          .. math::
  
              \log \mathcal{L}(\Theta) = \sum_i
                  \left<h_i(\Theta)|d_i\right> -
                  \frac{1}{2}\left<h_i(\Theta)|h_i(\Theta)\right>,
  
          at the current parameter values :math:`\Theta`.
  
          Returns
          -------
          float
              The value of the log likelihood ratio.