def absdeg(deg):
    '''Change from signed degrees to 0-180 or 0-360 ranges

    deg: ndarray
        Movement data in pitch, roll, yaw (degrees)

    Returns
    -------
    deg_abs: ndarray
        Movement translated from -180:180/-90:90 degrees to 0:360/0:180 degrees

    Example
    -------
    deg = numpy.array([-170, -120, 0, 90])
    absdeg(deg) # returns array([190, 240,   0,  90])
    '''
    import numpy

    d = numpy.copy(deg)

    if numpy.max(numpy.abs(deg)) > 90.0:
        d[deg < 0] = 360 + deg[deg < 0]
    else:
        d[deg < 0] = 180 + deg[deg < 0]

    return d
def absdeg ( deg ) : import numpy d = numpy . copy ( deg ) if numpy . max ( numpy . abs ( deg ) ) > 90.0 : d [ deg < 0 ] = 360 + deg [ deg < 0 ] else : d [ deg < 0 ] = 180 + deg [ deg < 0 ] return d
Change from signed degrees to 0-180 or 0-360 ranges

    deg: ndarray
        Movement data in pitch, roll, yaw (degrees)

    Returns
    -------
    deg_abs: ndarray
        Movement translated from -180:180/-90:90 degrees to 0:360/0:180 degrees

    Example
    -------
    deg = numpy.array([-170, -120, 0, 90])
    absdeg(deg) # returns array([190, 240,   0,  90])