docs: def baseline_correct(G):
  
      """
      This function zeroes the baseline from 2.5ppm upwards 
     
      """
      # define ppm ranges that are known to be at baseline, get indices
      baseidx =[]
      baseidx.extend(range(np.min(np.where(G.f_ppm<5.0)),np.max(np.where(G.f_ppm>4.0))+1))
      baseidx.extend(range(np.min(np.where(G.f_ppm<3.5)),np.max(np.where(G.f_ppm>3.2))+1))
      baseidx.extend(range(np.min(np.where(G.f_ppm<2.8)),np.max(np.where(G.f_ppm>2.5))+1))
  
      G.diff = np.mean(G.diff_spectra,0)
      # find x and y values at those indices
      yArr=np.real(G.diff[baseidx])
      baseppm = G.f_ppm[baseidx]
      # filter out anything above the new max
      adjbaseppm =[baseppm[i] for i in np.where(baseppm<=np.max(G.f_ppm))[0]]
      
      # spline
      f = interpolate.interp1d(adjbaseppm[::-1], yArr[::-1], kind='linear', bounds_error=True, fill_value=0)
      
      fitidxmax = np.where(G.f_ppm<np.max(adjbaseppm))[0]
      fitidxmin = np.where(G.f_ppm>np.min(adjbaseppm))[0]
      fitidx = list(set(fitidxmax) & set(fitidxmin))
      
      basefit = f(G.f_ppm[fitidx])#[::-1]
      adjusted = G.diff[fitidx]-basefit#[::-1]
  
      G.diff_corrected = G.diff
      G.diff_corrected[fitidx] = adjusted
      
      # tag as corrected
      G.baseline_corrected = True