本文整理汇总了Python中PyMca5.PyMcaIO.ArraySave.save3DArrayAsHDF5方法的典型用法代码示例。如果您正苦于以下问题:Python ArraySave.save3DArrayAsHDF5方法的具体用法?Python ArraySave.save3DArrayAsHDF5怎么用?Python ArraySave.save3DArrayAsHDF5使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyMca5.PyMcaIO.ArraySave
的用法示例。
在下文中一共展示了ArraySave.save3DArrayAsHDF5方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveStackAsSimplestHDF5
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save3DArrayAsHDF5 [as 别名]
def saveStackAsSimplestHDF5(self):
filename = self._getOutputHDF5Filename()
if not len(filename):
return
view = self._getCroppedView()
ArraySave.save3DArrayAsHDF5(view, filename,
labels = None, dtype=None, mode='simplest')
示例2: saveStackAsNeXus
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save3DArrayAsHDF5 [as 别名]
def saveStackAsNeXus(self, dtype=None, interpretation=None, compression=False):
mcaIndex = self._stack.info.get('McaIndex', -1)
if interpretation is None:
if mcaIndex in [0]:
interpretation = "image"
else:
interpretation = "spectrum"
if interpretation not in ["spectrum", "image"]:
raise ValueError("Unknown data interpretation %s" % interpretation)
filename = self._getOutputHDF5Filename()
if not len(filename):
return
# get only the seen stack portion
view = self._getCroppedView()
# the current graph axis is saved
axes = [None] * len(self._stack.data.shape)
labels = [None] * len(self._stack.data.shape)
try:
xLabel = qt.safe_str(self.mcaWidget.graph.getGraphXLabel())
except:
xLabel = None
try:
xData, y, legend, info = self.mcaWidget.getActiveCurve()[:4]
except:
xData = self._mcaData0.x[0]
xLabel = 'Channels'
if interpretation == 'image':
labels[0] = xLabel
axes[0] = xData
else:
labels[-1] = xLabel
axes[-1] = xData
try:
ArraySave.save3DArrayAsHDF5(view,
filename,
axes=axes,
labels=labels,
dtype=dtype,
mode='nexus',
mcaindex=mcaIndex,
interpretation=interpretation,
compression=compression)
except:
msg = qt.QMessageBox(self)
msg.setIcon(qt.QMessageBox.Critical)
msg.setWindowTitle("Save error")
msg.setText("An error has occured while saving the data:")
msg.setInformativeText(qt.safe_str(sys.exc_info()[1]))
msg.setDetailedText(traceback.format_exc())
msg.exec_()
示例3: saveStackAsSimplestHDF5
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save3DArrayAsHDF5 [as 别名]
def saveStackAsSimplestHDF5(self):
filename = self._getOutputHDF5Filename()
if not len(filename):
return
ArraySave.save3DArrayAsHDF5(self._stack.data, filename,
labels = None, dtype=None, mode='simplest')
示例4: saveStackAsNeXusPlus
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save3DArrayAsHDF5 [as 别名]
def saveStackAsNeXusPlus(self):
filename = self._getOutputHDF5Filename()
if not len(filename):
return
ArraySave.save3DArrayAsHDF5(self._stack.data, filename,
labels = None, dtype=None, mode='nexus+')