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


Python XSDataCollection.addSubWedge方法代码示例

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


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

示例1: createDataCollectionFromDataFiles

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
 def createDataCollectionFromDataFiles(self, _pyListXSDataFile):
     """
     This method takes as input a list of paths to XML data files. It parses
     these files and create a single XSDataCollection object.
     """
     EDVerbose.DEBUG("EDPluginControlCCP4iv10.createDataCollectionFromDataFiles")
     xsDataCollection = None
     xsDataCollectionCurrent = None
     for xsDataInputFile in _pyListXSDataFile:
         try:
             strInputFileContent = EDUtilsFile.readFile(xsDataInputFile.getPath().getValue())
             xsDataCollectionCurrent = XSDataCollection.parseString(strInputFileContent)
         except Exception, detail:
             errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv10.preProcess', 'EDPluginControlCCP4iv10', detail)
             EDVerbose.error(errorMessage)
             self.addErrorMessage(errorMessage)
             self.setFailure()
         if (xsDataCollectionCurrent is None):
             errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv10.preProcess', 'EDPluginControlCCP4iv10', "None data collection")
             EDVerbose.error(errorMessage)
             self.addErrorMessage(errorMessage)
             self.setFailure()
         else:
             # Instantiate the xsDataCollection object if it's not already done.  
             if (xsDataCollection is None):
                 xsDataCollection = XSDataCollection()
             for xsDataSubWedge in xsDataCollectionCurrent.getSubWedge():
                 xsDataCollection.addSubWedge(xsDataSubWedge)
开发者ID:antolinos,项目名称:edna,代码行数:30,代码来源:EDPluginControlCCP4iv10.py

示例2: doXdsIndexingIntegration

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
    def doXdsIndexingIntegration(self, _xsDataCollection):
        # Load the plugin
        self._edPluginIndexing = self.loadPlugin(self._strIndexingPluginName, "Indexing")
        # XDS Indexing
        xsDataIndexingInput = XSDataIndexingInput()
        xsDataIndexingInput.setDataCollection(_xsDataCollection)
        self._edPluginIndexing.dataInput = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIndexing(xsDataIndexingInput)
        self._edPluginIndexing.executeSynchronous()
        xsDataResultXDSIndexing = self._edPluginIndexing.dataOutput
        if xsDataResultXDSIndexing.spaceGroupNumber is not None:
            spaceGroupNumber = xsDataResultXDSIndexing.spaceGroupNumber.value
            unitCell = xsDataResultXDSIndexing.unitCell
            filePaths = xsDataResultXDSIndexing.filePaths
            index = 1
            for subWedge in _xsDataCollection.subWedge:
                xsDataCollection = XSDataCollection()
                xsDataCollection.addSubWedge(subWedge)
                xsDataIndexingInput = XSDataIndexingInput()
                xsDataIndexingInput.setDataCollection(xsDataCollection)

                xsDataInputXDSIntegration = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIntegration(xsDataIndexingInput,
                                                                                                     spaceGroupNumber,
                                                                                                     unitCell,
                                                                                                     filePaths)
                edPluginIntegration = self.loadPlugin(self._strIntegrationPluginName, "Integration_{0}".format(index))
                edPluginIntegration.dataInput = xsDataInputXDSIntegration
                edPluginIntegration.executeSynchronous()
                # self._edPluginIntegration.dataInput = xsDataInputXDSIntegration
                index += 1
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:31,代码来源:EDPluginControlCharacterisationv1_6.py

示例3: preProcess

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
    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,代码行数:57,代码来源:EDPluginControlGeneratePredictionv10.py

