

import math
import os

import cva
import numpy as np

__UpperCAmelCase      = 255.0





def 	snake_case_      (__A     :						float					,   __A     :						float     )			->	float:
   __lowerCAmelCase  :			Any					    =						np.mean((original - contrast) ** 2     )
   if mse == 0:
      return 1_0_0

   return 2_0 * math.logaa(PIXEL_MAX / math.sqrt(__A     )     )





def 	snake_case_      ()			->	None:
   __lowerCAmelCase  :			int					    =						os.path.dirname(os.path.realpath(__A     )     )
   # Loading images (original image and compressed image)
   __lowerCAmelCase  :			Tuple					    =						cva.imread(os.path.join(__A					,   """image_data/original_image.png"""     )     )
   __lowerCAmelCase  :			Dict					    =						cva.imread(os.path.join(__A					,   """image_data/compressed_image.png"""     )					,   1     )

   __lowerCAmelCase  :			Optional[int]					    =						cva.imread(os.path.join(__A					,   """image_data/PSNR-example-base.png"""     )     )
   __lowerCAmelCase  :			Optional[int]					    =						cva.imread(
       os.path.join(__A					,   """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(__A					,   __A     )} dB'''     )

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


if __name__ == "__main__":
   main()





from math import sqrt





def 	snake_case_      (__A     :						int     )			->	list[int]:
   __lowerCAmelCase  :			List[str]					    =						[1]
   for i in range(2					,   int(sqrt(__A     )     ) + 1					,   1     ):
      if number % i == 0:
         values.append(__A     )
         if int(number // i     ) != i:
            values.append(int(number // i     )     )
   return sorted(__A     )





def 	snake_case_      (__A     :						int     )			->	bool:
   return sum(factors(__A     )     ) > n





def 	snake_case_      (__A     :						int     )			->	bool:
   __lowerCAmelCase  :			Any					    =						factors(__A     )
   __lowerCAmelCase  :			Union[str, Any]					    =						len(__A     )
   __lowerCAmelCase  :			str					    =						[[0 for i in range(number + 1     )] for j in range(r + 1     )]
   for i in range(r + 1     ):
      __lowerCAmelCase  :			Tuple					    =						True

   for i in range(1					,   number + 1     ):
      __lowerCAmelCase  :			List[str]					    =						False

   for i in range(1					,   r + 1     ):
      for j in range(1					,   number + 1     ):
         if j < values[i - 1]:
            __lowerCAmelCase  :			Dict					    =						subset[i - 1][j]
         else:
            __lowerCAmelCase  :			Dict					    =						subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

   return subset[r][number] != 0





def 	snake_case_      (__A     :						int     )			->	bool:
   return abundant(__A     ) and not semi_perfect(__A     )


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   for number in (69, 70, 71):
      print(F'{number} is {"" if weird(number) else "not "}weird.')


