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)
def testGenerateXSDataInputBestv1_2( self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference): """ This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object. """ strReferenceInputFile = os.path.join( self.strDataPath, _strFileNameXSDataInputStrategy_reference) strPath = os.path.join(self.strDataPath, strReferenceInputFile) from XSDataMXv1 import XSDataInputStrategy xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath) from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2 edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2() xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest( xsDataInputStrategy) strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference) strXMLInputBestReference = EDUtilsTest.readAndParseFile( strReferencePath) EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataBestv1_2 import XSDataInputBest xsDataInputBestReference = XSDataInputBest.parseString( strXMLInputBestReference) EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
def testGenerateExecutiveSummary(self): pyStrInputBest = self.readAndParseFile (self.m_edReferenceInputFile) pyStrResultBest = self.readAndParseFile (self.m_edReferenceResultFile) from XSDataBestv1_2 import XSDataInputBest from XSDataBestv1_2 import XSDataResultBest xsDataInputBest = XSDataInputBest.parseString(pyStrInputBest) xsDataResultBest = XSDataResultBest.parseString(pyStrResultBest) edPluginBest = self.createPlugin() edPluginBest.setDataInput(xsDataInputBest) edPluginBest.setDataOutput(xsDataResultBest) edPluginBest.generateExecutiveSummary(edPluginBest)
def testGenerateExecutiveSummary(self): pyStrInputBest = self.readAndParseFile(self.m_edReferenceInputFile) pyStrResultBest = self.readAndParseFile(self.m_edReferenceResultFile) from XSDataBestv1_2 import XSDataInputBest from XSDataBestv1_2 import XSDataResultBest xsDataInputBest = XSDataInputBest.parseString(pyStrInputBest) xsDataResultBest = XSDataResultBest.parseString(pyStrResultBest) edPluginBest = self.createPlugin() edPluginBest.setDataInput(xsDataInputBest) edPluginBest.setDataOutput(xsDataResultBest) edPluginBest.generateExecutiveSummary(edPluginBest)
def testGenerateXSDataInputBestv1_2(self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference): """ This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object. """ strReferenceInputFile = os.path.join(self.strDataPath, _strFileNameXSDataInputStrategy_reference) strPath = os.path.join(self.strDataPath, strReferenceInputFile) from XSDataMXv1 import XSDataInputStrategy xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath) from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2 edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2() xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(xsDataInputStrategy) strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference) strXMLInputBestReference = EDUtilsTest.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataBestv1_2 import XSDataInputBest xsDataInputBestReference = XSDataInputBest.parseString(strXMLInputBestReference) EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
def testSetDataModelInput(self): edPluginBest = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration( os.path.join(self.m_pyStrDataPath, "XSConfiguration.xml")) edPluginBest.setConfiguration(xsPluginItemGood01) 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 XSDataSpeed 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(XSDataSpeed(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)