Exemplo n.º 1
0
 def testGenerateIntegrationShortSummary(self):
     edPluginControlIntegrationv10 = self.createPlugin()
     strReferenceOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataIntegrationResult_reference.xml")
     strXML = self.readAndParseFile(strReferenceOutputFile)
     xsDataIntegrationResult = XSDataIntegrationResult.parseString(strXML)
     edPluginControlIntegrationv10.generateIntegrationShortSummary(xsDataIntegrationResult)
     for strLine in edPluginControlIntegrationv10.getDataOutput("integrationShortSummary")[0].getValue().split("\n"):
         EDVerbose.unitTest(strLine)
    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)
Exemplo n.º 3
0
class EDPluginControlIntegrationv10(EDPluginControl):
    """
    The Plugin that controls the MOSFLM integration.
    """
    def __init__(self):
        """
        """
        EDPluginControl.__init__(self)
        self.setXSDataInputClass(XSDataIntegrationInput)
        self.__strPluginIntegrationName = "EDPluginMOSFLMIntegrationv10"
        self.__edPluginIntegrationList = []
        self.__iNoSubwedges = None
        self.__strCONF_CONTROL_INTEGRATION_MAX_RMS = "maxRMSSpotDeviation"
        self.__fMaxRMSSpotDeviation = None
        self.__xsDataExperimentalConditionRefined = None
        self.__xsDataIntegrationResult = None

    def checkParameters(self):
        """
        Checks the mandatory parameters
        """
        self.DEBUG("EDPluginControlIntegrationv10.checkParameters")
        self.checkMandatoryParameters(self.getDataInput(),
                                      "Data Input is None")
        self.checkMandatoryParameters(self.getDataInput().getDataCollection(),
                                      "dataCollection")
        self.checkMandatoryParameters(
            self.getDataInput().getSelectedIndexingSolution(),
            "selectedIndexingSolution")

    def configure(self):
        EDPluginControl.configure(self)
        self.DEBUG("EDPluginControlIntegrationv10.configure")
        strMaxRMSSpotDeviation = self.config.get(
            self.__strCONF_CONTROL_INTEGRATION_MAX_RMS)
        if (strMaxRMSSpotDeviation == None):
            self.DEBUG(
                "EDPluginControlIntegrationv10.configure: No configuration parameter found for: "
                + self.__strCONF_CONTROL_INTEGRATION_MAX_RMS +
                ", no default value.")
        else:
            self.setMaxRMSSpotDeviation(float(strMaxRMSSpotDeviation))

    def setMaxRMSSpotDeviation(self, _fMaxRMSSpotDeviation):
        self.__fMaxRMSSpotDeviation = _fMaxRMSSpotDeviation

    def getMaxRMSSpotDeviation(self):
        return self.__fMaxRMSSpotDeviation

    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlIntegrationv10.preProcess...")

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

        self.__edPluginIntegrationList = []

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

            edPluginIntegration = self.loadPlugin(
                self.__strPluginIntegrationName)

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

    def process(self, _edObject=None):
        EDPluginControl.process(self, _edObject)
        self.DEBUG("EDPluginControlIntegrationv10.process")
        for (iSubWedgeNumber,
             edPluginIntegration) in self.__edPluginIntegrationList:
            self.addPluginToActionCluster(edPluginIntegration)
        self.executeActionCluster()
        self.synchronizeActionCluster()
        if self.isFailure():
            self.generateExecutiveSummary(self)

    def doSuccessActionIntegration(self, _edPlugin=None):
        self.DEBUG("EDPluginControlIntegrationv10.doSuccessActionIntegration")
        self.retrieveSuccessMessages(
            _edPlugin,
            "EDPluginControlIntegrationv10.doSuccessActionIntegration")

    def doFailureActionIntegration(self, _edPlugin=None):
        self.DEBUG("EDPluginControlIntegrationv10.doFailureActionIntegration")
        self.retrieveFailureMessages(
            _edPlugin,
            "EDPluginControlIntegrationv10.doFailureActionIntegration")
