当前位置: 首页>>代码示例>>Python>>正文


Python ArraySave.getHDF5FileInstanceAndBuffer方法代码示例

本文整理汇总了Python中PyMca5.PyMcaIO.ArraySave.getHDF5FileInstanceAndBuffer方法的典型用法代码示例。如果您正苦于以下问题:Python ArraySave.getHDF5FileInstanceAndBuffer方法的具体用法?Python ArraySave.getHDF5FileInstanceAndBuffer怎么用?Python ArraySave.getHDF5FileInstanceAndBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyMca5.PyMcaIO.ArraySave的用法示例。


在下文中一共展示了ArraySave.getHDF5FileInstanceAndBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadFileList

# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import getHDF5FileInstanceAndBuffer [as 别名]

#.........这里部分代码省略.........
                   ('PySide' in sys.modules) or\
                   ('PyMca5.PyMcaGui.PyMcaQt' in sys.modules):
                    qtflag = True
                hdf5done = False
                if HDF5 and qtflag:
                    from PyMca5.PyMcaGui import PyMcaQt as qt
                    from PyMca5.PyMcaIO import ArraySave
                    msg=qt.QMessageBox.information( None,
                      "Memory error\n",
                      "Do you want to convert your data to HDF5?\n",
                      qt.QMessageBox.Yes,qt.QMessageBox.No)
                    if msg != qt.QMessageBox.No:
                        hdf5file = qt.QFileDialog.getSaveFileName(None,
                                    "Please select output file name",
                                    os.path.dirname(filelist[0]),
                                    "HDF5 files *.h5")
                        if not len(hdf5file):
                            raise IOError("Invalid output file")
                        hdf5file = qt.safe_str(hdf5file)
                        if not hdf5file.endswith(".h5"):
                            hdf5file += ".h5"

                        #get the final shape
                        from PyMca5.RGBCorrelatorWidget import ImageShapeDialog
                        stackImageShape = self.nbFiles,\
                                     int(numberofmca/numberofdetectors)
                        dialog = ImageShapeDialog(None, shape =stackImageShape)
                        dialog.setModal(True)
                        ret = dialog.exec_()
                        if ret:
                            stackImageShape= dialog.getImageShape()
                            dialog.close()
                            del dialog
                        hdf, self.data =  ArraySave.getHDF5FileInstanceAndBuffer(hdf5file,
                                       (stackImageShape[0],
                                        stackImageShape[1],
                                        arrRet.shape[0]),
                                       compression=None,
                                       interpretation="spectrum")
                        nRow = 0
                        nCol = 0
                        for tempFileName in filelist:
                            tempInstance=specfile.Specfile(tempFileName)
                            #it can only be here if there is one scan per file
                            #prevent problems if the scan number is different
                            #scan = tempInstance.select(keylist[-1])
                            scan = tempInstance[-1]
                            nRow = int(self.incrProgressBar/stackImageShape[1])
                            nCol = self.incrProgressBar%stackImageShape[1]
                            for i in iterlist:
                                #mcadata = scan_obj.mca(i)
                                self.data[nRow,
                                          nCol,
                                          :] = scan.mca(i)[:]
                                self.incrProgressBar += 1
                                self.onProgress(self.incrProgressBar)
                        hdf5done = True
                        hdf.flush()
                    self.onEnd()
                    self.info["SourceType"] = "HDF5Stack1D"
                    self.info["McaIndex"] = 2
                    self.info["FileIndex"] = 0
                    self.info["SourceName"] = [hdf5file]
                    self.info["NumberOfFiles"] = 1
                    self.info["Size"]       = 1
                    return
开发者ID:dnaudet,项目名称:pymca,代码行数:70,代码来源:SpecFileStack.py


注:本文中的PyMca5.PyMcaIO.ArraySave.getHDF5FileInstanceAndBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。