def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv1ResultCharacterisation': obj_ = XSDataResultCharacterisation() obj_.build(child_) self.setMxv1ResultCharacterisation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv1ResultCharacterisation_Reference': obj_ = XSDataResultCharacterisation() obj_.build(child_) self.setMxv1ResultCharacterisation_Reference(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv2DataCollection': obj_ = XSDataCollection() obj_.build(child_) self.setMxv2DataCollection(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv2DataCollection_Reference': obj_ = XSDataCollection() obj_.build(child_) self.setMxv2DataCollection_Reference(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'suggestedStrategy': obj_ = XSDataResultStrategy() obj_.build(child_) self.setSuggestedStrategy(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'possibleOrientations': obj_ = kappa_alignment_response() obj_.build(child_) self.setPossibleOrientations(obj_) XSDataResultInterface.buildChildren(self, child_, nodeName_)
def testCheckParameters(self): xsDataInputControlISPyB = XSDataInputControlISPyB() xsDataResultCharacterisation = XSDataResultCharacterisation() xsDataInputControlISPyB.setCharacterisationResult( xsDataResultCharacterisation) edPluginControlISPyB = self.createPlugin() edPluginControlISPyB.setDataInput(xsDataInputControlISPyB) edPluginControlISPyB.checkParameters()
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 buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'resultCharacterisation': obj_ = XSDataResultCharacterisation() obj_.build(child_) self.setResultCharacterisation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'resultControlISPyB': obj_ = XSDataResultControlISPyB() obj_.build(child_) self.setResultControlISPyB(obj_)
def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'characterisationResult': obj_ = XSDataResultCharacterisation() obj_.build(child_) self.setCharacterisationResult(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'fileGraph': obj_ = XSDataFile() obj_.build(child_) self.fileGraph.append(obj_) XSDataInput.buildChildren(self, child_, nodeName_)
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 buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv1InputCharacterisation': obj_ = XSDataInputCharacterisation() obj_.build(child_) self.setMxv1InputCharacterisation(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv1ResultCharacterisation_Reference': obj_ = XSDataResultCharacterisation() obj_.build(child_) self.setMxv1ResultCharacterisation_Reference(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv2DataCollection': obj_ = XSDataCollection() obj_.build(child_) self.setMxv2DataCollection(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'mxv2DataCollection_Reference': obj_ = XSDataCollection() obj_.build(child_) self.setMxv2DataCollection_Reference(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'possibleOrientations': obj_ = kappa_alignment_response() obj_.build(child_) self.setPossibleOrientations(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'omega': obj_ = XSDataAngle() obj_.build(child_) self.setOmega(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'kappa': obj_ = XSDataAngle() obj_.build(child_) self.setKappa(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == 'phi': obj_ = XSDataAngle() obj_.build(child_) self.setPhi(obj_) XSDataInputInterface.buildChildren(self, child_, nodeName_)
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) self.DEBUG("EDPluginControlCharacterisationv1_6.preProcess") self._xsDataResultCharacterisation = XSDataResultCharacterisation()
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): """ 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()))