code: def _median_window(window, window_start, multiplier, starttime, sampling_rate,
                     debug=0):
      
      MAD = np.median(np.abs(window))
      thresh = multiplier * MAD
      if debug >= 2:
          print('Threshold for window is: ' + str(thresh) +
                '\nMedian is: ' + str(MAD) +
                '\nMax is: ' + str(np.max(window)))
      peaks = find_peaks2_short(arr=window,
                                thresh=thresh, trig_int=5, debug=0)
      if debug >= 4 and peaks:
          peaks_plot(window, starttime, sampling_rate,
                     save=False, peaks=peaks)
      if peaks:
          peaks = [(peak[0], peak[1] + window_start) for peak in peaks]
      else:
          peaks = []
      return peaks
docs: Internal function to aid parallel processing
  
      :type window: numpy.ndarry
      :param window: Data to look for peaks in.
      :type window_start: int
      :param window_start: Index of window start point in larger array, used \
          for peak indexing.
      :type multiplier: float
      :param multiplier: Multiple of MAD to use as threshold
      :type starttime: obspy.core.utcdatetime.UTCDateTime
      :param starttime: Starttime of window, used in debug plotting.
      :type sampling_rate: float
      :param sampling_rate in Hz, used for debug plotting
      :type debug: int
      :param debug: debug level, if want plots, >= 4.
  
      :returns: peaks
      :rtype: list