


"""simple docstring"""






def 							A_					(   snake_case__		)				->     bool:
			if not isinstance(snake_case__					,				snake_case__		):
						raise ValueError('''Input series is not valid, valid series - [1, 2/3, 2]'''		)
			if len(snake_case__		) == 0:
						raise ValueError('''Input list must be a non empty list'''		)
			if len(snake_case__		) == 1 and series[0] != 0:
						return True
			_UpperCamelCase				:Any				    =  []
			_UpperCamelCase				:str				    =  len(snake_case__		)
			for i in range(0					,				snake_case__		):
						if series[i] == 0:
									raise ValueError('''Input series cannot have 0 as an element'''		)
						rec_series.append(1 / series[i]		)
			_UpperCamelCase				:Optional[int]				    =  rec_series[1] - rec_series[0]
			for index in range(2					,				snake_case__		):
						if rec_series[index] - rec_series[index - 1] != common_diff:
									return False
			return True





def 							A_					(   snake_case__		)				->     float:
			if not isinstance(snake_case__					,				snake_case__		):
						raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''		)
			if len(snake_case__		) == 0:
						raise ValueError('''Input list must be a non empty list'''		)
			_UpperCamelCase				:Any				    =  0
			for val in series:
						answer += 1 / val
			return len(snake_case__		) / answer


if __name__ == "__main__":
					import doctest

					doctest.testmod()





"""simple docstring"""






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

from digital_image_processing.filters.convolve import img_convolve





def 							A_					(   snake_case__		)				->     str:
			_UpperCamelCase				:List[Any]				    =  np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]		)
			_UpperCamelCase				:Dict				    =  np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]]		)

			_UpperCamelCase				:List[str]				    =  np.abs(img_convolve(snake_case__					,				snake_case__		)		)
			_UpperCamelCase				:Dict				    =  np.abs(img_convolve(snake_case__					,				snake_case__		)		)
			# modify the pix within [0, 255]
			_UpperCamelCase				:List[Any]				    =  dst_x * 2_55 / np.max(snake_case__		)
			_UpperCamelCase				:Tuple				    =  dst_y * 2_55 / np.max(snake_case__		)

			_UpperCamelCase				:Tuple				    =  np.sqrt((np.square(snake_case__		)) + (np.square(snake_case__		))		)
			_UpperCamelCase				:Any				    =  dst_xy * 2_55 / np.max(snake_case__		)
			_UpperCamelCase				:Optional[int]				    =  dst_xy.astype(np.uinta		)

			_UpperCamelCase				:str				    =  np.arctana(snake_case__					,				snake_case__		)
			return dst, theta


if __name__ == "__main__":
					# read original image
					UpperCamelCase__							:List[str]       =  imread("""../image_data/lena.jpg""")
					# turn image in gray scale value
					UpperCamelCase__							:Union[str, Any]       =  cvtColor(img, COLOR_BGR2GRAY)

					UpperCamelCase__      , UpperCamelCase__							:Optional[int]       =  sobel_filter(gray)

					# show result images
					imshow("""sobel filter""", sobel_grad)
					imshow("""sobel theta""", sobel_theta)
					waitKey(0)

