code: def to_annot(self, annot, category, name, s_freq=512):
          
          if 'tp_cons' == category:
              cons = consensus((self.detection, self.standard), 1, s_freq)
              events = cons.events
          
          elif 'tp_det' == category:
              events = asarray(self.detection)[self.tp.any(axis=1)]
              
          elif 'tp_std' == category:
              events = asarray(self.standard)[self.tp.any(axis=0)] 
              
          elif 'fp' == category:
              events = asarray(self.detection)[self.fp]
          
          elif 'fn' == category:
              events = asarray(self.standard)[self.fn]
          
          else:
              raise ValueError("Invalid category.")
          
          for one_ev in events:
              annot.add_event(name,
                              (one_ev['start'], one_ev['end']),
                              chan=one_ev['chan'])
docs: Write matched events to Wonambi XML file for visualization.
          
          Parameters
          ----------
          annot : instance of Annotations
              Annotations file
          category : str
              'tp_cons', 'tp_det', 'tp_std', 'fp' or 'fn'
          name : str
              name for the event type
          s_freq : int
              sampling frequency, in Hz, only required for 'tp_cons' category