#        self.setFailure()

    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 generateExecutiveSummary(self, _edPlugin):
        """
        Generates a summary of the execution of the plugin.
        """
        self.DEBUG("EDPluginControlIntegrationv10.generateExecutiveSummary")
        self.addExecutiveSummaryLine("Summary of integration:")
        self.addErrorWarningMessagesToExecutiveSummary(
            "Integration warning/error messages:")
        for (iSubWedgeNumber,
             edPluginIntegration) in self.__edPluginIntegrationList:
            if (edPluginIntegration is not None):
                if (edPluginIntegration.getDataOutput() is not None):
                    self.appendExecutiveSummary(edPluginIntegration,
                                                "MOSFLM : ")

    def generateIntegrationShortSummary(self, _xsDataIntegrationResult):
        """
        Generates a short summary of the MOSFLM integration(s)
        """
        self.DEBUG(
            "EDPluginControlIntegrationv10.generateIntegrationShortSummary")
        strIntegrationShortSummary = ""
        for xsDataIntegrationSubWedgeResult in _xsDataIntegrationResult.getIntegrationSubWedgeResult(
        ):
            iSubWedgeNumber = xsDataIntegrationSubWedgeResult.getSubWedgeNumber(
            ).getValue()
            strIntegrationShortSummary += "Integration: %d " % iSubWedgeNumber
            xsDataStatisticsIntegration = xsDataIntegrationSubWedgeResult.getStatistics(
            )
            if xsDataStatisticsIntegration.getNumberOfFullyRecordedReflections(
            ) is None:
                strIntegrationShortSummary += "FAILED\n"
            else:
                iNoFull = xsDataStatisticsIntegration.getNumberOfFullyRecordedReflections(
                ).getValue()
                strIntegrationShortSummary += "no full: %d, " % iNoFull
                iNoPartial = xsDataStatisticsIntegration.getNumberOfPartialReflections(
                ).getValue()
                strIntegrationShortSummary += "part: %d, " % iNoPartial
                iNoBad = xsDataStatisticsIntegration.getNumberOfBadReflections(
                ).getValue()
                iNoNegative = xsDataStatisticsIntegration.getNumberOfNegativeReflections(
                ).getValue()
                iNoOverlapped = xsDataStatisticsIntegration.getNumberOfOverlappedReflections(
                ).getValue()
                strIntegrationShortSummary += "bad/neg/ovrlp: %d, " % (
                    iNoBad + iNoNegative + iNoOverlapped)
                fRMSSpotDeviation = xsDataStatisticsIntegration.getRMSSpotDeviation(
                ).getValue()
                strIntegrationShortSummary += "RMS dev: %.3f [mm], " % fRMSSpotDeviation
                fIOverSigmaOverall = xsDataStatisticsIntegration.getIOverSigmaOverall(
                ).getValue()
                strIntegrationShortSummary += "I/sigma overall %.1f " % fIOverSigmaOverall
                fIOverSigmaAtHighestResolution = xsDataStatisticsIntegration.getIOverSigmaAtHighestResolution(
                ).getValue()
                strIntegrationShortSummary += "at highest res %.1f" % fIOverSigmaAtHighestResolution
                strIntegrationShortSummary += "\n"
        for strLine in strIntegrationShortSummary.split("\n"):
            self.screen(strLine)
        self.setDataOutput(XSDataString(strIntegrationShortSummary),
                           "integrationShortSummary")
Exemplo n.º 4
0
    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)
class EDPluginControlIntegrationv10(EDPluginControl):
    """
    The Plugin that controls the MOSFLM integration.
    """

    def __init__ (self):
        """
        """
        EDPluginControl.__init__(self)
        self.setXSDataInputClass(XSDataIntegrationInput)
        self.__strPluginIntegrationName = "EDPluginMOSFLMIntegrationv10"
        self.__edPluginIntegrationList = []
        self.__iNoSubwedges = None
        self.__strCONF_CONTROL_INTEGRATION_MAX_RMS = "maxRMSSpotDeviation"
        self.__fMaxRMSSpotDeviation = None
        self.__xsDataExperimentalConditionRefined = None
        self.__xsDataIntegrationResult = None


    def checkParameters(self):
        """
        Checks the mandatory parameters
        """
        self.DEBUG("EDPluginControlIntegrationv10.checkParameters")
        self.checkMandatoryParameters(self.getDataInput(), "Data Input is None")
        self.checkMandatoryParameters(self.getDataInput().getDataCollection(), "dataCollection")
        self.checkMandatoryParameters(self.getDataInput().getSelectedIndexingSolution(), "selectedIndexingSolution")


    def configure(self):
        EDPluginControl.configure(self)
        self.DEBUG("EDPluginControlIntegrationv10.configure")
        strMaxRMSSpotDeviation = self.config.get(self.__strCONF_CONTROL_INTEGRATION_MAX_RMS)
        if(strMaxRMSSpotDeviation == None):
            self.DEBUG("EDPluginControlIntegrationv10.configure: No configuration parameter found for: " + self.__strCONF_CONTROL_INTEGRATION_MAX_RMS + ", no default value.")
        else:
            self.setMaxRMSSpotDeviation(float(strMaxRMSSpotDeviation))


    def setMaxRMSSpotDeviation(self, _fMaxRMSSpotDeviation):
        self.__fMaxRMSSpotDeviation = _fMaxRMSSpotDeviation

    def getMaxRMSSpotDeviation(self):
        return self.__fMaxRMSSpotDeviation


    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlIntegrationv10.preProcess...")

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

        self.__edPluginIntegrationList = []

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

            edPluginIntegration = self.loadPlugin(self.__strPluginIntegrationName)

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


    def process(self, _edObject=None):
        EDPluginControl.process(self, _edObject)
        self.DEBUG("EDPluginControlIntegrationv10.process")
        for (iSubWedgeNumber, edPluginIntegration) in self.__edPluginIntegrationList:
            self.addPluginToActionCluster(edPluginIntegration)
        self.executeActionCluster()
        self.synchronizeActionCluster()
        if self.isFailure():
            self.generateExecutiveSummary(self)



    def doSuccessActionIntegration(self, _edPlugin=None):
        self.DEBUG("EDPluginControlIntegrationv10.doSuccessActionIntegration")
        self.retrieveSuccessMessages(_edPlugin, "EDPluginControlIntegrationv10.doSuccessActionIntegration")


    def doFailureActionIntegration(self, _edPlugin=None):
        self.DEBUG("EDPluginControlIntegrationv10.doFailureActionIntegration")
        self.retrieveFailureMessages(_edPlugin, "EDPluginControlIntegrationv10.doFailureActionIntegration")
