points.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:autolab_core 作者: BerkeleyAutomation 项目源码 文件源码
def _check_valid_data(self, data):
        """Checks that the incoming data is a 3 x #elements ndarray of normal
        vectors.

        Parameters
        ----------
        data : :obj:`numpy.ndarray`
            The data to verify.

        Raises
        ------
        ValueError
            If the data is not of the correct shape or type, or if the vectors
            therein are not normalized.
        """
        if data.dtype.type != np.float32 and data.dtype.type != np.float64:
            raise ValueError('Must initialize normals clouds with a numpy float ndarray')
        if data.shape[0] != 3:
            raise ValueError('Illegal data array passed to normal cloud. Must have 3 coordinates')
        if len(data.shape) > 2:
            raise ValueError('Illegal data array passed to normal cloud. Must have 1 or 2 dimensions')
        if np.any((np.abs(np.linalg.norm(data, axis=0) - 1) > 1e-4) & (np.linalg.norm(data, axis=0) != 0)):
            raise ValueError('Illegal data array passed to normal cloud. Must have norm=1.0 or norm=0.0')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号