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


Python EDUtilsArray.xsDataToArray方法代码示例

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


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

示例1: testExecute

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()

        # Checking obtained results
        xsDataResult = plugin.getDataOutput()
        xsDataRef = XSDataResult1DPowderEDF.parseString(
            self.readAndParseFile(self.getReferenceDataOutputFile()))
        #        EDAssert.strAlmostEqual(XSDataResult1DPowderEDF.parseString(self.readAndParseFile(self.getReferenceDataOutputFile())).marshal(), xsDataResult.marshal(), _strComment="XML structures are the same")
        tthref = EDUtilsArray.xsDataToArray(
            xsDataRef.getTwoTheta(), _bCheckMd5sum=False)
        tthobt = EDUtilsArray.xsDataToArray(
            xsDataResult.getTwoTheta(), _bCheckMd5sum=False)

        Iref = EDUtilsArray.xsDataToArray(
            xsDataRef.getIntensity(), _bCheckMd5sum=False)
        Iobt = EDUtilsArray.xsDataToArray(
            xsDataResult.getIntensity(), _bCheckMd5sum=False)

        EDAssert.arraySimilar(
            _npaValue=tthobt,
            _npaRef=tthref,
            _fAbsMaxDelta=0.1,
            _strComment="2theta arrays are the same")
        EDAssert.arraySimilar(
            _npaValue=Iobt,
            _npaRef=Iref,
            _fAbsMaxDelta=0.1,
            _strComment="Intensity arrays are the same")
开发者ID:edna-site,项目名称:edna,代码行数:33,代码来源:EDTestCasePluginExecuteExportAsciiPowderEDF_array2array.py

示例2: process

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def process(self, _edObject = None):
        EDPluginExec.process(self)
        self.DEBUG("EDPluginExecWriteNexusFilev1_0.process")
        xsDataInput = self.getDataInput()
#        print xsDataInput.marshal()
        fileName = str(xsDataInput.outputFileName.value)
        if xsDataInput.outputFileDirectory is None:
            fileDir = self.getWorkingDirectory()
        else:
            fileDir = str(xsDataInput.outputFileDirectory.value)
#        timestamp = "2010-10-18T17:17:04-0500"
        timestamp = datetime.datetime.now().isoformat()
        instrument = str(xsDataInput.instrument.value)
        # Create nexus file
        nexusFile = self.makeFile(os.path.join(fileDir, fileName), file_name=fileName,
            file_time=timestamp,
            instrument=instrument,
            creator="EDPluginExecWriteNexusFilev1_0",
            NeXus_version="4.3.0",
            HDF5_Version=h5py.version.hdf5_version,
            h5py_version=h5py.version.version) 
        # Write main data
        nxentry = self.makeGroup(nexusFile, "Result", "NXentryResult")
        for nexusGroup in xsDataInput.nexusGroup:
            groupTitle = str(nexusGroup.title.value)
            long_name = str(nexusGroup.long_name.value)
            nxdata = self.makeGroup(nxentry, groupTitle, "NXdata", long_name=long_name)
            # First add the axes - if any...
            listAxisNames = []
            for xsDataNexusAxis in nexusGroup.axis:
                numpyAxisArray = EDUtilsArray.xsDataToArray(xsDataNexusAxis.axisData)
                self.makeDataset(nxdata, 
                                 str(xsDataNexusAxis.title.value), 
                                 numpyAxisArray, 
                                 axis=xsDataNexusAxis.axis.value,
                                 primary=xsDataNexusAxis.primary.value, 
                                 units=str(xsDataNexusAxis.units.value), 
                                 long_name=str(xsDataNexusAxis.long_name.value))
                listAxisNames.append(str(xsDataNexusAxis.title.value))
            numpyDataArray = EDUtilsArray.xsDataToArray(nexusGroup.data)
            strAxisNames = ""
            bFirst = True
            for strAxisName in listAxisNames:
                if bFirst:
                    strAxisNames += strAxisName
                    bFirst = False
                else:
                    strAxisNames += ":"+strAxisName
            self.makeDataset(nxdata, groupTitle, numpyDataArray.transpose(), 
                signal='1', # Y axis of default plot
                axes=strAxisNames, # name of X and Y axes
                long_name=long_name)
            pass
        xsDataResult = XSDataResultWriteNexusFile()
        xsDataResult.outputFilePath = XSDataFile(XSDataString(os.path.join(fileDir, fileName)))
        self.setDataOutput(xsDataResult)
