code: def make_slow_waves(events, data, time, s_freq):
      
      slow_waves = []
      for ev in events:
          one_sw = {'start': time[ev[0]],
                    'trough_time': time[ev[1]],
                    'zero_time': time[ev[2]],
                    'peak_time': time[ev[3]],
                    'end': time[ev[4] - 1],
                    'trough_val': data[ev[1]],
                    'peak_val': data[ev[3]],
                    'dur': (ev[4] - ev[0]) / s_freq,
                    'ptp': abs(ev[3] - ev[1])
                    }
          slow_waves.append(one_sw)
  
      return slow_waves
docs: Create dict for each slow wave, based on events of time points.
  
      Parameters
      ----------
      events : ndarray (dtype='int')
          N x 5 matrix with start, trough, zero, peak, end samples
      data : ndarray (dtype='float')
          vector with the data
      time : ndarray (dtype='float')
          vector with time points
      s_freq : float
          sampling frequency
  
      Returns
      -------
      list of dict
          list of all the SWs, with information about start,
          trough_time, zero_time, peak_time, end, duration (s), trough_val,
          peak_val, peak-to-peak amplitude (signal units), area_under_curve
          (signal units * s)