angle
- sisl.utils.angle(s: str, rad: bool = True, in_rad: bool = True) float [source]
Convert the input string to an angle, either radians or degrees.
- Parameters:
s – If s starts with ‘r’ it is interpreted as radians
[0:2pi]
. If s starts with ‘a’ it is interpreted as a regular angle[0:360]
. If s ends with ‘r’ it returns in radians. If s ends with ‘a’ it returns in regular angle.s may be any mathematical equation which can be intercepted through
eval
.rad – Whether the returned angle is in radians. Note than an ‘r’ at the end of s has precedence.
in_rad – Whether the calculated angle is in radians. Note than an ‘r’ at the beginning of s has precedence.
- Returns:
float
– the angle in the requested unit