def doFailureIndexingLabelit(self, _edPlugin=None): EDVerbose.DEBUG("EDPluginControlCharacterisationv1_2.doFailureIndexingLabelit") self.addStatusMessage("Labelit: Indexing FAILURE.") if self.__xsDataResultCharacterisation is not None: self.setDataOutput(self.__xsDataResultCharacterisation) if self.__xsDataIndexingResultMOSFLM == None: strErrorMessage = "Execution of indexing with both MOSFLM and Labelit failed. Execution of characterisation aborted." EDVerbose.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.generateExecutiveSummary(self) self.setFailure() if self.__strStatusMessage != None: self.setDataOutput(XSDataString(self.__strStatusMessage), "statusMessage") self.writeDataOutput() else: # Use the MOSFLM indexing results - even if it's P1 self.__xsDataResultCharacterisation.setIndexingResult(self.__xsDataIndexingResultMOSFLM) xsDataCollection = self.__xsDataResultCharacterisation.getDataCollection() xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(self.__xsDataIndexingResultMOSFLM.getSelectedSolution().marshal())) self.__edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) if self.__edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self.__strCharacterisationShortSummary += self.__edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() # Start the generation of prediction images - we synchronize in the post-process self.__edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration()
def doSuccessEvaluationIndexingMOSFLM(self, _edPlugin=None): self.DEBUG("EDPluginControlCharacterisationv1_5.doSuccessEvaluationIndexingMOSFLM") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlCharacterisationv1_5.doSuccessEvaluationIndexingMOSFLM") # Retrieve status messages (if any) if self._edPluginExecEvaluationIndexingMOSFLM.hasDataOutput("statusMessageIndexing"): self.addStatusMessage("MOSFLM: " + self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput("statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexingSuccess = self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingResult")[0] self._xsDataResultCharacterisation.setIndexingResult(xsDataIndexingResult) self._strCharacterisationShortSummary += self.generateIndexingShortSummary(xsDataIndexingResult) xsDataCollection = self._xsDataResultCharacterisation.getDataCollection() xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataIndexingResult.getSelectedSolution().marshal())) self._edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) if self._edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self._strCharacterisationShortSummary += self._edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() # Start the generation of prediction images - we synchronize in the post-process self._edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: strErrorMessage = "Execution of indexing with MOSFLM failed." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage(strErrorMessage) self.setFailure() self.generateExecutiveSummary(self) if self._strStatusMessage != None: self.setDataOutput(XSDataString(self._strStatusMessage), "statusMessage") self.writeDataOutput()
def doSuccessEvaluationIndexingMOSFLM(self, _edPlugin=None): self.DEBUG("EDPluginControlCharacterisationv1_2.doSuccessEvaluationIndexingMOSFLM") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlCharacterisationv1_2.doSuccessEvaluationIndexing") # Retrieve status messages (if any) if self.__edPluginExecEvaluationIndexingMOSFLM.hasDataOutput("statusMessageImageQualityIndicators"): self.addStatusMessage(self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("statusMessageImageQualityIndicators")[0].getValue()) if self.__edPluginExecEvaluationIndexingMOSFLM.hasDataOutput("statusMessageIndexing"): self.addStatusMessage("MOSFLM: " + self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexWithLabelit = False bIndexingSuccess = self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingResult")[0] self.__xsDataIndexingResultMOSFLM = xsDataIndexingResult # Check if space group is P1 - if yes run Labelit indexing xsDataIndexingSolutionSelected = xsDataIndexingResult.getSelectedSolution() xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal() xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() strSpaceGroupName = xsDataSpaceGroup.getName().getValue().upper() # Check if MOSFLM has indexed in P1 if strSpaceGroupName == "P1": # Check if the user maybe asked for P1! bIndexWithLabelit = True if self.__xsDataCollection.getDiffractionPlan() is not None: if self.__xsDataCollection.getDiffractionPlan().getForcedSpaceGroup() is not None: if self.__xsDataCollection.getDiffractionPlan().getForcedSpaceGroup().getValue().upper() == "P1": self.screen("P1 space forced by diffraction plan") bIndexWithLabelit = False if bIndexWithLabelit: self.screen("P1 space group choosed - reindexing with Labelit") else: self.screen("MOSFLM indexing successful!") if self.__edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self.__strCharacterisationShortSummary += self.__edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() # Generate prediction images xsDataCollection = self.__xsDataResultCharacterisation.getDataCollection() self.__xsDataResultCharacterisation.setIndexingResult(xsDataIndexingResult) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataIndexingResult.getSelectedSolution().marshal())) self.__edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) # Start the generation of prediction images - we synchronize in the post-process self.__edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: self.screen("Indexing with MOSFLM failed!") bIndexWithLabelit = True if bIndexWithLabelit: # Execute Labelit indexing self.screen("Now trying to index with Labelit - please be patient...") xsDataIndexingInput = XSDataIndexingInput() xsDataSubWedgeList = self.__xsDataCollection.getSubWedge() xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() xsDataIndexingInput.setDataCollection(self.__xsDataCollection) xsDataIndexingInput.setExperimentalCondition(xsDataExperimentalCondition) if self.__xsDataCrystal != None: xsDataIndexingInput.setCrystal(self.__xsDataCrystal) self.__edPluginControlIndexingLabelit.setDataInput(xsDataIndexingInput) self.__edPluginControlIndexingLabelit.executeSynchronous()
def doFailureIndexingLabelit(self, _edPlugin=None): self.DEBUG("EDPluginControlCharacterisationv1_2.doFailureIndexingLabelit") self.addStatusMessage("Labelit: Indexing FAILURE.") if self.__xsDataResultCharacterisation is not None: self.setDataOutput(self.__xsDataResultCharacterisation) if self.__xsDataIndexingResultMOSFLM == None: strErrorMessage = "Execution of indexing with both MOSFLM and Labelit failed. Execution of characterisation aborted." self.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.generateExecutiveSummary(self) self.setFailure() if self.__strStatusMessage != None: self.setDataOutput(XSDataString(self.__strStatusMessage), "statusMessage") self.writeDataOutput() else: # Use the MOSFLM indexing results - even if it's P1 self.__xsDataResultCharacterisation.setIndexingResult(self.__xsDataIndexingResultMOSFLM) xsDataCollection = self.__xsDataResultCharacterisation.getDataCollection() xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(self.__xsDataIndexingResultMOSFLM.getSelectedSolution().marshal())) self.__edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) if self.__edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self.__strCharacterisationShortSummary += self.__edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() # Start the generation of prediction images - we synchronize in the post-process self.__edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration()
def doSuccessEvaluationIndexingMOSFLM(self, _edPlugin=None): EDVerbose.DEBUG("EDPluginControlCharacterisationv1_2.doSuccessEvaluationIndexingMOSFLM") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlCharacterisationv1_2.doSuccessEvaluationIndexing") # Retrieve status messages (if any) if self.__edPluginExecEvaluationIndexingMOSFLM.hasDataOutput("statusMessageImageQualityIndicators"): self.addStatusMessage(self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("statusMessageImageQualityIndicators")[0].getValue()) if self.__edPluginExecEvaluationIndexingMOSFLM.hasDataOutput("statusMessageIndexing"): self.addStatusMessage("MOSFLM: " + self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexWithLabelit = False bIndexingSuccess = self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self.__edPluginExecEvaluationIndexingMOSFLM.getDataOutput("indexingResult")[0] self.__xsDataIndexingResultMOSFLM = xsDataIndexingResult # Check if space group is P1 - if yes run Labelit indexing xsDataIndexingSolutionSelected = xsDataIndexingResult.getSelectedSolution() xsDataCrystal = xsDataIndexingSolutionSelected.getCrystal() xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() strSpaceGroupName = xsDataSpaceGroup.getName().getValue().upper() # Check if MOSFLM has indexed in P1 if strSpaceGroupName == "P1": # Check if the user maybe asked for P1! bIndexWithLabelit = True if self.__xsDataCollection.getDiffractionPlan() is not None: if self.__xsDataCollection.getDiffractionPlan().getForcedSpaceGroup() is not None: if self.__xsDataCollection.getDiffractionPlan().getForcedSpaceGroup().getValue().upper() == "P1": EDVerbose.screen("P1 space forced by diffraction plan") bIndexWithLabelit = False if bIndexWithLabelit: EDVerbose.screen("P1 space group choosed - reindexing with Labelit") else: EDVerbose.screen("MOSFLM indexing successful!") if self.__edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self.__strCharacterisationShortSummary += self.__edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() # Generate prediction images xsDataCollection = self.__xsDataResultCharacterisation.getDataCollection() self.__xsDataResultCharacterisation.setIndexingResult(xsDataIndexingResult) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataIndexingResult.getSelectedSolution().marshal())) self.__edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) # Start the generation of prediction images - we synchronize in the post-process self.__edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: EDVerbose.screen("Indexing with MOSFLM failed!") bIndexWithLabelit = True if bIndexWithLabelit: # Execute Labelit indexing EDVerbose.screen("Now trying to index with Labelit - please be patient...") xsDataIndexingInput = XSDataIndexingInput() xsDataSubWedgeList = self.__xsDataCollection.getSubWedge() xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() xsDataIndexingInput.setDataCollection(self.__xsDataCollection) xsDataIndexingInput.setExperimentalCondition(xsDataExperimentalCondition) if self.__xsDataCrystal != None: xsDataIndexingInput.setCrystal(self.__xsDataCrystal) self.__edPluginControlIndexingLabelit.setDataInput(xsDataIndexingInput) self.__edPluginControlIndexingLabelit.executeSynchronous()
def generateXSDataIndexingResult(_xsDataResultXDSIndexing, _xsDataExperimentalCondition=None): xsDataIndexingResult = XSDataIndexingResult() xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected() xsDataCrystalSelected = XSDataCrystal() # xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex)) # xsDataCellSelected = xsDataLabelitSolution.getUnitCell() spaceGroupName = EDUtilsSymmetry.getMinimumSymmetrySpaceGroupFromBravaisLattice(_xsDataResultXDSIndexing.bravaisLattice.value) xsDataCrystalSelected = XSDataCrystal() xsDataSpaceGroupSelected = XSDataSpaceGroup() xsDataSpaceGroupSelected.setName(XSDataString(spaceGroupName)) xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected) # xsDataCrystalSelected.setCell(xsDataCellSelected) xsDataCrystalSelected.setMosaicity(XSDataDouble(_xsDataResultXDSIndexing.mosaicity.value)) xsDataCrystalSelected.setCell(XSDataCell.parseString(_xsDataResultXDSIndexing.unitCell.marshal())) xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected) xsDataOrientation = XSDataOrientation() xsDataOrientation.setMatrixA(_xsDataResultXDSIndexing.getAMatrix()) xsDataOrientation.setMatrixU(_xsDataResultXDSIndexing.getUMatrix()) xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation) xsDataStatisticsIndexing = XSDataStatisticsIndexing() if (_xsDataExperimentalCondition is not None): fBeamPositionXOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionX().getValue() fBeamPositionYOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionY().getValue() fBeamPositionXNew = _xsDataResultXDSIndexing.getBeamCentreX().getValue() fBeamPositionYNew = _xsDataResultXDSIndexing.getBeamCentreY().getValue() xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(fBeamPositionXOrig - fBeamPositionXNew)) xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(fBeamPositionYOrig - fBeamPositionYNew)) xsDataExperimentalConditionRefined = None if (_xsDataExperimentalCondition is None): xsDataExperimentalConditionRefined = XSDataExperimentalCondition() else: # Copy the incoming experimental condition xmlExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition) xsDataDetector = xsDataExperimentalConditionRefined.getDetector() if (xsDataDetector is None): xsDataDetector = XSDataDetector() xsDataDetector.setBeamPositionX(XSDataLength(_xsDataResultXDSIndexing.getBeamCentreX().value)) xsDataDetector.setBeamPositionY(XSDataLength(_xsDataResultXDSIndexing.getBeamCentreY().value)) xsDataDetector.setDistance(_xsDataResultXDSIndexing.getDistance()) xsDataExperimentalConditionRefined.setDetector(xsDataDetector) xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined) xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected) return xsDataIndexingResult
def generatePredictionImageList(self, _edPluginGeneratePrediction, _xsDataCollection, _xsDataIndexingResult): """ Generate a list containing the prediction images """ self.verboseDebug("EDPluginControlIndexingv10.generatePredictionImageList") xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(_xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(_xsDataIndexingResult.getSelectedSolution().marshal())) _edPluginGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) _edPluginGeneratePrediction.executeSynchronous()
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)
def doSuccessEvaluationIndexingMOSFLM(self, _edPlugin=None): self.DEBUG( "EDPluginControlCharacterisationv1_4.doSuccessEvaluationIndexingMOSFLM" ) self.retrieveSuccessMessages( _edPlugin, "EDPluginControlCharacterisationv1_4.doSuccessEvaluationIndexingMOSFLM" ) # Retrieve status messages (if any) if self._edPluginExecEvaluationIndexingMOSFLM.hasDataOutput( "statusMessageIndexing"): self.addStatusMessage( "MOSFLM: " + self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput( "statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexingSuccess = self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput( "indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self._edPluginExecEvaluationIndexingMOSFLM.getDataOutput( "indexingResult")[0] self._xsDataResultCharacterisation.setIndexingResult( xsDataIndexingResult) self._strCharacterisationShortSummary += self.generateIndexingShortSummary( xsDataIndexingResult) xsDataCollection = self._xsDataResultCharacterisation.getDataCollection( ) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection( XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution( XSDataIndexingSolutionSelected.parseString( xsDataIndexingResult.getSelectedSolution().marshal())) self._edPluginControlGeneratePrediction.setDataInput( xsDataGeneratePredictionInput) if self._edPluginControlIndexingIndicators.hasDataOutput( "indexingShortSummary"): self._strCharacterisationShortSummary += self._edPluginControlIndexingIndicators.getDataOutput( "indexingShortSummary")[0].getValue() # Start the generation of prediction images - we synchronize in the post-process self._edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: strErrorMessage = "Execution of indexing with MOSFLM failed." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage(strErrorMessage) self.setFailure() self.generateExecutiveSummary(self) if self._strStatusMessage != None: self.setDataOutput(XSDataString(self._strStatusMessage), "statusMessage") self.writeDataOutput()
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()
def doSuccessEvaluationIndexingLABELIT(self, _edPlugin=None): self.DEBUG("EDPluginControlCharacterisationv1_5.doSuccessEvaluationIndexingLABELIT") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlCharacterisationv1_5.doSuccessEvaluationIndexingLABELIT") # Retrieve status messages (if any) if self._edPluginExecEvaluationIndexingLABELIT.hasDataOutput("statusMessageIndexing"): self.addStatusMessage("Labelit: " + self._edPluginExecEvaluationIndexingLABELIT.getDataOutput("statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexingSuccess = self._edPluginExecEvaluationIndexingLABELIT.getDataOutput("indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self._edPluginExecEvaluationIndexingLABELIT.getDataOutput("indexingResult")[0] self._xsDataResultCharacterisation.setIndexingResult(xsDataIndexingResult) if self._edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): self._strCharacterisationShortSummary += self._edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() xsDataCollection = self._xsDataResultCharacterisation.getDataCollection() xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataIndexingResult.getSelectedSolution().marshal())) self._edPluginControlGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) if self._edPluginControlIndexingIndicators.hasDataOutput("indexingShortSummary"): indexingShortSummary = self._edPluginControlIndexingIndicators.getDataOutput("indexingShortSummary")[0].getValue() self._strCharacterisationShortSummary += indexingShortSummary self.sendMessageToMXCuBE(indexingShortSummary) # Start the generation of prediction images - we synchronize in the post-process self._edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: if self._iNoImagesWithDozorScore > 0: strWarningMessage = "Execution of Indexing and Indicators plugin failed - trying to index with MOSFLM." self.WARNING(strWarningMessage) self.sendMessageToMXCuBE(strWarningMessage, "warning") self.addWarningMessage(strWarningMessage) xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.dataCollection = self._xsDataCollection xsDataIndexingInput.experimentalCondition = self._xsDataCollection.subWedge[0].experimentalCondition xsDataIndexingInput.crystal = self._xsDataCrystal self._edPluginControlIndexingMOSFLM.setDataInput(xsDataIndexingInput) self.executePluginSynchronous(self._edPluginControlIndexingMOSFLM) else: strErrorMessage = "Execution of indexing with Labelit failed." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage(strErrorMessage) self.setFailure() self.generateExecutiveSummary(self) if self._strStatusMessage != None: self.setDataOutput(XSDataString(self._strStatusMessage), "statusMessage") self.writeDataOutput()
def doSuccessActionIndexing(self, _edPlugin=None): self.verboseDebug("EDPluginControlIndexingv10.doSuccessActionIndexing") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlIndexingv10.doSuccessActionIndexing") # Retrieve the output from the plugin self.xsDataIndexingResult = self.getDataIndexingResult(_edPlugin) self.generateShortSummary() # Add the list of images to the results xsDataListImage = self.generateImageList(self.xsDataCollection) self.xsDataIndexingResult.setImage(xsDataListImage) if (self.bGeneratePredictionImage): # Generate prediction images xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection(XSDataCollection.parseString(self.xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(self.xsDataIndexingResult.getSelectedSolution().marshal())) self.edPluginGeneratePrediction.setDataInput(xsDataGeneratePredictionInput) self.edPluginGeneratePrediction.executeSynchronous()
def generateXSDataIndexingResult(_xsDataMOSFLMIndexingOutput, _xsDataExperimentalCondition=None): """ Translation from XSDataMOSFLMIndexingOutput to XSDataIndexingResult. """ EDVerbose.DEBUG( "EDHandlerXSDataMOSFLMv10.generateXSDataIndexingOutput") xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMIndexingOutput.getRefinedBeam( ) xsDataMOSFLMBeamPositionShift = _xsDataMOSFLMIndexingOutput.getBeamShift( ) dDeviationAngular = _xsDataMOSFLMIndexingOutput.getDeviationAngular( ).getValue() dDeviationPositional = _xsDataMOSFLMIndexingOutput.getDeviationPositional( ).getValue() dMosaicityEstimation = _xsDataMOSFLMIndexingOutput.getMosaicityEstimation( ).getValue() dDistanceRefined = _xsDataMOSFLMIndexingOutput.getRefinedDistance( ).getValue() iSelectedSolution = _xsDataMOSFLMIndexingOutput.getSelectedSolutionNumber( ).getValue() iSpotsTotal = _xsDataMOSFLMIndexingOutput.getSpotsTotal().getValue() iSpotsUsed = _xsDataMOSFLMIndexingOutput.getSpotsUsed().getValue() xsDataCellRefined = _xsDataMOSFLMIndexingOutput.getRefinedNewmat( ).getRefinedCell() xsDataMatrixA = _xsDataMOSFLMIndexingOutput.getRefinedNewmat( ).getAMatrix() xsDataMatrixU = _xsDataMOSFLMIndexingOutput.getRefinedNewmat( ).getUMatrix() strSelectedSpaceGroupName = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroup( ).getValue() iSelectedSpaceGroupNumber = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroupNumber( ).getValue() xsDataIndexingResult = XSDataIndexingResult() xsDataIndexingSolutionSelected = None for possibleSolutions in _xsDataMOSFLMIndexingOutput.getPossibleSolutions( ): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName( XSDataString(possibleSolutions.getLattice().getValue())) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataCrystal.setCell(possibleSolutions.getCell()) xsDataIndexingSolution = XSDataIndexingSolution() xsDataIndexingSolution.setCrystal(xsDataCrystal) iIndex = possibleSolutions.getIndex().getValue() xsDataIndexingSolution.setNumber(XSDataInteger(iIndex)) xsDataIndexingSolution.setPenalty( XSDataFloat(possibleSolutions.getPenalty().getValue())) xsDataIndexingResult.addSolution(xsDataIndexingSolution) if (iIndex == iSelectedSolution): xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected( ) xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex)) xsDataIndexingSolutionSelected.setPenalty( XSDataFloat(possibleSolutions.getPenalty().getValue())) xsDataCrystalSelected = XSDataCrystal() xsDataSpaceGroupSelected = XSDataSpaceGroup() xsDataSpaceGroupSelected.setName( XSDataString(strSelectedSpaceGroupName)) xsDataSpaceGroupSelected.setITNumber( XSDataInteger(iSelectedSpaceGroupNumber)) xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected) xsDataCrystalSelected.setCell(xsDataCellRefined) xsDataCrystalSelected.setMosaicity(XSDataDouble(dMosaicityEstimation)) xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected) xsDataOrientation = XSDataOrientation() xsDataOrientation.setMatrixA(xsDataMatrixA) xsDataOrientation.setMatrixU(xsDataMatrixU) xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation) xsDataStatisticsIndexing = XSDataStatisticsIndexing() xsDataStatisticsIndexing.setBeamPositionShiftX( XSDataLength(xsDataMOSFLMBeamPositionShift.getX().getValue())) xsDataStatisticsIndexing.setBeamPositionShiftY( XSDataLength(xsDataMOSFLMBeamPositionShift.getY().getValue())) xsDataStatisticsIndexing.setSpotDeviationAngular( XSDataAngle(dDeviationAngular)) xsDataStatisticsIndexing.setSpotDeviationPositional( XSDataLength(dDeviationPositional)) xsDataStatisticsIndexing.setSpotsUsed(XSDataInteger(iSpotsUsed)) xsDataStatisticsIndexing.setSpotsTotal(XSDataInteger(iSpotsTotal)) xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing) xsDataExperimentalConditionRefined = None if (_xsDataExperimentalCondition is None): xsDataExperimentalConditionRefined = XSDataExperimentalCondition() else: # Copy the incoming experimental condition xmlExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString( xmlExperimentalCondition) xsDataDetector = xsDataExperimentalConditionRefined.getDetector() if (xsDataDetector is None): xsDataDetector = XSDataDetector() xsDataDetector.setBeamPositionX( XSDataLength(xsDataMOSFLMBeamPositionRefined.getX().getValue())) xsDataDetector.setBeamPositionY( XSDataLength(xsDataMOSFLMBeamPositionRefined.getY().getValue())) xsDataDetector.setDistance(XSDataLength(dDistanceRefined)) xsDataExperimentalConditionRefined.setDetector(xsDataDetector) xsDataIndexingSolutionSelected.setExperimentalConditionRefined( xsDataExperimentalConditionRefined) xsDataIndexingResult.setSelectedSolution( xsDataIndexingSolutionSelected) xsDataIndexingResult.setIndexingLogFile( _xsDataMOSFLMIndexingOutput.getPathToLogFile()) return xsDataIndexingResult
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.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)
def generateXSDataIndexingResult(_xsDataLabelitScreenOutput, _xsDataLabelitMosflmScriptsOutput, \ _xsDataExperimentalCondition=None): EDVerbose.DEBUG( "EDHandlerXSDataLabelitv1_1.generateXSDataIndexingOutput") iSelectedSolutionNumber = _xsDataLabelitScreenOutput.getSelectedSolutionNumber( ).getValue() xsDataIndexingResult = XSDataIndexingResult() xsDataIndexingSolutionSelected = None for xsDataLabelitSolution in _xsDataLabelitScreenOutput.getLabelitScreenSolution( ): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() edStringSpaceGroupName = EDUtilsSymmetry.getMinimumSymmetrySpaceGroupFromBravaisLattice( xsDataLabelitSolution.getBravaisLattice().getValue()) xsDataSpaceGroup.setName(XSDataString(edStringSpaceGroupName)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataCrystal.setCell(xsDataLabelitSolution.getUnitCell()) xsDataIndexingSolution = XSDataIndexingSolution() xsDataIndexingSolution.setCrystal(xsDataCrystal) iIndex = xsDataLabelitSolution.getSolutionNumber().getValue() xsDataIndexingSolution.setNumber(XSDataInteger(iIndex)) xsDataIndexingResult.addSolution(xsDataIndexingSolution) if (iIndex == iSelectedSolutionNumber): xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected( ) xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex)) edStringSelectedSpaceGroupName = edStringSpaceGroupName xsDataCellSelected = xsDataLabelitSolution.getUnitCell() fRmsdSelected = xsDataLabelitSolution.getRmsd().getValue() iNumberOfSpotsSelected = xsDataLabelitSolution.getNumberOfSpots( ).getValue() xsDataCrystalSelected = XSDataCrystal() xsDataSpaceGroupSelected = XSDataSpaceGroup() xsDataSpaceGroupSelected.setName( XSDataString(edStringSelectedSpaceGroupName)) #xsDataSpaceGroupSelected.setITNumber( XSDataInteger( iSelectedSpaceGroupNumber ) ) xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected) xsDataCrystalSelected.setCell(xsDataCellSelected) xsDataCrystalSelected.setMosaicity( XSDataDouble(_xsDataLabelitScreenOutput.getMosaicity().getValue())) xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected) xsDataOrientation = XSDataOrientation() xsDataOrientation.setMatrixA( _xsDataLabelitMosflmScriptsOutput.getAMatrix()) xsDataOrientation.setMatrixU( _xsDataLabelitMosflmScriptsOutput.getUMatrix()) xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation) xsDataStatisticsIndexing = XSDataStatisticsIndexing() if (_xsDataExperimentalCondition is not None): fBeamPositionXOrig = _xsDataExperimentalCondition.getDetector( ).getBeamPositionX().getValue() fBeamPositionYOrig = _xsDataExperimentalCondition.getDetector( ).getBeamPositionY().getValue() fBeamPositionXNew = _xsDataLabelitScreenOutput.getBeamCentreX( ).getValue() fBeamPositionYNew = _xsDataLabelitScreenOutput.getBeamCentreY( ).getValue() xsDataStatisticsIndexing.setBeamPositionShiftX( XSDataLength(fBeamPositionXOrig - fBeamPositionXNew)) xsDataStatisticsIndexing.setBeamPositionShiftY( XSDataLength(fBeamPositionYOrig - fBeamPositionYNew)) #xsDataStatisticsIndexing.setSpotDeviXSDataLength( dDistanceRefinedationAngular( XSDataAngle( dDeviationAngular ) ) xsDataStatisticsIndexing.setSpotDeviationPositional( XSDataLength(fRmsdSelected)) xsDataStatisticsIndexing.setSpotsUsed( XSDataInteger(iNumberOfSpotsSelected)) xsDataStatisticsIndexing.setSpotsTotal( XSDataInteger(iNumberOfSpotsSelected)) xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing) xsDataExperimentalConditionRefined = None if (_xsDataExperimentalCondition is None): xsDataExperimentalConditionRefined = XSDataExperimentalCondition() else: # Copy the incoming experimental condition xmlExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString( xmlExperimentalCondition) xsDataDetector = xsDataExperimentalConditionRefined.getDetector() if (xsDataDetector is None): xsDataDetector = XSDataDetector() xsDataDetector.setBeamPositionX( _xsDataLabelitScreenOutput.getBeamCentreX()) xsDataDetector.setBeamPositionY( _xsDataLabelitScreenOutput.getBeamCentreY()) xsDataDetector.setDistance(_xsDataLabelitScreenOutput.getDistance()) xsDataExperimentalConditionRefined.setDetector(xsDataDetector) xsDataIndexingSolutionSelected.setExperimentalConditionRefined( xsDataExperimentalConditionRefined) xsDataIndexingResult.setSelectedSolution( xsDataIndexingSolutionSelected) xsDataIndexingResult.setIndexingLogFile( _xsDataLabelitScreenOutput.getPathToLogFile()) return xsDataIndexingResult
def generateXSDataIndexingResult(_xsDataResultLabelitIndexing, _xsDataExperimentalCondition=None): EDVerbose.DEBUG("EDHandlerXSDataLabelitv1_1.generateXSDataIndexingOutput") xsDataLabelitScreenOutput = _xsDataResultLabelitIndexing.screenOutput xsDataLabelitMosflmScriptsOutput = _xsDataResultLabelitIndexing.mosflmScriptsOutput iSelectedSolutionNumber = xsDataLabelitScreenOutput.getSelectedSolutionNumber().getValue() xsDataIndexingResult = XSDataIndexingResult() xsDataIndexingSolutionSelected = None for xsDataLabelitSolution in xsDataLabelitScreenOutput.getLabelitScreenSolution(): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() edStringSpaceGroupName = EDUtilsSymmetry.getMinimumSymmetrySpaceGroupFromBravaisLattice(xsDataLabelitSolution.getBravaisLattice().getValue()) xsDataSpaceGroup.setName(XSDataString(edStringSpaceGroupName)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataCrystal.setCell(xsDataLabelitSolution.getUnitCell()) xsDataIndexingSolution = XSDataIndexingSolution() xsDataIndexingSolution.setCrystal(xsDataCrystal) iIndex = xsDataLabelitSolution.getSolutionNumber().getValue() xsDataIndexingSolution.setNumber(XSDataInteger(iIndex)) xsDataIndexingResult.addSolution(xsDataIndexingSolution) if (iIndex == iSelectedSolutionNumber): xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected() xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex)) edStringSelectedSpaceGroupName = edStringSpaceGroupName xsDataCellSelected = xsDataLabelitSolution.getUnitCell() fRmsdSelected = xsDataLabelitSolution.getRmsd().getValue() iNumberOfSpotsSelected = xsDataLabelitSolution.getNumberOfSpots().getValue() xsDataCrystalSelected = XSDataCrystal() xsDataSpaceGroupSelected = XSDataSpaceGroup() xsDataSpaceGroupSelected.setName(XSDataString(edStringSelectedSpaceGroupName)) xsDataSpaceGroupSelected.setITNumber(XSDataInteger(EDUtilsSymmetry.getITNumberFromSpaceGroupName(edStringSelectedSpaceGroupName))) xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected) xsDataCrystalSelected.setCell(xsDataCellSelected) xsDataCrystalSelected.setMosaicity(XSDataDouble(xsDataLabelitScreenOutput.getMosaicity().getValue())) xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected) xsDataOrientation = XSDataOrientation() xsDataOrientation.setMatrixA(xsDataLabelitMosflmScriptsOutput.getAMatrix()) xsDataOrientation.setMatrixU(xsDataLabelitMosflmScriptsOutput.getUMatrix()) xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation) xsDataStatisticsIndexing = XSDataStatisticsIndexing() if (_xsDataExperimentalCondition is not None): fBeamPositionXOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionX().getValue() fBeamPositionYOrig = _xsDataExperimentalCondition.getDetector().getBeamPositionY().getValue() fBeamPositionXNew = xsDataLabelitScreenOutput.getBeamCentreX().getValue() fBeamPositionYNew = xsDataLabelitScreenOutput.getBeamCentreY().getValue() xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(fBeamPositionXOrig - fBeamPositionXNew)) xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(fBeamPositionYOrig - fBeamPositionYNew)) # xsDataStatisticsIndexing.setSpotDeviXSDataLength( dDistanceRefinedationAngular( XSDataAngle( dDeviationAngular ) ) xsDataStatisticsIndexing.setSpotDeviationPositional(XSDataLength(fRmsdSelected)) xsDataStatisticsIndexing.setSpotsUsed(XSDataInteger(iNumberOfSpotsSelected)) xsDataStatisticsIndexing.setSpotsTotal(XSDataInteger(iNumberOfSpotsSelected)) xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing) xsDataExperimentalConditionRefined = None if (_xsDataExperimentalCondition is None): xsDataExperimentalConditionRefined = XSDataExperimentalCondition() else: # Copy the incoming experimental condition xmlExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition) xsDataDetector = xsDataExperimentalConditionRefined.getDetector() if (xsDataDetector is None): xsDataDetector = XSDataDetector() xsDataDetector.setBeamPositionX(xsDataLabelitScreenOutput.getBeamCentreX()) xsDataDetector.setBeamPositionY(xsDataLabelitScreenOutput.getBeamCentreY()) xsDataDetector.setDistance(xsDataLabelitScreenOutput.getDistance()) xsDataExperimentalConditionRefined.setDetector(xsDataDetector) xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined) xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected) xsDataIndexingResult.setIndexingLogFile(xsDataLabelitScreenOutput.getPathToLogFile()) return xsDataIndexingResult
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()
def doSuccessEvaluationIndexingLABELIT(self, _edPlugin=None): self.DEBUG( "EDPluginControlCharacterisationv1_4.doSuccessEvaluationIndexingLABELIT" ) self.retrieveSuccessMessages( _edPlugin, "EDPluginControlCharacterisationv1_4.doSuccessEvaluationIndexingLABELIT" ) # Retrieve status messages (if any) if self._edPluginExecEvaluationIndexingLABELIT.hasDataOutput( "statusMessageIndexing"): self.addStatusMessage( "Labelit: " + self._edPluginExecEvaluationIndexingLABELIT.getDataOutput( "statusMessageIndexing")[0].getValue()) # Check if indexing was successful bIndexingSuccess = self._edPluginExecEvaluationIndexingLABELIT.getDataOutput( "indexingSuccess")[0].getValue() if bIndexingSuccess: xsDataIndexingResult = self._edPluginExecEvaluationIndexingLABELIT.getDataOutput( "indexingResult")[0] self._xsDataResultCharacterisation.setIndexingResult( xsDataIndexingResult) xsDataCollection = self._xsDataResultCharacterisation.getDataCollection( ) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setDataCollection( XSDataCollection.parseString(xsDataCollection.marshal())) xsDataGeneratePredictionInput.setSelectedIndexingSolution( XSDataIndexingSolutionSelected.parseString( xsDataIndexingResult.getSelectedSolution().marshal())) self._edPluginControlGeneratePrediction.setDataInput( xsDataGeneratePredictionInput) if self._edPluginControlIndexingIndicators.hasDataOutput( "indexingShortSummary"): indexingShortSummary = self._edPluginControlIndexingIndicators.getDataOutput( "indexingShortSummary")[0].getValue() self._strCharacterisationShortSummary += indexingShortSummary self.sendMessageToMXCuBE(indexingShortSummary) # Start the generation of prediction images - we synchronize in the post-process self._edPluginControlGeneratePrediction.execute() # Then start the integration of the reference images self.indexingToIntegration() else: if self._iNoImagesWithDozorScore > 0: if not self._bDoOnlyMoslmfIndexing: strWarningMessage = "Execution of Indexing and Indicators plugin failed - trying to index with MOSFLM." self.WARNING(strWarningMessage) self.sendMessageToMXCuBE(strWarningMessage, "warning") self.addWarningMessage(strWarningMessage) xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.dataCollection = self._xsDataCollection xsDataIndexingInput.experimentalCondition = self._xsDataCollection.subWedge[ 0].experimentalCondition xsDataIndexingInput.crystal = self._xsDataCrystal self._edPluginControlIndexingMOSFLM.setDataInput( xsDataIndexingInput) self.executePluginSynchronous( self._edPluginControlIndexingMOSFLM) else: strErrorMessage = "Execution of indexing with Labelit failed." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage(strErrorMessage) self.setFailure() self.generateExecutiveSummary(self) if self._strStatusMessage != None: self.setDataOutput(XSDataString(self._strStatusMessage), "statusMessage") self.writeDataOutput()
def generateXSDataIndexingResult(_xsDataMOSFLMIndexingOutput, _xsDataExperimentalCondition=None): """ Translation from XSDataMOSFLMIndexingOutput to XSDataIndexingResult. """ EDVerbose.DEBUG("EDHandlerXSDataMOSFLMv10.generateXSDataIndexingOutput") xsDataMOSFLMBeamPositionRefined = _xsDataMOSFLMIndexingOutput.getRefinedBeam() xsDataMOSFLMBeamPositionShift = _xsDataMOSFLMIndexingOutput.getBeamShift() dDeviationAngular = _xsDataMOSFLMIndexingOutput.getDeviationAngular().getValue() dDeviationPositional = _xsDataMOSFLMIndexingOutput.getDeviationPositional().getValue() dMosaicityEstimation = _xsDataMOSFLMIndexingOutput.getMosaicityEstimation().getValue() dDistanceRefined = _xsDataMOSFLMIndexingOutput.getRefinedDistance().getValue() iSelectedSolution = _xsDataMOSFLMIndexingOutput.getSelectedSolutionNumber().getValue() iSpotsTotal = _xsDataMOSFLMIndexingOutput.getSpotsTotal().getValue() iSpotsUsed = _xsDataMOSFLMIndexingOutput.getSpotsUsed().getValue() xsDataCellRefined = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getRefinedCell() xsDataMatrixA = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getAMatrix() xsDataMatrixU = _xsDataMOSFLMIndexingOutput.getRefinedNewmat().getUMatrix() strSelectedSpaceGroupName = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroup().getValue() iSelectedSpaceGroupNumber = _xsDataMOSFLMIndexingOutput.getSelectedSolutionSpaceGroupNumber().getValue() xsDataIndexingResult = XSDataIndexingResult() xsDataIndexingSolutionSelected = None for possibleSolutions in _xsDataMOSFLMIndexingOutput.getPossibleSolutions(): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(XSDataString(possibleSolutions.getLattice().getValue())) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataCrystal.setCell(possibleSolutions.getCell()) xsDataIndexingSolution = XSDataIndexingSolution() xsDataIndexingSolution.setCrystal(xsDataCrystal) iIndex = possibleSolutions.getIndex().getValue() xsDataIndexingSolution.setNumber(XSDataInteger(iIndex)) xsDataIndexingSolution.setPenalty(XSDataFloat(possibleSolutions.getPenalty().getValue())) xsDataIndexingResult.addSolution(xsDataIndexingSolution) if (iIndex == iSelectedSolution): xsDataIndexingSolutionSelected = XSDataIndexingSolutionSelected() xsDataIndexingSolutionSelected.setNumber(XSDataInteger(iIndex)) xsDataIndexingSolutionSelected.setPenalty(XSDataFloat(possibleSolutions.getPenalty().getValue())) xsDataCrystalSelected = XSDataCrystal() xsDataSpaceGroupSelected = XSDataSpaceGroup() xsDataSpaceGroupSelected.setName(XSDataString(strSelectedSpaceGroupName)) xsDataSpaceGroupSelected.setITNumber(XSDataInteger(iSelectedSpaceGroupNumber)) xsDataCrystalSelected.setSpaceGroup(xsDataSpaceGroupSelected) xsDataCrystalSelected.setCell(xsDataCellRefined) xsDataCrystalSelected.setMosaicity(XSDataDouble(dMosaicityEstimation)) xsDataIndexingSolutionSelected.setCrystal(xsDataCrystalSelected) xsDataOrientation = XSDataOrientation() xsDataOrientation.setMatrixA(xsDataMatrixA) xsDataOrientation.setMatrixU(xsDataMatrixU) xsDataIndexingSolutionSelected.setOrientation(xsDataOrientation) xsDataStatisticsIndexing = XSDataStatisticsIndexing() xsDataStatisticsIndexing.setBeamPositionShiftX(XSDataLength(xsDataMOSFLMBeamPositionShift.getX().getValue())) xsDataStatisticsIndexing.setBeamPositionShiftY(XSDataLength(xsDataMOSFLMBeamPositionShift.getY().getValue())) xsDataStatisticsIndexing.setSpotDeviationAngular(XSDataAngle(dDeviationAngular)) xsDataStatisticsIndexing.setSpotDeviationPositional(XSDataLength(dDeviationPositional)) xsDataStatisticsIndexing.setSpotsUsed(XSDataInteger(iSpotsUsed)) xsDataStatisticsIndexing.setSpotsTotal(XSDataInteger(iSpotsTotal)) xsDataIndexingSolutionSelected.setStatistics(xsDataStatisticsIndexing) xsDataExperimentalConditionRefined = None if (_xsDataExperimentalCondition is None): xsDataExperimentalConditionRefined = XSDataExperimentalCondition() else: # Copy the incoming experimental condition xmlExperimentalCondition = _xsDataExperimentalCondition.marshal() xsDataExperimentalConditionRefined = XSDataExperimentalCondition.parseString(xmlExperimentalCondition) xsDataDetector = xsDataExperimentalConditionRefined.getDetector() if (xsDataDetector is None): xsDataDetector = XSDataDetector() xsDataDetector.setBeamPositionX(XSDataLength(xsDataMOSFLMBeamPositionRefined.getX().getValue())) xsDataDetector.setBeamPositionY(XSDataLength(xsDataMOSFLMBeamPositionRefined.getY().getValue())) xsDataDetector.setDistance(XSDataLength(dDistanceRefined)) xsDataExperimentalConditionRefined.setDetector(xsDataDetector) xsDataIndexingSolutionSelected.setExperimentalConditionRefined(xsDataExperimentalConditionRefined) xsDataIndexingResult.setSelectedSolution(xsDataIndexingSolutionSelected) return xsDataIndexingResult