示例4: preProcess

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlIntegrationv10.preProcess...")

        xsDataIntegrationInput = self.getDataInput()
        xsDataSelectedIndexingSolution = xsDataIntegrationInput.getSelectedIndexingSolution()
        self.__xsDataExperimentalConditionRefined = xsDataIntegrationInput.getExperimentalConditionRefined()
        # To be changed (see bug #40)
        if (self.__xsDataExperimentalConditionRefined is None):
            self.__xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined()
        xsDataCollection = xsDataIntegrationInput.getDataCollection()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()

        self.__edPluginIntegrationList = []

        iIndex = 0
        for xsDataSubWedge in xsDataSubWedgeList:
            iSubWedgeNumber = iIndex
            if (xsDataSubWedge.getSubWedgeNumber() is not None):
                # Use the incoming subwedge number if it exists
                iSubWedgeNumber = xsDataSubWedge.getSubWedgeNumber().getValue()

            edPluginIntegration = self.loadPlugin(self.__strPluginIntegrationName)

            if (not edPluginIntegration is None):
                iIndex += 1
                xsDataIntegrationInputSubWedge = XSDataIntegrationInput()
                xsDataIntegrationInputSubWedge.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataSelectedIndexingSolution.marshal()))
                xsDataIntegrationInputSubWedge.setExperimentalConditionRefined(XSDataExperimentalCondition.parseString(self.__xsDataExperimentalConditionRefined.marshal()))
                xsDataCollection = XSDataCollection()
                xsDataCollection.addSubWedge(xsDataSubWedge)
                xsDataIntegrationInputSubWedge.setDataCollection(xsDataCollection)
                try:
                    from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
                    xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(xsDataIntegrationInputSubWedge)
                    edPluginIntegration.setDataInput(xsDataMOSFLMInputIntegration)
                    edPluginIntegration.setBaseName("%s-%02d" % (self.__strPluginIntegrationName, iIndex))
                    edPluginIntegration.connectSUCCESS(self.doSuccessActionIntegration)
                    edPluginIntegration.connectFAILURE(self.doFailureActionIntegration)
                    # Here we store the sub wedge number for use in the results
                    self.__edPluginIntegrationList.append([iSubWedgeNumber, edPluginIntegration])
                except Exception as strErrorMessage:
                    self.addErrorMessage(strErrorMessage)
                    self.ERROR(strErrorMessage)
                    self.setFailure()
            else:
                strErrorMessage = "EDPluginControlIntegrationv10.preProcess: could not load plugin %s" % self.__strPluginIntegrationName
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:55,代码来源:EDPluginControlIntegrationv10.py

示例5: createDataInputCharacterisationFromDataSets

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
 def createDataInputCharacterisationFromDataSets(self, _pyListXSDataCCP4iDataSet):
     """
     This method takes as input a list of ccp4i data sets. Each data set can contain several
     paths to image files. It runs the EDPluginControlSubWedgeAssemble plugin to read the
     experimental information from the image headers and then creates a single XSDataInputCharacterisation object.
     """
     EDVerbose.DEBUG("EDPluginControlCCP4iv1_1.createDataInputCharacterisationFromDataSets")
     xsDataInputCharacterisation = None
     # We might have to run the plugin several times
     edActionCluster = EDActionCluster()
     pyListPluginControlSubWedgeAssemble = []
     # Prepare the action cluster
     iIndex = 1
     for xsDataCCP4iDataSet in _pyListXSDataCCP4iDataSet:
         edPluginControlSubWedgeAssemble = self.loadPlugin(self.__strPluginControlSubWedgeAssembleName, "SubWedgeAssemble-%02d" % iIndex)
         edPluginControlSubWedgeAssemble.connectSUCCESS(self.doSuccessActionSubWedgeAssemble)
         edPluginControlSubWedgeAssemble.connectFAILURE(self.doFailureActionSubWedgeAssemble)
         # Prepare the input for the sub wedge assemble plugin
         xsDataInputSubWedgeAssemble = XSDataInputSubWedgeAssemble()
         for xsDataImageFile in xsDataCCP4iDataSet.getImageFile():
             xsDataInputSubWedgeAssemble.addFile(xsDataImageFile)
         edPluginControlSubWedgeAssemble.setDataInput(xsDataInputSubWedgeAssemble)
         pyListPluginControlSubWedgeAssemble.append(edPluginControlSubWedgeAssemble)
         self.addPluginToActionCluster(edPluginControlSubWedgeAssemble)
         iIndex += 1
     # Run the action cluster synchronously
     self.executeActionCluster()
     self.synchronizeActionCluster()
     # Recuperate the output
     for edPluginControlSubWedgeAssemble in pyListPluginControlSubWedgeAssemble:
         if (edPluginControlSubWedgeAssemble.isFailure()):
             self.setFailure()
         else:
             xsDataResultSubWedgeAssemble = edPluginControlSubWedgeAssemble.getDataOutput()
             for xsDataSubWedge in xsDataResultSubWedgeAssemble.getSubWedge():
                 # Instantiate the xsDataInputCharacterisation object if it's not already done.
                 xsDataCollection = None
                 if (xsDataInputCharacterisation is None):
                     xsDataInputCharacterisation = XSDataInputCharacterisation()
                 else:
                     xsDataCollection = xsDataInputCharacterisation.getDataCollection()
                 if (xsDataCollection is None):
                     xsDataCollection = XSDataCollection()
                 xsDataCollection.addSubWedge(xsDataSubWedge)
                 xsDataInputCharacterisation.setDataCollection(xsDataCollection)
     return xsDataInputCharacterisation
开发者ID:antolinos,项目名称:edna,代码行数:48,代码来源:EDPluginControlCCP4iv1_1.py

