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


Python EDUtilsArray.arrayToXSData方法代码示例

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


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

示例1: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def postProcess(self, _edObject=None):
        EDPluginExec.postProcess(self)
        self.DEBUG("EDPluginExecShiftImagev1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultShiftImage()
        if self.strOutputType is None:
            xsDataResult.setOutputArray(EDUtilsArray.arrayToXSData(self.npaImage))
        elif self.strOutputType == "file":
            image = edfimage(
                data=self.npaImage,
                header={"Offset_1": self.tOffset[0], "Offset_2": self.tOffset[1], "Max_Offset": self.MAX_OFFSET_VALUE},
            )
            image.write(self.strOutputImage, force_type=self.npaImage.dtype)
            xsdimg = XSDataImageExt(path=XSDataString(self.strOutputImage))
            xsDataResult.outputImage = xsdimg
        elif self.strOutputType == "shared":
            EDShare[self.strOutputImage] = self.npaImage
            xsdimg = XSDataImageExt(shared=XSDataString(self.strOutputImage))
            xsDataResult.outputImage = xsdimg
        elif self.strOutputType == "array":
            xsdimg = XSDataImageExt(array=EDUtilsArray.arrayToXSData(self.npaImage))
            xsDataResult.outputImage = xsdimg

        self.setDataOutput(xsDataResult)
        self.npaImage = None
开发者ID:gbourgh,项目名称:edna,代码行数:27,代码来源:EDPluginExecShiftImagev1_1.py

示例2: process

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def process(self, _edObject = None):
        EDPluginExec.process(self)
        self.DEBUG("EDPluginExecReadDataID24v1_0.process")
        self.checkMandatoryParameters(self.dataInput, "Data Input is None")
        self.checkMandatoryParameters(self.dataInput.inputFile, "Data Input 'inputFile' is None")
        self.checkMandatoryParameters(self.dataInput.energyCalibration, "Data Input 'energyuCalibration' is None")
        self.checkMandatoryParameters(self.dataInput.energyCalibration.a, "Data Input 'energyCalibration a' is None")
        self.checkMandatoryParameters(self.dataInput.energyCalibration.b, "Data Input 'energyCalibration b' is None")
        # Load input data
        listNumpyArray = []
        iNumberOfSPectra = 0
        iNumberOfEnergies = 0
        for xsDataFile in self.dataInput.inputFile:
            numpyDataArray = self.loadInputData(xsDataFile.path.value)
#            print numpyDataArray.shape
            listNumpyArray.append(numpyDataArray)
            iNumberOfEnergies = numpyDataArray.shape[0]
            iNumberOfSPectra += numpyDataArray.shape[1]
        numpyTotalDataArray = numpy.zeros((iNumberOfEnergies,iNumberOfSPectra))
#        print numpyTotalDataArray.shape
        iIndex = 0
        for numpyDataArray in listNumpyArray:
            iSpectra = numpyDataArray.shape[1]
            numpyTotalDataArray[:,iIndex:iIndex+iSpectra] = numpyDataArray
            iIndex += iSpectra
            
        # Create energy calibration array
        numpyEnergyCalibrationArray = self.createEnergyCalibrationArray(numpyTotalDataArray.shape[0], self.dataInput.energyCalibration)
        # Create some output data
        xsDataResultReadDataID24 = XSDataResultReadDataID24()
        xsDataResultReadDataID24.energy = EDUtilsArray.arrayToXSData(numpyEnergyCalibrationArray)
        xsDataResultReadDataID24.dataArray = EDUtilsArray.arrayToXSData(numpyTotalDataArray)
        self.setDataOutput(xsDataResultReadDataID24)
开发者ID:edna-site,项目名称:edna,代码行数:35,代码来源:EDPluginExecReadDataID24v1_0.py

示例3: createNexusGroup

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def createNexusGroup(self, _numpyDataArray,_groupTitle, _groupLongName, 
                         _numpyXAxisDataArray=None, _xAxisTitle=None, _xAxisLongName=None, _xAxisUnit=None,
                         _numpyYAxisDataArray=None, _yAxisTitle=None, _yAxisLongName=None, _yAxisUnit=None,
                         ):
        # Create entry for data arrays in nexus file
        xsDataNexusArrayGroup = XSDataNexusArrayGroup()
        xsDataNexusArrayGroup.title = XSDataString(_groupTitle)
        xsDataNexusArrayGroup.long_name = XSDataString(_groupLongName)
        xsDataNexusArrayGroup.data = EDUtilsArray.arrayToXSData(_numpyDataArray)
        xsDataNexusArrayGroup.signal = XSDataInteger(1)
        if _numpyXAxisDataArray is not None:
            xsDataNexusAxisX = XSDataNexusAxis()
            xsDataNexusAxisX.title = XSDataString(_xAxisTitle)
            xsDataNexusAxisX.long_name = XSDataString(_xAxisLongName)
            xsDataNexusAxisX.primary = XSDataInteger(1)
            xsDataNexusAxisX.axis = XSDataInteger(0)
            xsDataNexusAxisX.units = XSDataString(_xAxisUnit)
            xsDataNexusAxisX.axisData = EDUtilsArray.arrayToXSData(_numpyXAxisDataArray)
            xsDataNexusArrayGroup.addAxis(xsDataNexusAxisX)
        if _numpyYAxisDataArray is not None:
            xsDataNexusAxisY = XSDataNexusAxis()
            xsDataNexusAxisY.title = XSDataString(_yAxisTitle)
            xsDataNexusAxisY.long_name = XSDataString(_yAxisLongName)
            xsDataNexusAxisY.primary = XSDataInteger(2)
            xsDataNexusAxisY.axis = XSDataInteger(1)
            xsDataNexusAxisY.units = XSDataString(_yAxisUnit)
            xsDataNexusAxisY.axisData = EDUtilsArray.arrayToXSData(_numpyYAxisDataArray)
            xsDataNexusArrayGroup.addAxis(xsDataNexusAxisY)
#        print xsDataInputWriteNexusFile.marshal()
        return xsDataNexusArrayGroup
开发者ID:regis73,项目名称:edna,代码行数:32,代码来源:EDPluginControlTRExafsv1_0.py

示例4: unitTestArraytoXsdNoNumpy

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def unitTestArraytoXsdNoNumpy(self):
     """
     test the execution of detectNumberOfCPUs
     """
     EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestArraytoXsdNoNumpy")
     EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
                             EDUtilsArray.arrayToXSData(self.arrayNumpy, _bForceNoNumpy=True).marshal(),
                             _strComment="XSDataArray from (numpyArray) are the same (forced No Numpy)")
     EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
                             EDUtilsArray.arrayToXSData(self.arrayNoNumpy, _bForceNoNumpy=True).marshal(),
                             _strComment="XSDataArray from (list of lists) are the same (forced No Numpy)")