开发者ID:regis73,项目名称:edna,代码行数:58,代码来源:EDPluginExecWriteNexusFilev1_0.py

示例3: doSuccessProcessOneFile

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def doSuccessProcessOneFile(self, _edPlugin=None):
        self.DEBUG("EDPluginBioSaxsHPLCv1_5.doSuccessProcessOneFile")
        self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsHPLCv1_5.doSuccessProcessOneFile")
        if _edPlugin and _edPlugin.dataOutput and _edPlugin.dataOutput.status and _edPlugin.dataOutput.status.executiveSummary:
            self.lstExecutiveSummary.append(_edPlugin.dataOutput.status.executiveSummary.value)
        output = _edPlugin.dataOutput
        if not output.integratedCurve:
            strErr = "Edna plugin ProcessOneFile did not produce integrated curve"
            self.ERROR(strErr)
            self.lstExecutiveSummary.append(strErr)
            self.setFailure()
            return
        self.curve = output.integratedCurve.path.value
        if not os.path.exists(self.curve):
            strErr = "Edna plugin ProcessOneFile: integrated curve not on disk !!"
            self.ERROR(strErr)
            self.lstExecutiveSummary.append(strErr)
            self.setFailure()
            return
        self.xsDataResult.integratedCurve = output.integratedCurve
        self.xsDataResult.normalizedImage = output.normalizedImage
        self.xsDataResult.dataI = output.dataI
        self.xsDataResult.dataQ = output.dataQ
        self.xsDataResult.dataStdErr = output.dataStdErr
        self.intensity = EDUtilsArray.xsDataToArray(output.dataI)
        self.stdError = EDUtilsArray.xsDataToArray(output.dataStdErr)
        if output.experimentSetup and output.experimentSetup.timeOfFrame:
            startTime = output.experimentSetup.timeOfFrame.value
        else:
            try:
                startTime = float(fabio.openheader(self.dataInput.rawImage.path.value).header["time_of_day"])
            except Exception:
                self.ERROR("Unable to read time_of_day in header of %s" % self.dataInput.rawImage.path.value)
                startTime = 0

        if not self.hplc_run.first_curve:
            with self._sem:
                if True: #not self.hplc_run.first_curve:
                    # Populate the buffer with the first curve if needed
                    self.hplc_run.first_curve = self.curve
                    self.hplc_run.start_time = startTime
                    self.hplc_run.q = EDUtilsArray.xsDataToArray(output.dataQ)
                    self.hplc_run.size = self.hplc_run.q.size
                    self.hplc_run.buffer_I = self.intensity
                    self.hplc_run.buffer_Stdev = self.stdError
                    self.hplc_run.firstCurveIntensity = self.intensity
                    self.hplc_run.for_buffer_sum_I = self.intensity
                    self.hplc_run.for_buffer_sum_sigma2 = self.stdError ** 2
                    self.hplc_run.for_buffer.append(self.frameId)
        self.frame.curve = self.curve
        self.frame.time = startTime
        self.xsDataResult.timeStamp = XSDataTime(value=(startTime - self.hplc_run.start_time))
#         self.calcIntensity()
        self.frame.sum_I = float(self.intensity.sum())
        self.xsDataResult.summedIntensity = XSDataDouble(value=self.frame.sum_I)
开发者ID:kif,项目名称:edna,代码行数:57,代码来源:EDPluginBioSaxsHPLCv1_5.py

