當前位置: 首頁>>代碼示例>>Python>>正文


Python XSDataCommon.XSDataImage類代碼示例

本文整理匯總了Python中XSDataCommon.XSDataImage的典型用法代碼示例。如果您正苦於以下問題:Python XSDataImage類的具體用法?Python XSDataImage怎麽用?Python XSDataImage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了XSDataImage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: doSuccessExecMetadata

 def doSuccessExecMetadata(self, _edPlugin=None):
     self.DEBUG("EDPluginBioSaxsNormalizev1_0.doSuccessExecMetadata")
     self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsNormalizev1_0.doSuccessExecMetadata")
     if os.path.isfile(self.strNormalizedImage):
         xsNormFile = XSDataImage()
         xsNormFile.setPath(XSDataString(self.strNormalizedImage))
         self.xsdResult.setNormalizedImage(xsNormFile)
開發者ID:edna-site,項目名稱:edna,代碼行數:7,代碼來源:EDPluginBioSaxsNormalizev1_0.py

示例2: buildChildren

	def buildChildren(self, child_, nodeName_):
		if child_.nodeType == Node.ELEMENT_NODE and \
			nodeName_ == 'image':
			obj_ = XSDataImage()
			obj_.build(child_)
			self.image.append(obj_)
		XSDataInput.buildChildren(self, child_, nodeName_)
開發者ID:antolinos,項目名稱:edna,代碼行數:7,代碼來源:XSDataLabelitv10.py

示例3: createDataMOSFLMOutputGeneratePrediction

 def createDataMOSFLMOutputGeneratePrediction(self):
     EDVerbose.DEBUG("EDPluginMOSFLMGeneratePredictionv10.createDataMOSFLMOutputIntegration")
     xsDataMOSFLMInputGeneratePrediction = self.getDataInput()
     xsDataMOSFLMImage = xsDataMOSFLMInputGeneratePrediction.getImage()
     iImageNumber = xsDataMOSFLMImage.getNumber().getValue()
     xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction()
     xsDataImage = XSDataImage()
     xsDataImage.setNumber(XSDataInteger(iImageNumber))
     xsDataImage.setPath(XSDataString(os.path.join(self.getWorkingDirectory(), self.getPredictionImageFileName())))
     xsDataMOSFLMOutputGeneratePrediction.setPredictionImage(xsDataImage)
     return xsDataMOSFLMOutputGeneratePrediction
開發者ID:olofsvensson,項目名稱:edna-plugins-mx,代碼行數:11,代碼來源:EDPluginMOSFLMGeneratePredictionv10.py

示例4: postProcess

    def postProcess(self, _edObject=None):
        EDPluginControl.postProcess(self)
        self.DEBUG("EDPluginBioSaxsNormalizev1_1.postProcess")

        if os.path.isfile(self.strNormalizedImage):
            xsNormFile = XSDataImage()
            xsNormFile.setPath(XSDataString(self.strNormalizedImage))
            self.xsdResult.setNormalizedImage(xsNormFile)
        self.xsdResult.status = XSDataStatus(executiveSummary=XSDataString(os.linesep.join(self.lstProcessLog)))
        # Create some output data
        self.setDataOutput(self.xsdResult)
開發者ID:antolinos,項目名稱:edna,代碼行數:11,代碼來源:EDPluginBioSaxsNormalizev1_1.py

示例5: postProcess

    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecSaxsMacv1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultSaxsMacv1_0()
        if self.outputImage is None:
            self.outputImage = "output.edf"
        if os.path.isfile(self.outputImage):
            xsdFile = XSDataImage()
            xsdFile.setPath(XSDataString(os.path.abspath(self.outputImage)))
            xsDataResult.setOutputImage(xsdFile)

        self.setDataOutput(xsDataResult)
開發者ID:antolinos,項目名稱:edna,代碼行數:13,代碼來源:EDPluginExecSaxsMacv1_0.py

