code: def _add_singles_to_buffer(self, results, ifos):
          
          if len(self.singles.keys()) == 0:
              self.set_singles_buffer(results)
  
          # convert to single detector trigger values
          # FIXME Currently configured to use pycbc live output
          # where chisq is the reduced chisq and chisq_dof is the actual DOF
          logging.info("adding singles to the background estimate...")
          updated_indices = {}
          for ifo in ifos:
              trigs = results[ifo]
  
              if len(trigs['snr'] > 0):
                  trigsc = copy.copy(trigs)
                  trigsc['chisq'] = trigs['chisq'] * trigs['chisq_dof']
                  trigsc['chisq_dof'] = (trigs['chisq_dof'] + 2) / 2
                  single_stat = self.stat_calculator.single(trigsc)
              else:
                  single_stat = numpy.array([], ndmin=1,
                                dtype=self.stat_calculator.single_dtype)
              trigs['stat'] = single_stat
  
              # add each single detector trigger to the and advance the buffer
              data = numpy.zeros(len(single_stat), dtype=self.singles_dtype)
              for key, value in trigs.items():
                  data[key] = value
  
              self.singles[ifo].add(trigs['template_id'], data)
              updated_indices[ifo] = trigs['template_id']
          return updated_indices
docs: Add single detector triggers to the internal buffer
  
          Parameters
          ----------
          results: dict of arrays
              Dictionary of dictionaries indexed by ifo and keys such as 'snr',
              'chisq', etc. The specific format it determined by the
              LiveBatchMatchedFilter class.
  
          Returns
          -------
          updated_singles: dict of numpy.ndarrays
              Array of indices that have been just updated in the internal
              buffers of single detector triggers.