示例4: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginExec.preProcess(self)
        self.DEBUG("EDPluginExecMeasureOffsetv1_0.preProcess")
        sdi = self.getDataInput()
        images = sdi.getImage()
        arrays = sdi.getArray()

        if len(images) == 2:
            self.npaIm1 = numpy.array(EDUtilsArray.getArray(images[0]))
            self.npaIm2 = numpy.array(EDUtilsArray.getArray(images[1]))
        elif len(arrays) == 2:
            self.npaIm1 = EDUtilsArray.xsDataToArray(arrays[0])
            self.npaIm2 = EDUtilsArray.xsDataToArray(arrays[1])
        else:
            strError = (
                "EDPluginExecMeasureOffsetv1_0.preProcess: You should either provide two images or two arrays, but I got: %s"
                % sdi.marshal()[:1000]
            )
            self.ERROR(strError)
            self.setFailure()
            raise RuntimeError(strError)

        crop = sdi.getCropBorders()
        if len(crop) > 1:
            self.tCrop = tuple([i.getValue() for i in crop])
        elif len(crop) == 1:
            self.tCrop = (crop[0].getValue(), crop[0].getValue())

        center = sdi.getCenter()
        if len(center) > 1:
            self.tCenter = tuple([i.getValue() for i in center])
        elif len(center) == 1:
            self.tCenter = (center[0].getValue(), center[0].getValue())

        width = sdi.getWidth()
        if len(width) > 1:
            self.tWidth = tuple([i.getValue() for i in width])
        elif len(width) == 1:
            self.tWidth = (width[0].getValue(), width[0].getValue())

        smooth = sdi.getSmoothBorders()
        if len(smooth) == 2:
            self.tSmooth = (smooth[0].getValue(), smooth[1].getValue())
        elif len(smooth) == 1:
            self.tSmooth = (smooth[0].getValue(), smooth[0].getValue())

        if sdi.getBackgroundSubtraction() is not None:
            self.bBackgroundsubtraction = sdi.getBackgroundSubtraction().getValue() in [1, True, "true"]

        if sdi.getSobelFilter() is not None:
            self.sobel = sdi.getSobelFilter() in [1, True, "true"]
        EDAssert.equal(self.npaIm1.shape, self.npaIm2.shape, "Images have the same size")
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:54,代码来源:EDPluginExecMeasureOffsetv1_0.py

示例5: unitTestXsdToArray

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
 def unitTestXsdToArray(self):
     """
     test the execution of xsDataToArray static method
     """
     EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestXsdToArray")
     if numpy is not None:
         EDAssert.arraySimilar(self.arrayNumpy,
                               EDUtilsArray.xsDataToArray(self.xsDataArrayNumpy, _bForceNoNumpy=False),
                               _strComment="Array are the same (Numpy used)")
     else:
         EDAssert.equal(self.arrayNoNumpy,
                        EDUtilsArray.xsDataToArray(self.xsDataArrayNumpy, _bCheckMd5sum=True, _bForceNoNumpy=False),
                        "Array are the same (no Numpy available)")
开发者ID:antolinos,项目名称:edna,代码行数:15,代码来源:EDTestCaseEDUtilsArray.py