示例6: getXSDataResultStrategy

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
    def getXSDataResultStrategy(self, _xsDataResultBest, _xsDataExperimentalCondition, _xsDataSample):
        xsDataResultStrategy = XSDataResultStrategy()


        #xsDataCollectionRunsBest = _xsDataResultBest.getCollectionRun()
        xsDataCollectionPlansBest = _xsDataResultBest.getCollectionPlan()

        for xsDataCollectionPlanBest in xsDataCollectionPlansBest:

            xsDataCollectionPlan = XSDataCollectionPlan()
            xsDataCollectionStrategy = XSDataCollection()

            xsDataDoubleTransmission = xsDataCollectionPlanBest.getStrategySummary().getAttenuation()

            for xsDataCollectionRunBest in xsDataCollectionPlanBest.getCollectionRun():
                xsDataSubWedge = XSDataSubWedge()
                strXmlStringDataExperimentalCondition = _xsDataExperimentalCondition.marshal()
                xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(strXmlStringDataExperimentalCondition)
                xsDataExperimentalCondition.getBeam().setExposureTime(xsDataCollectionRunBest.getExposureTime())
                xsDataExperimentalCondition.getBeam().setTransmission(xsDataDoubleTransmission)
                xsDataExperimentalCondition.getDetector().setDistance(xsDataCollectionRunBest.getDistance())
                xsDataExperimentalCondition.getGoniostat().setRotationAxisStart(xsDataCollectionRunBest.getPhiStart())
                xsDataExperimentalCondition.getGoniostat().setOscillationWidth(xsDataCollectionRunBest.getPhiWidth())
                fRotationAxisEnd = xsDataCollectionRunBest.getPhiStart().getValue() + xsDataCollectionRunBest.getNumberOfImages().getValue() * xsDataCollectionRunBest.getPhiWidth().getValue()
                xsDataExperimentalCondition.getGoniostat().setRotationAxisEnd(XSDataAngle(fRotationAxisEnd))
                xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
                xsDataSubWedge.setSubWedgeNumber(xsDataCollectionRunBest.getCollectionRunNumber())
                xsDataCollectionStrategy.addSubWedge(xsDataSubWedge)

            xsDataCollectionStrategy.setSample(_xsDataSample)

            xsDataCollectionPlan.setCollectionStrategy(xsDataCollectionStrategy)
            xsDataStrategySummary = xsDataCollectionPlanBest.getStrategySummary()
            xsDataCollectionPlan.setStrategySummary(xsDataStrategySummary)

            xsDataStatistics = xsDataCollectionPlanBest.getStatisticalPrediction()
            xsDataCollectionPlan.setStatistics(xsDataStatistics)

            xsDataCollectionPlan.setCollectionPlanNumber(xsDataCollectionPlanBest.getCollectionPlanNumber())

            xsDataResultStrategy.addCollectionPlan(xsDataCollectionPlan)

        return xsDataResultStrategy
开发者ID:antolinos,项目名称:edna,代码行数:45,代码来源:EDHandlerXSDataBestv1_1.py

示例7: EDPluginControlImageQualityIndicatorsv1_2

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]

#.........这里部分代码省略.........
        for edPluginPluginExecImageQualityIndicator in listPlugin:
            edPluginPluginExecImageQualityIndicator.synchronize()
            xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString( \
                                             edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators.marshal())
            self.xsDataResultControlImageQualityIndicators.addImageQualityIndicators(
                xsDataImageQualityIndicators)
            xsDataISPyBImageQualityIndicators = \
                XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal())
            xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(
                xsDataISPyBImageQualityIndicators)
