def createInputCharacterisationFromSubWedges(self):
     self.DEBUG("EDPluginControlInterfacev1_3.createInputCharacterisationFromSubWedges")
     xsDataResultSubWedgeAssemble = self.edPluginControlSubWedgeAssemble.getDataOutput()
     self.xsDataInputCharacterisation = XSDataInputCharacterisation()
     xsDataCollection = XSDataCollection()
     # Default exposure time (for the moment, this value should be
     # possible to read from the command line)
     if self.xsDataDiffractionPlan is None:
         self.xsDataDiffractionPlan = XSDataDiffractionPlan()
     if (not xsDataResultSubWedgeAssemble is None):
         pyListSubWedge = xsDataResultSubWedgeAssemble.getSubWedge()
         xsDataCollection.setSubWedge(pyListSubWedge)
         for xsDataSubWedge in pyListSubWedge:
             if (self.strComplexity is not None):
                 self.xsDataDiffractionPlan.setComplexity(XSDataString(self.strComplexity))
             if (self.fFlux is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setFlux(XSDataFlux(self.fFlux))
             if (self.fBeamSizeX is not None) and (self.fBeamSizeY is not None):
                 xsDataSize = XSDataSize()
                 xsDataSize.setX(XSDataLength(self.fBeamSizeX))
                 xsDataSize.setY(XSDataLength(self.fBeamSizeY))
                 xsDataSubWedge.getExperimentalCondition().getBeam().setSize(xsDataSize)
             if (self.fApertureSize is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setApertureSize(XSDataLength(self.fApertureSize))
             if (self.fBeamPosX is not None):
                 xsDataSubWedge.getExperimentalCondition().getDetector().setBeamPositionX(XSDataLength(self.fBeamPosX))
             if (self.fBeamPosY is not None):
                 xsDataSubWedge.getExperimentalCondition().getDetector().setBeamPositionY(XSDataLength(self.fBeamPosY))
             if (self.fMinExposureTimePerImage is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setMinExposureTimePerImage(XSDataTime(self.fMinExposureTimePerImage))
             if (self.fTransmission is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setTransmission(XSDataDouble(self.fTransmission))
             if (self.fWavelength is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setWavelength(XSDataWavelength(self.fWavelength))
             if self.fMinOscillationWidth != None:
                 xsDataSubWedge.getExperimentalCondition().getGoniostat().setMinOscillationWidth(XSDataAngle(self.fMinOscillationWidth))
             if self.fMaxOscillationSpeed != None:
                 xsDataSubWedge.getExperimentalCondition().getGoniostat().setMaxOscillationSpeed(XSDataAngularSpeed(self.fMaxOscillationSpeed))
     if (self.strForcedSpaceGroup is not None):
         self.xsDataDiffractionPlan.setForcedSpaceGroup(XSDataString(self.strForcedSpaceGroup))
     self.xsDataDiffractionPlan.setAnomalousData(XSDataBoolean(self.bAnomalousData))
     self.xsDataDiffractionPlan.setMaxExposureTimePerDataCollection(XSDataTime(self.fMaxExposureTimePerDataCollection))
     if (self.strStrategyOption is not None):
         self.xsDataDiffractionPlan.setStrategyOption(XSDataString(self.strStrategyOption))
     xsDataCollection.setDiffractionPlan(self.xsDataDiffractionPlan)
     if self.xsDataSample is not None:
         xsDataCollection.setSample(XSDataSampleCrystalMM.parseString(self.xsDataSample.marshal()))
     self.xsDataInputCharacterisation.setDataCollection(xsDataCollection)
示例#2
0
 def createInputCharacterisationFromSubWedges(self):
     self.DEBUG("EDPluginControlInterfacev1_2.createInputCharacterisationFromSubWedges")
     xsDataResultSubWedgeAssemble = self.edPluginControlSubWedgeAssemble.getDataOutput()
     self.xsDataInputCharacterisation = XSDataInputCharacterisation()
     xsDataCollection = XSDataCollection()
     # Default exposure time (for the moment, this value should be
     # possible to read from the command line)
     if self.xsDataDiffractionPlan is None:
         self.xsDataDiffractionPlan = XSDataDiffractionPlan()
     if (not xsDataResultSubWedgeAssemble is None):
         pyListSubWedge = xsDataResultSubWedgeAssemble.getSubWedge()
         xsDataCollection.setSubWedge(pyListSubWedge)
         for xsDataSubWedge in pyListSubWedge:
             if (self.strComplexity is not None):
                 self.xsDataDiffractionPlan.setComplexity(XSDataString(self.strComplexity))
             if (self.fFlux is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setFlux(XSDataFlux(self.fFlux))
             if (self.fBeamSizeX is not None) and (self.fBeamSizeY is not None):
                 xsDataSize = XSDataSize()
                 xsDataSize.setX(XSDataLength(self.fBeamSizeX))
                 xsDataSize.setY(XSDataLength(self.fBeamSizeY))
                 xsDataSubWedge.getExperimentalCondition().getBeam().setSize(xsDataSize)
             if (self.fBeamPosX is not None):
                 xsDataSubWedge.getExperimentalCondition().getDetector().setBeamPositionX(XSDataLength(self.fBeamPosX))
             if (self.fBeamPosY is not None):
                 xsDataSubWedge.getExperimentalCondition().getDetector().setBeamPositionY(XSDataLength(self.fBeamPosY))
             if (self.fMinExposureTimePerImage is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setMinExposureTimePerImage(XSDataTime(self.fMinExposureTimePerImage))
             if (self.fTransmission is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setTransmission(XSDataDouble(self.fTransmission))
             if (self.fWavelength is not None):
                 xsDataSubWedge.getExperimentalCondition().getBeam().setWavelength(XSDataWavelength(self.fWavelength))
             if self.fMinOscillationWidth != None:
                 xsDataSubWedge.getExperimentalCondition().getGoniostat().setMinOscillationWidth(XSDataAngle(self.fMinOscillationWidth))
             if self.fMaxOscillationSpeed != None:
                 xsDataSubWedge.getExperimentalCondition().getGoniostat().setMaxOscillationSpeed(XSDataAngularSpeed(self.fMaxOscillationSpeed))
     if (self.strForcedSpaceGroup is not None):
         self.xsDataDiffractionPlan.setForcedSpaceGroup(XSDataString(self.strForcedSpaceGroup))
     self.xsDataDiffractionPlan.setAnomalousData(XSDataBoolean(self.bAnomalousData))
     self.xsDataDiffractionPlan.setMaxExposureTimePerDataCollection(XSDataTime(self.fMaxExposureTimePerDataCollection))
     if (self.strStrategyOption is not None):
         self.xsDataDiffractionPlan.setStrategyOption(XSDataString(self.strStrategyOption))
     xsDataCollection.setDiffractionPlan(self.xsDataDiffractionPlan)
     if self.xsDataSample is not None:
         xsDataCollection.setSample(XSDataSampleCrystalMM.parseString(self.xsDataSample.marshal()))
     self.xsDataInputCharacterisation.setDataCollection(xsDataCollection)
     self.xsDataInputCharacterisation.setToken(self.xsDataToken)
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlStrategyv1_1.preProcess...")
        self.__edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if (xsDataSampleCrystalMM is None):
            self.__xsDataSampleCopy = XSDataSampleCrystalMM()

        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self.__xsDataSampleCopy = XSDataSampleCrystalMM.parseString(
                strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if (xsDataCrystal is not None):
            self.__xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Raddose is enabled only if the beam flux is set
        if (self.getDataInput().getExperimentalCondition().getBeam().getFlux()
                is None):
            pyStrWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % (
                'EDPluginControlStrategyv1_1.preProcess',
                self.__strPluginRaddoseName, "Beam Flux not set")
            EDVerbose.warning(pyStrWarningMessage)
            self.addWarningMessage(pyStrWarningMessage)

        else:
            self.__edPluginRaddose = self.loadPlugin(
                self.__strPluginRaddoseName)

            if (self.__edPluginRaddose is not None):
                EDVerbose.DEBUG("EDPluginControlStrategyv1_1.preProcess: " +
                                self.__strPluginRaddoseName +
                                " Found... setting Data Input")

                strFileSymop = os.path.join(self.getSymopHome(), "symop.lib")

                xsDataStringSpaceGroup = self.getDataInput(
                ).getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                strNumOperators = None
                strSpaceGroup = None
                if (xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue().upper()
                    EDVerbose.DEBUG(
                        "EDPluginControlStrategyv1_1.preProcess: Forced Space Group Found: "
                        + strSpaceGroup)
                    try:
                        strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                            strSpaceGroup, strFileSymop)
                    except Exception, detail:
                        pyStrErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                            'EDPluginControlStrategyv1_1.preProcess',
                            "Problem to calculate Number of symmetry operators",
                            detail)
                        EDVerbose.error(pyStrErrorMessage)
                        self.addErrorMessage(pyStrErrorMessage)
                        self.setFailure()
                # Space Group has NOT been forced
                else:
                    xsDataStringSpaceGroup = self.__xsDataSampleCopy.getCrystal(
                    ).getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self.__xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getName().getValue()
                        EDVerbose.DEBUG(
                            "EDPluginControlStrategyv1_1.preProcess: Space Group IT Name found by indexing: "
                            + strSpaceGroupName)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroupName, strFileSymop)
                        except Exception, detail:
                            pyStrErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                                'EDPluginControlStrategyv1_1.preProcess',
                                "Problem to calculate Number of symmetry operators",
                                detail)
                            EDVerbose.error(pyStrErrorMessage)
                            self.addErrorMessage(pyStrErrorMessage)
                            self.setFailure()
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        iSpaceGroupITNumber = self.__xsDataSampleCopy.getCrystal(
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlStrategyv10.preProcess...")
        self.__edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if(xsDataSampleCrystalMM is None):
            self.__xsDataSampleCopy = XSDataSampleCrystalMM()

        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self.__xsDataSampleCopy = XSDataSampleCrystalMM.parseString(strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if(xsDataCrystal is not None):
            self.__xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Raddose is enabled only if the beam flux is set
        if(self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None):
            warningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % ('EDPluginControlStrategyv10.preProcess', self.__strPluginRaddoseName, "Beam Flux not set")
            EDVerbose.warning(warningMessage)
            self.addWarningMessage(warningMessage)

        else:
            self.__edPluginRaddose = self.loadPlugin(self.__strPluginRaddoseName)

            if (self.__edPluginRaddose is not None):
                EDVerbose.DEBUG("EDPluginControlStrategyv10.preProcess: " + self.__strPluginRaddoseName + " Found... setting Data Input")

                strFileSymop = os.path.join(self.getSymopHome(), "symop.lib")

                xsDataStringSpaceGroup = self.getDataInput().getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                if(xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue()
                    EDVerbose.DEBUG("EDPluginControlStrategyv10.preProcess: Forced Space Group Found: " + strSpaceGroup)
                    try:
                        strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroup, strFileSymop)
                    except Exception, detail:
                        errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv10.preProcess', "Problem to calculate Number of symmetry operators", detail)
                        EDVerbose.error(errorMessage)
                        self.addErrorMessage(errorMessage)
                        raise RuntimeError, errorMessage
                # Space Group has NOT been forced
                else:
                    xsDataStringSpaceGroup = self.__xsDataSampleCopy.getCrystal().getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self.__xsDataSampleCopy.getCrystal().getSpaceGroup().getName().getValue()
                        EDVerbose.DEBUG("EDPluginControlStrategyv10.preProcess: Space Group IT Name found by indexing: " + strSpaceGroupName)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroupName, strFileSymop)
                        except Exception, detail:
                            errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv10.preProcess', "Problem to calculate Number of symmetry operators", detail)
                            EDVerbose.error(errorMessage)
                            self.addErrorMessage(errorMessage)
                            raise RuntimeError, errorMessage
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        strSpaceGroupITNumber = str(self.__xsDataSampleCopy.getCrystal().getSpaceGroup().getITNumber().getValue())
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess...")
        self._edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if(xsDataSampleCrystalMM is None):
            self._xsDataSampleCopy = XSDataSampleCrystalMM()
        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if(xsDataCrystal is not None):
            self._xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Load the Best plugin
        self._edPluginBest = self.loadPlugin(self._strPluginBestName)
        self._edPluginBest.setBaseDirectory(self.getWorkingDirectory())
        self._edPluginBest.setBaseName(self._strPluginBestName)

        # Load the plot gle plugin
        self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName)

        # Check if radiation damage estimation is required or not in the diffraction plan
        xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan()
        if xsDataDiffractionPlan is not None:
            if xsDataDiffractionPlan.getEstimateRadiationDamage():
                if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue():
                    # Yes, is requested
                    self._bEstimateRadiationDamage = True
                else:
                    # No, is explicitly not requested
                    self._bEstimateRadiationDamage = False
            elif xsDataDiffractionPlan.getStrategyOption() is not None:
                if xsDataDiffractionPlan.getStrategyOption().getValue().find("-DamPar") != -1:
                    # The "-DamPar" option requires estimation of radiation damage
                    self._bEstimateRadiationDamage = True

        # Check if we know what to do with radiation damage
        if self._bEstimateRadiationDamage is None:
            # "Force" the estimation of radiation damage if the flux is present
            if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None:
                strWarningMessage = "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage."
                EDVerbose.WARNING(strWarningMessage)
                self.addWarningMessage(strWarningMessage)
                self._bEstimateRadiationDamage = False
            else:
                self._bEstimateRadiationDamage = True


        if self._bEstimateRadiationDamage:
            if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None:
                strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage"
                EDVerbose.ERROR(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()

        if not self.isFailure():

            self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName)

            if (self._edPluginRaddose is not None):
                EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: " + self._strPluginRaddoseName + " Found... setting Data Input")

                strFileSymop = os.path.join(self.getSymopHome(), "symop.lib")

                xsDataStringSpaceGroup = self.getDataInput().getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                if(xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue().upper()
                    EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: " + strSpaceGroup)
                    try:
                        strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroup, strFileSymop)
                    except Exception, detail:
                        strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail)
                        EDVerbose.error(strErrorMessage)
                        self.addErrorMessage(strErrorMessage)
                        raise RuntimeError, strErrorMessage
                # Space Group has NOT been forced
                else:
                    xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName().getValue()
                        EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: " + strSpaceGroupName)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroupName, strFileSymop)
                        except Exception, detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail)
                            EDVerbose.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError, strErrorMessage
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        iSpaceGroupITNumber = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getITNumber().getValue()
                        EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d" % iSpaceGroupITNumber)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(str(iSpaceGroupITNumber), strFileSymop)
                        except Exception, detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail)
                            EDVerbose.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError, strErrorMessage
示例#6
0
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess...")
        self._edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if (xsDataSampleCrystalMM is None):
            self._xsDataSampleCopy = XSDataSampleCrystalMM()
        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(
                strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if (xsDataCrystal is not None):
            self._xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Load the Best plugin
        self._edPluginBest = self.loadPlugin(self._strPluginBestName)
        self._edPluginBest.setBaseDirectory(self.getWorkingDirectory())
        self._edPluginBest.setBaseName(self._strPluginBestName)

        # Load the plot gle plugin
        self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName)

        # Check if radiation damage estimation is required or not in the diffraction plan
        xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan()
        if xsDataDiffractionPlan is not None:
            if xsDataDiffractionPlan.getEstimateRadiationDamage():
                if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue(
                ):
                    # Yes, is requested
                    self._bEstimateRadiationDamage = True
                else:
                    # No, is explicitly not requested
                    self._bEstimateRadiationDamage = False
            elif xsDataDiffractionPlan.getStrategyOption() is not None:
                if xsDataDiffractionPlan.getStrategyOption().getValue().find(
                        "-DamPar") != -1:
                    # The "-DamPar" option requires estimation of radiation damage
                    self._bEstimateRadiationDamage = True

        # Check if we know what to do with radiation damage
        if self._bEstimateRadiationDamage is None:
            # "Force" the estimation of radiation damage if the flux is present
            if self.getDataInput().getExperimentalCondition().getBeam(
            ).getFlux() is None:
                strWarningMessage = "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage."
                EDVerbose.WARNING(strWarningMessage)
                self.addWarningMessage(strWarningMessage)
                self._bEstimateRadiationDamage = False
            else:
                self._bEstimateRadiationDamage = True

        if self._bEstimateRadiationDamage:
            if self.getDataInput().getExperimentalCondition().getBeam(
            ).getFlux() is None:
                strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage"
                EDVerbose.ERROR(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()

        if not self.isFailure():

            self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName)

            if (self._edPluginRaddose is not None):
                EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: " +
                                self._strPluginRaddoseName +
                                " Found... setting Data Input")

                strFileSymop = os.path.join(self.getSymopHome(), "symop.lib")

                xsDataStringSpaceGroup = self.getDataInput(
                ).getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                if (xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue().upper()
                    EDVerbose.DEBUG(
                        "EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: "
                        + strSpaceGroup)
                    try:
                        strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                            strSpaceGroup, strFileSymop)
                    except Exception, detail:
                        strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                            'EDPluginControlStrategyv1_2.preProcess',
                            "Problem to calculate Number of symmetry operators",
                            detail)
                        EDVerbose.error(strErrorMessage)
                        self.addErrorMessage(strErrorMessage)
                        raise RuntimeError, strErrorMessage
                # Space Group has NOT been forced
                else:
                    xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal(
                    ).getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self._xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getName().getValue()
                        EDVerbose.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: "
                            + strSpaceGroupName)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroupName, strFileSymop)
                        except Exception, detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                                'EDPluginControlStrategyv1_2.preProcess',
                                "Problem to calculate Number of symmetry operators",
                                detail)
                            EDVerbose.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError, strErrorMessage
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        iSpaceGroupITNumber = self._xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getITNumber().getValue()
                        EDVerbose.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d"
                            % iSpaceGroupITNumber)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(
                                str(iSpaceGroupITNumber), strFileSymop)
                        except Exception, detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                                'EDPluginControlStrategyv1_2.preProcess',
                                "Problem to calculate Number of symmetry operators",
                                detail)
                            EDVerbose.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError, strErrorMessage
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlStrategyv1_2.preProcess...")
        self._edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if xsDataSampleCrystalMM is None:
            self._xsDataSampleCopy = XSDataSampleCrystalMM()
        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if xsDataCrystal is not None:
            self._xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Load the Best plugin
        self._edPluginBest = self.loadPlugin(self._strPluginBestName)
        self._edPluginBest.setBaseDirectory(self.getWorkingDirectory())
        self._edPluginBest.setBaseName(self._strPluginBestName)

        # Load the plot gle plugin
        self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName)

        # Check if radiation damage estimation is required or not in the diffraction plan
        xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan()
        if xsDataDiffractionPlan is not None:
            if xsDataDiffractionPlan.getEstimateRadiationDamage():
                if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue():
                    # Yes, is requested
                    self._bEstimateRadiationDamage = True
                else:
                    # No, is explicitly not requested
                    self._bEstimateRadiationDamage = False
            elif xsDataDiffractionPlan.getStrategyOption() is not None:
                if xsDataDiffractionPlan.getStrategyOption().getValue().find("-DamPar") != -1:
                    # The "-DamPar" option requires estimation of radiation damage
                    self._bEstimateRadiationDamage = True

        # Check if we know what to do with radiation damage
        if self._bEstimateRadiationDamage is None:
            # "Force" the estimation of radiation damage if the flux is present
            if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None:
                strWarningMessage = (
                    "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage."
                )
                self.WARNING(strWarningMessage)
                self.addWarningMessage(strWarningMessage)
                self._bEstimateRadiationDamage = False
            else:
                self._bEstimateRadiationDamage = True

        if self._bEstimateRadiationDamage:
            if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None:
                strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage"
                self.ERROR(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()

        if not self.isFailure():

            self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName)

            if self._edPluginRaddose is not None:
                self.DEBUG(
                    "EDPluginControlStrategyv1_2.preProcess: "
                    + self._strPluginRaddoseName
                    + " Found... setting Data Input"
                )

                strFileSymop = os.path.join(self.getSymopHome(), "symop.lib")

                xsDataStringSpaceGroup = self.getDataInput().getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                bSpaceGroupForced = False
                if xsDataStringSpaceGroup is not None:
                    strSpaceGroup = xsDataStringSpaceGroup.getValue().upper().replace(" ", "")
                    if strSpaceGroup != "":
                        self.DEBUG("EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: " + strSpaceGroup)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroup, strFileSymop
                            )
                            bSpaceGroupForced = True
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail
                            )
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)
                if not bSpaceGroupForced:
                    # Space Group has NOT been forced
                    xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName()
                    if xsDataStringSpaceGroup is not None:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName().getValue()
                        self.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: "
                            + strSpaceGroupName
                        )
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroupName, strFileSymop
                            )
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail
                            )
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        iSpaceGroupITNumber = (
                            self._xsDataSampleCopy.getCrystal().getSpaceGroup().getITNumber().getValue()
                        )
                        self.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d"
                            % iSpaceGroupITNumber
                        )
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(
                                str(iSpaceGroupITNumber), strFileSymop
                            )
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail
                            )
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)

                if strNumOperators is not None:
                    iNumOperators = int(strNumOperators)
                else:
                    strErrorMessage = "EDPluginControlStrategyv1_2: No symmetry operators found for Space Group: {0}".format(
                        strNumOperators
                    )
                    self.error(strErrorMessage)
                    self.addErrorMessage(strErrorMessage)
                    raise RuntimeError(strErrorMessage)

                xsDataChemicalComposition = self._xsDataSampleCopy.getChemicalComposition()

                if xsDataChemicalComposition is None:
                    # create a default chemical composition and assign it to the sample
                    xsDataDefaultChemicalComposition = self.getDefaultChemicalComposition(
                        self._xsDataSampleCopy, iNumOperators
                    )
                    self._xsDataSampleCopy.setChemicalComposition(xsDataDefaultChemicalComposition)
                else:
                    # Check for Sulfur atoms, if none, add native sulfur atoms
                    xsDataUpdatedChemicalComposition = self.updateChemicalComposition(xsDataChemicalComposition)
                    self._xsDataSampleCopy.setChemicalComposition(xsDataUpdatedChemicalComposition)

                # create Data Input for Raddose
                from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10

                self._edHandlerXSDataRaddose = EDHandlerXSDataRaddosev10()
                xsDataBeam = self.getDataInput().getExperimentalCondition().getBeam()

                # Calculate number of images (MXSUP-1616):
                iNumberOfImages = None
                xsDataCollection = self.dataInput.dataCollection
                if xsDataCollection is not None:
                    iNumberOfImages = 0
                    for xsDataSubWedge in xsDataCollection.subWedge:
                        xsDataGoniostat = xsDataSubWedge.experimentalCondition.goniostat
                        iOscStart = xsDataGoniostat.rotationAxisStart.value
                        iOscEnd = xsDataGoniostat.rotationAxisEnd.value
                        iOscWidth = xsDataGoniostat.oscillationWidth.value
                        iNumberOfImages += int(round((iOscEnd - iOscStart) / iOscWidth, 0))
                if iNumberOfImages is None:
                    iNumberOfImages = 1
                    self.WARNING("No goniostat information, number of images for RADDOSE set to 1")

                xsDataRaddoseInput = self._edHandlerXSDataRaddose.getXSDataRaddoseInput(
                    xsDataBeam, self._xsDataSampleCopy, iNumOperators, iNumberOfImages
                )
                if xsDataRaddoseInput is not None:
                    self._edPluginRaddose.setDataInput(xsDataRaddoseInput)
                    self._edPluginRaddose.setBaseDirectory(self.getWorkingDirectory())
                    self._edPluginRaddose.setBaseName(self._strPluginRaddoseName)
