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)
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 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 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)
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 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 testCheckParameters(self): strXMLInput = self.readAndParseFile(self.strPathToReferenceInput) xsDataInput = XSDataCollection.parseString(strXMLInput) edPluginControlIndexingIndicators = self.createPlugin() edPluginControlIndexingIndicators.setDataInput(xsDataInput, "dataCollection") edPluginControlIndexingIndicators.checkParameters()
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) EDVerbose.DEBUG("EDPluginControlCharacterisationv1_3.preProcess") # Load the plugins self._edPluginControlIndexingIndicators = self.loadPlugin(self._strPluginControlIndexingIndicators, \ "Indexing") self._edPluginControlIndexingLabelit = self.loadPlugin(self._strPluginControlIndexingLabelit, \ "IndexingLabelit") self._edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self._edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self._edPluginControlGeneratePrediction = self.loadPlugin(self._strPluginControlGeneratePrediction, \ "GeneratePrediction") self._edPluginControlIntegration = self.loadPlugin(self._strPluginControlIntegration, \ "Integration") self._edPluginControlXDSGenerateBackgroundImage = self.loadPlugin(self._strPluginControlXDSGenerateBackgroundImage, \ "ControlXDSGenerateBackgroundImage") self._edPluginControlStrategy = self.loadPlugin(self._strPluginControlStrategy, \ "Strategy") if (self._edPluginControlIndexingIndicators is not None): EDVerbose.DEBUG("EDPluginControlCharacterisationv1_3.preProcess: " + self._strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self._xsDataCollection = xsDataInputCharacterisation.getDataCollection() xsDataCrystal = None xsDataSubWedgeList = self._xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_3.preProcess: No subwedges in input data." EDVerbose.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam().getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." EDVerbose.ERROR(strErrorMessage) self.addErrorMessage("EDPluginControlCharacterisationv1_3.preProcess ERROR: " + strErrorMessage) #self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self._xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if (xsDataStringForcedSpaceGroup is not None): self._xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self._xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCollection, "dataCollection") if self._xsDataCrystal is not None: self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCrystal, "crystal") # Populate characterisation object self._xsDataResultCharacterisation = XSDataResultCharacterisation() self._xsDataResultCharacterisation.setDataCollection(XSDataCollection.parseString(self._xsDataCollection.marshal()))
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) self.DEBUG("EDPluginControlCharacterisationv1_2.preProcess") # Load the plugins self.__edPluginControlIndexingIndicators = self.loadPlugin(self.__strPluginControlIndexingIndicators, \ "Indexing") self.__edPluginControlIndexingLabelit = self.loadPlugin(self.__strPluginControlIndexingLabelit, \ "IndexingLabelit") self.__edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self.__strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self.__edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self.__strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self.__edPluginControlGeneratePrediction = self.loadPlugin(self.__strPluginControlGeneratePrediction, \ "GeneratePrediction") self.__edPluginControlIntegration = self.loadPlugin(self.__strPluginControlIntegration, \ "Integration") self.__edPluginControlStrategy = self.loadPlugin(self.__strPluginControlStrategy, \ "Strategy") if (self.__edPluginControlIndexingIndicators is not None): self.DEBUG("EDPluginControlCharacterisationv1_2.preProcess: " + self.__strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self.__xsDataCollection = xsDataInputCharacterisation.getDataCollection() xsDataCrystal = None xsDataSubWedgeList = self.__xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_2.preProcess: No subwedges in input data." self.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam().getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." self.ERROR(strErrorMessage) self.addErrorMessage("EDPluginControlCharacterisationv1_2.preProcess ERROR: " + strErrorMessage) #self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self.__xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if (xsDataStringForcedSpaceGroup is not None): self.__xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self.__xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self.__edPluginControlIndexingIndicators.setDataInput(self.__xsDataCollection, "dataCollection") if self.__xsDataCrystal is not None: self.__edPluginControlIndexingIndicators.setDataInput(self.__xsDataCrystal, "crystal") # Populate characterisation object self.__xsDataResultCharacterisation = XSDataResultCharacterisation() self.__xsDataResultCharacterisation.setDataCollection(XSDataCollection.parseString(self.__xsDataCollection.marshal()))
def testCreatePyarchHtmlDirectoryPath(self): strTestDataDir = self.getPluginTestsDataHome() strTestFile = os.path.join(strTestDataDir, "EDHandlerESRFPyarchv1_0", "XSDataCollection_reference.xml") strXml = self.readAndParseFile(strTestFile) xsDataCollection = XSDataCollection.parseString(strXml) strPyarchHtmlDirectoryPath = EDHandlerESRFPyarchv1_0.createPyarchHtmlDirectoryPath(xsDataCollection) #print strPyarchHtmlDirectoryPath strReferencePath = "/data/pyarch/id23eh1/Pasha/data/visitor/mx1199/id29/20111205/RAW_DATA/4ESR372D11/4ESR372D11_1_dnafiles" EDAssert.equal(strReferencePath, strPyarchHtmlDirectoryPath, "Correct pyarch path")
def testCreatePyarchHtmlDirectoryPath(self): strTestDataDir = self.getPluginTestsDataHome() strTestFile = os.path.join(strTestDataDir, "EDHandlerESRFPyarchv1_0", "XSDataCollection_reference.xml") strXml = self.readAndParseFile(strTestFile) xsDataCollection = XSDataCollection.parseString(strXml) strPyarchHtmlDirectoryPath = EDHandlerESRFPyarchv1_0.createPyarchHtmlDirectoryPath(xsDataCollection) #print strPyarchHtmlDirectoryPath strReferencePath = "/data/pyarch/id23eh1/Pasha/data/visitor/mx1199/id29/20111205/RAW_DATA/4ESR372D11/4ESR372D11_1_dnafiles" EDAssert.equal(strReferencePath, strPyarchHtmlDirectoryPath, "Correct pyarch path")
def testCreatePyarchHtmlDirectoryPath(self): strTestDataDir = self.getPluginTestsDataHome() strTestFile = os.path.join(strTestDataDir, "EDHandlerESRFPyarchv1_0", "XSDataCollection_reference.xml") strXml = self.readAndParseFile(strTestFile) xsDataCollection = XSDataCollection.parseString(strXml) strPyarchHtmlDirectoryPath = EDHandlerESRFPyarchv1_0.createPyarchHtmlDirectoryPath(xsDataCollection) # print strPyarchHtmlDirectoryPath strReferencePath = "/data/pyarch/2016/id30b/opid30b/20161214/RAW_DATA/Magda/Test_x1_2_dnafiles" EDAssert.equal(strReferencePath, strPyarchHtmlDirectoryPath, "Correct pyarch path")
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 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 testCreatePyarchHtmlDirectoryPath(self): strTestDataDir = self.getPluginTestsDataHome() strTestFile = os.path.join(strTestDataDir, "EDHandlerESRFPyarchv1_0", "XSDataCollection_reference.xml") strXml = self.readAndParseFile(strTestFile) xsDataCollection = XSDataCollection.parseString(strXml) strPyarchHtmlDirectoryPath = EDHandlerESRFPyarchv1_0.createPyarchHtmlDirectoryPath( xsDataCollection) # print strPyarchHtmlDirectoryPath strReferencePath = "/data/pyarch/2016/id30b/opid30b/20161214/RAW_DATA/Magda/Test_x1_2_dnafiles" EDAssert.equal(strReferencePath, strPyarchHtmlDirectoryPath, "Correct pyarch path")
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlCharacterisationv1_1.preProcess...") self.__edPluginIndexing = self.loadPlugin(self.__strPluginIndexingName , "Indexing") self.__edPluginIntegration = self.loadPlugin(self.__strPluginIntegrationName, "Integration") self.__edPluginStrategy = self.loadPlugin(self.__strPluginStrategyName , "Strategy") if (self.__edPluginIndexing is not None): EDVerbose.DEBUG("EDPluginControlCharacterisationv1_1.preProcess: " + self.__strPluginIndexingName + " Found... setting Data Input") # create Data Input for indexing xsDataInputStrategy = self.getDataInput() xsDataCollection = xsDataInputStrategy.getDataCollection() xsDataSample = xsDataCollection.getSample() xsDataSubWedgeList = xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_1.preProcess: No subwedges in input data." EDVerbose.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam().getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): pyStrErrorMessage = "EDPluginControlCharacterisationv1_1.preProcess ERROR: Input flux is negative or close to zero. Execution of characterisation aborted." EDVerbose.ERROR(pyStrErrorMessage) self.addErrorMessage(pyStrErrorMessage) self.setFailure() xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(xsDataCollection) xsDataIndexingInput.setExperimentalCondition(xsDataExperimentalCondition) xsDataDiffractionPlan = xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if (xsDataStringForcedSpaceGroup is not None): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataIndexingInput.setCrystal(xsDataCrystal) self.__edPluginIndexing.setDataInput(xsDataIndexingInput) # Populate characterisation object self.__xsDataResultCharacterisation = XSDataResultCharacterisation() self.__xsDataResultCharacterisation.setDataCollection(XSDataCollection.parseString(xsDataCollection.marshal()))
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlCharacterisationv2_0.preProcess...") self.edPluginIndexing = self.loadPlugin(self.strPluginIndexingName, "Indexing") self.edPluginIntegration = self.loadPlugin( self.strPluginIntegrationName, "Integration") self.edPluginStrategy = self.loadPlugin(self.strPluginStrategyName, "Strategy") if (self.edPluginIndexing is not None): EDVerbose.DEBUG( "EDPluginControlCharacterisationv2_0.preProcess: " + self.strPluginIndexingName + " Found... setting Data Input") # create Data Input for indexing xsDataInputStrategy = self.getDataInput( "mxv1InputCharacterisation")[0] xsDataCollection = xsDataInputStrategy.getDataCollection() #xsDataSample = xsDataCollection.getSample() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataExperimentalCondition = xsDataSubWedgeList[ 0].getExperimentalCondition() xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(xsDataCollection) xsDataIndexingInput.setExperimentalCondition( xsDataExperimentalCondition) xsDataDiffractionPlan = xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup( ) if (xsDataStringForcedSpaceGroup is not None): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataIndexingInput.setCrystal(xsDataCrystal) self.edPluginIndexing.setDataInput(xsDataIndexingInput) # Populate characterisation object self.xsDataResultCharacterisationv2_0 = XSDataResultCharacterisationv2_0( ) self.xsDataResultCharacterisation = XSDataResultCharacterisation() self.xsDataResultCharacterisationv2_0.setMxv1ResultCharacterisation( self.xsDataResultCharacterisation) self.xsDataResultCharacterisation.setDataCollection( XSDataCollection.parseString(xsDataCollection.marshal()))
def testSetDataInput(self): edPluginControlCharacterisationv10 = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginControlCharacterisationv10.setConfiguration(xsPluginItemGood01) edPluginControlCharacterisationv10.configure() edStringXMLInput = self.readAndParseFile(self.strReferenceInputFile) edPluginControlCharacterisationv10.setDataInput(edStringXMLInput) from XSDataMXv1 import XSDataCollection xsDataCollectionReference = XSDataCollection.parseString(edStringXMLInput) xsDataCharacterisationv10Input = edPluginControlCharacterisationv10.getDataInput() EDAssert.equal(xsDataCollectionReference.marshal(), xsDataCharacterisationv10Input.marshal())
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 preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlCharacterisationv2_0.preProcess...") self.edPluginIndexing = self.loadPlugin(self.strPluginIndexingName, "Indexing") self.edPluginIntegration = self.loadPlugin(self.strPluginIntegrationName, "Integration") self.edPluginStrategy = self.loadPlugin(self.strPluginStrategyName, "Strategy") if self.edPluginIndexing is not None: EDVerbose.DEBUG( "EDPluginControlCharacterisationv2_0.preProcess: " + self.strPluginIndexingName + " Found... setting Data Input" ) # create Data Input for indexing xsDataInputStrategy = self.getDataInput("mxv1InputCharacterisation")[0] xsDataCollection = xsDataInputStrategy.getDataCollection() # xsDataSample = xsDataCollection.getSample() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(xsDataCollection) xsDataIndexingInput.setExperimentalCondition(xsDataExperimentalCondition) xsDataDiffractionPlan = xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if xsDataStringForcedSpaceGroup is not None: xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataIndexingInput.setCrystal(xsDataCrystal) self.edPluginIndexing.setDataInput(xsDataIndexingInput) # Populate characterisation object self.xsDataResultCharacterisationv2_0 = XSDataResultCharacterisationv2_0() self.xsDataResultCharacterisation = XSDataResultCharacterisation() self.xsDataResultCharacterisationv2_0.setMxv1ResultCharacterisation(self.xsDataResultCharacterisation) self.xsDataResultCharacterisation.setDataCollection( XSDataCollection.parseString(xsDataCollection.marshal()) )
def testSetDataInput(self): edPluginControlCharacterisationv10 = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration( os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginControlCharacterisationv10.setConfiguration(xsPluginItemGood01) edPluginControlCharacterisationv10.configure() edStringXMLInput = self.readAndParseFile(self.strReferenceInputFile) edPluginControlCharacterisationv10.setDataInput(edStringXMLInput) from XSDataMXv1 import XSDataCollection xsDataCollectionReference = XSDataCollection.parseString( edStringXMLInput) xsDataCharacterisationv10Input = edPluginControlCharacterisationv10.getDataInput( ) EDAssert.equal(xsDataCollectionReference.marshal(), xsDataCharacterisationv10Input.marshal())
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 preProcess(self, _edObject=None): EDPluginControl.preProcess(self) EDVerbose.DEBUG("EDPluginControlCharacterisationv1_3.preProcess") # Load the plugins self._edPluginControlIndexingIndicators = self.loadPlugin(self._strPluginControlIndexingIndicators, \ "Indexing") self._edPluginControlIndexingLabelit = self.loadPlugin(self._strPluginControlIndexingLabelit, \ "IndexingLabelit") self._edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self._edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self._edPluginControlGeneratePrediction = self.loadPlugin(self._strPluginControlGeneratePrediction, \ "GeneratePrediction") self._edPluginControlIntegration = self.loadPlugin(self._strPluginControlIntegration, \ "Integration") self._edPluginControlXDSGenerateBackgroundImage = self.loadPlugin(self._strPluginControlXDSGenerateBackgroundImage, \ "ControlXDSGenerateBackgroundImage") self._edPluginControlStrategy = self.loadPlugin(self._strPluginControlStrategy, \ "Strategy") if (self._edPluginControlIndexingIndicators is not None): EDVerbose.DEBUG( "EDPluginControlCharacterisationv1_3.preProcess: " + self._strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self._xsDataCollection = xsDataInputCharacterisation.getDataCollection( ) # MXSUP-1445: Check if transmission is less than 10% and warn if it's the case xsDataFirstSubWedge = self._xsDataCollection.getSubWedge()[0] xsDataBeam = xsDataFirstSubWedge.getExperimentalCondition( ).getBeam() if xsDataBeam.getTransmission() is not None: fTransmission = xsDataBeam.getTransmission().getValue() if fTransmission < self._fMinTransmission: strWarningMessageBanner = "^" * 80 strWarningMessage1 = "WARNING! Transmission for characterisation set to %.1f %%" % fTransmission strWarningMessage2 = "Please consider re-characterising with transmission set to 100 %" self.warning(strWarningMessageBanner) self.warning(strWarningMessage1) self.warning(strWarningMessage2) self.warning(strWarningMessageBanner) self.addWarningMessage(strWarningMessageBanner) self.addWarningMessage(strWarningMessage1) self.addWarningMessage(strWarningMessage2) self.addWarningMessage(strWarningMessageBanner) xsDataCrystal = None xsDataSubWedgeList = self._xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_3.preProcess: No subwedges in input data." EDVerbose.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[ 0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam( ).getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." EDVerbose.ERROR(strErrorMessage) self.addErrorMessage( "EDPluginControlCharacterisationv1_3.preProcess ERROR: " + strErrorMessage) #self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self._xsDataCollection.getDiffractionPlan( ) xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup( ) if (xsDataStringForcedSpaceGroup is not None): self._xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self._xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self._edPluginControlIndexingIndicators.setDataInput( self._xsDataCollection, "dataCollection") if self._xsDataCrystal is not None: self._edPluginControlIndexingIndicators.setDataInput( self._xsDataCrystal, "crystal") # Populate characterisation object self._xsDataResultCharacterisation = XSDataResultCharacterisation( ) self._xsDataResultCharacterisation.setDataCollection( XSDataCollection.parseString( self._xsDataCollection.marshal()))
def testCheckParameters(self): strXMLInput = self.readAndParseFile(self.strPathToReferenceInput) xsDataInput = XSDataCollection.parseString(strXMLInput) edPluginControlIndexingIndicators = self.createPlugin() edPluginControlIndexingIndicators.setDataInput(xsDataInput, "dataCollection") edPluginControlIndexingIndicators.checkParameters()
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) self.DEBUG("EDPluginControlCharacterisationv1_4.preProcess") self._xsDataResultCharacterisation = XSDataResultCharacterisation() # Load the plugins self._edPluginControlIndexingIndicators = self.loadPlugin(self._strPluginControlIndexingIndicators, \ "Indexing") self._edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self._edPluginControlIndexingMOSFLM = self.loadPlugin(self._strPluginControlIndexingMOSFLM, \ "IndexingMOSFLM") self._edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self._edPluginControlGeneratePrediction = self.loadPlugin(self._strPluginControlGeneratePrediction, \ "GeneratePrediction") self._edPluginControlIntegration = self.loadPlugin(self._strPluginControlIntegration, \ "Integration") self._edPluginControlXDSGenerateBackgroundImage = self.loadPlugin(self._strPluginControlXDSGenerateBackgroundImage, \ "ControlXDSGenerateBackgroundImage") self._edPluginControlStrategy = self.loadPlugin(self._strPluginControlStrategy, \ "Strategy") if self._runKappa: self._edPluginControlKappa = self.loadPlugin( self._strPluginControlKappaName, "Kappa") if (self._edPluginControlIndexingIndicators is not None): self.DEBUG("EDPluginControlCharacterisationv1_4.preProcess: " + self._strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self._xsDataCollection = xsDataInputCharacterisation.getDataCollection( ) # MXSUP-1445: Check if transmission is less than 10% and warn if it's the case xsDataFirstSubWedge = self._xsDataCollection.getSubWedge()[0] xsDataBeam = xsDataFirstSubWedge.getExperimentalCondition( ).getBeam() if xsDataBeam.getTransmission() is not None: fTransmission = xsDataBeam.getTransmission().getValue() if fTransmission < self._fMinTransmission: strWarningMessageBanner = "^" * 80 strWarningMessage1 = "WARNING! Transmission for characterisation set to %.1f %%" % fTransmission strWarningMessage2 = "Please consider re-characterising with transmission set to 100 %" self.warning(strWarningMessageBanner) self.warning(strWarningMessage1) self.warning(strWarningMessage2) self.warning(strWarningMessageBanner) self.addWarningMessage(strWarningMessageBanner) self.addWarningMessage(strWarningMessage1) self.addWarningMessage(strWarningMessage2) self.addWarningMessage(strWarningMessageBanner) self.sendMessageToMXCuBE(strWarningMessage1, "warning") self.sendMessageToMXCuBE(strWarningMessage2, "warning") xsDataCrystal = None xsDataSubWedgeList = self._xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_4.preProcess: No subwedges in input data." self.ERROR(strError) self.setFailure() else: # Load the thumbnail plugins self._iNoReferenceImages = 0 for subWedge in xsDataInputCharacterisation.dataCollection.subWedge: for image in subWedge.image: self._iNoReferenceImages += 1 edPluginJpeg = self.loadPlugin( self._strPluginGenerateThumbnailName) xsDataInputMXThumbnail = XSDataInputMXThumbnail() xsDataInputMXThumbnail.image = XSDataFile(image.path) xsDataInputMXThumbnail.height = XSDataInteger(1024) xsDataInputMXThumbnail.width = XSDataInteger(1024) jpegFilename = os.path.splitext( os.path.basename(image.path.value))[0] + ".jpg" xsDataInputMXThumbnail.outputPath = XSDataFile( XSDataString( os.path.join(self.getWorkingDirectory(), jpegFilename))) edPluginJpeg.dataInput = xsDataInputMXThumbnail edPluginThumnail = self.loadPlugin( self._strPluginGenerateThumbnailName) xsDataInputMXThumbnail = XSDataInputMXThumbnail() xsDataInputMXThumbnail.image = XSDataFile(image.path) xsDataInputMXThumbnail.height = XSDataInteger(256) xsDataInputMXThumbnail.width = XSDataInteger(256) thumbnailFilename = os.path.splitext( os.path.basename( image.path.value))[0] + ".thumbnail.jpg" xsDataInputMXThumbnail.outputPath = XSDataFile( XSDataString( os.path.join(self.getWorkingDirectory(), thumbnailFilename))) edPluginThumnail.dataInput = xsDataInputMXThumbnail self._listPluginGenerateThumbnail.append( (image, edPluginJpeg, edPluginThumnail)) edPluginJpeg.execute() edPluginThumnail.execute() xsDataExperimentalCondition = xsDataSubWedgeList[ 0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam( ).getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage( "EDPluginControlCharacterisationv1_4.preProcess ERROR: " + strErrorMessage) # self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self._xsDataCollection.getDiffractionPlan( ) xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup( ) if (xsDataStringForcedSpaceGroup is not None): self._xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self._xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self._edPluginControlIndexingIndicators.setDataInput( self._xsDataCollection, "dataCollection") if self._xsDataCrystal is not None: self._edPluginControlIndexingIndicators.setDataInput( self._xsDataCrystal, "crystal") # Populate characterisation object self._xsDataResultCharacterisation.setDataCollection( XSDataCollection.parseString( self._xsDataCollection.marshal()))
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) EDVerbose.DEBUG("EDPluginControlCharacterisationv1_3.preProcess") # Load the plugins self._edPluginControlIndexingIndicators = self.loadPlugin(self._strPluginControlIndexingIndicators, \ "Indexing") self._edPluginControlIndexingLabelit = self.loadPlugin(self._strPluginControlIndexingLabelit, \ "IndexingLabelit") self._edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self._edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self._edPluginControlGeneratePrediction = self.loadPlugin(self._strPluginControlGeneratePrediction, \ "GeneratePrediction") self._edPluginControlIntegration = self.loadPlugin(self._strPluginControlIntegration, \ "Integration") self._edPluginControlXDSGenerateBackgroundImage = self.loadPlugin(self._strPluginControlXDSGenerateBackgroundImage, \ "ControlXDSGenerateBackgroundImage") self._edPluginControlStrategy = self.loadPlugin(self._strPluginControlStrategy, \ "Strategy") if (self._edPluginControlIndexingIndicators is not None): EDVerbose.DEBUG("EDPluginControlCharacterisationv1_3.preProcess: " + self._strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self._xsDataCollection = xsDataInputCharacterisation.getDataCollection() # MXSUP-1445: Check if transmission is less than 10% and warn if it's the case xsDataFirstSubWedge = self._xsDataCollection.getSubWedge()[0] xsDataBeam = xsDataFirstSubWedge.getExperimentalCondition().getBeam() if xsDataBeam.getTransmission() is not None: fTransmission = xsDataBeam.getTransmission().getValue() if fTransmission < self._fMinTransmission: strWarningMessageBanner = "^"*80 strWarningMessage1 = "WARNING! Transmission for characterisation set to %.1f %%" % fTransmission strWarningMessage2 = "Please consider re-characterising with transmission set to 100 %" self.warning(strWarningMessageBanner) self.warning(strWarningMessage1) self.warning(strWarningMessage2) self.warning(strWarningMessageBanner) self.addWarningMessage(strWarningMessageBanner) self.addWarningMessage(strWarningMessage1) self.addWarningMessage(strWarningMessage2) self.addWarningMessage(strWarningMessageBanner) xsDataCrystal = None xsDataSubWedgeList = self._xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_3.preProcess: No subwedges in input data." EDVerbose.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam().getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." EDVerbose.ERROR(strErrorMessage) self.addErrorMessage("EDPluginControlCharacterisationv1_3.preProcess ERROR: " + strErrorMessage) #self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self._xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if (xsDataStringForcedSpaceGroup is not None): self._xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self._xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCollection, "dataCollection") if self._xsDataCrystal is not None: self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCrystal, "crystal") # Populate characterisation object self._xsDataResultCharacterisation = XSDataResultCharacterisation() self._xsDataResultCharacterisation.setDataCollection(XSDataCollection.parseString(self._xsDataCollection.marshal()))
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) self.DEBUG("EDPluginControlCharacterisationv1_5.preProcess") self._xsDataResultCharacterisation = XSDataResultCharacterisation() # Load the plugins self._edPluginControlIndexingIndicators = self.loadPlugin(self._strPluginControlIndexingIndicators, \ "Indexing") self._edPluginExecEvaluationIndexingLABELIT = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionLABELIT") self._edPluginControlIndexingMOSFLM = self.loadPlugin(self._strPluginControlIndexingMOSFLM, \ "IndexingMOSFLM") self._edPluginExecEvaluationIndexingMOSFLM = self.loadPlugin(self._strPluginExecEvaluationIndexing, \ "IndexingEvalualtionMOSFLM") self._edPluginControlGeneratePrediction = self.loadPlugin(self._strPluginControlGeneratePrediction, \ "GeneratePrediction") self._edPluginControlIntegration = self.loadPlugin(self._strPluginControlIntegration, \ "Integration") self._edPluginControlXDSGenerateBackgroundImage = self.loadPlugin(self._strPluginControlXDSGenerateBackgroundImage, \ "ControlXDSGenerateBackgroundImage") self._edPluginControlStrategy = self.loadPlugin(self._strPluginControlStrategy, \ "Strategy") if self._runKappa: self._edPluginControlKappa = self.loadPlugin(self._strPluginControlKappaName, "Kappa") if (self._edPluginControlIndexingIndicators is not None): self.DEBUG("EDPluginControlCharacterisationv1_5.preProcess: " + self._strPluginControlIndexingIndicators + " Found... setting Data Input") # create Data Input for indexing xsDataInputCharacterisation = self.getDataInput() self._xsDataCollection = xsDataInputCharacterisation.getDataCollection() # MXSUP-1445: Check if transmission is less than 10% and warn if it's the case xsDataFirstSubWedge = self._xsDataCollection.getSubWedge()[0] xsDataBeam = xsDataFirstSubWedge.getExperimentalCondition().getBeam() if xsDataBeam.getTransmission() is not None: fTransmission = xsDataBeam.getTransmission().getValue() if fTransmission < self._fMinTransmission: strWarningMessageBanner = "^"*80 strWarningMessage1 = "WARNING! Transmission for characterisation set to %.1f %%" % fTransmission strWarningMessage2 = "Please consider re-characterising with transmission set to 100 %" self.warning(strWarningMessageBanner) self.warning(strWarningMessage1) self.warning(strWarningMessage2) self.warning(strWarningMessageBanner) self.addWarningMessage(strWarningMessageBanner) self.addWarningMessage(strWarningMessage1) self.addWarningMessage(strWarningMessage2) self.addWarningMessage(strWarningMessageBanner) self.sendMessageToMXCuBE(strWarningMessage1, "warning") self.sendMessageToMXCuBE(strWarningMessage2, "warning") xsDataCrystal = None xsDataSubWedgeList = self._xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_5.preProcess: No subwedges in input data." self.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam().getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): strErrorMessage = "Input flux is negative or close to zero. Execution of characterisation aborted." self.ERROR(strErrorMessage) self.sendMessageToMXCuBE(strErrorMessage, "error") self.addErrorMessage("EDPluginControlCharacterisationv1_5.preProcess ERROR: " + strErrorMessage) # self.addComment(strErrorMessage) self.setFailure() xsDataDiffractionPlan = self._xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup() if (xsDataStringForcedSpaceGroup is not None): self._xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) self._xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCollection, "dataCollection") if self._xsDataCrystal is not None: self._edPluginControlIndexingIndicators.setDataInput(self._xsDataCrystal, "crystal") # Populate characterisation object self._xsDataResultCharacterisation.setDataCollection(XSDataCollection.parseString(self._xsDataCollection.marshal())) # Load the thumbnail plugins self._iNoReferenceImages = 0 if not self.isFailure(): for subWedge in xsDataInputCharacterisation.dataCollection.subWedge: for image in subWedge.image: self._iNoReferenceImages += 1 edPluginJpeg = self.loadPlugin(self._strPluginGenerateThumbnailName) xsDataInputMXThumbnail = XSDataInputMXThumbnail() xsDataInputMXThumbnail.image = XSDataFile(image.path) xsDataInputMXThumbnail.height = XSDataInteger(1024) xsDataInputMXThumbnail.width = XSDataInteger(1024) jpegFilename = os.path.splitext(os.path.basename(image.path.value))[0] + ".jpg" xsDataInputMXThumbnail.outputPath = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), jpegFilename))) edPluginJpeg.dataInput = xsDataInputMXThumbnail edPluginThumnail = self.loadPlugin(self._strPluginGenerateThumbnailName) xsDataInputMXThumbnail = XSDataInputMXThumbnail() xsDataInputMXThumbnail.image = XSDataFile(image.path) xsDataInputMXThumbnail.height = XSDataInteger(256) xsDataInputMXThumbnail.width = XSDataInteger(256) thumbnailFilename = os.path.splitext(os.path.basename(image.path.value))[0] + ".thumbnail.jpg" xsDataInputMXThumbnail.outputPath = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), thumbnailFilename))) edPluginThumnail.dataInput = xsDataInputMXThumbnail self._listPluginGenerateThumbnail.append((image, edPluginJpeg, edPluginThumnail))
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlCharacterisationv1_1.preProcess...") self.__edPluginIndexing = self.loadPlugin(self.__strPluginIndexingName, "Indexing") self.__edPluginIntegration = self.loadPlugin( self.__strPluginIntegrationName, "Integration") self.__edPluginStrategy = self.loadPlugin(self.__strPluginStrategyName, "Strategy") if (self.__edPluginIndexing is not None): EDVerbose.DEBUG( "EDPluginControlCharacterisationv1_1.preProcess: " + self.__strPluginIndexingName + " Found... setting Data Input") # create Data Input for indexing xsDataInputStrategy = self.getDataInput() xsDataCollection = xsDataInputStrategy.getDataCollection() xsDataSample = xsDataCollection.getSample() xsDataSubWedgeList = xsDataCollection.getSubWedge() if ((xsDataSubWedgeList is None) or (xsDataSubWedgeList == [])): strError = "EDPluginControlCharacterisationv1_1.preProcess: No subwedges in input data." EDVerbose.ERROR(strError) self.setFailure() else: xsDataExperimentalCondition = xsDataSubWedgeList[ 0].getExperimentalCondition() # Fix for bug 431: if the flux is zero raise an error xsDataDoubleFlux = xsDataExperimentalCondition.getBeam( ).getFlux() if (xsDataDoubleFlux is not None): if (xsDataDoubleFlux.getValue() < 0.1): pyStrErrorMessage = "EDPluginControlCharacterisationv1_1.preProcess ERROR: Input flux is negative or close to zero. Execution of characterisation aborted." EDVerbose.ERROR(pyStrErrorMessage) self.addErrorMessage(pyStrErrorMessage) self.setFailure() xsDataIndexingInput = XSDataIndexingInput() xsDataIndexingInput.setDataCollection(xsDataCollection) xsDataIndexingInput.setExperimentalCondition( xsDataExperimentalCondition) xsDataDiffractionPlan = xsDataCollection.getDiffractionPlan() xsDataStringForcedSpaceGroup = xsDataDiffractionPlan.getForcedSpaceGroup( ) if (xsDataStringForcedSpaceGroup is not None): xsDataCrystal = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setName(xsDataStringForcedSpaceGroup) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataIndexingInput.setCrystal(xsDataCrystal) self.__edPluginIndexing.setDataInput(xsDataIndexingInput) # Populate characterisation object self.__xsDataResultCharacterisation = XSDataResultCharacterisation( ) self.__xsDataResultCharacterisation.setDataCollection( XSDataCollection.parseString(xsDataCollection.marshal()))