开发者ID:antolinos,项目名称:edna,代码行数:13,代码来源:EDTestCaseEDUtilsArray.py

示例5: unitTestArraytoXsd

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def unitTestArraytoXsd(self):
     """
     test the execution of xsDataToArray static method
     """
     EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestArraytoXsd")
     if numpy is not None:
         EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNumpy).marshal(),
                                 EDUtilsArray.arrayToXSData(self.arrayNumpy).marshal(),
                                 _strComment="XSDataArray from (numpyArray) are the same")
     else:
         EDAssert.strAlmostEqual(XSDataArray.parseString(self.strXSDataArrayNoNumpy).marshal(),
                                 EDUtilsArray.arrayToXSData(self.arrayNumpy).marshal(),
                                 _strComment="XSDataArray from (Non numpy Array) are the same")
开发者ID:antolinos,项目名称:edna,代码行数:15,代码来源:EDTestCaseEDUtilsArray.py

示例6: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def postProcess(self, _edObject=None):
     EDPluginExecProcessScript.postProcess(self)
     self.DEBUG("EDPluginExecGnomv0_2.postProcess")
     # Create some output data
     self.parseGnomOutputFile()
     xsDataResult = XSDataResultGnom(radiusOfGyration=XSDataDouble(self.fRadiusOfGir),
                                     arrayErr=EDUtilsArray.arrayToXSData(self.npaPRerr),
                                     arrayPr=EDUtilsArray.arrayToXSData(self.npaPR),
                                     arrayR=EDUtilsArray.arrayToXSData(self.npaR),
                                     scatteringFitIArray=EDUtilsArray.arrayToXSData(self.npaFitDataI),
                                     scatteringFitQArray=EDUtilsArray.arrayToXSData(self.npaFitDataQ),
                                     output=XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), "gnom.out"))),
                                     fitQuality=XSDataDouble(self.fFitQuality))
     self.dataOutput = xsDataResult
开发者ID:gbourgh,项目名称:edna,代码行数:16,代码来源:EDPluginExecGnomv0_2.py

