当前位置: 首页>>代码示例>>Python>>正文


Python XSDataSampleCrystalMM.parseString方法代码示例

本文整理汇总了Python中XSDataMXv1.XSDataSampleCrystalMM.parseString方法的典型用法代码示例。如果您正苦于以下问题:Python XSDataSampleCrystalMM.parseString方法的具体用法?Python XSDataSampleCrystalMM.parseString怎么用?Python XSDataSampleCrystalMM.parseString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XSDataMXv1.XSDataSampleCrystalMM的用法示例。


在下文中一共展示了XSDataSampleCrystalMM.parseString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createInputCharacterisationFromSubWedges

# 需要导入模块: from XSDataMXv1 import XSDataSampleCrystalMM [as 别名]
# 或者: from XSDataMXv1.XSDataSampleCrystalMM import parseString [as 别名]
 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)
开发者ID:IvarsKarpics,项目名称:edna-mx,代码行数:50,代码来源:EDPluginControlInterfacev1_3.py

示例2: preProcess

# 需要导入模块: from XSDataMXv1 import XSDataSampleCrystalMM [as 别名]
# 或者: from XSDataMXv1.XSDataSampleCrystalMM import parseString [as 别名]
    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)
#.........这里部分代码省略.........
开发者ID:antolinos,项目名称:edna,代码行数:103,代码来源:EDPluginControlStrategyv1_2.py

示例3: preProcess

# 需要导入模块: from XSDataMXv1 import XSDataSampleCrystalMM [as 别名]
# 或者: from XSDataMXv1.XSDataSampleCrystalMM import parseString [as 别名]
    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())
开发者ID:antolinos,项目名称:edna,代码行数:67,代码来源:EDPluginControlStrategyv10.py

示例4: preProcess

# 需要导入模块: from XSDataMXv1 import XSDataSampleCrystalMM [as 别名]
# 或者: from XSDataMXv1.XSDataSampleCrystalMM import parseString [as 别名]
    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:
#.........这里部分代码省略.........
开发者ID:jordiandreu,项目名称:edna-mx,代码行数:103,代码来源:EDPluginControlStrategyv1_2.py


注:本文中的XSDataMXv1.XSDataSampleCrystalMM.parseString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。