



"""simple docstring"""







import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey

def       _lowerCamelCase				(							UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int,	UpperCAmelCase_ :       int     )	-> np.ndarray:






	"""simple docstring"""





	if (ksize % 2) == 0:
		A__											=					ksize + 1
	A__											=					np.zeros((ksize, ksize),	dtype=np.floataa     )

	# each value
	for y in range(UpperCAmelCase_     ):
		for x in range(UpperCAmelCase_     ):
			# distance from center
			A__											=					x - ksize // 2
			A__											=					y - ksize // 2

			# degree to radiant
			A__											=					theta / 180 * np.pi
			A__											=					np.cos(_theta     )
			A__											=					np.sin(_theta     )

			# get kernel x
			A__											=					cos_theta * px + sin_theta * py

			# get kernel y
			A__											=					-sin_theta * px + cos_theta * py

			# fill kernel
			A__											=					np.exp(
			    -(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)     ) * np.cos(2 * np.pi * _x / lambd + psi     )

	return gabor


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			# read original image
			UpperCamelCase     =							imread("""../image_data/lena.jpg""")
			# turn image in gray scale value
			UpperCamelCase     =							cvtColor(img, COLOR_BGR2GRAY)

			# Apply multiple Kernel to detect edges
			UpperCamelCase     =							np.zeros(gray.shape[:2])
			for theta in [0, 30, 60, 90, 120, 150]:
						UpperCamelCase     =							gabor_filter_kernel(10, 8, theta, 10, 0, 0)
						out += filteraD(gray, CV_8UC3, kernel_aa)
			UpperCamelCase     =							out / out.max() * 255
			UpperCamelCase     =							out.astype(np.uinta)

			imshow("""Original""", gray)
			imshow("""Gabor filter with 20x20 mask and 6 directions""", out)

			waitKey(0)









"""simple docstring"""







from __future__ import annotations

def       _lowerCamelCase				(							UpperCAmelCase_ :       float,	UpperCAmelCase_ :       float,	UpperCAmelCase_ :       float,	)	-> tuple:






	"""simple docstring"""





	if (electron_conc, hole_conc, intrinsic_conc).count(0     ) != 1:
		raise ValueError("You cannot supply more or less than 2 values"     )
	elif electron_conc < 0:
		raise ValueError("Electron concentration cannot be negative in a semiconductor"     )
	elif hole_conc < 0:
		raise ValueError("Hole concentration cannot be negative in a semiconductor"     )
	elif intrinsic_conc < 0:
		raise ValueError(
		    "Intrinsic concentration cannot be negative in a semiconductor"     )
	elif electron_conc == 0:
		return (
		    "electron_conc",
		    intrinsic_conc**2 / hole_conc,
		)
	elif hole_conc == 0:
		return (
		    "hole_conc",
		    intrinsic_conc**2 / electron_conc,
		)
	elif intrinsic_conc == 0:
		return (
		    "intrinsic_conc",
		    (electron_conc * hole_conc) ** 0.5,
		)
	else:
		return (-1, -1)


if __name__ == "__main__":
			import doctest

			doctest.testmod()




