

from pathlib import Path

import cva
import numpy as np
from matplotlib import pyplot as plt

def       a__					(		UpperCAmelCase							:      np.ndarray    ,			UpperCAmelCase							:      np.ndarray    ,			UpperCAmelCase							:      np.ndarray    ,			UpperCAmelCase							:      int    ,			UpperCAmelCase							:      int      )  ->						np.ndarray:
  UpperCAmelCase	:							Union[str, Any]						=			cva.getAffineTransform(UpperCAmelCase    ,			UpperCAmelCase      )
  return cva.warpAffine(UpperCAmelCase    ,			UpperCAmelCase    ,			(rows, cols)      )


if __name__ == "__main__":
     # read original image
     _lowerCamelCase    :       Any        =							cva.imread(
         str(Path(__file__).resolve().parent.parent / "image_data" / "lena.jpg")
     )
     # turn image in gray scale value
     _lowerCamelCase    :       Optional[Any]        =							cva.cvtColor(image, cva.COLOR_BGR2GRAY)
     # get image shape
     _lowerCamelCase    :       Optional[Any]        =							gray_img.shape

     # set different points to rotate image
     _lowerCamelCase    :       Optional[int]        =							np.array([[5_0, 5_0], [2_0_0, 5_0], [5_0, 2_0_0]], np.floataa)
     _lowerCamelCase    :       int        =							np.array([[1_0, 1_0_0], [2_0_0, 5_0], [1_0_0, 2_5_0]], np.floataa)
     _lowerCamelCase    :       Optional[int]        =							np.array([[5_0, 5_0], [1_5_0, 5_0], [1_2_0, 2_0_0]], np.floataa)
     _lowerCamelCase    :       Optional[Any]        =							np.array([[1_0, 1_0_0], [8_0, 5_0], [1_8_0, 2_5_0]], np.floataa)

     # add all rotated images in a list
     _lowerCamelCase    :       Union[str, Any]        =							[
         gray_img,
         get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
         get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
         get_rotation(gray_img, ptsa, ptsa, img_rows, img_cols),
     ]

     # plot different image rotations
     _lowerCamelCase    :       Union[str, Any]        =							plt.figure(1)
     _lowerCamelCase    :       Any        =							["Original", "Rotation 1", "Rotation 2", "Rotation 3"]
     for i, image in enumerate(images):
          plt.subplot(2, 2, i + 1), plt.imshow(image, "gray")
          plt.title(titles[i])
          plt.axis("off")
          plt.subplots_adjust(left=0.0, bottom=0.0_5, right=1.0, top=0.9_5)
     plt.show()








from math import log

from scipy.constants import Boltzmann, physical_constants

_lowerCamelCase    :       Tuple        =							3_0_0  # TEMPERATURE (unit = K)

def       a__					(		UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			)  ->						float:

  if donor_conc <= 0:
    raise ValueError('''Donor concentration should be positive'''      )
  elif acceptor_conc <= 0:
    raise ValueError('''Acceptor concentration should be positive'''      )
  elif intrinsic_conc <= 0:
    raise ValueError('''Intrinsic concentration should be positive'''      )
  elif donor_conc <= intrinsic_conc:
    raise ValueError(
        '''Donor concentration should be greater than intrinsic concentration'''      )
  elif acceptor_conc <= intrinsic_conc:
    raise ValueError(
        '''Acceptor concentration should be greater than intrinsic concentration'''      )
  else:
    return (
        Boltzmann
        * T
        * log((donor_conc * acceptor_conc) / intrinsic_conc**2      )
        / physical_constants["electron volt"][0]
    )


if __name__ == "__main__":
     import doctest

     doctest.testmod()





