コード例 #1
0
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()
################################################################################
# Compare XSDataResults
################################################################################
        strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertFile.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), _strComment="XSDataResult output are the same")

################################################################################
# Check that  outputData * inputData - Id = 0
################################################################################
        outputData = openimage(self.outputFile).data
        size = outputData.shape[0]
        inputData = openimage(self.inputFile).data
        EDAssert.arraySimilar(numpy.matrix(outputData) * numpy.matrix(inputData), numpy.identity(size), _fAbsMaxDelta=2e-4, _strComment="output x input = Id ")


################################################################################
# Compare image Files
################################################################################
        referenceData = openimage(os.path.join(self.getTestsDataImagesHome(), os.path.basename(self.outputFile))).data
        EDAssert.arraySimilar(referenceData, outputData, _fAbsMaxDelta=1e-5, _strComment="images are the same")
コード例 #2
0
    def preProcess(self):
        """
        PreProcess of the execution test: download a set of images  from http://www.edna-site.org
        and delete any output file
        """
        EDTestCasePluginExecute.preProcess(self)

        xsDataInput = XSDataInputMatrixInvertFile.parseString(self.readAndParseFile(self.getDataInputFile()))
        self.inputFile = xsDataInput.getInputMatrixFile().getPath().getValue()

        self.xsDataResultReference = XSDataResultMatrixInvertFile.parseString(self.readAndParseFile(self.getReferenceDataOutputFile()))
        self.outputFile = self.xsDataResultReference.getOutputMatrixFile().getPath().getValue()

        self.loadTestImage([os.path.basename(self.inputFile), os.path.basename(self.outputFile) ])

        if not os.path.isdir(os.path.dirname(self.outputFile)):
            os.makedirs(os.path.dirname(self.outputFile))
        if os.path.isfile(self.outputFile):
            EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.outputFile)
            os.remove(self.outputFile)
コード例 #3
0
    def preProcess(self):
        """
        PreProcess of the execution test: download a set of images  from http://www.edna-site.org
        and delete any output file
        """
        EDTestCasePluginExecute.preProcess(self)

        xsDataInput = XSDataInputMatrixInvertFile.parseString(self.readAndParseFile(self.getDataInputFile()))
        self.inputFile = xsDataInput.getInputMatrixFile().getPath().getValue()

        self.xsDataResultReference = XSDataResultMatrixInvertFile.parseString(
            self.readAndParseFile(self.getReferenceDataOutputFile())
        )
        self.outputFile = self.xsDataResultReference.getOutputMatrixFile().getPath().getValue()

        self.loadTestImage([os.path.basename(self.inputFile), os.path.basename(self.outputFile)])

        if not os.path.isdir(os.path.dirname(self.outputFile)):
            os.makedirs(os.path.dirname(self.outputFile))
        if os.path.isfile(self.outputFile):
            EDVerbose.DEBUG(" Output file exists %s, I will remove it" % self.outputFile)
            os.remove(self.outputFile)
コード例 #4
0
    def testExecute(self):
        """
        """
        self.run()
        plugin = self.getPlugin()
        ################################################################################
        # Compare XSDataResults
        ################################################################################
        strExpectedOutput = self.readAndParseFile(self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertFile.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(
            xsDataResultReference.marshal(),
            xsDataResultObtained.marshal(),
            _strComment="XSDataResult output are the same",
        )

        ################################################################################
        # Check that  outputData * inputData - Id = 0
        ################################################################################
        outputData = openimage(self.outputFile).data
        size = outputData.shape[0]
        inputData = openimage(self.inputFile).data
        EDAssert.arraySimilar(
            numpy.matrix(outputData) * numpy.matrix(inputData),
            numpy.identity(size),
            _fAbsMaxDelta=2e-4,
            _strComment="output x input = Id ",
        )

        ################################################################################
        # Compare image Files
        ################################################################################
        referenceData = openimage(os.path.join(self.getTestsDataImagesHome(), os.path.basename(self.outputFile))).data
        EDAssert.arraySimilar(referenceData, outputData, _fAbsMaxDelta=1e-5, _strComment="images are the same")