def testExecute(self): """ """ self.run() plugin = self.getPlugin() EDVerbose.DEBUG("Checking obtained result...") strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() # EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal()) # EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal()) EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") # Checking obtained results xsDataResultsSPDCake = plugin.getDataOutput() strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue() strPathToChiReference = os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_0.chi") Xref, Yref = readChiPlot(strPathToChiReference) Xobt, Yobt = readChiPlot(strPathToChiOutput) EDVerbose.DEBUG("Output File: %s, Reference file: %s" % (strPathToChiOutput, strPathToChiReference)) bigX = Xref + Xobt bigX.sort() bigYobt = numpy.interp(bigX, Xobt, Yobt) bigYref = numpy.interp(bigX, Xref, Yref) EDVerbose.DEBUG("ref.shape= %s, obt.shape=%s" % (bigYobt.shape, bigYref.shape)) EDVerbose.DEBUG("Type of object ref= %s, obt=%s" % (bigYobt.__class__, bigYref.__class__)) EDAssert.arraySimilar(bigYobt, bigYref, _fAbsMaxDelta=0.1, _fScaledMaxDelta=0.1, _strComment="Comparing ChiPlot files")
def testExecute(self): """ """ self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString( strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() # EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal()) # EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal()) EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") # Checking obtained results xsDataResultsSPDCake = plugin.getDataOutput() strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath( ).getValue() strDataObtained = EDUtilsFile.readFile(strPathToChiOutput) strDataReference = EDUtilsFile.readFile( os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_1.cif")) EDAssert.strAlmostEqual(strDataReference, strDataObtained, "Comparing PowderCIF output", _fAbsError=2e-3)
def preProcess(self): """ """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage([ "diff6105.edf", "darks0001.edf", "flats0001.edf", "EDPluginSPDCakev1_0.cif" ]) strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput) outputFileName = xsDataResultReference.getCakedFile().getPath().getValue() EDVerbose.DEBUG(" Output file is %s" % outputFileName) if not os.path.isdir(os.path.dirname(outputFileName)): os.makedirs(os.path.dirname(outputFileName)) if os.path.isfile(outputFileName): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % outputFileName) os.remove(outputFileName)
def testExecute(self): """ """ self.run() plugin = self.getPlugin() # # Checking obtained results xsDataResultsSPDCake = plugin.getDataOutput() pathToOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue() # edStringDataObtained = EDUtilsFile.readFile(pathToOutput) # edStringDataReference = EDUtilsFile.readFile(os.path.join(self.getPluginTestsDataHome(), \ # "EDPluginSPDCakev1_1.chi")) # EDAssert.strAlmostEqual(edStringDataReference, edStringDataObtained, "Comparing ChiPlot files") EDVerbose.DEBUG("Checking obtained result...") strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString( strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") # Checking obtained results xsDataResultsSPDCake = plugin.getDataOutput() strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath( ).getValue() strPathToChiReference = os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_1.chi") Xref, Yref = readChiPlot(strPathToChiReference) Xobt, Yobt = readChiPlot(strPathToChiOutput) EDVerbose.DEBUG("Output File: %s, Reference file: %s" % (strPathToChiOutput, strPathToChiReference)) bigX = Xref + Xobt bigX.sort() bigYobt = numpy.interp(bigX, Xobt, Yobt) bigYref = numpy.interp(bigX, Xref, Yref) EDVerbose.DEBUG("ref.shape= %s, obt.shape=%s" % (bigYobt.shape, bigYref.shape)) EDVerbose.DEBUG("Type of object ref= %s, obt=%s" % (bigYobt.__class__, bigYref.__class__)) EDAssert.arraySimilar(bigYobt, bigYref, _fAbsMaxDelta=0.1, _fScaledMaxDelta=0.1, _strComment="Comparing ChiPlot files")
def testExecute(self): """ """ self.run() plugin = self.getPlugin() strExpectedOutput = self.readAndParseFile (self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString(strExpectedOutput) xsDataResultObtained = plugin.getDataOutput() # EDVerbose.DEBUG("Reference XML:%s" + xsDataResultReference.marshal()) # EDVerbose.DEBUG("Obtained XML:%s" + xsDataResultObtained.marshal()) EDAssert.strAlmostEqual(xsDataResultReference.marshal(), xsDataResultObtained.marshal(), "XSDataResult output are the same") # Checking obtained results xsDataResultsSPDCake = plugin.getDataOutput() strPathToChiOutput = xsDataResultsSPDCake.getCakedFile().getPath().getValue() strDataObtained = EDUtilsFile.readFile(strPathToChiOutput) strDataReference = EDUtilsFile.readFile(os.path.join(self.getTestsDataImagesHome(), "EDPluginSPDCakev1_0.cif")) EDAssert.strAlmostEqual(strDataReference, strDataObtained, "Comparing PowderCIF output")
def preProcess(self): """ """ EDTestCasePluginExecute.preProcess(self) self.loadTestImage([ "diff6105.edf", "darks0001.edf", "flats0001.edf", "EDPluginSPDCakev1_1.chi" ]) strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) xsDataResultReference = XSDataResultSPDCake.parseString( strExpectedOutput) outputFileName = xsDataResultReference.getCakedFile().getPath( ).getValue() EDVerbose.DEBUG(" Output file is %s" % outputFileName) if not os.path.isdir(os.path.dirname(outputFileName)): os.makedirs(os.path.dirname(outputFileName)) if os.path.isfile(outputFileName): EDVerbose.DEBUG(" Output file exists %s, I will remove it" % outputFileName) os.remove(outputFileName)