#        print xsDataInputStoreListOfImageQualityIndicators.marshal()
        if self.bDoISPyBUpload:
            self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName)
            self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators
            self.edPluginISPyB.execute()
        #
        if bDoIndexing:
            # Find the 5 most intensive images (TIS):
            listImage = []
            listSorted = sorted(
                self.xsDataResultControlImageQualityIndicators.
                imageQualityIndicators,
                key=
                lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value
            )
            for xsDataResultControlImageQualityIndicator in listSorted[-5:]:
                if xsDataResultControlImageQualityIndicator.goodBraggCandidates.value > 30:
                    xsDataInputReadImageHeader = XSDataInputReadImageHeader()
                    xsDataInputReadImageHeader.image = XSDataFile(
                        xsDataResultControlImageQualityIndicator.image.path)
                    self.edPluginReadImageHeader = self.loadPlugin(
                        self.strPluginReadImageHeaderName)
                    self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader
                    self.edPluginReadImageHeader.executeSynchronous()
                    xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput
                    if xsDataResultReadImageHeader is not None:
                        xsDataSubWedge = xsDataResultReadImageHeader.subWedge
                        self.xsDataCollection = XSDataCollection()
                        self.xsDataCollection.addSubWedge(xsDataSubWedge)
                        xsDataIndexingInput = XSDataIndexingInput()
                        xsDataIndexingInput.setDataCollection(
                            self.xsDataCollection)
                        xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(
                            xsDataIndexingInput)
                        edPluginMOSFLMIndexing = self.loadPlugin(
                            self.strIndexingMOSFLMPluginName)
                        self.listPluginMOSFLM.append([
                            edPluginMOSFLMIndexing,
                            xsDataResultControlImageQualityIndicator
                        ])
                        edPluginMOSFLMIndexing.setDataInput(
                            xsDataMOSFLMIndexingInput)
                        edPluginMOSFLMIndexing.execute()
            for tupleMOSFLM in self.listPluginMOSFLM:
                edPluginMOSFLMIndexing = tupleMOSFLM[0]
                xsDataResultControlImageQualityIndicator = tupleMOSFLM[1]
                edPluginMOSFLMIndexing.synchronize()
                if not edPluginMOSFLMIndexing.isFailure():
                    xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput
                    xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(
                        xsDataMOSFLMOutput)
                    selectedSolution = xsDataIndexingResult.selectedSolution
                    if selectedSolution is not None:
                        xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution


#                print xsDataIndexingResult.marshal()
#                xsDataResultISPyB = edPluginISPyB.dataOutput
#                if xsDataResultISPyB is not None:
#print xsDataResultISPyB.marshal()

    def finallyProcess(self, _edPlugin=None):
        EDPluginControl.finallyProcess(self, _edPlugin)
        # Synchronize ISPyB plugin
        self.DEBUG("EDPluginControlImageQualityIndicatorsv1_2.finallyProcess")
        if self.bDoISPyBUpload:
            self.edPluginISPyB.synchronize()
            listId = []
            for xsDataInteger in self.edPluginISPyB.dataOutput.imageQualityIndicatorsId:
                listId.append(xsDataInteger.value)
            self.DEBUG("ISPyB imageQualityIndicatorIds = %r" % listId)
        self.setDataOutput(self.xsDataResultControlImageQualityIndicators)

    def generateExecutiveSummary(self, _edPlugin=None):
        self.DEBUG(
            "EDPluginControlImageQualityIndicatorsv1_2.generateExecutiveSummary"
        )
        self.addErrorWarningMessagesToExecutiveSummary(
            "Image quality indicator plugin execution failure! Error messages: "
        )
        self.addExecutiveSummaryLine(
            "Summary of image quality indicators with %s :" %
            self.strPluginName)
        for edPluginPluginExecImageQualityIndicator in self.listPluginExecImageQualityIndicator:
            self.addExecutiveSummaryLine("")
            if edPluginPluginExecImageQualityIndicator is not None:
                self.appendExecutiveSummary(
                    edPluginPluginExecImageQualityIndicator,
                    "Distl.signal_strength : ",
                    _bAddSeparator=False)
开发者ID:jordiandreu,项目名称:edna-mx,代码行数:104,代码来源:EDPluginControlImageQualityIndicatorsv1_2.py

示例8: EDPluginControlGridScreeningv1_0

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]

