當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。