





__magic_name__       					=      {
    '''kilogram''': 1,
    '''gram''': pow(1_0, 3),
    '''milligram''': pow(1_0, 6),
    '''metric-ton''': pow(1_0, -3),
    '''long-ton''': 0.00_09_84_20_73,
    '''short-ton''': 0.00_11_02_31_22,
    '''pound''': 2.20_46_24_42_02,
    '''stone''': 0.15_74_73_17_28,
    '''ounce''': 35.2_73_99_07_23,
    '''carrat''': 5_0_0_0,
    '''atomic-mass-unit''': 6.022_136_652E26,
}

__magic_name__       					=      {
    '''kilogram''': 1,
    '''gram''': pow(1_0, -3),
    '''milligram''': pow(1_0, -6),
    '''metric-ton''': pow(1_0, 3),
    '''long-ton''': 1_0_1_6.0_4_6_0_8,
    '''short-ton''': 9_0_7.1_8_4,
    '''pound''': 0.45_35_92,
    '''stone''': 6.3_50_29,
    '''ounce''': 0.0_28_34_95,
    '''carrat''': 0.00_02,
    '''atomic-mass-unit''': 1.660_540_199E-27,
}







def     __magic_name__  (      lowerCAmelCase_      ,					lowerCAmelCase_      ,					lowerCAmelCase_):
	'''simple docstring'''


	if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
		lowerCamelCase_			:							Optional[Any]      =       (
		    F"""Invalid 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
		    F"""Supported values are: {', '.join(lowerCAmelCase_)}"""
		)
		raise ValueError(lowerCAmelCase_)
	return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
							import doctest

							doctest.testmod()





import math
import os

import cva
import numpy as np

__magic_name__       					=      2_55.0







def     __magic_name__  (      lowerCAmelCase_      ,					lowerCAmelCase_):
	'''simple docstring'''


	lowerCamelCase_			:							List[Any]      =       np.mean((original - contrast) ** 2)
	if mse == 0:
		return 100

	return 20 * math.logaa(PIXEL_MAX / math.sqrt(lowerCAmelCase_))







def     __magic_name__  (      ):
	'''simple docstring'''


	lowerCamelCase_			:							List[str]      =       os.path.dirname(os.path.realpath(lowerCAmelCase_))
	# Loading images (original image and compressed image)
	lowerCamelCase_			:							Optional[int]      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/original_image.png"))
	lowerCamelCase_			:							List[str]      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/compressed_image.png")      ,					1)

	lowerCamelCase_			:							str      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/PSNR-example-base.png"))
	lowerCamelCase_			:							int      =       cva.imread(
	    os.path.join(lowerCAmelCase_      ,					"image_data/PSNR-example-comp-10.jpg")      ,					1)

	# Value expected: 29.73dB
	print("-- First Test --")
	print(F"""PSNR value is {peak_signal_to_noise_ratio(lowerCAmelCase_      ,					lowerCAmelCase_)} dB""")

	# # Value expected: 31.53dB (Wikipedia Example)
	print("\n-- Second Test --")
	print(F"""PSNR value is {peak_signal_to_noise_ratio(lowerCAmelCase_      ,					lowerCAmelCase_)} dB""")


if __name__ == "__main__":
							main()

