






'''simple docstring'''




import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
		import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin







@require_torch
class       __lowercase					(unittest.TestCase   ,				__lowerCamelCase    ):

	def      __UpperCamelCase							(      self   :						List[str]):
			UpperCamelCase__				:					Union[str, Any]					=					load_tool('text-to-speech')
			self.tool.setup()

	def      __UpperCamelCase							(      self   :						str):
			# SpeechT5 isn't deterministic
			torch.manual_seed(0)
			UpperCamelCase__				:					Tuple					=					self.tool('hey')
			UpperCamelCase__				:					Optional[int]					=					result.to_raw()
			self.assertTrue(
			    torch.allclose(
			        resulting_tensor[:3]  ,					torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85])  ,					))





	def      __UpperCamelCase							(      self   :						Union[str, Any]):
			# SpeechT5 isn't deterministic
			torch.manual_seed(0)
			UpperCamelCase__				:					List[Any]					=					self.tool('hey')
			UpperCamelCase__				:					List[str]					=					result.to_raw()
			self.assertTrue(
			    torch.allclose(
			        resulting_tensor[:3]  ,					torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85])  ,					))












'''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()




