本文整理汇总了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()