



"""simple docstring"""


from collections.abc import Callable

snake_case_								=			Callable[[float], float]  # type alias for a real -> real function

def 					_lowerCAmelCase (  lowercase_						,      lowercase_						,      lowercase_						,      ):
						UpperCAmelCase			 =					float(lowercase_		)
						while True:
												try:
																		UpperCAmelCase			 =					prev_guess - function(lowercase_		) / derivative(lowercase_		)
												except ZeroDivisionError:
																		raise ZeroDivisionError('Could not find root'		) from None
												if abs(prev_guess - next_guess		) < 10**-5:
																		return next_guess
												UpperCAmelCase			 =					next_guess

def 					_lowerCAmelCase (  lowercase_		):
						return (x**3) - (2 * x) - 5

def 					_lowerCAmelCase (  lowercase_		):
						return 3 * (x**2) - 2


if __name__ == "__main__":
				print(newton(f, fa, 3))











import math
import os

import cva
import numpy as np

_lowerCamelCase							=      255.0





def 							lowerCamelCase    (							UpperCAmelCase_	:      float   ,       UpperCAmelCase_	:      float      )->			float:

       """simple docstring"""




       a			   =np.mean((original - contrast) ** 2      )
       if mse == 0:
              return 100

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





def 							lowerCamelCase    (							)->			None:

       """simple docstring"""




       a			   =os.path.dirname(os.path.realpath(UpperCAmelCase_      )      )
       # Loading images (original image and compressed image)
       a			   =cva.imread(os.path.join(UpperCAmelCase_   ,       """image_data/original_image.png"""      )      )
       a			   =cva.imread(os.path.join(UpperCAmelCase_   ,       """image_data/compressed_image.png"""      )   ,       1      )

       a			   =cva.imread(os.path.join(UpperCAmelCase_   ,       """image_data/PSNR-example-base.png"""      )      )
       a			   =cva.imread(
           os.path.join(UpperCAmelCase_   ,       """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(UpperCAmelCase_   ,       UpperCAmelCase_      )} dB'''      )

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


if __name__ == "__main__":
    main()
