code: def refine_peaks(arr, ipeaks, window_width):
      
      _check_window_width(window_width)
  
      step = window_width // 2
  
      ipeaks = filter_array_margins(arr, ipeaks, window_width)
  
      winoff = numpy.arange(-step, step+1, dtype='int')
      peakwin = ipeaks[:, numpy.newaxis] + winoff
      ycols = arr[peakwin]
  
      ww = return_weights(window_width)
  
      coff2 = numpy.dot(ww, ycols.T)
  
      uc = -0.5 * coff2[1] / coff2[2]
      yc = coff2[0] + uc * (coff2[1] + coff2[2] * uc)
      xc = ipeaks + 0.5 * (window_width-1) * uc
  
      return xc, yc
docs: Refine the peak location previously found by find_peaks_indexes
  
      Parameters
      ----------
      arr : 1d numpy array, float
          Input 1D spectrum.
      ipeaks : 1d numpy array (int)
          Indices of the input array arr in which the peaks were initially found.
      window_width : int
          Width of the window where the peak must be found.
  
      Returns
      -------
       xc, yc: tuple
          X-coordinates in which the refined peaks have been found,
          interpolated Y-coordinates