示例6: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginExec.preProcess(self)
        self.DEBUG("EDPluginExecAlignFramev1_0.preProcess")
        sdi = self.dataInput
        images = sdi.image
        arrays = sdi.array

        if len(images) == 2:
            self.npaIm1 = numpy.array(EDUtilsArray.getArray(images[0]))
            self.npaIm2 = numpy.array(EDUtilsArray.getArray(images[1]))
        elif len(arrays) == 2:
            self.npaIm1 = EDUtilsArray.xsDataToArray(arrays[0])
            self.npaIm2 = EDUtilsArray.xsDataToArray(arrays[1])
        else:
            strError = "EDPluginExecAlignFramev1_0.preProcess: You should either provide two images or two arrays, but I got: %s" % sdi.marshal()[:1000]
            self.ERROR(strError)
            self.setFailure()
            raise RuntimeError(strError)

        crop = sdi.cropBorders
        if len(crop) > 1 :
            self.tCrop = tuple([ i.value for i in crop ])
        elif len(crop) == 1:
            self.tCrop = (crop[0].value, crop[0].value)

        center = sdi.center
        if len(center) > 1:
            self.tCenter = tuple([ i.value for i in center ])
        elif len(center) == 1:
            self.tCenter = (center[0].value, center[0].value)

        width = sdi.width
        if len(width) > 1 :
            self.tWidth = tuple([i.value for i in width])
        elif len(width) == 1:
            self.tWidth = (width[0].value, width[0].value)

        smooth = sdi.smoothBorders
        if len(smooth) == 2:
            self.tSmooth = (smooth[0].value, smooth[1].value)
        elif len(smooth) == 1:
            self.tSmooth = (smooth[0].value, smooth[0].value)

        if sdi.backgroundSubtraction is not None:
            self.bBackgroundsubtraction = (sdi.backgroundSubtraction.value in [1, True, "true"])

        if sdi.sobelFilter is not None:
            self.sobel = (sdi.sobelFilter in [1, True, "true"])
        EDAssert.equal(self.npaIm1.shape , self.npaIm2.shape, "Images have the same size")
开发者ID:gbourgh,项目名称:edna,代码行数:51,代码来源:EDPluginExecAlignFramev1_0.py

示例7: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginHDF5.preProcess(self)
        self.DEBUG("EDPluginHDF5StackImagesv10.preProcess")

        for onefile in self.dataInput.inputImageFile:
            if onefile is None:
                self.ERROR("Please investigate why  EDPluginHDF5StackImagesv10.dataInput.inputImageFile is a list containing None !!!!")
                self.setFailure()
                continue
            if onefile.path is not None:
                self.listImageFilenames.append(onefile.path.value)
            if onefile.date is not None:
                self.listImageDates.append(onefile.date.value)
            if onefile.number is not None:
                self.listForcedPositions.append(onefile.number.value)
            self.listArray.append(EDUtilsArray.getArray(onefile))

        for oneArray in self.dataInput.inputArray:
            self.listArray.append(EDUtilsArray.xsDataToArray(oneArray))

        if self.dataInput.index != []:
            self.listForcedPositions = [i.value for i in self.dataInput.index]

        if self.dataInput.getDeleteInputImage() is not None:
            self.bDeleteImage = bool(self.dataInput.deleteInputImage.value)

        if self.listForcedPositions != []:
            EDAssert.equal(len(self.listForcedPositions), max(len(self.listImageFilenames), len(self.listArray)), "Forced position list has a good length")
        if self.listImageDates != []:
            EDAssert.equal(len(self.listImageDates) , len(self.listImageFilenames), "listImageDates has the same size as listImageFilenames")

        self.hdf5group = EDPluginHDF5.createStructure(self.strHDF5Filename, self.strHDF5Path, self.dictExtraAttributes)
开发者ID:antolinos,项目名称:edna,代码行数:34,代码来源:EDPluginHDF5StackImagesv10.py

示例8: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginHDF5.preProcess(self)
        self.DEBUG("EDPluginHDF5StackImagesv10test.preProcess")

        for onefile in self.dataInput.inputImageFile:
            if onefile.path is not None:
                self.listImageFilenames.append(onefile.path.value)
            if onefile.date is not None:
                self.listImageDates.append(onefile.date.value)
            if onefile.number is not None:
                self.listForcedPositions.append(onefile.number.value)
            self.listArray.append(EDUtilsArray.getArray(onefile))

        for oneArray in self.dataInput.getInputArray():
            self.listArray.append(EDUtilsArray.xsDataToArray(oneArray))

        if self.dataInput.index != []:
            self.listForcedPositions = [i.value for i in self.dataInput.index]

        if self.dataInput.getDeleteInputImage() is not None:
            self.bDeleteImage = bool(self.dataInput.deleteInputImage.value)

        if self.listForcedPositions != []:
            EDAssert.equal(len(self.listForcedPositions), max(len(self.listImageFilenames), len(self.listArray)), "Forced position list has a good length")
        if self.listImageDates != []:
            EDAssert.equal(len(self.listImageDates) , len(self.listImageFilenames), "listImageDates has the same size as listImageFilenames")
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:28,代码来源:EDPluginHDF5StackImagesv10test.py