示例6: makeXML

    def makeXML(self, filename):
        """Here we create the XML string to be passed to the EDNA plugin from the input filename
        This can / should be modified by the final user
        
        @param filename: full path of the input file
        @type filename: python string representing the path
        @rtype: XML string
        @return: python string  
        """
        bProcessFile = False
        basename = os.path.basename(filename)
        for oneExt in self.listExtensions:
            if basename.endswith(oneExt):
                bProcessFile = True
                break
        if bProcessFile:
            for onePref in self.listExcludedPrefix:
                if basename.startswith(onePref):
                    bProcessFile = False
        if not bProcessFile:
            EDVerbose.screen("Not processing file: %s" % filename)
            return
        xsdimage = XSDataImage()
        xsdimage.setPath(XSDataString(filename))
        xsd = XSDataInputDiffractionCT()
        xsd.setImage(xsdimage)
        xsd.setDestinationDirectory(self.destinationDirectory)
        xsd.setSinogramFileNamePrefix(self.sinogramFileNamePrefix)
        xsd.setPowderDiffractionSubdirectory(self.powderDiffractionSubdirectory)
        xsd.setPowderDiffractionFormat(self.powderDiffractionFormat)
        if self.indexOffset is not None and self.fastMotorSteps is not None:
            idx = 0
            basename = list(os.path.splitext(os.path.basename(filename))[0])
            basename.reverse()
            number = ""
            for i in basename:
                if i.isdigit():
                    number = i + number
                else: break
            idx = int(number) - self.indexOffset
            if idx < 0:return

            self.forceInstrument.set_tomo_spec_displ_x(XSDataLength(idx % (self.fastMotorSteps + 1)))
            self.forceInstrument.set_tomo_spec_displ_rotation(XSDataLength(idx // (self.fastMotorSteps + 1)))
        xsd.setOverrideScanParam(self.forceInstrument)
        xsd.setOverrideImageParam(self.forceImage)

        return xsd.marshal()
開發者ID:antolinos,項目名稱:edna,代碼行數:48,代碼來源:edna-DiffactionTomo.py

示例7: doSucessGetMetadata

    def doSucessGetMetadata(self, _edPlugin=None):
        EDVerbose.DEBUG("EDPluginBioSaxsAveragev1_0.doSuccessGetMetadata")
#        self.strProcessLog += "Averaging EDF images to '%s'\n" % (self.averagedImage)
        self.xsdMetadata = _edPlugin.getDataOutput()

        xsdSaxsMac = XSDataInputSaxsMacv1_0()
        prefix = os.path.commonprefix(self.integratedImages)
        listFilesReversed = []
        for oneFile in self.integratedImages:
            revLst = list(oneFile)
            revLst.reverse()
            listFilesReversed.append("".join(revLst))
        revLst = list(os.path.commonprefix(listFilesReversed))
        revLst.reverse()
        suffix = "".join(revLst)
        lenSuffix = len(suffix)
        lenPrefix = len(prefix)
        maxdif = 0
        maxInt = 0
        miniInt = sys.maxint
        for oneFile in self.integratedImages:
            lenOneFile = len(oneFile)
            if lenOneFile - lenSuffix - lenPrefix > maxdif:
                maxdif = lenOneFile - lenSuffix - lenPrefix
            try:
                val = int(oneFile[lenPrefix:-lenSuffix])
            except Exception:
                val = None
                pass
            if val is not None:
                if val < miniInt:
                    miniInt = val
                if val > maxInt:
                    maxInt = val
        strImages = prefix + """%""" * maxdif + suffix + ",%i,%i" % (miniInt, maxInt)
        self.strProcessLog += "Averaging images '%s' to %s\n" % (strImages, self.averagedImage)
        EDVerbose.DEBUG("Averaging '%s'\n" % (strImages))
        xsdImage = XSDataImage()
        xsdImage.setPath(XSDataString(strImages))
        xsdiSaxsMac = XSDataInputSaxsMacv1_0()
        xsdiSaxsMac.setInputImage(xsdImage)
        xsdiSaxsMac.setOutputImage(self.dataInput.getAveragedImage())
        xsdiSaxsMac.setOptions(XSDataString("+pass -omod n +var -add %d" % len(self.integratedImages)))
        xsdiSaxsMac.setMultConst(XSDataDouble(1.0 / len(self.integratedImages)))
        self.__edPluginSaxsMac.setDataInput(xsdiSaxsMac)
        self.__edPluginSaxsMac.connectSUCCESS(self.doSuccessSaxsMac)
        self.__edPluginSaxsMac.connectFAILURE(self.doFailureSaxsMac)
        self.__edPluginSaxsMac.executeSynchronous()
開發者ID:antolinos,項目名稱:edna,代碼行數:48,代碼來源:EDPluginBioSaxsAveragev1_0.py

示例8: doSuccessGeneratePrediction

 def doSuccessGeneratePrediction(self, _edPlugin=None):
     self.DEBUG("EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction")
     self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction")
     if (self.__xsDataGeneratePredictionResult is None):
         self.__xsDataGeneratePredictionResult = XSDataGeneratePredictionResult()
     xsDataMOSFLMOutputGeneratePrediction = _edPlugin.getDataOutput()
     xsDataImage = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage()
     self.__xsDataGeneratePredictionResult.addPredictionImage(XSDataImage.parseString(xsDataImage.marshal()))
開發者ID:IvarsKarpics,項目名稱:edna-mx,代碼行數:8,代碼來源:EDPluginControlGeneratePredictionv10.py

示例9: preProcess

    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlGeneratePredictionv10.preProcess...")

        xsDataGeneratePredictionInput = self.getDataInput()

        xsDataSelectedIndexingSolution = xsDataGeneratePredictionInput.getSelectedIndexingSolution()
        xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined()
        xsDataCollection = xsDataGeneratePredictionInput.getDataCollection()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()

        # List containing instances of all the generate prediction plugins
        self.__listPluginGeneratePrediction = []

        # Loop through all subwedges
        iIndex = 0
        for xsDataSubWedge in xsDataSubWedgeList:

            xsDataImageList = xsDataSubWedge.getImage()
            # First find the lowest image number
            iLowestImageNumber = None
            for xsDataImage in xsDataImageList:
                iImageNumber = xsDataImage.getNumber().getValue()
                if (iLowestImageNumber is None):
                    iLowestImageNumber = iImageNumber
                elif (iImageNumber < iLowestImageNumber):
                    iLowestImageNumber = iImageNumber
            # Then loop through all images in a sub wedge
            for xsDataImage in xsDataImageList:
                iIndex += 1
                edPluginGeneratePrediction = self.loadPlugin(self.__strPluginGeneratePredictionName,
                                                              "%s-%02d" % (self.__strPluginGeneratePredictionName, iIndex))
                xsDataGeneratePredictionInput = XSDataGeneratePredictionInput()
                xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataSelectedIndexingSolution.marshal()))
                xsDataCollectionNew = XSDataCollection()
                xsDataSubWedgeNew = XSDataSubWedge()
                xsDataSubWedgeNew.addImage(XSDataImage.parseString(xsDataImage.marshal()))
                xsDataSubWedgeNew.setExperimentalCondition(XSDataExperimentalCondition.parseString(xsDataSubWedge.getExperimentalCondition().marshal()))
                # We must modify the rotationOscillationStart for the new subwedge
                xsDataGoniostatNew = xsDataSubWedgeNew.getExperimentalCondition().getGoniostat()
                fGoniostatRotationAxisStart = xsDataGoniostatNew.getRotationAxisStart().getValue()
                fGonioStatOscillationRange = xsDataGoniostatNew.getOscillationWidth().getValue()
                iImageNumber = xsDataImage.getNumber().getValue()
                fGoniostatRotationAxisStartNew = fGoniostatRotationAxisStart + (iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange
                xsDataGoniostatNew.setRotationAxisStart(XSDataAngle(fGoniostatRotationAxisStartNew))
                # 
                xsDataCollectionNew.addSubWedge(xsDataSubWedgeNew)
                xsDataGeneratePredictionInput.setDataCollection(xsDataCollectionNew)
                from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
                xsDataMOSFLMInputGeneratePrediction = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction(xsDataGeneratePredictionInput)
                edPluginGeneratePrediction.setDataInput(xsDataMOSFLMInputGeneratePrediction)
                self.__listPluginGeneratePrediction.append(edPluginGeneratePrediction)
開發者ID:IvarsKarpics,項目名稱:edna-mx,代碼行數:55,代碼來源:EDPluginControlGeneratePredictionv10.py

示例10: generateListXSDataImageReference

    def generateListXSDataImageReference(_xsDataIndexingInput):

        listXSDataImageReference = []
        xsDataCollection = _xsDataIndexingInput.getDataCollection()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()
        xsDataImageFirst = xsDataSubWedgeList[0].getImage()[0]
        listXSDataImageReference.append(XSDataImage.parseString(xsDataImageFirst.marshal()))
        fPhiStartFirst = xsDataSubWedgeList[0].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue()

        if (len(xsDataSubWedgeList) > 1):

            xsDataImageSecond = xsDataSubWedgeList[-1].getImage()[0]
            fPhiStartSecond = xsDataSubWedgeList[-1].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue()

            # Add modulus!            
            if (abs(fPhiStartSecond - fPhiStartFirst) > 4):

                listXSDataImageReference.append(XSDataImage.parseString(xsDataImageSecond.marshal()))

        return listXSDataImageReference
開發者ID:olofsvensson,項目名稱:edna-plugins-mx,代碼行數:20,代碼來源:EDHandlerXSDataLabelitv1_1.py

示例11: generateImageList

 def generateImageList(self, _xsDataCollection):
     """
     Make a list of all images in the subwedges
     """
     self.verboseDebug("EDPluginControlIndexingIndicatorsv1_1.generateImageList")
     listImage = None
     if (_xsDataCollection is not None):
         listImage = []
         xsDataSubWedgeList = _xsDataCollection.getSubWedge()
         for xsDataSubWedge in xsDataSubWedgeList:
             xsDataImageList = xsDataSubWedge.getImage()
             for xsDataImage in xsDataImageList:
                 listImage.append(XSDataImage.parseString(xsDataImage.marshal()))
     return listImage
開發者ID:IvarsKarpics,項目名稱:edna-mx,代碼行數:14,代碼來源:EDPluginControlIndexingIndicatorsv1_1.py

示例12: testParseLabelitDistlOutput

 def testParseLabelitDistlOutput(self):
     """
     This method test the parsing of the Labelit results in the log file.
     """
     edPluginLabelitDistlv1_1 = self.createPlugin()
     strPathToLabelitLogText = os.path.join(self.getPluginTestsDataHome(), "labelit.distl_v116.log")
     strLabelitLogText = self.readAndParseFile(strPathToLabelitLogText)
     xsDataImageQualityIndicators = edPluginLabelitDistlv1_1.parseLabelitDistlOutput(strLabelitLogText)
     xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1)
     xsDataImage1 = XSDataImage.parseString(xmlInput1)
     xsDataImageQualityIndicators.setImage(xsDataImage1)
     strLabelitDistlOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataImageQualityIndicators_reference.xml")
     strLabelitDistlOutputXML = self.readAndParseFile(strLabelitDistlOutputFile)
     from XSDataLabelitv1_1 import XSDataImageQualityIndicators
     xsDataImageQualityIndicatorsReference = XSDataImageQualityIndicators.parseString(strLabelitDistlOutputXML)
     EDAssert.equal(xsDataImageQualityIndicatorsReference.marshal(), xsDataImageQualityIndicators.marshal())