#        self.setFailure()


    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 generateExecutiveSummary(self, _edPlugin):
        """
        Generates a summary of the execution of the plugin.
        """
        self.DEBUG("EDPluginControlIntegrationv10.generateExecutiveSummary")
        self.addExecutiveSummaryLine("Summary of integration:")
        self.addErrorWarningMessagesToExecutiveSummary("Integration warning/error messages:")
        for (iSubWedgeNumber, edPluginIntegration) in self.__edPluginIntegrationList:
            if (edPluginIntegration is not None):
                if (edPluginIntegration.getDataOutput() is not None):
                    self.appendExecutiveSummary(edPluginIntegration, "MOSFLM : ")


    def generateIntegrationShortSummary(self, _xsDataIntegrationResult):
        """
        Generates a short summary of the MOSFLM integration(s)
        """
        self.DEBUG("EDPluginControlIntegrationv10.generateIntegrationShortSummary")
        strIntegrationShortSummary = ""
        for xsDataIntegrationSubWedgeResult in _xsDataIntegrationResult.getIntegrationSubWedgeResult():
            iSubWedgeNumber = xsDataIntegrationSubWedgeResult.getSubWedgeNumber().getValue()
            strIntegrationShortSummary += "Integration: %d " % iSubWedgeNumber
            xsDataStatisticsIntegration = xsDataIntegrationSubWedgeResult.getStatistics()
            if xsDataStatisticsIntegration.getNumberOfFullyRecordedReflections() is None:
                strIntegrationShortSummary += "FAILED\n"
            else:
                iNoFull = xsDataStatisticsIntegration.getNumberOfFullyRecordedReflections().getValue()
                strIntegrationShortSummary += "no full: %d, " % iNoFull
                iNoPartial = xsDataStatisticsIntegration.getNumberOfPartialReflections().getValue()
                strIntegrationShortSummary += "part: %d, " % iNoPartial
                iNoBad = xsDataStatisticsIntegration.getNumberOfBadReflections().getValue()
                iNoNegative = xsDataStatisticsIntegration.getNumberOfNegativeReflections().getValue()
                iNoOverlapped = xsDataStatisticsIntegration.getNumberOfOverlappedReflections().getValue()
                strIntegrationShortSummary += "bad/neg/ovrlp: %d, " % (iNoBad + iNoNegative + iNoOverlapped)
                fRMSSpotDeviation = xsDataStatisticsIntegration.getRMSSpotDeviation().getValue()
                strIntegrationShortSummary += "RMS dev: %.3f [mm], " % fRMSSpotDeviation
                fIOverSigmaOverall = xsDataStatisticsIntegration.getIOverSigmaOverall().getValue()
                strIntegrationShortSummary += "I/sigma overall %.1f " % fIOverSigmaOverall
                fIOverSigmaAtHighestResolution = xsDataStatisticsIntegration.getIOverSigmaAtHighestResolution().getValue()
                strIntegrationShortSummary += "at highest res %.1f" % fIOverSigmaAtHighestResolution
                strIntegrationShortSummary += "\n"
        for strLine in strIntegrationShortSummary.split("\n"):
            self.screen(strLine)
        self.setDataOutput(XSDataString(strIntegrationShortSummary), "integrationShortSummary")