def testExecute(self): self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) # strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile) EDVerbose.DEBUG("Checking obtained result...") xsDataResultReference = XSDataResultSaxsAddv1_0.parseString( strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") outputData = openimage( xsDataResultObtained.getOutputImage().getPath().getValue()).data referenceData = openimage( os.path.join(self.getTestsDataImagesHome(), "bsa_014_07.msk")).data EDAssert.arraySimilar(outputData, referenceData, _fAbsMaxDelta=0.8, _fScaledMaxDelta=0.05, _fRfactor=5, _fRelMaxDelta=1.5, _strComment="Images are the same")
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) EDVerbose.DEBUG("EDPluginExecSaxsAddv1_0.postProcess") # Create some output data xsDataResult = XSDataResultSaxsAddv1_0() if self.outputImage is None: self.outputImage = "output.edf" if os.path.isfile(self.outputImage): xsdFile = XSDataImage() xsdFile.setPath(XSDataString(os.path.abspath(self.outputImage))) xsDataResult.setOutputImage(xsdFile) self.setDataOutput(xsDataResult)
def testExecute(self): self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) # strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile) EDVerbose.DEBUG("Checking obtained result...") xsDataResultReference = XSDataResultSaxsAddv1_0.parseString(strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") outputData = openimage(xsDataResultObtained.getOutputImage().getPath().getValue()).data referenceData = openimage(os.path.join(self.getTestsDataImagesHome(), "bsa_014_07.msk")).data EDAssert.arraySimilar(outputData, referenceData , _fAbsMaxDelta=0.8, _fScaledMaxDelta=0.05, _fRfactor=5, _fRelMaxDelta=1.5 , _strComment="Images are the same")
def preProcess(self): """ PreProcess of the execution test: download a set of images from http://www.edna-site.org and remove any existing output file """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage(["bsa_014_07.edf", "bsa_014_07.msk", "Pcon_01Apr_msk.edf"]) strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput) xsDataResultReference = XSDataResultSaxsAddv1_0.parseString(strExpectedOutput) self.refOutput = xsDataResultReference.getOutputImage().getPath().getValue() EDVerbose.DEBUG(" Output file is %s" % self.refOutput) if not os.path.isdir(os.path.dirname(self.refOutput)): os.makedirs(os.path.dirname(self.refOutput)) if os.path.isfile(self.refOutput): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.refOutput) os.remove(self.refOutput)
def preProcess(self): """ PreProcess of the execution test: download a set of images from http://www.edna-site.org and remove any existing output file """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage( ["bsa_014_07.edf", "bsa_014_07.msk", "Pcon_01Apr_msk.edf"]) strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput) xsDataResultReference = XSDataResultSaxsAddv1_0.parseString( strExpectedOutput) self.refOutput = xsDataResultReference.getOutputImage().getPath( ).getValue() EDVerbose.DEBUG(" Output file is %s" % self.refOutput) if not os.path.isdir(os.path.dirname(self.refOutput)): os.makedirs(os.path.dirname(self.refOutput)) if os.path.isfile(self.refOutput): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.refOutput) os.remove(self.refOutput)