示例#8
0
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlStrategyv1_2.preProcess...")
        self._edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput().getSample()

        if (xsDataSampleCrystalMM is None):
            self._xsDataSampleCopy = XSDataSampleCrystalMM()
        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(
                strXmlStringDataSample)

        xsDataCrystal = self.getDataInput().getCrystalRefined()
        if (xsDataCrystal is not None):
            self._xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Load the Best plugin
        self._edPluginBest = self.loadPlugin(self._strPluginBestName)
        self._edPluginBest.setBaseDirectory(self.getWorkingDirectory())
        self._edPluginBest.setBaseName(self._strPluginBestName)

        # Load the plot gle plugin
        self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName)

        # Check if radiation damage estimation is required or not in the diffraction plan
        xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan()
        if xsDataDiffractionPlan is not None:
            if xsDataDiffractionPlan.getEstimateRadiationDamage():
                if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue(
                ):
                    # Yes, is requested
                    self._bEstimateRadiationDamage = True
                else:
                    # No, is explicitly not requested
                    self._bEstimateRadiationDamage = False
            elif xsDataDiffractionPlan.getStrategyOption() is not None:
                if xsDataDiffractionPlan.getStrategyOption().getValue().find(
                        "-DamPar") != -1:
                    # The "-DamPar" option requires estimation of radiation damage
                    self._bEstimateRadiationDamage = True

        # Check if we know what to do with radiation damage
        if self._bEstimateRadiationDamage is None:
            # "Force" the estimation of radiation damage if the flux is present
            if self.getDataInput().getExperimentalCondition().getBeam(
            ).getFlux() is None:
                strWarningMessage = "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage."
                self.WARNING(strWarningMessage)
                self.addWarningMessage(strWarningMessage)
                self._bEstimateRadiationDamage = False
            else:
                self._bEstimateRadiationDamage = True

        if self._bEstimateRadiationDamage:
            if self.getDataInput().getExperimentalCondition().getBeam(
            ).getFlux() is None:
                strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage"
                self.ERROR(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                self.setFailure()

        if not self.isFailure():

            self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName)

            if (self._edPluginRaddose is not None):
                self.DEBUG("EDPluginControlStrategyv1_2.preProcess: " +
                           self._strPluginRaddoseName +
                           " Found... setting Data Input")

                xsDataStringSpaceGroup = self.getDataInput(
                ).getDiffractionPlan().getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                bSpaceGroupForced = False
                if (xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue().upper(
                    ).replace(" ", "")
                    if strSpaceGroup != "":
                        self.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: "
                            + strSpaceGroup)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroup)
                            bSpaceGroupForced = True
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail)
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)
                if not bSpaceGroupForced:
                    # Space Group has NOT been forced
                    xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal(
                    ).getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroupName = self._xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getName().getValue()
                        self.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: "
                            + strSpaceGroupName)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroupName)
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail)
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        iSpaceGroupITNumber = self._xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getITNumber().getValue()
                        self.DEBUG(
                            "EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d"
                            % iSpaceGroupITNumber)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(
                                str(iSpaceGroupITNumber))
                        except Exception as detail:
                            strErrorMessage = "EDPluginControlStrategyv1_2: Problem to calculate Number of symmetry operators: {0}".format(
                                detail)
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)

                if (strNumOperators is not None):
                    iNumOperators = int(strNumOperators)
                else:
                    strErrorMessage = "EDPluginControlStrategyv1_2: No symmetry operators found for Space Group: {0}".format(
                        strNumOperators)
                    self.error(strErrorMessage)
                    self.addErrorMessage(strErrorMessage)
                    raise RuntimeError(strErrorMessage)

                xsDataChemicalComposition = self._xsDataSampleCopy.getChemicalComposition(
                )

                if (xsDataChemicalComposition is None):
                    # create a default chemical composition and assign it to the sample
                    xsDataDefaultChemicalComposition = self.getDefaultChemicalComposition(
                        self._xsDataSampleCopy, iNumOperators)
                    self._xsDataSampleCopy.setChemicalComposition(
                        xsDataDefaultChemicalComposition)
                else:
                    # Check for Sulfur atoms, if none, add native sulfur atoms
                    xsDataUpdatedChemicalComposition = self.updateChemicalComposition(
                        xsDataChemicalComposition)
                    self._xsDataSampleCopy.setChemicalComposition(
                        xsDataUpdatedChemicalComposition)

                # create Data Input for Raddose
                from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10
                self._edHandlerXSDataRaddose = EDHandlerXSDataRaddosev10()
                xsDataBeam = self.getDataInput().getExperimentalCondition(
                ).getBeam()

                # Calculate number of images (MXSUP-1616):
                iNumberOfImages = None
                xsDataCollection = self.dataInput.dataCollection
                if xsDataCollection is not None:
                    iNumberOfImages = 0
                    for xsDataSubWedge in xsDataCollection.subWedge:
                        xsDataGoniostat = xsDataSubWedge.experimentalCondition.goniostat
                        iOscStart = xsDataGoniostat.rotationAxisStart.value
                        iOscEnd = xsDataGoniostat.rotationAxisEnd.value
                        iOscWidth = xsDataGoniostat.oscillationWidth.value
                        iNumberOfImages += int(
                            round((iOscEnd - iOscStart) / iOscWidth, 0))
                if iNumberOfImages is None:
                    iNumberOfImages = 1
                    self.WARNING(
                        "No goniostat information, number of images for RADDOSE set to 1"
                    )

                xsDataRaddoseInput = self._edHandlerXSDataRaddose.getXSDataRaddoseInput(
                    xsDataBeam, self._xsDataSampleCopy, iNumOperators,
                    iNumberOfImages)
                if xsDataRaddoseInput is not None:
                    self._edPluginRaddose.setDataInput(xsDataRaddoseInput)
                    self._edPluginRaddose.setBaseDirectory(
                        self.getWorkingDirectory())
                    self._edPluginRaddose.setBaseName(
                        self._strPluginRaddoseName)
    def preProcess(self, _edObject=None):
        """
        Gets the Configuration Parameters, if found, overrides default parameters
        """
        EDPluginControl.preProcess(self, _edObject)
        self.DEBUG("EDPluginControlKappaStrategyv2_0.preProcess...")
        self.edPluginRaddose = None

        xsDataSampleCrystalMM = self.getDataInput(
            "mxv1InputStrategy")[0].getSample()

        if (xsDataSampleCrystalMM is None):
            self.xsDataSampleCopy = XSDataSampleCrystalMM()

        else:
            strXmlStringDataSample = xsDataSampleCrystalMM.marshal()
            self.xsDataSampleCopy = XSDataSampleCrystalMM.parseString(
                strXmlStringDataSample)

        xsDataCrystal = self.getDataInput(
            "mxv1InputStrategy")[0].getCrystalRefined()
        if (xsDataCrystal is not None):
            self.xsDataSampleCopy.setCrystal(xsDataCrystal)

        # Raddose is enabled only if the beam flux is set
        if (self.getDataInput("mxv1InputStrategy")
            [0].getExperimentalCondition().getBeam().getFlux() is None):
            strWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % (
                'EDPluginControlKappaStrategyv2_0.preProcess',
                self.strPluginRaddoseName, "Beam Flux not set")
            self.warning(strWarningMessage)
            self.addWarningMessage(strWarningMessage)

        else:
            self.edPluginRaddose = self.loadPlugin(self.strPluginRaddoseName)

            if (self.edPluginRaddose is not None):
                self.DEBUG("EDPluginControlKappaStrategyv2_0.preProcess: " +
                           self.strPluginRaddoseName +
                           " Found... setting Data Input")

                xsDataStringSpaceGroup = self.getDataInput(
                    "mxv1InputStrategy")[0].getDiffractionPlan(
                    ).getForcedSpaceGroup()
                # Space Group has been forced
                # Prepare chemical composition calculation with the forced Space Group (Space Group Name)
                strNumOperators = None
                strSpaceGroup = None
                if (xsDataStringSpaceGroup is not None):
                    strSpaceGroup = xsDataStringSpaceGroup.getValue()
                    self.DEBUG(
                        "EDPluginControlKappaStrategyv2_0.preProcess: Forced Space Group Found: "
                        + strSpaceGroup)
                    try:
                        strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                            strSpaceGroup)
                    except Exception as detail:
                        strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                            'EDPluginControlKappaStrategyv2_0.preProcess',
                            "Problem to calculate Number of symmetry operators",
                            detail)
                        self.error(strErrorMessage)
                        self.addErrorMessage(strErrorMessage)
                        raise RuntimeError(strErrorMessage)
                # Space Group has NOT been forced
                else:
                    xsDataStringSpaceGroup = self.xsDataSampleCopy.getCrystal(
                    ).getSpaceGroup().getName()
                    if (xsDataStringSpaceGroup is not None):
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name)
                        strSpaceGroup = self.xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getName().getValue()
                        self.DEBUG(
                            "EDPluginControlKappaStrategyv2_0.preProcess: Space Group IT Name found by indexing: "
                            + strSpaceGroup)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(
                                strSpaceGroup)
                        except Exception as detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                                'EDPluginControlKappaStrategyv2_0.preProcess',
                                "Problem to calculate Number of symmetry operators",
                                detail)
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)
                    else:
                        # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number)
                        dSpaceGroupITNumber = self.xsDataSampleCopy.getCrystal(
                        ).getSpaceGroup().getITNumber().getValue()
                        self.DEBUG(
                            "EDPluginControlKappaStrategyv2_0.preProcess: Space Group IT Number Found by indexing: %d"
                            % dSpaceGroupITNumber)
                        try:
                            strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(
                                str(dSpaceGroupITNumber))
                        except Exception as detail:
                            strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                                'EDPluginControlKappaStrategyv2_0.preProcess',
                                "Problem to calculate Number of symmetry operators",
                                detail)
                            self.error(strErrorMessage)
                            self.addErrorMessage(strErrorMessage)
                            raise RuntimeError(strErrorMessage)

                if (strNumOperators is not None):
                    iNumOperators = int(strNumOperators)
                else:
                    strErrorMessage = EDMessage.ERROR_EXECUTION_03 % (
                        'EDPluginControlKappaStrategyv2_0.preProcess',
                        "No symmetry operators found for Space Group: ",
                        strSpaceGroup)
                    self.error(strErrorMessage)
                    self.addErrorMessage(strErrorMessage)
                    raise RuntimeError(strErrorMessage)

                xsDataChemicalComposition = self.xsDataSampleCopy.getChemicalComposition(
                )

                if (xsDataChemicalComposition is None):
                    # create a default chemical composition and assign it to the sample
                    xsDataDefaultChemicalComposition = self.getDefaultChemicalComposition(
                        self.xsDataSampleCopy, iNumOperators)
                    self.xsDataSampleCopy.setChemicalComposition(
                        xsDataDefaultChemicalComposition)
                else:
                    # Check for Sulfur atoms, if none, add native sulfur atoms
                    xsDataUpdatedChemicalComposition = self.updateChemicalComposition(
                        xsDataChemicalComposition)
                    self.xsDataSampleCopy.setChemicalComposition(
                        xsDataUpdatedChemicalComposition)

                # create Data Input for Raddose
                from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10
                self.edHandlerXSDataRaddose = EDHandlerXSDataRaddosev10()
                xsDataBeam = self.getDataInput("mxv1InputStrategy")[
                    0].getExperimentalCondition().getBeam()

                xsDataRaddoseInput = None
                iNumberOfImages = 1
                self.warning("Number of images for RADDOSE forced to 1")
                try:
                    xsDataRaddoseInput = self.edHandlerXSDataRaddose.getXSDataRaddoseInput(
                        xsDataBeam, self.xsDataSampleCopy, iNumOperators,
                        iNumberOfImages)

                except Exception as detail:
                    strWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % (
                        'EDPluginControlKappaStrategyv2_0.preProcess',
                        self.strPluginRaddoseName,
                        "EDHandlerXSDataRaddose : " + detail)
                    self.warning(strWarningMessage)
                    self.addWarningMessage(strWarningMessage)

                if (xsDataRaddoseInput is not None):
                    self.edPluginRaddose.setDataInput(xsDataRaddoseInput)
                    self.edPluginRaddose.setBaseDirectory(
                        self.getWorkingDirectory())
                    self.edPluginRaddose.setBaseName(self.strPluginRaddoseName)

                    # More checks?
