code: def select_peaks(data, events, limit):
      
      selected = abs(data[events[:, 1]]) >= abs(limit)
  
      return events[selected, :]
docs: Check whether event satisfies amplitude limit.
  
      Parameters
      ----------
      data : ndarray (dtype='float')
          vector with data
      events : ndarray (dtype='int')
          N x 2+ matrix with peak/trough in second position
      limit : float
          low and high limit for spindle duration
  
      Returns
      -------
      ndarray (dtype='int')
          N x 2+ matrix with peak/trough in second position