code: def rfft2d_freqs(h, w):
      
  
      fy = np.fft.fftfreq(h)[:, None]
      # when we have an odd input dimension we need to keep one additional
      # frequency and later cut off 1 pixel
      if w % 2 == 1:
          fx = np.fft.fftfreq(w)[: w // 2 + 2]
      else:
          fx = np.fft.fftfreq(w)[: w // 2 + 1]
      return np.sqrt(fx * fx + fy * fy)
docs: Computes 2D spectrum frequencies.