示例7: process

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def process(self, _edObject=None):
     EDPluginExec.process(self)
     self.DEBUG("EDPluginExecReadDataBM23v1_0.process")
     self.checkMandatoryParameters(self.dataInput, "Data Input is None")
     self.checkMandatoryParameters(self.dataInput.inputFile, "Data Input 'inputFile' is None")
     iSkipHeaderLines = 0
     if self.dataInput.nSkipHeader:
         iSkipHeaderLines = self.dataInput.nSkipHeader.value
     # Load input data
     numpyDataArray = numpy.genfromtxt(self.dataInput.inputFile.path.value, skip_header=iSkipHeaderLines)
     # Create output data
     xsDataResultReadDataBM23 = XSDataResultReadDataBM23()
     xsDataResultReadDataBM23.energy = EDUtilsArray.arrayToXSData(numpyDataArray[:, 0])
     xsDataResultReadDataBM23.dataArray = EDUtilsArray.arrayToXSData(numpyDataArray[:, 1:])
     self.setDataOutput(xsDataResultReadDataBM23)
开发者ID:edna-site,项目名称:edna,代码行数:17,代码来源:EDPluginExecReadDataBM23v1_0.py

示例8: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     EDVerbose.DEBUG("EDPluginExportAsciiPowderv1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResult1DPowderEDF()
     if self.outputFilename is None:
         xsDataResult.setTwoTheta(EDUtilsArray.arrayToXSData(self.npaTwoTheta))
         xsDataResult.setIntensity(EDUtilsArray.arrayToXSData(self.npaIntensities))
     else:
         xsdFile = XSDataFile()
         xsdFile.setPath(XSDataString(self.outputFilename))
         xsDataResult.setOutputFile(xsdFile)
     self.setDataOutput(xsDataResult)
     self.npaTwoTheta = None
     self.npaIntensities = None
     self.inputArray = None
开发者ID:gbourgh,项目名称:edna,代码行数:18,代码来源:EDPluginExportAsciiPowderv1_0.py

示例9: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     EDVerbose.DEBUG("EDPluginExecMatrixInvertv1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultMatrixInvert()
     xsdMatOut = EDUtilsArray.arrayToXSData(self.matOut, _bIncludeMd5sum=False)
     xsDataResult.setOutputMatrix(xsdMatOut)
     self.setDataOutput(xsDataResult)
开发者ID:antolinos,项目名称:edna,代码行数:10,代码来源:EDPluginExecMatrixInvertv1_0.py

示例10: testCheckParameters

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def testCheckParameters(self):
     xsDataInputJesf = XSDataInputJesf()
     numpyData = numpy.genfromtxt(os.path.join(self.getPluginTestsDataHome(),"spectra.dat"))
     xsDataArray = EDUtilsArray.arrayToXSData(numpyData)
     xsDataInputJesf.setData(xsDataArray)
     #print xsDataInputJesf.marshal()
     xsDataInputJesf.exportToFile(os.path.join(self.getPluginTestsDataHome(),"XSDataInputJesfv1_0_reference.xml"))
     edPluginExecJesf = self.createPlugin()
     edPluginExecJesf.setDataInput(xsDataInputJesf)
     edPluginExecJesf.checkParameters()
开发者ID:edna-site,项目名称:edna,代码行数:12,代码来源:EDTestCasePluginUnitExecJesfv1_0.py

示例11: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginControl.preProcess(self)
        EDVerbose.DEBUG("EDPluginExecMeasureOffsetv2_0.preProcess")
        sdi = self.getDataInput()

        crop = sdi.getCropBorders()
        if len(crop) == 2:
            self.tCrop = (crop[0].getValue(), crop[1].getValue())
        elif len(crop) == 1:
            self.tCrop = (crop[0].getValue(), crop[0].getValue())

#
        if len(sdi.getImage()) == 2:
            for i in sdi.getImage():

                array = openimage(i.getPath().getValue()).data
                shape = array.shape
                if (self.tCrop != [0, 0]) and (shape[0] > self.tCrop[0]) and (shape[1] > self.tCrop[1]):
                    array = array[self.tCrop[0]:-self.tCrop[0], self.tCrop[1]:-self.tCrop[1] ]
                    EDVerbose.DEBUG("After Crop, images have shape : (%s,%s) " % (array.shape))
                self.xsdImages.append(EDUtilsArray.arrayToXSData(array))
        elif len(sdi.getArray()) == 2:
            if (self.tCrop == [0, 0]) :
                self.xsdImages = sdi.getArray()
            else:
                for xsdArray  in  sdi.getArray():
                    array = EDUtilsArray.xsDataToArray(xsdArray)
                    shape = array.shape
                    if (shape[0] > self.tCrop[0]) and (shape[1] > self.tCrop[1]):
                        array = array[self.tCrop[0]:-self.tCrop[0], self.tCrop[1]:-self.tCrop[1] ]
                        EDVerbose.DEBUG("After Crop, images have shape : (%s,%s) " % (array.shape))
                    self.xsdImages.append(EDUtilsArray.arrayToXSData(array))
        else:
            strError = "EDPluginExecMeasureOffsetv2_0.preProcess: You should either provide two images or two arrays, but I got: %s" % sdi.marshal()
            EDVerbose.ERROR(strError)
            self.setFailure()
            raise RuntimeError(strError)
        EDVerbose.DEBUG("EDPluginExecMeasureOffsetv2_0.xsdImages len=%i %s" % (len(self.xsdImages), self.xsdImages))
        EDAssert.equal(self.xsdImages[0].getShape() , self.xsdImages[1].getShape(), "Images have the same size")
        self.xsdIdx = sdi.getIndex()
        if len(self.xsdIdx) < len(self.xsdImages):
            self.xsdIdx = [XSDataInteger(i) for i in range(len(self.xsdImages))]
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:44,代码来源:EDPluginExecMeasureOffsetv2_0.py

示例12: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     self.DEBUG("EDPluginExecStitchOffsetedImagev1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultStitchOffsetedImage()
     if self._strOutFile is not None:
         edf = edfimage(data=self._ndaResult, header={"Dummy":str(self._fDummy), "Blending":self._strBlending, "Autoscale":str(self._bAutoscale)})
         edf.write(self._strOutFile)
         xsDataResult.setOutputImage(XSDataImageExt(path=XSDataString(self._strOutFile)))
     else:
         xsDataResult.setOutputArray(EDUtilsArray.arrayToXSData(self._ndaResult))
     self.setDataOutput(xsDataResult)
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:14,代码来源:EDPluginExecStitchOffsetedImagev1_0.py

示例13: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def postProcess(self, _edObject=None):
        EDPluginExec.postProcess(self)
        self.DEBUG("EDPluginExecPyFAIv1_0.postProcess")
        # Create some output data
        if self.strOutputFile:
            output = XSDataImageExt(path=XSDataString(self.strOutputFile))
        elif self.shared:
            output = XSDataImageExt(shared=XSDataString(self.shared))
        else:
            output = XSDataImageExt(array=EDUtilsArray.arrayToXSData(self.npaOut))
        xsDataResult = XSDataResultPyFAI(output=output)

        self.setDataOutput(xsDataResult)
开发者ID:antolinos,项目名称:edna,代码行数:15,代码来源:EDPluginExecPyFAIv1_0.py

示例14: process

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        self.DEBUG("EDPluginBioSaxsProcessOneFilev1_6.process")

        xsd = XSDataInputWaitFile(expectedFile=XSDataFile(XSDataString(self.rawImage)),
                                  expectedSize=self.rawImageSize,
                                  timeOut=XSDataTime(30))
        self.__edPluginWaitFile.setDataInput(xsd)
        self.__edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
        self.__edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
        self.__edPluginWaitFile.executeSynchronous()
        if self.isFailure():
            return

        self.xsDataResult.sample = self.sample
        self.xsDataResult.experimentSetup = self.experimentSetup

        res = self.integrate()
        self.write3ColumnAscii(res, self.integratedCurve)
        self.xsDataResult.dataQ = EDUtilsArray.arrayToXSData(res.radial)
        self.xsDataResult.dataI = EDUtilsArray.arrayToXSData(res.intensity)
        self.xsDataResult.dataStdErr = EDUtilsArray.arrayToXSData(res.sigma)
开发者ID:kif,项目名称:edna,代码行数:24,代码来源:EDPluginBioSaxsProcessOneFilev1_6.py

示例15: postProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import arrayToXSData [as 别名]
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     EDVerbose.DEBUG("EDPluginExecShiftImagev1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultShiftImage()
     if self.strOutputImage is None:
         #ArrayOutput
         xsDataResult.setOutputArray(EDUtilsArray.arrayToXSData(self.npaImage))
     else:
         image = edfimage(data=self.npaImage, header={"Offset_1":self.tOffset[0], "Offset_2":self.tOffset[1]})
         image.write(self.strOutputImage, force_type=self.npaImage.dtype)
         xsdimg = XSDataImageExt(path=XSDataString(self.strOutputImage))
         xsDataResult.setOutputImage(xsdimg)
     self.setDataOutput(xsDataResult)
开发者ID:antolinos,项目名称:edna,代码行数:16,代码来源:EDPluginExecShiftImagev1_0.py


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