code: def _loglr(self):
          r
          params = self.current_params
          try:
              wfs = self._waveform_generator.generate(**params)
          except NoWaveformError:
              return self._nowaveform_loglr()
          hh = 0.
          hd = 0j
          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
                  hh_i = 0.
                  hd_i = 0j
              else:
                  # whiten the waveform
                  h[self._kmin:kmax] *= self._weight[det][self._kmin:kmax]
                  # calculate inner products
                  hh_i = h[self._kmin:kmax].inner(h[self._kmin:kmax]).real
                  hd_i = self.data[det][self._kmin:kmax].inner(
                      h[self._kmin:kmax])
              # store
              setattr(self._current_stats, '{}_optimal_snrsq'.format(det), hh_i)
              hh += hh_i
              hd += hd_i
          hd = abs(hd)
          self._current_stats.maxl_phase = numpy.angle(hd)
          return numpy.log(special.i0e(hd)) + hd - 0.5*hh
docs: r"""Computes the log likelihood ratio,
          .. math::
              \log \mathcal{L}(\Theta) =
                  I_0 \left(\left|\sum_i O(h^0_i, d_i)\right|\right) -
                  \frac{1}{2}\left<h^0_i, h^0_i\right>,
          at the current point in parameter space :math:`\Theta`.
          Returns
          -------
          float
              The value of the log likelihood ratio evaluated at the given point.