#.........这里部分代码省略.........
        if self.xsDataIndexingResult is None:
            if strComment == "":
                strComment = "No indexing result"
            else:
                strComment += ", no indexing result"
        else:
            xsDataSelectedSolution = self.xsDataIndexingResult.getSelectedSolution()
            xsDataResultGridScreening.setMosaicity(xsDataSelectedSolution.getCrystal().getMosaicity())
            if self.xsDataStrategyResult is None:
                if strComment == "":
                    strComment = "No strategy result"
                else:
                    strComment += ", no strategy result"
            else:
                xsDataCollectionPlan = self.xsDataStrategyResult.getCollectionPlan()[0]
                xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary()
                xsDataResultGridScreening.setRankingResolution(xsDataStrategySummary.getRankingResolution())
        xsDataResultGridScreening.setResultIntegration(self.xsDataGridScreeningResultIntegration)
        xsDataResultGridScreening.setComment(XSDataString(strComment))
        if self.iImageQualityIndicatorsId is not None:
            xsDataResultGridScreening.setImageQualityIndicatorsId(XSDataInteger(self.iImageQualityIndicatorsId))
        # print xsDataResultGridScreening.marshal()
        self.setDataOutput(xsDataResultGridScreening)



    def doSuccessReadImageHeader(self, _edPlugin=None):
        self.DEBUG("EDPluginControlGridScreeningv1_0.doSuccessReadImageHeader")
        self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGridScreeningv1_0.doSuccessReadImageHeader")
        xsDataResultReadImageHeader = self.edPluginControlReadImageHeader.getDataOutput()
        if xsDataResultReadImageHeader is not None:
            xsDataSubWedge = xsDataResultReadImageHeader.getSubWedge()
            self.xsDataCollection = XSDataCollection()
            self.xsDataCollection.addSubWedge(xsDataSubWedge)
            self.xsDataCollection.setDiffractionPlan(self.xsDataDiffractionPlan)
            if not self.bDoOnlyIntegrationWithXMLOutput:
                xsDataInputControlImageQualityIndicators = XSDataInputControlImageQualityIndicators()
                if self.bStoreImageQualityIndicatorsInISPyB:
                    xsDataInputControlImageQualityIndicators.doUploadToIspyb = XSDataBoolean(True)
                else:
                    xsDataInputControlImageQualityIndicators.doUploadToIspyb = XSDataBoolean(False)
                xsDataInputControlImageQualityIndicators.addImage(XSDataImage(path=XSDataString(self.strImageFile)))
                self.edPluginControlIndicators.setDataInput(xsDataInputControlImageQualityIndicators)
                self.edPluginControlIndicators.connectSUCCESS(self.doSuccessIndicators)
                self.edPluginControlIndicators.connectFAILURE(self.doFailureIndicators)
                self.executePluginSynchronous(self.edPluginControlIndicators)
            else:
                xsDataIndexingInput = XSDataIndexingInput()
                xsDataIndexingInput.setDataCollection(self.xsDataCollection)
                from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
                xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput)
                self.edPluginMOSFLMIndexing.connectSUCCESS(self.doSuccessIndexingMOSFLM)
                self.edPluginMOSFLMIndexing.connectFAILURE(self.doFailureIndexingMOSFLM)
                self.edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput)
                self.edPluginMOSFLMIndexing.executeSynchronous()


    def doFailureReadImageHeader(self, _edPlugin=None):
        self.DEBUG("EDPluginControlGridScreeningv1_0.doFailureReadImageHeader")
        self.retrieveFailureMessages(_edPlugin, "EDPluginControlGridScreeningv1_0.doSuccessReadImageHeader")



    def doSuccessIndicators(self, _edPlugin=None):
        self.DEBUG("EDPluginControlGridScreeningv1_0.doSuccessIndicators")
        # self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGridScreeningv1_0.doSuccessIndexingIndicators")
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:70,代码来源:EDPluginControlGridScreeningv1_0.py

示例9: EDPluginControlImageQualityIndicatorsv1_4

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]

#.........这里部分代码省略.........
                        xsDataImageQualityIndicators.dozorSpotsResolution = imageDozor.spotsResolution
                        if self.xsDataResultControlImageQualityIndicators.inputDozor is None:
                            if edPluginControlDozor.dataOutput.inputDozor is not None:
                                self.xsDataResultControlImageQualityIndicators.inputDozor = XSDataDozorInput().parseString(
                                               edPluginControlDozor.dataOutput.inputDozor.marshal())
            if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value:
                xsDataISPyBImageQualityIndicators = \
                    XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal())
                xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(xsDataISPyBImageQualityIndicators)
#        print xsDataInputStoreListOfImageQualityIndicators.marshal()
        if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value:
            self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName)
            self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators
            self.edPluginISPyB.execute()
        #
        if bDoIndexing:
            # Find the 5 most intensive images (TIS):
            listImage = []
            # Check that we have dozor_score from all images:
            has_dozor_score = True
            for imageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators:
                if imageQualityIndicators.dozor_score is None:
                    has_dozor_score = False
            if has_dozor_score:
                listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                    key=lambda imageQualityIndicators: imageQualityIndicators.dozor_score.value)
            else:
                listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                    key=lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value)
            for xsDataResultControlImageQualityIndicator in listSorted[-5:]:
                if xsDataResultControlImageQualityIndicator.goodBraggCandidates.value > 30:
                    xsDataInputReadImageHeader = XSDataInputReadImageHeader()
                    xsDataInputReadImageHeader.image = XSDataFile(xsDataResultControlImageQualityIndicator.image.path)
                    self.edPluginReadImageHeader = self.loadPlugin(self.strPluginReadImageHeaderName)
                    self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader
                    self.edPluginReadImageHeader.executeSynchronous()
                    xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput
                    if xsDataResultReadImageHeader is not None:
                        xsDataSubWedge = xsDataResultReadImageHeader.subWedge
                        self.xsDataCollection = XSDataCollection()
                        self.xsDataCollection.addSubWedge(xsDataSubWedge)
                        xsDataIndexingInput = XSDataIndexingInput()
                        xsDataIndexingInput.setDataCollection(self.xsDataCollection)
                        xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput)
                        edPluginMOSFLMIndexing = self.loadPlugin(self.strIndexingMOSFLMPluginName)
                        self.listPluginMOSFLM.append([edPluginMOSFLMIndexing, xsDataResultControlImageQualityIndicator])
                        edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput)
                        edPluginMOSFLMIndexing.execute()
            for tupleMOSFLM in self.listPluginMOSFLM:
                edPluginMOSFLMIndexing = tupleMOSFLM[0]
                xsDataResultControlImageQualityIndicator = tupleMOSFLM[1]
                edPluginMOSFLMIndexing.synchronize()
                if not edPluginMOSFLMIndexing.isFailure():
                    xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput
                    xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutput)
                    selectedSolution = xsDataIndexingResult.selectedSolution
                    if selectedSolution is not None:
                        xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution

