docs: def naa_correct(G):
  
      """
      This function resets the fits and corrects shifts in the spectra.
      It uses uses the NAA peak at 2.0ppm as a guide to replaces the existing
      f_ppm values! 
      """
      G.reset_fits()
  
      # calculate diff
      diff = np.mean(G.diff_spectra, 0)
      # find index of NAA peak in diff spectrum, that is between 3 and 1ppm
      temp_diff = np.mean(G.diff_spectra, 0)
      temp_diff[slice(0,np.min(np.where(G.f_ppm<3)))]=0
      temp_diff[np.max(np.where(G.f_ppm>1)):]=0 
      idx = np.argmin(temp_diff)
      adjust_by=(float(idx)/len(diff))*(np.max(G.f_ppm)-
                                        np.min(G.f_ppm))
      NAA_ppm = np.max(G.f_ppm)-adjust_by 
      
      # determine how far spectrum is shifted
      NAA_shift = 2.0-NAA_ppm
      
      # correct
      G.f_ppm = G.f_ppm + NAA_shift
  
      # tag as corrected
      G.naa_corrected = True