3.3.2. unit_scaling.constraints.apply_constraint

unit_scaling.constraints.apply_constraint(constraint_name: str | None, *scales: float) Tuple[float, ...][source]

Retrieves the constraint function corresponding to constraint_name and applies it to the group of scales. This name must be that of one of the functions defined in this module.

Parameters:

constraint_name (Optional[str]) – The name of the constraint function to be used.

Raises:

ValueError – if constraint_name is not that of a function in this module.

Returns:

the scales after the constraint has been applied.

Return type:

Tuple[float, …]