#                print xsDataIndexingResult.marshal()
#                xsDataResultISPyB = edPluginISPyB.dataOutput
#                if xsDataResultISPyB is not None:
                # print xsDataResultISPyB.marshal()



    def finallyProcess(self, _edPlugin=None):
        EDPluginControl.finallyProcess(self, _edPlugin)
        if self.edPluginISPyB is not None:
            # Synchronize ISPyB plugin
            self.DEBUG("EDPluginControlImageQualityIndicatorsv1_4.finallyProcess")
            self.edPluginISPyB.synchronize()
            listId = []
            for xsDataInteger in self.edPluginISPyB.dataOutput.imageQualityIndicatorsId:
                listId.append(xsDataInteger.value)
            self.DEBUG("ISPyB imageQualityIndicatorIds = %r" % listId)
        self.setDataOutput(self.xsDataResultControlImageQualityIndicators)



    def generateExecutiveSummary(self, _edPlugin=None):
        self.DEBUG("EDPluginControlImageQualityIndicatorsv1_4.generateExecutiveSummary")
        self.addErrorWarningMessagesToExecutiveSummary("Image quality indicator plugin execution failure! Error messages: ")
        self.addExecutiveSummaryLine("Summary of image quality indicators with %s :" % self.strPluginName)
        for edPluginPluginExecImageQualityIndicator in self.listPluginExecImageQualityIndicator:
            self.addExecutiveSummaryLine("")
            if edPluginPluginExecImageQualityIndicator is not None:
                self.appendExecutiveSummary(edPluginPluginExecImageQualityIndicator, "Distl.signal_strength : ", _bAddSeparator=False)

    def getH5FilePath(self, filePath, batchSize=1):
        imageNumber = EDUtilsImage.getImageNumber(filePath)
        prefix = EDUtilsImage.getPrefix(filePath)
        h5FileNumber = int((imageNumber - 1) / batchSize) * batchSize + 1
        h5MasterFileName = "{prefix}_{h5FileNumber}_master.h5".format(prefix=prefix,
                                                                      h5FileNumber=h5FileNumber)
        h5MasterFilePath = os.path.join(os.path.dirname(filePath), h5MasterFileName)
        h5DataFileName = "{prefix}_{h5FileNumber}_data_000001.h5".format(prefix=prefix,
                                                                      h5FileNumber=h5FileNumber)
        h5DataFilePath = os.path.join(os.path.dirname(filePath), h5DataFileName)
        return h5MasterFilePath, h5DataFilePath, h5FileNumber
开发者ID:jordiandreu,项目名称:edna-mx,代码行数:104,代码来源:EDPluginControlImageQualityIndicatorsv1_4.py

