def compare_psnr(im_true, im_test, data_range=None, dynamic_range=None):
 _assert_compatible(im_true, im_test)
 if (dynamic_range is not None):
  warn('`dynamic_range` has been deprecated in favor of `data_range`. The `dynamic_range` keyword argument will be removed in v0.14', skimage_deprecation)
  data_range = dynamic_range
 if (data_range is None):
  (dmin, dmax) = dtype_range[im_true.dtype.type]
  (true_min, true_max) = (np.min(im_true), np.max(im_true))
  if ((true_max > dmax) or (true_min < dmin)):
   raise ValueError('im_true has intensity values outside the range expected for its data type.  Please manually specify the data_range')
  if (true_min >= 0):
   data_range = dmax
  else:
   data_range = (dmax - dmin)
 (im_true, im_test) = _as_floats(im_true, im_test)
 err = compare_mse(im_true, im_test)
 return (10 * np.log10(((data_range ** 2) / err)))

def compare_psnr ( im_true , im_test , data_range = None , dynamic_range = None ) : _assert_compatible ( im_true , im_test ) if ( dynamic_range is not None ) : warn ( '`dynamic_range` has been deprecated in favor of `data_range`. The `dynamic_range` keyword argument will be removed in v0.14' , skimage_deprecation ) data_range = dynamic_range if ( data_range is None ) : ( dmin , dmax ) = dtype_range [ im_true . dtype . type ] ( true_min , true_max ) = ( np . min ( im_true ) , np . max ( im_true ) ) if ( ( true_max > dmax ) or ( true_min < dmin ) ) : raise ValueError ( 'im_true has intensity values outside the range expected for its data type.  Please manually specify the data_range' ) if ( true_min >= 0 ) : data_range = dmax else : data_range = ( dmax - dmin ) ( im_true , im_test ) = _as_floats ( im_true , im_test ) err = compare_mse ( im_true , im_test ) return ( 10 * np . log10 ( ( ( data_range ** 2 ) / err ) ) )
compute the peak signal to noise ratio for an image .