示例9: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginExec.preProcess(self)
        self.DEBUG("EDPluginExecShiftImagev1_0.preProcess")
        sdi = self.dataInput
        if sdi.inputImage is not None:
            self.npaImage = numpy.array(EDUtilsArray.getArray(sdi.inputImage))
        elif  sdi.inputArray is not None:
            self.npaImage = EDUtilsArray.xsDataToArray(sdi.getInputArray())
        else:
            self.ERROR("EDPluginExecShiftImagev1_0.preProcess: You should either provide an images or an arrays, but I got: %s" % sdi.marshal())
            self.setFailure()
            raise RuntimeError

        offset = sdi.offset
        if len(offset) == 2:
            self.tOffset = (offset[0].value, offset[1].value)
        elif len(offset) == 1:
            self.tOffset = (offset[0].value, offset[0].value)

        if sdi.outputImage is not None:
            if sdi.outputImage.path is not None:
                self.strOutputType = "file"
                self.strOutputImage = sdi.outputImage.path.value
            if sdi.outputImage.shared is not None:
                self.strOutputType = "shared"
                self.strOutputImage = sdi.outputImage.shared.value
            if sdi.outputImage.array is not None:
                self.strOutputType = "array"
开发者ID:antolinos,项目名称:edna,代码行数:30,代码来源:EDPluginExecShiftImagev1_1.py

示例10: unitTestXsdToArrayNoNumpy

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
 def unitTestXsdToArrayNoNumpy(self):
     """
     test the execution of detectNumberOfCPUs
     """
     EDVerbose.DEBUG("EDTestCaseEDUtilsArray.unitTestXsdToArrayNoNumpy")
     EDAssert.equal(self.arrayNoNumpy,
                    EDUtilsArray.xsDataToArray(self.xsDataArrayNumpy, _bForceNoNumpy=True),
                    "Array are the same (forced No Numpy)")
开发者ID:antolinos,项目名称:edna,代码行数:10,代码来源:EDTestCaseEDUtilsArray.py

示例11: testExecute

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def testExecute(self):
        """
        """
        self.run()
#        plugin = self.getPlugin()

        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
        strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultNormalize.parseString(strExpectedOutput)
        xsDataResultObtained = XSDataResultNormalize.parseString(strObtainedOutput)

        #EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "Result XML are the same")

        npaReference = EDUtilsArray.xsDataToArray(xsDataResultReference.output.array)
        npaObtained = EDUtilsArray.xsDataToArray(xsDataResultObtained.output.array)
        EDAssert.arraySimilar(npaReference, npaObtained, "Arrays are the same", _fAbsMaxDelta=1e-6)
        EDAssert.equal(npaReference.dtype, npaObtained.dtype, "Datatypes are the same")
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:20,代码来源:EDTestCasePluginExecuteExecNormalizeImagev1_0_file.py