示例10: getXSDataResultStrategy

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]
    def getXSDataResultStrategy(self, _xsDataResultBest, _xsDataExperimentalCondition, _xsDataSample):
        xsDataResultStrategy = XSDataResultStrategy()

        listXSDataBestCollectionPlan = _xsDataResultBest.getCollectionPlan()

        for xsDataBestCollectionPlan in listXSDataBestCollectionPlan:

            xsDataCollectionPlan = XSDataCollectionPlan()
            xsDataCollectionStrategy = XSDataCollection()

            xsDataBestStrategySummary = xsDataBestCollectionPlan.getStrategySummary()

            xsDataDoubleTransmission = xsDataBestStrategySummary.getTransmission()

            for xsDataBestCollectionRun in xsDataBestCollectionPlan.getCollectionRun():
                xsDataSubWedge = XSDataSubWedge()
                strXmlStringDataExperimentalCondition = _xsDataExperimentalCondition.marshal()
                xsDataExperimentalCondition = XSDataExperimentalCondition.parseString(
                    strXmlStringDataExperimentalCondition
                )
                xsDataExperimentalCondition.getBeam().setExposureTime(xsDataBestCollectionRun.getExposureTime())
                if xsDataBestCollectionRun.getTransmission() is None:
                    xsDataExperimentalCondition.getBeam().setTransmission(xsDataDoubleTransmission)
                else:
                    xsDataExperimentalCondition.getBeam().setTransmission(xsDataBestCollectionRun.getTransmission())
                xsDataExperimentalCondition.getDetector().setDistance(xsDataBestStrategySummary.getDistance())
                xsDataExperimentalCondition.getGoniostat().setRotationAxisStart(xsDataBestCollectionRun.getPhiStart())
                xsDataExperimentalCondition.getGoniostat().setOscillationWidth(xsDataBestCollectionRun.getPhiWidth())
                fRotationAxisEnd = (
                    xsDataBestCollectionRun.getPhiStart().getValue()
                    + xsDataBestCollectionRun.getNumberOfImages().getValue()
                    * xsDataBestCollectionRun.getPhiWidth().getValue()
                )
                xsDataExperimentalCondition.getGoniostat().setRotationAxisEnd(XSDataAngle(fRotationAxisEnd))
                xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition)
                xsDataSubWedge.setSubWedgeNumber(xsDataBestCollectionRun.getCollectionRunNumber())
                if xsDataBestCollectionRun.getCrystalPosition():
                    xsDataSubWedge.setAction(
                        XSDataString("Crystal position: %d" % xsDataBestCollectionRun.getCrystalPosition().getValue())
                    )
                else:
                    xsDataSubWedge.setAction(xsDataBestCollectionRun.getAction())
                xsDataCollectionStrategy.addSubWedge(xsDataSubWedge)

            xsDataCollectionStrategy.setSample(_xsDataSample)

            xsDataCollectionPlan.setCollectionStrategy(xsDataCollectionStrategy)

            xsDataStrategySummary = XSDataStrategySummary()
            xsDataStrategySummary.setCompleteness(xsDataBestStrategySummary.getCompleteness())
            xsDataStrategySummary.setISigma(xsDataBestStrategySummary.getISigma())
            xsDataStrategySummary.setRankingResolution(xsDataBestStrategySummary.getRankingResolution())
            xsDataStrategySummary.setRedundancy(xsDataBestStrategySummary.getRedundancy())
            xsDataStrategySummary.setResolution(xsDataBestStrategySummary.getResolution())
            xsDataStrategySummary.setResolutionReasoning(xsDataBestStrategySummary.getResolutionReasoning())
            xsDataStrategySummary.setTotalDataCollectionTime(xsDataBestStrategySummary.getTotalDataCollectionTime())
            xsDataStrategySummary.setTotalExposureTime(xsDataBestStrategySummary.getTotalExposureTime())
            xsDataCollectionPlan.setStrategySummary(xsDataStrategySummary)

            if xsDataBestCollectionPlan.getStatisticalPrediction() is not None:
                xsDataStatisticsStrategy = XSDataStatisticsStrategy.parseString(
                    xsDataBestCollectionPlan.getStatisticalPrediction().marshal()
                )
                xsDataCollectionPlan.setStatistics(xsDataStatisticsStrategy)

            xsDataCollectionPlan.setCollectionPlanNumber(xsDataBestCollectionPlan.getCollectionPlanNumber())

            xsDataResultStrategy.addCollectionPlan(xsDataCollectionPlan)

        if _xsDataResultBest.getPathToLogFile() != None:
            xsDataResultStrategy.setBestLogFile(_xsDataResultBest.getPathToLogFile())

        return xsDataResultStrategy
开发者ID:edna-site,项目名称:edna,代码行数:75,代码来源:EDHandlerXSDataBestv1_2.py

示例11: EDPluginControlImageQualityIndicatorsv1_4

# 需要导入模块: from XSDataMXv1 import XSDataCollection [as 别名]
# 或者: from XSDataMXv1.XSDataCollection import addSubWedge [as 别名]

