def functionXMLout(_strXMLin, _strXMLout): """ This is an example of XMLout function ... it prints only the name of the file created @param _srXMLin: The XML string used to launch the job @type _strXMLin: python string with the input XML @param _strXMLout: The XML string retrieved job @type _strXMLout: python string with the output XML @return: None """ xsDataInputInterface = XSDataInputInterface.parseString(_strXMLin) strImagePath = xsDataInputInterface.getImagePath()[0].getPath().getValue() EDVerbose.screen("Successful processing of image %s" % strImagePath) strResultText = os.path.dirname(strImagePath) + " " + os.path.basename(strImagePath) + " " xsDataResultInterface = XSDataResultInterface.parseString(_strXMLout) xsDataResultCharacterisation = xsDataResultInterface.getResultCharacterisation() # xsDataIndexingResult = xsDataResultCharacterisation.getIndexingResult() #strResultText = _strDirectoryVisit + " " + strFileName + " " if (xsDataIndexingResult is None): strResultText += "Indexing failed" else: xsDataSelectedSolution = xsDataIndexingResult.getSelectedSolution() fMosaicityEstimation = xsDataSelectedSolution.getCrystal().getMosaicity().getValue() strResultText += "Mosaicity: %.2f " % fMosaicityEstimation xsDataStrategyResult = xsDataResultCharacterisation.getStrategyResult() if (xsDataStrategyResult is None): strResultText += "No strategy result" else: xsDataCollectionPlan = xsDataStrategyResult.getCollectionPlan()[0] xsDataStrategySummary = xsDataCollectionPlan.getStrategySummary() fRankingResolution = xsDataStrategySummary.getRankingResolution().getValue() strResultText += "Resolution: %.2f" % fRankingResolution writeToResultFile(strResultText)
def functionXMLerror(_strXMLin): """ @param _strXMLin: The XML string used to launch the job @type _strXMLin: python string with the input XML @return: None """ xsDataInputInterface = XSDataInputInterface.parseString(_strXMLin) strImagePath = xsDataInputInterface.getImagePath()[0].getPath().getValue() strResultText = os.path.dirname(strImagePath) + " " + os.path.basename(strImagePath) + " " strResultText = strResultText + "Processing failed." writeToResultFile(strResultText) return None
def testExecute(self): """ Runs the plugin and marshals the obtained XML file into an XSDataInputInterface object """ self.run() edPlugin = self.getPlugin() xsDataOutputObtained = edPlugin.getDataOutput() strXMLFile = xsDataOutputObtained.getPath().getValue() strObtainedOutput = self.readAndParseFile(strXMLFile) xsDataInputInterfaceObtained = XSDataInputInterface.parseString(strObtainedOutput) EDVerbose.DEBUG("Checking obtained result...") EDVerbose.DEBUG("Found class of type: %s" % xsDataInputInterfaceObtained.__class__.__name__) # Just quickly check that we have an actual XSDataInputInterface object EDAssert.equal(xsDataInputInterfaceObtained.__class__.__name__ == "XSDataInputInterface", True)
def testExecute(self): """ Runs the plugin and marshals the obtained XML file into an XSDataInputInterface object """ self.run() edPlugin = self.getPlugin() xsDataOutputObtained = edPlugin.getDataOutput() strXMLFile = xsDataOutputObtained.getPath().getValue() strObtainedOutput = self.readAndParseFile(strXMLFile) xsDataInputInterfaceObtained = XSDataInputInterface.parseString( strObtainedOutput) self.DEBUG("Checking obtained result...") self.DEBUG("Found class of type: %s" % xsDataInputInterfaceObtained.__class__.__name__) # Just quickly check that we have an actual XSDataInputInterface object EDAssert.equal( xsDataInputInterfaceObtained.__class__.__name__ == "XSDataInputInterface", True)