






'''simple docstring'''




import timeit

import numpy as np

import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD







def       __UpperCAmelCase						(  lowerCamelCase_)							->     List[str]:
		def wrapper(*lowerCamelCase_     ,      **lowerCamelCase_):
				UpperCamelCase__				:					List[Any]					=					timeit.default_timer()
				UpperCamelCase__				:					List[str]					=					func(*lowercase_     ,      **lowercase_)
				UpperCamelCase__				:					Any					=					timeit.default_timer() - starttime
				return delta

		UpperCamelCase__				:					List[str]					=					func.__name__

		return wrapper







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_=100     ,      lowerCamelCase_=None)							->     str:
		UpperCamelCase__				:					Dict					=					[]
		UpperCamelCase__				:					List[Any]					=					seq_shapes or {}
		for i in range(lowercase_):
				UpperCamelCase__				:					Any					=					{}
				for col_id, (k, v) in enumerate(features.items()):
						if isinstance(lowercase_     ,      _ArrayXD):
								UpperCamelCase__				:					Union[str, Any]					=					np.random.rand(*v.shape).astype(v.dtype)
						elif isinstance(lowercase_     ,      datasets.Value):
								if v.dtype == "string":
										UpperCamelCase__				:					Optional[Any]					=					"""The small grey turtle was surprisingly fast when challenged."""
								else:
										UpperCamelCase__				:					List[str]					=					np.random.randint(10     ,      size=1).astype(v.dtype).item()
						elif isinstance(lowercase_     ,      datasets.Sequence):
								while isinstance(lowercase_     ,      datasets.Sequence):
										UpperCamelCase__				:					Optional[Any]					=					v.feature
								UpperCamelCase__				:					str					=					seq_shapes[k]
								UpperCamelCase__				:					Dict					=					np.random.rand(*lowercase_).astype(v.dtype)
						UpperCamelCase__				:					List[Any]					=					data

				dummy_data.append((i, example))

		return dummy_data







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_=100     ,      lowerCamelCase_=None)							->     str:
		UpperCamelCase__				:					Union[str, Any]					=					generate_examples(lowercase_     ,      num_examples=lowercase_     ,      seq_shapes=lowercase_)

		with ArrowWriter(features=lowercase_     ,      path=lowercase_) as writer:
				for key, record in dummy_data:
						UpperCamelCase__				:					List[Any]					=					features.encode_example(lowercase_)
						writer.write(lowercase_)

				UpperCamelCase__				:					List[Any]					=					writer.finalize()

		if not num_final_examples == num_examples:
				raise ValueError(
				    f'Error writing the dataset, wrote {num_final_examples} examples but should have written {num_examples}.')

		UpperCamelCase__				:					Optional[Any]					=					datasets.Dataset.from_file(filename=lowercase_     ,      info=datasets.DatasetInfo(features=lowercase_))

		return dataset







'''simple docstring'''




from math import log

from scipy.constants import Boltzmann, physical_constants

lowerCAmelCase__          =						300  # TEMPERATURE (unit = K)







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_     ,      )							->     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()