#                    try:
#                        self.edPluginRaddose.setDataInput( xsDataRaddoseInput )
#                        self.edPluginRaddose.setBaseDirectory( self.getWorkingDirectory() )
#                        self.edPluginRaddose.setBaseName( self.strPluginRaddoseName )
#
#                    except Exception, detail:
#                        strWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % ('EDPluginControlStrategyv1_1.preProcess', self.strPluginRaddoseName,  detail ) )
#                        self.warning( strWarningMessage )
#                        self.addWarningMessage( strWarningMessage )

            else:
                strErrorMessage = EDMessage.ERROR_PLUGIN_NOT_LOADED_02 % (
                    'EDPluginControlKappaStrategyv2_0.preProcess',
                    self.strPluginRaddoseName)
                self.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                raise RuntimeError(strErrorMessage)

        self.edPluginBest = self.loadPlugin(self.strPluginBestName)
        if (self.edPluginBest is None):
            strErrorMessage = EDMessage.ERROR_PLUGIN_NOT_LOADED_02 % (
                'EDPluginControlKappaStrategyv2_0.preProcess',
                self.strPluginBestName)
            self.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError(strErrorMessage)
        else:
            self.edPluginBest.setBaseDirectory(self.getWorkingDirectory())
            self.edPluginBest.setBaseName(self.strPluginBestName)

        if (self.KappaStrategy):
            # Alignment
            self.edPluginAlignment = self.loadPlugin(
                self.strPluginAlignmentName)
            if (self.edPluginAlignment is None):
                errorMessage = EDMessage.ERROR_PLUGIN_NOT_LOADED_02 % (
                    'EDPluginControlKappaStrategyv2_0.preProcess',
                    self.strPluginAlignmentName)
                self.error(errorMessage)
                self.addErrorMessage(errorMessage)
                # do not kill the application just because this feature is not available
                # raise RuntimeError, errorMessage
            else:
                self.edPluginAlignment.setBaseDirectory(
                    self.getWorkingDirectory())
                self.edPluginAlignment.setBaseName(self.strPluginAlignmentName)

            # KappaStaregy
            self.edPluginKappaStrategy = self.loadPlugin(
                self.strPluginKappaStrategyName)
            if (self.edPluginKappaStrategy is None):
                errorMessage = EDMessage.ERROR_PLUGIN_NOT_LOADED_02 % (
                    'EDPluginControlKappaStrategyv2_0.preProcess',
                    self.strPluginKappaStrategyName)
                self.error(errorMessage)
                self.addErrorMessage(errorMessage)
                # raise RuntimeError, errorMessage
            else:
                self.edPluginKappaStrategy.setBaseDirectory(
                    self.getWorkingDirectory())
                self.edPluginKappaStrategy.setBaseName(
                    self.strPluginKappaStrategyName)