當前位置: 首頁>>代碼示例>>Python>>正文


Python Object3DCTools.getVertexArrayMeshAxes方法代碼示例

本文整理匯總了Python中PyMca5.Object3D.Object3DCTools.getVertexArrayMeshAxes方法的典型用法代碼示例。如果您正苦於以下問題:Python Object3DCTools.getVertexArrayMeshAxes方法的具體用法?Python Object3DCTools.getVertexArrayMeshAxes怎麽用?Python Object3DCTools.getVertexArrayMeshAxes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyMca5.Object3D.Object3DCTools的用法示例。


在下文中一共展示了Object3DCTools.getVertexArrayMeshAxes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setData

# 需要導入模塊: from PyMca5.Object3D import Object3DCTools [as 別名]
# 或者: from PyMca5.Object3D.Object3DCTools import getVertexArrayMeshAxes [as 別名]
    def setData(self, data, x=None, y=None, z=None, xyz=None):
        self.values = data[:]
        self._configuration['private']['useminmax'] = [0, self.values.min(), self.values.max()]
        if (xyz is not None) and (x is None) and (y is None):
            arr = Object3DCTools.getVertexArrayMeshAxes(xyz)
            if arr is not None:
                doit = True
                x = arr[0]
                if len(x) > 1:
                    if abs(x[1] - xyz[0,0]) > 1.0e-10:
                        #not proper C order
                        #prevent bad plotting of a regular grid
                        doit = False
                        x = None
                if doit:
                    y = arr[1]
                    z = numpy.zeros(x.shape[0]*y.shape[0], numpy.float)
                    z[:] = xyz[:, 2]
                    xyz = None
        if (x is None) and (y is None) and (xyz is None):
            #regular mesh
            self.xSize, self.ySize = data.shape
            self.zSize = 1
            self._x = numpy.arange(self.xSize).astype(numpy.float32)
            self._y = numpy.arange(self.ySize).astype(numpy.float32)
            if z is not None:
                self._z = numpy.array(z).astype(numpy.float32)
                if len(self._z.shape) == 0:
                    #assume just a number
                    self._z.shape = 1, 1
                    self.zSize = 1
                else:
                    self._z.shape = -1, 1
                    self.zSize = self._z.shape[0]
                    self.__flat = False
            else:
                self._z = numpy.arange(self.zSize).astype(numpy.float32)
                self._z.shape = 1, 1
                self.zSize = 1
        elif xyz is not None:
            #full irregular mesh
            self.__setXYZArray(xyz, values=data)
            self.xSize = self.vertices.shape[0]
            self.ySize = 1
            self._x = self.vertices[:,0]
            self._y = self.vertices[:,1]
            self._z = self.vertices[:,2]
            self._xyz = True
        elif (x is not None) and (y is not  None):
            #regular mesh
            self._x = numpy.array(x).astype(numpy.float32)
            self._y = numpy.array(y).astype(numpy.float32)
            self._x.shape = -1, 1
            self._y.shape = -1, 1
            self.xSize = self._x.shape[0]
            self.ySize = self._y.shape[0]
            if z is not None:
                self._z = numpy.array(z).astype(numpy.float32)
                if len(self._z.shape) == 0:
                    #assume just a number
                    self._z.shape = 1, 1
                    self.zSize = 1
                else:
                    self._z.shape = -1, 1
                    self.zSize = self._z.shape[0]
                    self.__flat = False
            else:
                self._z = numpy.arange(self.zSize).astype(numpy.float32)
                self._z.shape = 1, 1
                self.zSize = 1
        else:
            raise ValueError("Unhandled case")
        self.nVertices = self.xSize * self.ySize
        self.values.shape = self.nVertices, 1

        self.getColors()
        self._obtainLimits()
開發者ID:PiRK,項目名稱:pymca,代碼行數:79,代碼來源:Object3DMesh.py


注:本文中的PyMca5.Object3D.Object3DCTools.getVertexArrayMeshAxes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。