示例12: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        self.DEBUG("EDPluginExecGnomv0_2.preProcess")
        if self.dataInput.angularScale is not None:
            self.fAngularScale = self.dataInput.angularScale.value
        dataInput = self.dataInput

        inputFile = None
        if len(dataInput.experimentalDataQ) > 0:
            self.npaExperimentalDataQ = numpy.array([i.value for i in dataInput.experimentalDataQ])
        elif dataInput.experimentalDataQArray is not None:
            self.npaExperimentalDataQ = EDUtilsArray.xsDataToArray(dataInput.experimentalDataQArray)
        elif dataInput.experimentalDataFile is not None:
            inputFile = dataInput.experimentalDataFile.path.value
        else:
            strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataQ or experimentalDataQArray or experimentalDataFile"
            self.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        if len(dataInput.experimentalDataValues) > 0:
            self.npaExperimentalDataI = numpy.array([i.value for i in dataInput.experimentalDataValues])
        elif dataInput.experimentalDataIArray is not None:
            self.npaExperimentalDataI = EDUtilsArray.xsDataToArray(dataInput.experimentalDataIArray)
        elif dataInput.experimentalDataFile is not None:
            inputFile = dataInput.experimentalDataFile.path.value
        else:
            strErrorMessage = "EDPluginExecGnomv0_2: input parameter is missing: experimentalDataValues or experimentalDataIArray or experimentalDataFile"
            self.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        if len(dataInput.experimentalDataStdDev) > 0:
            self.npaExperimentalDataStdDev = numpy.array([i.value for i in dataInput.experimentalDataStdDev])
        elif dataInput.experimentalDataStdArray is not None:
            self.npaExperimentalDataStdDev = EDUtilsArray.getArray(dataInput.experimentalDataStdArray)

        if inputFile:
            self.loadDataFile(inputFile)

        self.generateGnomConfigFile()
        self.generateGnomScript()
开发者ID:gbourgh,项目名称:edna,代码行数:44,代码来源:EDPluginExecGnomv0_2.py

示例13: prepareGleGraph

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
 def prepareGleGraph(self, _xsDataPlot):
     strGraph = ""
     if _xsDataPlot.xsize != None and _xsDataPlot.ysize != None:
         strGraph += "size %f %f\n" % (_xsDataPlot.xsize, _xsDataPlot.ysize)
     strGraph += "begin graph\n"
     strGraph += '  title "%s"\n' % _xsDataPlot.title
     strGraph += '  xtitle "%s"\n' % _xsDataPlot.xtitle
     strGraph += '  ytitle "%s"\n' % _xsDataPlot.ytitle
     if _xsDataPlot.xmin != None or _xsDataPlot.xmax != None:
         strGraph += "  xaxis "
         if _xsDataPlot.xmin != None:
             strGraph += "min %f " % _xsDataPlot.xmin
         if _xsDataPlot.xmax != None:
             strGraph += "max %f " % _xsDataPlot.xmax
         strGraph += "\n"
     if _xsDataPlot.ymin != None or _xsDataPlot.ymax != None:
         strGraph += "  yaxis "
         if _xsDataPlot.ymin != None:
             strGraph += "min %f " % _xsDataPlot.ymin
         if _xsDataPlot.ymax != None:
             strGraph += "max %f " % _xsDataPlot.ymax
         strGraph += "\n"
     if _xsDataPlot.keypos is None:
         strGraph += "  key pos tl hei 0.25\n"
     else:
         strGraph += "  key pos %s hei 0.25\n" % _xsDataPlot.keypos
     iIndex = 1
     listDataFiles = []
     for xsDataGraph in _xsDataPlot.graph:
         strTmpDataPath = tempfile.mkstemp(prefix="data_", suffix=".dat", dir=self.getWorkingDirectory(), text=True)[
             1
         ]
         numpyData = EDUtilsArray.xsDataToArray(xsDataGraph.data, _bForceNoNumpy=True)
         numpy.savetxt(strTmpDataPath, numpyData, delimiter=" ")
         listDataFiles.append(strTmpDataPath)
         # EDUtilsFile.writeFile(strTmpDataPath, strData)
         strGraph += "  data %s\n" % strTmpDataPath
         strGraph += "  d%d line " % iIndex
         if xsDataGraph.lineColor != None and xsDataGraph.lineColor != "None":
             strGraph += " color %s " % xsDataGraph.lineColor
         if xsDataGraph.lineStyle != None and xsDataGraph.lineStyle != "None":
             strGraph += " lstyle %s " % xsDataGraph.lineStyle
         if xsDataGraph.lineWidth != None:
             strGraph += " lwidth %f " % xsDataGraph.lineWidth
         if xsDataGraph.markerType != None and xsDataGraph.markerType != "None":
             strGraph += " marker %s " % xsDataGraph.markerType
         if xsDataGraph.markerColor != None and xsDataGraph.markerColor != "None":
             strGraph += " color %s " % xsDataGraph.markerColor
         if xsDataGraph.label != None and xsDataGraph.label != "None":
             strGraph += ' key "%s" ' % xsDataGraph.label
         strGraph += "\n"
         iIndex += 1
     strGraph += "end graph\n"
     return (strGraph, listDataFiles)