#.........这里部分代码省略.........
                                if edPluginControlDozor.dataOutput.inputDozor is not None:
                                    self.xsDataResultControlImageQualityIndicators.inputDozor = XSDataDozorInput().parseString(
                                                   edPluginControlDozor.dataOutput.inputDozor.marshal())
                if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value:
                    xsDataISPyBImageQualityIndicators = \
                        XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal())
                    xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(xsDataISPyBImageQualityIndicators)
    #        print xsDataInputStoreListOfImageQualityIndicators.marshal()
            if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value:
                self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName)
                self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators
                self.edPluginISPyB.execute()
            #
            if bDoIndexing:
                # Find the 5 most intensive images (TIS):
                listImage = []
                # Check that we have dozor_score from all images:
                has_dozor_score = True
                for imageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators:
                    if imageQualityIndicators.dozor_score is None:
                        has_dozor_score = False
                if has_dozor_score:
                    listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                        key=lambda imageQualityIndicators: imageQualityIndicators.dozor_score.value)
                else:
                    listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                        key=lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value)
                for xsDataResultControlImageQualityIndicator in listSorted[-5:]:
                    if xsDataResultControlImageQualityIndicator.dozor_score.value > 1:
                        xsDataInputReadImageHeader = XSDataInputReadImageHeader()
                        xsDataInputReadImageHeader.image = XSDataFile(xsDataResultControlImageQualityIndicator.image.path)
                        self.edPluginReadImageHeader = self.loadPlugin(self.strPluginReadImageHeaderName)
                        self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader
                        self.edPluginReadImageHeader.executeSynchronous()
                        xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput
                        if xsDataResultReadImageHeader is not None:
                            xsDataSubWedge = xsDataResultReadImageHeader.subWedge
                            self.xsDataCollection = XSDataCollection()
                            self.xsDataCollection.addSubWedge(xsDataSubWedge)
                            xsDataIndexingInput = XSDataIndexingInput()
                            xsDataIndexingInput.setDataCollection(self.xsDataCollection)
                            xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput)
                            edPluginMOSFLMIndexing = self.loadPlugin(self.strIndexingMOSFLMPluginName)
                            self.listPluginMOSFLM.append([edPluginMOSFLMIndexing, xsDataResultControlImageQualityIndicator])
                            edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput)
                            edPluginMOSFLMIndexing.execute()
                for tupleMOSFLM in self.listPluginMOSFLM:
                    edPluginMOSFLMIndexing = tupleMOSFLM[0]
                    xsDataResultControlImageQualityIndicator = tupleMOSFLM[1]
                    edPluginMOSFLMIndexing.synchronize()
                    if not edPluginMOSFLMIndexing.isFailure():
                        xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput
                        xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutput)
                        selectedSolution = xsDataIndexingResult.selectedSolution
                        if selectedSolution is not None:
                            xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution




    def finallyProcess(self, _edPlugin=None):
        EDPluginControl.finallyProcess(self, _edPlugin)
        if self.edPluginISPyB is not None:
            # Synchronize ISPyB plugin
            self.DEBUG("EDPluginControlImageQualityIndicatorsv1_4.finallyProcess")
            self.edPluginISPyB.synchronize()
            listId = []
            for xsDataInteger in self.edPluginISPyB.dataOutput.imageQualityIndicatorsId:
                listId.append(xsDataInteger.value)
            self.DEBUG("ISPyB imageQualityIndicatorIds = %r" % listId)
        self.setDataOutput(self.xsDataResultControlImageQualityIndicators)



    def generateExecutiveSummary(self, _edPlugin=None):
        self.DEBUG("EDPluginControlImageQualityIndicatorsv1_4.generateExecutiveSummary")
        self.addErrorWarningMessagesToExecutiveSummary("Image quality indicator plugin execution failure! Error messages: ")
        self.addExecutiveSummaryLine("Summary of image quality indicators with %s :" % self.strPluginName)
        for edPluginPluginExecImageQualityIndicator in self.listPluginExecImageQualityIndicator:
            self.addExecutiveSummaryLine("")
            if edPluginPluginExecImageQualityIndicator is not None:
                self.appendExecutiveSummary(edPluginPluginExecImageQualityIndicator, "Distl.signal_strength : ", _bAddSeparator=False)

    def getH5FilePath(self, filePath, batchSize=1, isFastMesh=False):
        imageNumber = EDUtilsImage.getImageNumber(filePath)
        prefix = EDUtilsImage.getPrefix(filePath)
        if isFastMesh:
            h5ImageNumber = int((imageNumber - 1) / 100) + 1
            h5FileNumber = 1
        else:
            h5ImageNumber = 1
            h5FileNumber = int((imageNumber - 1) / batchSize) * batchSize + 1
        h5MasterFileName = "{prefix}_{h5FileNumber}_master.h5".format(prefix=prefix,
                                                                      h5FileNumber=h5FileNumber)
        h5MasterFilePath = os.path.join(os.path.dirname(filePath), h5MasterFileName)
        h5DataFileName = "{prefix}_{h5FileNumber}_data_{h5ImageNumber:06d}.h5".format(prefix=prefix,
                                                                                      h5FileNumber=h5FileNumber,
                                                                                      h5ImageNumber=h5ImageNumber)
        h5DataFilePath = os.path.join(os.path.dirname(filePath), h5DataFileName)
        return h5MasterFilePath, h5DataFilePath, h5FileNumber
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:104,代码来源:EDPluginControlImageQualityIndicatorsv1_4.py


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