def testCheckParameters(self): strXMLInput = self.readAndParseFile(self.strPathToDataInputFile) xsDataInput = XSDataIndexingResult.parseString(strXMLInput) edPluginExecEvaluationIndexing = self.createPlugin() edPluginExecEvaluationIndexing.setDataInput(xsDataInput, "indexingResult") edPluginExecEvaluationIndexing.checkParameters()
def testExecute(self): self.run() # Checks that there are no error messages plugin = self.getPlugin() # Checks the expected result strExpectedOutput = self.readAndParseFile(self.strReferenceDataOutputFile) # Check that all the paths in the prediction results actaully exists from XSDataMXv1 import XSDataIndexingResult xsDataIndexingResultObtained = plugin.getDataOutput() xsDataIndexingResultExpected = XSDataIndexingResult.parseString(strExpectedOutput) xsDataGeneratePredictionResult = xsDataIndexingResultObtained.getPredictionResult() for predictionImage in xsDataGeneratePredictionResult.getPredictionImage(): strImagePath = predictionImage.getPath().getValue() bImageExists = os.path.exists(strImagePath) EDAssert.equal(True, bImageExists) # Check that we found the right space group xsDataIndexingSolutionSelectedObtained = xsDataIndexingResultObtained.getSelectedSolution() xsDataIndexingSolutionSelectedExpected = xsDataIndexingResultExpected.getSelectedSolution() xsDataCrystalObtained = xsDataIndexingSolutionSelectedObtained.getCrystal() xsDataCrystalExpected = xsDataIndexingSolutionSelectedExpected.getCrystal() xsDataSpaceGroupObtained = xsDataCrystalObtained.getSpaceGroup() xsDataSpaceGroupExpected = xsDataCrystalExpected.getSpaceGroup() strSpacegroupNameObtained = xsDataSpaceGroupObtained.getName().getValue() strSpacegroupNameExpected = xsDataSpaceGroupExpected.getName().getValue() EDAssert.equal(strSpacegroupNameExpected, strSpacegroupNameObtained)
def testGenerateXSDataIndexingResult(self): strFilename = "XSDataMOSFLMOutputIndexing_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString(strXMLMOSFLMOutputIndexing) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutputIndexing) strReferenceFilename = "XSDataIndexingResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsdataIndexingResultReference = XSDataIndexingResult.parseString(strXMLIndexingOutputReference) EDAssert.equal(xsdataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
def testGenerateXSDataIndexingResult(self): """ This method tests the generation of an XSDataIndexingResult object given an XSDataResultLabelit object. """ strPath = os.path.join(self.strDataPath, self.strReferenceOutputFile) strXMLResultLabelit = EDUtilsTest.readAndParseFile(strPath) EDFactoryPluginStatic.loadModule("XSDataLabelitv10") from XSDataLabelitv10 import XSDataResultLabelit xsDataResultLabelit = XSDataResultLabelit.parseString(strXMLResultLabelit) from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10 xsDataIndexingResult = EDHandlerXSDataLabelitv10.generateXSDataIndexingResult(xsDataResultLabelit) strReferencePath = os.path.join(self.strDataPath, "XSDataIndexingResult_reference.xml") strIndexingResultReferenceXML = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsDataIndexingResultReference = XSDataIndexingResult.parseString(strIndexingResultReferenceXML) EDAssert.equal(xsDataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
def testExecute(self): self.run() # Checks that there are no error messages plugin = self.getPlugin() # Checks the expected result strExpectedOutput = self.readAndParseFile( self.strReferenceDataOutputFile) # Check that all the paths in the prediction results actaully exists from XSDataMXv1 import XSDataIndexingResult xsDataIndexingResultObtained = plugin.getDataOutput() xsDataIndexingResultExpected = XSDataIndexingResult.parseString( strExpectedOutput) xsDataGeneratePredictionResult = xsDataIndexingResultObtained.getPredictionResult( ) for predictionImage in xsDataGeneratePredictionResult.getPredictionImage( ): strImagePath = predictionImage.getPath().getValue() bImageExists = os.path.exists(strImagePath) EDAssert.equal(True, bImageExists) # Check that we found the right space group xsDataIndexingSolutionSelectedObtained = xsDataIndexingResultObtained.getSelectedSolution( ) xsDataIndexingSolutionSelectedExpected = xsDataIndexingResultExpected.getSelectedSolution( ) xsDataCrystalObtained = xsDataIndexingSolutionSelectedObtained.getCrystal( ) xsDataCrystalExpected = xsDataIndexingSolutionSelectedExpected.getCrystal( ) xsDataSpaceGroupObtained = xsDataCrystalObtained.getSpaceGroup() xsDataSpaceGroupExpected = xsDataCrystalExpected.getSpaceGroup() strSpacegroupNameObtained = xsDataSpaceGroupObtained.getName( ).getValue() strSpacegroupNameExpected = xsDataSpaceGroupExpected.getName( ).getValue() EDAssert.equal(strSpacegroupNameExpected, strSpacegroupNameObtained)
def testGenerateXSDataIndexingResult(self): strFilename = "XSDataMOSFLMOutputIndexing_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString( strXMLMOSFLMOutputIndexing) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult( xsDataMOSFLMOutputIndexing) strReferenceFilename = "XSDataIndexingResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile( strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsdataIndexingResultReference = XSDataIndexingResult.parseString( strXMLIndexingOutputReference) EDAssert.equal(xsdataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())