code: def psnr(test, ref, mask=None):
      
  
      test, ref, mask = _preprocess_input(test, ref, mask)
  
      if mask is not None:
          test = mask * test
          ref = mask * ref
  
      num = np.max(np.abs(test))
      deno = mse(test, ref)
  
      return 10.0 * np.log10(num / deno)
docs: Peak Signal-to-Noise Ratio (PSNR)
  
      Calculate the PSNR between a test image and a reference image.
  
      Parameters
      ----------
      ref : np.ndarray
          the reference image
      test : np.ndarray
          the tested image
      mask : np.ndarray, optional
          the mask for the ROI
  
      Notes
      -----
      Compute the metric only on magnetude.
  
      Returns
      -------
      psnr: float, the psnr