開發者ID:antolinos,項目名稱:edna,代碼行數:16,代碼來源:EDTestCasePluginUnitLabelitDistlv1_1.py

示例13: postProcess

    def postProcess(self, _edObject=None):
        EDPluginControl.postProcess(self)
        EDVerbose.DEBUG("EDPluginBioSaxsMetadatav1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultBioSaxsMetadatav1_0()
        if self.strOutputImage is not None:
            xsdImage = XSDataImage()
            xsdImage.setPath(XSDataString(self.strOutputImage))
            xsDataResult.setOutputImage(xsdImage)
        if self.detector is not None:
#            EDVerbose.DEBUG("Detector=%s" % self.detector)
            xsDataResult.setDetector(XSDataString(self.detector))
        if self.detectorDistance is not None:
#            EDVerbose.DEBUG("DetectorDistance %s(%s)" % (self.detectorDistance, self.detectorDistance.__class__))
            xsDataResult.setDetectorDistance(XSDataLength(self.detectorDistance))
        if self.pixelSize_1 is not None:
#            EDVerbose.DEBUG("pixelSize_1  %s(%s)" % (self.pixelSize_1, self.pixelSize_1.__class__))
            xsDataResult.setPixelSize_1(XSDataLength(self.pixelSize_1))
        if self.pixelSize_2 is not None:
#            EDVerbose.DEBUG("pixelSize_2  %s(%s)" % (self.pixelSize_2, self.pixelSize_2.__class__))
            xsDataResult.setPixelSize_2(XSDataLength(self.pixelSize_2))
        if self.beamCenter_1 is not None:
#            EDVerbose.DEBUG("beamCenter_1  %s(%s)" % (self.beamCenter_1, self.beamCenter_1.__class__))
            xsDataResult.setBeamCenter_1(XSDataDouble(self.beamCenter_1))
        if self.beamCenter_2 is not None:
#            EDVerbose.DEBUG("beamCenter_2  %s(%s)" % (self.beamCenter_2, self.beamCenter_2.__class__))
            xsDataResult.setBeamCenter_2(XSDataDouble(self.beamCenter_2))
        if self.beamStopDiode is not None:
#            EDVerbose.DEBUG("beamStopDiode  %s(%s)" % (self.beamStopDiode, self.beamStopDiode.__class__))
            xsDataResult.setBeamStopDiode(XSDataDouble(self.beamStopDiode))
        if self.wavelength is not None:
            xsDataResult.setWavelength(XSDataWavelength(self.wavelength))
        if self.maskFile is not None:
            xsdFile = XSDataImage()
            xsdFile.setPath(XSDataString(self.maskFile))
            xsDataResult.setMaskFile(xsdFile)
        if self.normalizationFactor is not None:
            xsDataResult.setNormalizationFactor(XSDataDouble(self.normalizationFactor))
        if self.machineCurrent is not None:
            xsDataResult.setMachineCurrent(XSDataDouble(self.machineCurrent))
        if self.code is not None:
            xsDataResult.setCode(XSDataString(self.code))
        if self.comments is not None:
            xsDataResult.setComments(XSDataString(self.comments))
        if self.concentration is not None:
            xsDataResult.setConcentration(XSDataDouble(self.concentration))
        EDVerbose.DEBUG("xsDataResult=%s" % xsDataResult.marshal())
        self.setDataOutput(xsDataResult)
開發者ID:gbourgh,項目名稱:edna,代碼行數:48,代碼來源:EDPluginBioSaxsMetadatav1_0.py

示例14: process

    def process(self, _edObject=None):
        EDPluginExec.process(self)
        EDVerbose.DEBUG("EDPluginExecReadImageHeaderPilatus2Mv10.process")
        xsDataInputReadImageHeader = self.getDataInput()
        xsDataFile = xsDataInputReadImageHeader.getImage()
        strPath = xsDataFile.getPath().getValue()
        dictPilatus2MHeader = self.readHeaderPilatus2M(strPath)
        if (dictPilatus2MHeader is None):
            strErrorMessage = "EDPluginExecReadImageHeaderPilatus2Mv10.process : Cannot read header : %s" % strPath
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            self.setFailure()
        else:
            xsDataExperimentalCondition = XSDataExperimentalCondition()
            xsDataDetector = XSDataDetector()

            iNoPixelsX = 1475
            iNoPixelsY = 1679
            xsDataDetector.setNumberPixelX(XSDataInteger(iNoPixelsX))
            xsDataDetector.setNumberPixelY(XSDataInteger(iNoPixelsY))
            # Pixel size
            listPixelSizeXY = dictPilatus2MHeader[ "Pixel_size"   ].split(" ")
            fPixelSizeX = float(listPixelSizeXY[0]) * 1000
            xsDataDetector.setPixelSizeX(XSDataLength(fPixelSizeX))
            fPixelSizeY = float(listPixelSizeXY[3]) * 1000
            xsDataDetector.setPixelSizeY(XSDataLength(fPixelSizeY))
            # Beam position
            listBeamPosition = dictPilatus2MHeader["Beam_xy"].replace("(", " ").replace(")", " ").replace(",", " ").split()
            fBeamPositionX = float(listBeamPosition[1]) * fPixelSizeX
            fBeamPositionY = float(listBeamPosition[0]) * fPixelSizeY
            xsDataDetector.setBeamPositionX(XSDataLength(fBeamPositionX))
            xsDataDetector.setBeamPositionY(XSDataLength(fBeamPositionY))
            fDistance = float(dictPilatus2MHeader[ "Detector_distance" ].split(" ")[0]) * 1000
            xsDataDetector.setDistance(XSDataLength(fDistance))
#            xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictPilatus2MHeader[ "header_size"   ])))
            xsDataDetector.setSerialNumber(XSDataString(dictPilatus2MHeader[ "Detector:"   ]))
#            #xsDataDetector.setBin(                 XSDataString(   dictPilatus2MHeader[ "BIN" ] ) ) )
#            #xsDataDetector.setDataType(            XSDataString(   dictPilatus2MHeader[ "TYPE" ] ) ) )
#            #xsDataDetector.setByteOrder(           XSDataString(   dictPilatus2MHeader[ "BYTE_ORDER" ] ) ) )
#            xsDataDetector.setImageSaturation(XSDataInteger(int(dictPilatus2MHeader[ "saturation_level" ])))
            xsDataDetector.setName(XSDataString("PILATUS2 3M"))
            xsDataDetector.setType(XSDataString("pilatus2m"))
            xsDataExperimentalCondition.setDetector(xsDataDetector)

            # Beam object

            xsDataBeam = XSDataBeam()
            xsDataBeam.setWavelength(XSDataWavelength(float(dictPilatus2MHeader[ "Wavelength" ].split(" ")[0])))
            xsDataBeam.setExposureTime(XSDataTime(float(dictPilatus2MHeader[ "Exposure_time" ].split(" ")[0])))
            xsDataExperimentalCondition.setBeam(xsDataBeam)

            # Goniostat object
            xsDataGoniostat = XSDataGoniostat()
            fRotationAxisStart = float(dictPilatus2MHeader[ "Start_angle" ].split(" ")[0])
            fOscillationWidth = float(dictPilatus2MHeader[ "Angle_increment" ].split(" ")[0])
            xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart))
            xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth))
            xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth))
            xsDataExperimentalCondition.setGoniostat(xsDataGoniostat)
