flip_angles

cosmo_utils.utils.geometry.flip_angles(ang, unit='deg')[source] [edit on github]

Ensures that an angle is always between 0 and 360 degrees.

Parameters:

ang : float, int, numpy.ndarray

Angle in units of degrees.

unit : {‘deg’, ‘rad’} str, optional

Unit of the angle. This variable is set to ‘deg’ by default. If ‘rad’, the output will be in units of radians.

Returns:

ang_out : float

Convertions of ang, ranging from 0 to 360 degrees.

Raises:

LSSUtils_Error : Exception

This error gets raised when ang is not a digit or a number.

Examples

>>> flip_angles(-50, unit='deg')
310.0
>>> flip_angles(110, unit='deg')
110.0