

def       __lowerCAmelCase      (						A       ,     A       ,     A       ,     A       ,     A       ,     ):
	UpperCAmelCase_       				=			[redshift, radiation_density, matter_density, dark_energy]
	if any(p < 0 for p in parameters    ):
		raise ValueError("All input parameters must be positive"    )

	if any(p > 1 for p in parameters[1:4]    ):
		raise ValueError("Relative densities cannot be greater than one"    )
	else:
		UpperCAmelCase_       				=			1 - (matter_density + radiation_density + dark_energy)

		UpperCAmelCase_       				=			(
		    radiation_density * (redshift + 1) ** 4
		    + matter_density * (redshift + 1) ** 3
		    + curvature * (redshift + 1) ** 2
		    + dark_energy
		)

		UpperCAmelCase_       				=			hubble_constant * e_a ** (1 / 2)
		return hubble


if __name__ == "__main__":
				import doctest

				# run doctest
				doctest.testmod()

				# demo LCDM approximation
				_a:    Optional[Any] 							=			0.3

				print(
				    hubble_parameter(
				        hubble_constant=68.3,
				        radiation_density=1e-4,
				        matter_density=matter_density,
				        dark_energy=1 - matter_density,
				        redshift=0,
				    )
				)


from .imports import is_tqdm_available


if is_tqdm_available():
				from tqdm.auto import tqdm as _tqdm

from ..state import PartialState



def       __lowerCAmelCase      (						A = True       ,     *A       ,     **A    ):
	if not is_tqdm_available():
		raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."    )
	UpperCAmelCase_       				=			False
	if main_process_only:
		UpperCAmelCase_       				=			PartialState().local_process_index == 0
	return _tqdm(*A       ,     **A       ,     disable=A    )