#
            # Create the image object
            xsDataImage = XSDataImage()
            xsDataImage.setPath(XSDataString(strPath))
            if "DateTime" in dictPilatus2MHeader:
                strTimeStamp = dictPilatus2MHeader[ "DateTime" ]
                xsDataImage.setDate(XSDataString(strTimeStamp))
            iImageNumber = EDUtilsImage.getImageNumber(strPath)
            xsDataImage.setNumber(XSDataInteger(iImageNumber))

            xsDataSubWedge = XSDataSubWedge()
            xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
            xsDataSubWedge.addImage(xsDataImage)

            self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader()
            self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
開發者ID:edna-site,項目名稱:edna,代碼行數:75,代碼來源:EDPluginExecReadImageHeaderPilatus2Mv10.py

示例15: process

    def process(self, _edObject=None):
        EDPluginExec.process(self)
        EDVerbose.DEBUG("*** EDPluginExecReadImageHeaderADSCv10.process")
        xsDataInputReadImageHeader = self.getDataInput()
        xsDataFile = xsDataInputReadImageHeader.getImage()
        strPath = xsDataFile.getPath().getValue()
        strAbsolutePath = os.path.abspath(strPath)
        dictHeader = self.readHeaderADSC(strPath)
        if (dictHeader is None):
            strErrorMessage = "EDPluginExecReadImageHeaderADSCv10.process : error when reading header from %s" % strAbsolutePath
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            self.setFailure()
        else:
            xsDataExperimentalCondition = XSDataExperimentalCondition()
            xsDataDetector = XSDataDetector()

            xsDataDetector.setBeamPositionX(XSDataLength(float(dictHeader[ "BEAM_CENTER_X" ])))
            xsDataDetector.setBeamPositionY(XSDataLength(float(dictHeader[ "BEAM_CENTER_Y" ])))
            xsDataDetector.setDistance(XSDataLength(float(dictHeader[ "DISTANCE"   ])))
            fPixelSize = float(dictHeader[ "PIXEL_SIZE"   ])
            xsDataDetector.setPixelSizeX(XSDataLength(fPixelSize))
            xsDataDetector.setPixelSizeY(XSDataLength(fPixelSize))
            if "TWOTHETA" in dictHeader.keys():
                xsDataDetector.setTwoTheta(XSDataAngle(float(dictHeader[ "TWOTHETA"   ])))
            xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictHeader[ "HEADER_BYTES"   ])))
            xsDataDetector.setSerialNumber(XSDataString(dictHeader[ "DETECTOR_SN"   ]))
            xsDataDetector.setNumberPixelX(XSDataInteger(int(dictHeader[ "SIZE1"   ])))
            xsDataDetector.setNumberPixelY(XSDataInteger(int(dictHeader[ "SIZE2"   ])))
            xsDataDetector.setBin(XSDataString(dictHeader[ "BIN" ]))
            xsDataDetector.setDataType(XSDataString(dictHeader[ "TYPE" ]))
            xsDataDetector.setByteOrder(XSDataString(dictHeader[ "BYTE_ORDER" ]))
            if "CCD_IMAGE_SATURATION" in dictHeader.keys():
                xsDataDetector.setImageSaturation(XSDataInteger(int(dictHeader[ "CCD_IMAGE_SATURATION" ])))

            # Determine type of detector...
            iNoPixelsX = xsDataDetector.getNumberPixelX().getValue()
            iNoPixelsY = xsDataDetector.getNumberPixelY().getValue()
            if (iNoPixelsX == 2304 and iNoPixelsY == 2304):
                xsDataDetector.setName(XSDataString("ADSC Q4"))
                xsDataDetector.setType(XSDataString("q4"))
            elif (iNoPixelsX == 1152 and iNoPixelsY == 1152):
                xsDataDetector.setName(XSDataString("ADSC Q4 bin 2x2"))
                xsDataDetector.setType(XSDataString("q4-2x"))
            elif (iNoPixelsX == 4096 and iNoPixelsY == 4096):
                xsDataDetector.setName(XSDataString("ADSC Q210"))
                xsDataDetector.setType(XSDataString("q210"))
            elif (iNoPixelsX == 2048 and iNoPixelsY == 2048):
                xsDataDetector.setName(XSDataString("ADSC Q210 bin 2x2"))
                xsDataDetector.setType(XSDataString("q210-2x"))
            elif (iNoPixelsX == 6144 and iNoPixelsY == 6144):
                xsDataDetector.setName(XSDataString("ADSC Q315"))
                xsDataDetector.setType(XSDataString("q315"))
            elif (iNoPixelsX == 3072 and iNoPixelsY == 3072):
                xsDataDetector.setName(XSDataString("ADSC Q315 bin 2x2"))
                xsDataDetector.setType(XSDataString("q315-2x"))
            else:
                strErrorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginExecReadImageHeaderADSCv10.process", "Unknown detector type")
                EDVerbose.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                raise RuntimeError, strErrorMessage

            xsDataExperimentalCondition.setDetector(xsDataDetector)

            # Beam object

            xsDataBeam = XSDataBeam()
            xsDataBeam.setWavelength(XSDataWavelength(float(dictHeader[ "WAVELENGTH" ])))
            xsDataBeam.setExposureTime(XSDataTime(float(dictHeader[ "TIME" ])))
            xsDataExperimentalCondition.setBeam(xsDataBeam)

            # Goniostat object
            xsDataGoniostat = XSDataGoniostat()
            fRotationAxisStart = float(dictHeader[ "OSC_START" ])
            fOscillationWidth = float(dictHeader[ "OSC_RANGE" ])
            xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart))
            xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth))
            xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth))
            strRotationAxis = None
            if ("AXIS" in dictHeader.keys()):
                strRotationAxis = dictHeader[ "AXIS" ]
            elif ("OSC_AXIS" in dictHeader.keys()):
                strRotationAxis = dictHeader[ "OSC_AXIS" ]
            else:
                strErrorMessage = "EDPluginExecReadImageHeaderADSCv10.process : Neither AXIS nor OSC_AXIS header item found."
                EDVerbose.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
            xsDataGoniostat.setRotationAxis(XSDataString(strRotationAxis))
            xsDataExperimentalCondition.setGoniostat(xsDataGoniostat)

            # Create the image object
            xsDataImage = XSDataImage()
            xsDataImage.setPath(XSDataString(strAbsolutePath))
            xsDataImage.setDate(XSDataString(dictHeader[ "DATE" ]))
            strFileName = os.path.basename(strPath)
            iImageNumber = EDUtilsImage.getImageNumber(strFileName)
            xsDataImage.setNumber(XSDataInteger(iImageNumber))

            xsDataSubWedge = XSDataSubWedge()
#.........這裏部分代碼省略.........
開發者ID:edna-site,項目名稱:edna,代碼行數:101,代碼來源:EDPluginExecReadImageHeaderADSCv10.py


注:本文中的XSDataCommon.XSDataImage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。