本文整理汇总了Python中EDConfiguration.EDConfiguration类的典型用法代码示例。如果您正苦于以下问题:Python EDConfiguration类的具体用法?Python EDConfiguration怎么用?Python EDConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EDConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRasterConfiguration
def testRasterConfiguration(self):
strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome, "XSConfiguration_raster.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
edConfiguration.load()
xsPluginItem = edConfiguration.getPluginItem("EDPluginMOSFLMv10")
xsDataMOSFLMInput = XSDataMOSFLMInput()
xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
xsDataMOSFLMBeam.setX(XSDataLength(1.0))
xsDataMOSFLMBeam.setY(XSDataLength(2.0))
xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
xsDataMOSFLMDetector = XSDataMOSFLMDetector()
xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
edPluginMOSFLMv10 = self.createPlugin()
edPluginMOSFLMv10.setScriptExecutable("cat")
edPluginMOSFLMv10.setConfiguration(xsPluginItem)
edPluginMOSFLMv10.configure()
edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
edPluginMOSFLMv10.generateMOSFLMCommands()
edListCommands = edPluginMOSFLMv10.getListCommandExecution()
edListCommandsReference = ['WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0', 'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img', 'RASTER 15 15 3 3 3']
EDAssert.equal(edListCommandsReference, edListCommands, "MOSFLM commands with ratser configured")
示例2: configure
def configure(self):
"""
Gets the configuration parameters (if any).
"""
EDPluginControl.configure(self)
EDVerbose.DEBUG("EDPluginControlCharacterisationv1_1.configure")
pluginConfiguration = self.getConfiguration()
if(pluginConfiguration is None):
EDVerbose.DEBUG("No plugin configuration found for EDPluginControlCharacterisationv1_1.")
else:
if (self.getControlledPluginName("indexingPlugin") is not None):
self.__strPluginIndexingName = self.getControlledPluginName("indexingPlugin")
if (self.getControlledPluginName("integrationPlugin") is not None):
self.__strPluginIntegrationName = self.getControlledPluginName("integrationPlugin")
if (self.getControlledPluginName("strategyPlugin") is not None):
self.__strPluginStrategyName = self.getControlledPluginName("strategyPlugin")
if (self.getControlledPluginName("kappaStrategyPlugin") is not None):
self.__strPluginKappaStrategyName = self.getControlledPluginName("kappaStrategyPlugin")
if (self.getControlledPluginName("integrationPointlessPlugin") is not None):
self.__strPluginIntegrationPoitlessName = self.getControlledPluginName("integrationPointlessPlugin")
pyStrKappa = EDConfiguration.getStringParamValue(pluginConfiguration, "KAPPA")
if(pyStrKappa == "ON"):
self.__strPluginStrategyName = self.__strPluginKappaStrategyName
pyStrPointless = EDConfiguration.getStringParamValue(pluginConfiguration, "POINTLESS")
if(pyStrPointless == "ON"):
self.__strPluginIntegrationName = self.__strPluginIntegrationPointlessName
示例3: testConfigureOK
def testConfigureOK(self):
edPluginControlIndexingv10 = self.createPlugin()
strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
dictItem = edConfiguration.get(edPluginControlIndexingv10.getPluginName())
edPluginControlIndexingv10.setConfig(dictItem)
edPluginControlIndexingv10.configure()
示例4: configure
def configure(self):
"""
Gets the dbserver parameters from the config file and stores them in class member attributes.
"""
EDPluginExec.configure(self)
pluginConfiguration = self.getConfiguration()
if(pluginConfiguration == None):
EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration is None, using default settings")
else:
EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration found, using settings from there")
strDbserverHost = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverHost")
if(strDbserverHost == None):
strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \
"Configuration parameter missing: dbserverHost")
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
else:
self.setDbserverHost(strDbserverHost)
strDbserverPort = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverPort")
if(strDbserverPort == None):
strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \
"Configuration parameter missing: dbserverPort")
EDVerbose.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
raise RuntimeError, strErrorMessage
else:
self.setDbserverPort(int (strDbserverPort))
示例5: testSetXSConfigurationItem
def testSetXSConfigurationItem(self):
xsPluginItem = XSPluginItem()
xsPluginItem.name = "EDPluginTestSetConfig"
edConfiguration = EDConfiguration()
edConfiguration.setXSConfigurationItem(xsPluginItem)
xsDataPluginItem = edConfiguration.getXSConfigurationItem("EDPluginTestSetConfig")
EDAssert.equal(True, xsDataPluginItem is not None, "Obtanied set configuration")
示例6: testAddConfigFile
def testAddConfigFile(self):
# Tests adding a config file
strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
edConfiguration = EDConfiguration()
edConfiguration.addConfigurationFile(strPath)
# Load the config file again, this time the cache should be used
edConfiguration.addConfigurationFile(strPath)
示例7: testConfigureOK
def testConfigureOK(self):
edPluginStrategy = self.createPlugin()
strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration_ESRF.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
edPluginStrategy.setConfig(dictItem)
edPluginStrategy.configure()
示例8: preProcess
def preProcess(self):
EDTestCasePluginExecuteDistlSignalStrengthThinClientv1_1.preProcess(self)
# Load the configuration file
xsPluginItem = self.getPluginConfiguration()
if xsPluginItem is not None:
strServerPort = EDConfiguration.getStringParamValue(xsPluginItem, \
EDPluginDistlSignalStrengthThinClientv1_1.CONF_DISTL_SIGNAL_STRENGTH_SERVER_PORT)
if strServerPort is None:
iServerPort = EDPluginDistlSignalStrengthThinClientv1_1.DEFAULT_SERVER_PORT
else:
iServerPort = int(strServerPort)
strPathToServer = EDConfiguration.getStringParamValue(xsPluginItem, \
EDPluginDistlSignalStrengthThinClientv1_1.CONF_PATH_TO_DISTL_SIGNAL_STRENGTH_SERVER)
if(strPathToServer == None):
strErrorMessage = "EDPluginLabelitv1_1.configure : Configuration parameter missing: " + \
"distl.mp_spotfinder_server_read_file"
self.error(strErrorMessage)
self.addErrorMessage(strErrorMessage)
self.setFailure()
# Start the server using random port
self.subprocess = EDUtilsPlatform.Popen(shlex.split(str(EDUtilsPlatform.escape(strPathToServer + " distl.port=%d" % iServerPort))),
cwd=os.getcwd())
self.iPID = self.subprocess.pid
# Give the server some time to start up
time.sleep(8)
开发者ID:antolinos,项目名称:edna,代码行数:25,代码来源:EDTestCasePluginExecuteDistlSignalStrengthThinClientLocalServerv1_1.py
示例9: testSetDataModelInput
def testSetDataModelInput(self):
edPluginBest = self.createPlugin()
edConfigurationGood01 = EDConfiguration(os.path.join(self.m_pyStrDataPath, "XSConfiguration.xml"))
dictItemGood01 = edConfigurationGood01.get(self.getPluginName())
edPluginBest.setConfig(dictItemGood01, _bLocal = True)
edPluginBest.setScriptExecutable("cat")
edPluginBest.configure()
from XSDataBestv1_2 import XSDataInputBest
xsDataInputBest = XSDataInputBest()
from XSDataCommon import XSDataAbsorbedDoseRate
from XSDataCommon import XSDataDouble
from XSDataCommon import XSDataString
from XSDataCommon import XSDataTime
from XSDataCommon import XSDataFile
from XSDataCommon import XSDataAngularSpeed
from XSDataCommon import XSDataString
from XSDataCommon import XSDataAngle
from XSDataCommon import XSDataBoolean
xsDataInputBest.setCrystalAbsorbedDoseRate(XSDataAbsorbedDoseRate(0.22E+06))
xsDataInputBest.setCrystalShape(XSDataDouble(1))
xsDataInputBest.setCrystalSusceptibility(XSDataDouble(1.5))
xsDataInputBest.setDetectorType(XSDataString("q210-2x"))
xsDataInputBest.setBeamExposureTime(XSDataTime(1))
xsDataInputBest.setBeamMaxExposureTime(XSDataTime(10000))
xsDataInputBest.setBeamMinExposureTime(XSDataTime(0.1))
xsDataInputBest.setGoniostatMinRotationWidth(XSDataAngle(0.1))
xsDataInputBest.setGoniostatMaxRotationSpeed(XSDataAngularSpeed(10))
xsDataInputBest.setAimedResolution(XSDataDouble(2))
xsDataInputBest.setAimedRedundancy(XSDataDouble(6.5))
xsDataInputBest.setAimedCompleteness(XSDataDouble(0.9))
xsDataInputBest.setAimedIOverSigma(XSDataDouble(3))
xsDataInputBest.setComplexity(XSDataString("min"))
xsDataInputBest.setAnomalousData(XSDataBoolean(False))
fileDirectory = edPluginBest.getWorkingDirectory()
bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile.dat"))
xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat))
bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile.par"))
xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar))
bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile1.hkl"))
xsDataInputBest.addBestFileContentHKL(XSDataString(bestFileContentHKL))
xsDataInputBest.exportToFile(self.m_edObtainedInputFile)
pyStrExpectedInput = self.readAndParseFile (self.m_edReferenceInputFile)
pyStrObtainedInput = self.readAndParseFile (self.m_edObtainedInputFile)
xsDataInputExpected = XSDataInputBest.parseString(pyStrExpectedInput)
xsDataInputObtained = XSDataInputBest.parseString(pyStrObtainedInput)
EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
EDUtilsFile.deleteFile(self.m_edObtainedInputFile)
self.cleanUp(edPluginBest)
示例10: testGetXSConfigurationItem2
def testGetXSConfigurationItem2(self):
edConfiguration = EDConfiguration()
xsDataPluginItem1 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactory")
EDAssert.equal(True, xsDataPluginItem1 is not None, "Obtanied configuration for EDPluginTestPluginFactory")
xsDataPluginItem2 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactoryImport1")
EDAssert.equal(True, xsDataPluginItem2 is not None, "Obtanied imported configuration for EDPluginTestPluginFactoryImport1")
xsDataPluginItem3 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactoryImport2")
EDAssert.equal(True, xsDataPluginItem3 is not None, "Obtanied imported configuration for EDPluginTestPluginFactoryImport2")
示例11: testConfigureOK
def testConfigureOK(self):
edPluginStrategy = self.createPlugin()
strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration_ESRF.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
edPluginStrategy.setConfig(dictItem)
edPluginStrategy.configure()
EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/lib/data", edPluginStrategy.getSymopHome())
示例12: preProcess
def preProcess(self, _edObject=None):
EDPluginExecProcessScript.preProcess(self)
EDVerbose.DEBUG("EDPluginSTACv10.preProcess")
xsPluginItem = self.getConfiguration()
self.addListCommandPreExecution("export STACDIR=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "STACDIR"))
self.addListCommandPreExecution("export BCMDEF=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "BCMDEF"))
self.addListCommandPreExecution("export RUNDIR=%s" % self.getWorkingDirectory())
self.setScriptCommandline("stac.core.STAC_DNA_listener %s -%s/" % (self.getSTACcommand(), self.getWorkingDirectory()))
示例13: testStaticEDConfiguration
def testStaticEDConfiguration(self):
# This test make sure that changing an instatiation of EDConfiguration does not change the
# corresponding plugin configuration for EDConfigurationStatic
strPathToTestConfigFile = os.path.join(self.strDataPath, "XSConfiguration_testNonStatic.xml")
edConfiguration = EDConfiguration(strPathToTestConfigFile)
strParam1 = edConfiguration.getStringValue("EDPluginTestPluginFactory", "testItemName")
EDUtilsPath.setEdnaSite("TestStaticConfiguration")
strParam2 = EDConfigurationStatic.getStringValue("EDPluginTestPluginFactory", "testItemName")
EDAssert.equal(False, strParam1 == strParam2, "Static config is not equal to local config")
示例14: testGetPluginListSize
def testGetPluginListSize(self):
"""
Testing the retrieved XSPluginList size from configuration
"""
strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
edConfiguration = EDConfiguration()
edConfiguration.addConfigurationFile(strPath)
iPluginListSize = edConfiguration.getPluginListSize()
EDAssert.equal(1, iPluginListSize)
示例15: testGetPluginItemError
def testGetPluginItemError(self):
"""
Testing the retrieval of an absent plugin
"""
strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
edConfiguration = EDConfiguration()
edConfiguration.addConfigurationFile(strPath)
xsPluginItem = edConfiguration.getXSConfigurationItem("toto")
EDAssert.equal(None, xsPluginItem, "Non-existing configuration item should be None")