def recast_max_diff(row):
    """Limit differences in orientation to < 90 degrees, from 180 range
        
        Input: A pandas row containing two columns.
        Output: Difference between the columns, maximum of 90 degrees
        """
    value_one, value_two = row.values
    diff = value_one - value_two
    if diff > 90:
        diff = 180 - diff
    elif diff < -90:
        diff = -180 - diff
    return diff
