示例#1
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 = XSDataInputMatrixInvertv2.parseString(
            self.readAndParseFile(self.getDataInputFile()))
        self.inputFile = xsDataInput.getInputMatrix().getPath().getValue()

        self.xsDataResultReference = XSDataResultMatrixInvertv2.parseString(
            self.readAndParseFile(self.getReferenceDataOutputFile()))
        self.outputFile = self.xsDataResultReference.getOutputMatrix().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)
    def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()
################################################################################
# Compare XSDataResults
################################################################################
        strExpectedOutput = self.readAndParseFile(self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertv2.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), _fStrSimilar=0.99, _strComment="XSDataResult output are the same")
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     self.DEBUG("EDPluginExecMatrixInvertv2_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultMatrixInvertv2()
     xsd = XSDataImageExt()
     if self.dataInput.outputMatrix is not None:
         if self.dataInput.outputMatrix.path is not None:
             fabio.edfimage.edfimage(data=self.matOut).write(self.dataInput.outputMatrix.path.value)
             xsd.path = self.dataInput.outputMatrix.path
         elif self.dataInput.outputMatrix.shared is not None:
             EDShare[self.dataInput.outputMatrix.shared.value] = self.matOut
             xsd.shared = self.dataInput.outputMatrix.shared
     else:
         xsd.array = EDUtilsArray.arrayToXSData(self.matOut, _bIncludeMd5sum=False)
     xsDataResult.setOutputMatrix(xsd)
     self.setDataOutput(xsDataResult)
示例#4
0
    def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()
        ################################################################################
        # Compare XSDataResults
        ################################################################################
        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertv2.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                _fStrSimilar=0.99,
                                _strComment="XSDataResult output are the same")
    def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()
        ################################################################################
        # Compare XSDataResults
        ################################################################################
        strExpectedOutput = self.readAndParseFile(self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertv2.parseString(strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(
            xsDataResultReference.marshal(),
            xsDataResultObtained.marshal(),
            _fStrSimilar=0.99,
            _strComment="XSDataResult output are the same",
        )
        output = fabio.open(self.outputFile).data
        ref = fabio.open(os.path.join(self.getTestsDataImagesHome(), "inverted.edf")).data
        EDAssert.arraySimilar(output, ref, "arrays are the same", 1e-4)
    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 = XSDataInputMatrixInvertv2.parseString(self.readAndParseFile(self.getDataInputFile()))
        self.inputFile = xsDataInput.getInputMatrix().getPath().getValue()

        self.xsDataResultReference = XSDataResultMatrixInvertv2.parseString(
            self.readAndParseFile(self.getReferenceDataOutputFile())
        )
        self.outputFile = self.xsDataResultReference.getOutputMatrix().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)
示例#7
0
    def testExecute(self):
        """
        """
        self.run()

        plugin = self.getPlugin()
        ################################################################################
        # Compare XSDataResults
        ################################################################################
        strExpectedOutput = self.readAndParseFile(
            self.getReferenceDataOutputFile())
        EDVerbose.DEBUG("Checking obtained result...")
        xsDataResultReference = XSDataResultMatrixInvertv2.parseString(
            strExpectedOutput)
        xsDataResultObtained = plugin.getDataOutput()
        EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                                xsDataResultObtained.marshal(),
                                _fStrSimilar=0.99,
                                _strComment="XSDataResult output are the same")
        output = fabio.open(self.outputFile).data
        ref = fabio.open(
            os.path.join(self.getTestsDataImagesHome(), "inverted.edf")).data
        EDAssert.arraySimilar(output, ref, "arrays are the same", 1e-4)