开发者ID:edna-site,项目名称:edna,代码行数:56,代码来源:EDPluginExecPlotGlev1_0.py

示例14: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
 def preProcess(self, _edObject=None):
     EDPluginExec.preProcess(self)
     self.DEBUG("EDPluginExecMatrixInvertv2_0.preProcess")
     self.xsdMatIn = self.dataInput.inputMatrix
     if self.xsdMatIn.path is not None:
         self.matIn = fabio.open(self.xsdMatIn.path.value).data
     elif self.xsdMatIn.shared is not None:
         self.matIn = EDShare[self.xsdMatIn.shared.value]
     elif self.xsdMatIn.array is not None:
         self.matIn = EDUtilsArray.xsDataToArray(self.xsdMatIn.array)
     else:
         self.ERROR("No valid input array provided")
     if self.matIn is None:
         self.ERROR("Input array is None")
         self.setFailure()
开发者ID:antolinos,项目名称:edna,代码行数:17,代码来源:EDPluginExecMatrixInvertv2_0.py

示例15: preProcess

# 需要导入模块: from EDUtilsArray import EDUtilsArray [as 别名]
# 或者: from EDUtilsArray.EDUtilsArray import xsDataToArray [as 别名]
    def preProcess(self, _edObject=None):
        EDPluginExec.preProcess(self)
        self.DEBUG("EDPluginExecStitchOffsetedImagev1_0.preProcess")
        sdi = self.getDataInput()
        for ofImage in sdi.getInputImages():
            if (ofImage.file is not None) and os.path.isfile(ofImage.file.path.value):
                self._lImages.append(EDUtilsArray.getArray(ofImage.file))
            elif (ofImage.array is not None):
                self._lImages.append(EDUtilsArray.xsDataToArray(ofImage.array))
            else:
                strError = "EDPluginExecStitchOffsetedImagev1_0.preProcess: You need to provide either an image file either an array; I got: %s !!!" % ofImage.marshal()
                self.ERROR(strError)
                raise RuntimeError(strError)
            dummy = [0.0, 0.001]
            if ofImage.dummyValue is not None:
                dummy[0] = ofImage.dummyValue.value
            if ofImage.deltaDummy is not None:
                dummy[1] = ofImage.deltaDummy.value
            self._lDummies.append(tuple(dummy))
            if ofImage.offset not in [list(), None]:
                offset = [i.value for i in ofImage.offset ]
            else:
                offset = [0, 0]
            self._lOffsets.append(tuple(offset))
        if sdi.blending is not None:
            self._strBlending = sdi.blending.value
        if sdi.dummyValue is not None:
            self._fDummy = sdi.dummyValue.value
        if sdi.outputImage is not None:
            self._strOutFile = sdi.outputImage.path.value
        if sdi.autoscale is not None:
            self._bAutoscale = bool(sdi.autoscale.value)
        if sdi.mask is not None:
            self._strMask = sdi.mask.path.value
            if not os.path.isfile(self._strMask):
                self._strMask = None

        center = sdi.centerROI
        if len(center) > 1:
            self.tCenter = tuple([ i.value for i in center ])
        elif len(center) == 1:
            self.tCenter = (center[0].value, center[0].value)

        width = sdi.widthROI
        if len(width) > 1 :
            self.tWidth = tuple([i.value for i in width])
        elif len(width) == 1:
            self.tWidth = (width[0].value, width[0].value)
开发者ID:olofsvensson,项目名称:edna-plugins-exec,代码行数:50,代码来源:EDPluginExecStitchOffsetedImagev1_0.py


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