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 = XSDataResultSaxsMacv1_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(), "moke.edf")).data
        EDAssert.arraySimilar(outputData,
                              referenceData,
                              _fAbsMaxDelta=0.8,
                              _fScaledMaxDelta=0.05,
                              _fRfactor=5,
                              _fRelMaxDelta=1.5,
                              _strComment="Images are the same")
Пример #2
0
    def postProcess(self, _edObject=None):
        EDPluginExecProcessScript.postProcess(self)
        EDVerbose.DEBUG("EDPluginExecSaxsMacv1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultSaxsMacv1_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 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([ "Moke-2th%02i-tilt0-rot0.edf" % i for i in range(4, 13)] + ["moke.edf"])
     strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput)
     xsDataResultReference = XSDataResultSaxsMacv1_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 testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()

        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
#        strObtainedOutput = self.readAndParseFile (self.m_edObtainedOutputDataFile)
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultSaxsMacv1_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(), "moke.edf")).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(
         ["Moke-2th%02i-tilt0-rot0.edf" % i
          for i in range(4, 13)] + ["moke.edf"])
     strExpectedOutput = self.readAndParseFile(
         self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("strExpectedOutput:" + strExpectedOutput)
     xsDataResultReference = XSDataResultSaxsMacv1_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)