stko.cap_absolute_value
- stko.cap_absolute_value(value, max_absolute_value=1)[source]
Returns value with absolute value capped at max_absolute_value.
Particularly useful in passing values to trignometric functions where numerical errors may result in an argument > 1 being passed in.
This code is modified from the pymatgen source code [2].
- Parameters:
- Returns:
value capped at max_absolute_value with sign preserved.
- Return type:
References