def angle(self, vec, unit='rad'):
        """Calculate the angle between two Vectors

        unit: unit for returned angle, either 'rad' or 'deg'. Defaults to 'rad'
        """
        if not isinstance(vec, self.__class__):
            raise TypeError('Angle operand must be of class {}'
                            .format(self.__class__.__name__))
        if unit not in ['deg', 'rad']:
            raise ValueError('Only units of rad or deg are supported')

        denom = self.length * vec.length
        if denom == 0:
            raise ZeroDivisionError('Cannot calculate angle between '
                                    'zero-length vector(s)')

        ang = np.arccos(self.dot(vec) / denom)
        if unit == 'deg':
            ang = ang * 180 / np.pi
        return ang
def angle ( self , vec , unit = 'rad' ) : if not isinstance ( vec , self . __class__ ) : raise TypeError ( 'Angle operand must be of class {}' . format ( self . __class__ . __name__ ) ) if unit not in [ 'deg' , 'rad' ] : raise ValueError ( 'Only units of rad or deg are supported' ) denom = self . length * vec . length if denom == 0 : raise ZeroDivisionError ( 'Cannot calculate angle between ' 'zero-length vector(s)' ) ang = np . arccos ( self . dot ( vec ) / denom ) if unit == 'deg' : ang = ang * 180 / np . pi return ang
Calculate the angle between two Vectors

        unit: unit for returned angle, either 'rad' or 'deg'. Defaults to 'rad'