def finallyProcess(self, _edObject=None): EDPluginControl.finallyProcess(self, _edObject) self.DEBUG("EDPluginControlIntegrationv10.finallyProcess") from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 for (iSubWedgeNumber, edPluginIntegration) in self.__edPluginIntegrationList: xsDataMOSFLMOutputIntegration = edPluginIntegration.getDataOutput() if (xsDataMOSFLMOutputIntegration is None): strWarning = "MOSFLM integration error : no integration results obtained." self.addExecutiveSummaryLine(strWarning) self.WARNING(strWarning) # self.setFailure() else: xsDataIntegrationSubWedgeResult = None try: xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult(xsDataMOSFLMOutputIntegration, self.__xsDataExperimentalConditionRefined) except Exception as error: strWarningMessage = str(error) self.addWarningMessage(strWarningMessage) self.WARNING(strWarningMessage) # self.setFailure() if (xsDataIntegrationSubWedgeResult is None): strWarning = "MOSFLM integration error : no integration results obtained." self.addExecutiveSummaryLine(strWarning) self.WARNING(strWarning) # self.setFailure() else: xsDataIntegrationSubWedgeResult.setSubWedgeNumber(XSDataInteger(iSubWedgeNumber)) xsDataStatisticsIntegration = xsDataIntegrationSubWedgeResult.getStatistics() if xsDataStatisticsIntegration.getRMSSpotDeviation() is not None: fRMSSpotDeviation = xsDataStatisticsIntegration.getRMSSpotDeviation().getValue() if (self.__fMaxRMSSpotDeviation is not None): if (self.__fMaxRMSSpotDeviation < fRMSSpotDeviation): iImageStart = edPluginIntegration.getDataInput().getImageStart().getValue() iImageEnd = edPluginIntegration.getDataInput().getImageEnd().getValue() errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlIntegrationv10.postProcess", \ "MOSFLM Integration : RMS spot deviation (%.3f [mm]) larger than max value from configuration (%.3f [mm]) for images %d to %d" % \ (fRMSSpotDeviation, self.__fMaxRMSSpotDeviation, iImageStart, iImageEnd)) self.error(errorMessage) self.addErrorMessage(errorMessage) if (xsDataIntegrationSubWedgeResult is not None): if (self.__xsDataIntegrationResult is None): self.__xsDataIntegrationResult = XSDataIntegrationResult() self.__xsDataIntegrationResult.addIntegrationSubWedgeResult(xsDataIntegrationSubWedgeResult) bSuccess = False for integrationSubWedgeResult in self.__xsDataIntegrationResult.integrationSubWedgeResult: if integrationSubWedgeResult.statistics.iOverSigmaOverall is not None: bSuccess = True break if not bSuccess: strErrorMessage = "MOSFLM integration failed for all images" self.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() self.setDataOutput(self.__xsDataIntegrationResult) if self.__xsDataIntegrationResult is not None: self.generateIntegrationShortSummary(self.__xsDataIntegrationResult)
def testGenerateXSDataIntegrationSubWedgeResult(self): strFilename = "XSDataMOSFLMOutputIntegration_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString(strXMLMOSFLMOutputIntegration) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult(xsDataMOSFLMOutputIntegration) strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIntegrationSubWedgeResult xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString(strXMLIntegrationSubWedgeReference) EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(), xsDataIntegrationSubWedgeResult.marshal())
def testGenerateXSDataIntegrationSubWedgeResult(self): strFilename = "XSDataMOSFLMOutputIntegration_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIntegration = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIntegration xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration.parseString( strXMLMOSFLMOutputIntegration) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult( xsDataMOSFLMOutputIntegration) strReferenceFilename = "XSDataIntegrationSubWedgeResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationSubWedgeReference = EDUtilsTest.readAndParseFile( strReferencePath) from XSDataMXv1 import XSDataIntegrationSubWedgeResult xsDataIntegrationSubWedgeResult = XSDataIntegrationSubWedgeResult.parseString( strXMLIntegrationSubWedgeReference) EDAssert.equal(xsDataIntegrationSubWedgeResult.marshal(), xsDataIntegrationSubWedgeResult.marshal())
def finallyProcess(self, _edObject=None): EDPluginControl.finallyProcess(self, _edObject) self.DEBUG("EDPluginControlIntegrationv10.finallyProcess") from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 for (iSubWedgeNumber, edPluginIntegration) in self.__edPluginIntegrationList: xsDataMOSFLMOutputIntegration = edPluginIntegration.getDataOutput() if (xsDataMOSFLMOutputIntegration is None): strWarning = "MOSFLM integration error : no integration results obtained." self.addExecutiveSummaryLine(strWarning) self.WARNING(strWarning) # self.setFailure() else: xsDataIntegrationSubWedgeResult = None try: xsDataIntegrationSubWedgeResult = EDHandlerXSDataMOSFLMv10.generateXSDataIntegrationSubWedgeResult( xsDataMOSFLMOutputIntegration, self.__xsDataExperimentalConditionRefined) except Exception as error: strWarningMessage = str(error) self.addWarningMessage(strWarningMessage) self.WARNING(strWarningMessage) # self.setFailure() if (xsDataIntegrationSubWedgeResult is None): strWarning = "MOSFLM integration error : no integration results obtained." self.addExecutiveSummaryLine(strWarning) self.WARNING(strWarning) # self.setFailure() else: xsDataIntegrationSubWedgeResult.setSubWedgeNumber( XSDataInteger(iSubWedgeNumber)) xsDataStatisticsIntegration = xsDataIntegrationSubWedgeResult.getStatistics( ) if xsDataStatisticsIntegration.getRMSSpotDeviation( ) is not None: fRMSSpotDeviation = xsDataStatisticsIntegration.getRMSSpotDeviation( ).getValue() if (self.__fMaxRMSSpotDeviation is not None): if (self.__fMaxRMSSpotDeviation < fRMSSpotDeviation): iImageStart = edPluginIntegration.getDataInput( ).getImageStart().getValue() iImageEnd = edPluginIntegration.getDataInput( ).getImageEnd().getValue() errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlIntegrationv10.postProcess", \ "MOSFLM Integration : RMS spot deviation (%.3f [mm]) larger than max value from configuration (%.3f [mm]) for images %d to %d" % \ (fRMSSpotDeviation, self.__fMaxRMSSpotDeviation, iImageStart, iImageEnd)) self.error(errorMessage) self.addErrorMessage(errorMessage) if (xsDataIntegrationSubWedgeResult is not None): if (self.__xsDataIntegrationResult is None): self.__xsDataIntegrationResult = XSDataIntegrationResult( ) self.__xsDataIntegrationResult.addIntegrationSubWedgeResult( xsDataIntegrationSubWedgeResult) bSuccess = False for integrationSubWedgeResult in self.__xsDataIntegrationResult.integrationSubWedgeResult: if integrationSubWedgeResult.statistics.iOverSigmaOverall is not None: bSuccess = True break if not bSuccess: strErrorMessage = "MOSFLM integration failed for all images" self.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() self.setDataOutput(self.__xsDataIntegrationResult) if self.__xsDataIntegrationResult is not None: self.generateIntegrationShortSummary( self.__xsDataIntegrationResult)