def createDataMOSFLMOutputGeneratePrediction(self): EDVerbose.DEBUG("EDPluginMOSFLMGeneratePredictionv10.createDataMOSFLMOutputIntegration") xsDataMOSFLMInputGeneratePrediction = self.getDataInput() xsDataMOSFLMImage = xsDataMOSFLMInputGeneratePrediction.getImage() iImageNumber = xsDataMOSFLMImage.getNumber().getValue() xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction() xsDataImage = XSDataImage() xsDataImage.setNumber(XSDataInteger(iImageNumber)) xsDataImage.setPath(XSDataString(os.path.join(self.getWorkingDirectory(), self.getPredictionImageFileName()))) xsDataMOSFLMOutputGeneratePrediction.setPredictionImage(xsDataImage) return xsDataMOSFLMOutputGeneratePrediction
def testExecute(self): self.run() # Checks the expected result strObtainedOutput = self.readAndParseFile(self.m_edObtainedOutputDataFile) from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction.parseString(strObtainedOutput) strImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage().getPath().getValue() bImageExists = os.path.exists(strImagePath) EDAssert.strAlmostEqual(True, bImageExists, "(Test if the image with prediction exists)")
def testExecute(self): self.run() # Checks the expected result strObtainedOutput = self.readAndParseFile( self.m_edObtainedOutputDataFile) from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction.parseString( strObtainedOutput) strImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage( ).getPath().getValue() bImageExists = os.path.exists(strImagePath) EDAssert.strAlmostEqual(True, bImageExists, "(Test if the image with prediction exists)")
def createDataMOSFLMOutputGeneratePrediction(self): self.DEBUG("EDPluginMOSFLMGeneratePredictionv10.createDataMOSFLMOutputIntegration") xsDataMOSFLMInputGeneratePrediction = self.getDataInput() xsDataMOSFLMImage = xsDataMOSFLMInputGeneratePrediction.getImage() iImageNumber = xsDataMOSFLMImage.getNumber().getValue() xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction() xsDataImage = XSDataImage() xsDataImage.setNumber(XSDataInteger(iImageNumber)) xsDataImage.setPath(XSDataString(os.path.join(self.getWorkingDirectory(), self.getPredictionImageFileName()))) xsDataMOSFLMOutputGeneratePrediction.setPredictionImage(xsDataImage) # Path to log file xsDataMOSFLMOutputGeneratePrediction.setPathToLogFile(XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())))) return xsDataMOSFLMOutputGeneratePrediction
def testCreateDataMOSFLMOutputGeneratePrediction(self): """ """ pluginGeneratePrediction = self.createPlugin() pluginGeneratePrediction.setScriptExecutable("cat") pluginGeneratePrediction.configure() pluginGeneratePrediction.setPredictionImageFileName("prediction.jpg") stringBaseName = pluginGeneratePrediction.getBaseName() stringNewmatFile = os.path.join( self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt") pluginGeneratePrediction.setNewmatFileName(stringNewmatFile) from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction.parseFile( os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMInputGeneratePrediction_reference.xml")) pluginGeneratePrediction.setDataInput( xsDataMOSFLMInputGeneratePrediction) xsDataMOSFLMOutputGeneratePrediction = pluginGeneratePrediction.createDataMOSFLMOutputGeneratePrediction( ) stringImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage( ).getPath().getValue() stringReferenceXML = self.readAndParseFile( self.strReferenceDataOutputFile) from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction xsDataMOSFLMOutputGeneratePredictionReference = XSDataMOSFLMOutputGeneratePrediction.parseString( stringReferenceXML) xsDataImage = xsDataMOSFLMOutputGeneratePredictionReference.getPredictionImage( ) xsDataImage.setPath(XSDataString(stringImagePath)) xsDataMOSFLMOutputGeneratePredictionReference.setPredictionImage( xsDataImage) # Replace path to log file since it cannot be determined by the unit test xsDataMOSFLMOutputGeneratePrediction.setPathToLogFile( XSDataFile(XSDataString("MOSFLMGeneratePredictionv10.log"))) EDAssert.equal(xsDataMOSFLMOutputGeneratePredictionReference.marshal(), xsDataMOSFLMOutputGeneratePrediction.marshal()) self.cleanUp(pluginGeneratePrediction)
def testCreateDataMOSFLMOutputGeneratePrediction(self): """ """ pluginGeneratePrediction = self.createPlugin() pluginGeneratePrediction.setScriptExecutable("cat") pluginGeneratePrediction.configure() pluginGeneratePrediction.setPredictionImageFileName("prediction.jpg") stringBaseName = pluginGeneratePrediction.getBaseName() stringNewmatFile = os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt") pluginGeneratePrediction.setNewmatFileName(stringNewmatFile) from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction.parseFile( os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMInputGeneratePrediction_reference.xml") ) pluginGeneratePrediction.setDataInput(xsDataMOSFLMInputGeneratePrediction) xsDataMOSFLMOutputGeneratePrediction = pluginGeneratePrediction.createDataMOSFLMOutputGeneratePrediction() stringImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage().getPath().getValue() stringReferenceXML = self.readAndParseFile(self.strReferenceDataOutputFile) from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction xsDataMOSFLMOutputGeneratePredictionReference = XSDataMOSFLMOutputGeneratePrediction.parseString( stringReferenceXML ) xsDataImage = xsDataMOSFLMOutputGeneratePredictionReference.getPredictionImage() xsDataImage.setPath(XSDataString(stringImagePath)) xsDataMOSFLMOutputGeneratePredictionReference.setPredictionImage(xsDataImage) # Replace path to log file since it cannot be determined by the unit test xsDataMOSFLMOutputGeneratePrediction.setPathToLogFile( XSDataFile(XSDataString("MOSFLMGeneratePredictionv10.log")) ) EDAssert.equal( xsDataMOSFLMOutputGeneratePredictionReference.marshal(), xsDataMOSFLMOutputGeneratePrediction.marshal() ) self.cleanUp(pluginGeneratePrediction)