def getOutputDataFromDNATableFile(self, _strFileName): """ """ xsDataBestOutput = XSDataBestOutput() strDnaTablesXML = self.readProcessFile(_strFileName) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) # Loop through all the tables and fill in the relevant parts of xsDataBestOutput # SubWedges xsTablesCollectionStrategy = EDUtilsTable.getTableListFromTables(xsDataDnaTables, "data_collection_strategy") for xsTableCollectionStrategy in xsTablesCollectionStrategy: xsDataBestCollectionPlan = XSDataBestCollectionPlan() xsCollectionRunList = EDUtilsTable.getListsFromTable(xsTableCollectionStrategy, "collection_run") for xsCollectionRunItemList in xsCollectionRunList: xsDataCollectionRun = self.collectionRunItemListToCollectionRun(xsCollectionRunItemList) xsDataBestCollectionPlan.addCollectionRun(xsDataCollectionRun) # Strategy Summary xsStrategySummaryItemList = EDUtilsTable.getListsFromTable(xsTableCollectionStrategy, "summary") xsDataStrategySummary = self.strategySummaryItemListToStrategySummary(xsStrategySummaryItemList[0]) # Ranking Resolution # Not part of strategySummaryItemListToStrategySummary method since it is in the general_form part xsTableGeneralInform = EDUtilsTable.getTableFromTables(xsDataDnaTables, "general_inform") xsRankingResolutionItemList = EDUtilsTable.getListsFromTable(xsTableGeneralInform, "ranking_resolution") xsItemRankingResolution = EDUtilsTable.getItemFromList(xsRankingResolutionItemList[0], "dmin") fRankingResolution = float(xsItemRankingResolution.getValueOf_()) xsDataStrategySummary.setRankingResolution(XSDataFloat(fRankingResolution)) xsDataBestCollectionPlan.setStrategySummary(xsDataStrategySummary) # Satistics xsTablesStatisticalPrediction = EDUtilsTable.getTableListFromTables(xsDataDnaTables, "statistical_prediction") for xsTableStatisticalPrediction in xsTablesStatisticalPrediction: if(xsTableStatisticalPrediction.getIndex() == xsTableCollectionStrategy.getIndex()): xsResolutionBinList = EDUtilsTable.getListsFromTable(xsTableStatisticalPrediction, "resolution_bin") xsDataStatisticalPrediction = XSDataBestStatisticalPrediction() for xsResolutionBinItemList in xsResolutionBinList: xsDataResolutionBin = self.resolutionBinItemListToResolutionBin(xsResolutionBinItemList) xsDataStatisticalPrediction.addResolutionBin(xsDataResolutionBin) xsDataBestCollectionPlan.setStatisticalPrediction(xsDataStatisticalPrediction) xsDataBestOutput.addCollectionPlan(xsDataBestCollectionPlan) return xsDataBestOutput
def testExecute(self): self.run() edPlugin = self.getPlugin() strBestVersion = self.getPlugin().getStringVersion() if strBestVersion.find("3.1.0") != -1: self.setReferenceDataOutputFile( os.path.join(self.getPluginTestsDataHome(), "XSDataBestv10Output_reference.xml")) elif strBestVersion.find("3.2.0") != -1: self.setReferenceDataOutputFile( os.path.join(self.getPluginTestsDataHome(), "XSDataBestv10Output_reference_BESTv320.xml")) # Checks the expected result strExpectedOutput = self.readAndParseFile( self.getReferenceDataOutputFile()) from XSDataBestv10 import XSDataBestOutput xsDataOutputExpected = XSDataBestOutput.parseString(strExpectedOutput) xsDataOutputObtained = edPlugin.getDataOutput() EDAssert.equal(xsDataOutputExpected.marshal(), xsDataOutputObtained.marshal())
def testExecute(self): self.run() edPlugin = self.getPlugin() strBestVersion = self.getPlugin().getStringVersion() if strBestVersion.find("3.1.0") != -1: self.setReferenceDataOutputFile( os.path.join(self.getPluginTestsDataHome(), "XSDataBestv10Output_reference.xml") ) elif strBestVersion.find("3.2.0") != -1: self.setReferenceDataOutputFile( os.path.join(self.getPluginTestsDataHome(), "XSDataBestv10Output_reference_BESTv320.xml") ) # Checks the expected result strExpectedOutput = self.readAndParseFile(self.getReferenceDataOutputFile()) from XSDataBestv10 import XSDataBestOutput xsDataOutputExpected = XSDataBestOutput.parseString(strExpectedOutput) xsDataOutputObtained = edPlugin.getDataOutput() EDAssert.equal(xsDataOutputExpected.marshal(), xsDataOutputObtained.marshal())
def getOutputDataFromDNATableFile(self, _strFileName): """ """ xsDataBestOutput = XSDataBestOutput() strDnaTablesXML = self.readProcessFile(_strFileName) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) # Loop through all the tables and fill in the relevant parts of xsDataBestOutput # SubWedges xsTablesCollectionStrategy = EDUtilsTable.getTableListFromTables( xsDataDnaTables, "data_collection_strategy") for xsTableCollectionStrategy in xsTablesCollectionStrategy: xsDataBestCollectionPlan = XSDataBestCollectionPlan() xsCollectionRunList = EDUtilsTable.getListsFromTable( xsTableCollectionStrategy, "collection_run") for xsCollectionRunItemList in xsCollectionRunList: xsDataCollectionRun = self.collectionRunItemListToCollectionRun( xsCollectionRunItemList) xsDataBestCollectionPlan.addCollectionRun(xsDataCollectionRun) # Strategy Summary xsStrategySummaryItemList = EDUtilsTable.getListsFromTable( xsTableCollectionStrategy, "summary") xsDataStrategySummary = self.strategySummaryItemListToStrategySummary( xsStrategySummaryItemList[0]) # Ranking Resolution # Not part of strategySummaryItemListToStrategySummary method since it is in the general_form part xsTableGeneralInform = EDUtilsTable.getTableFromTables( xsDataDnaTables, "general_inform") xsRankingResolutionItemList = EDUtilsTable.getListsFromTable( xsTableGeneralInform, "ranking_resolution") xsItemRankingResolution = EDUtilsTable.getItemFromList( xsRankingResolutionItemList[0], "dmin") fRankingResolution = float(xsItemRankingResolution.getValueOf_()) xsDataStrategySummary.setRankingResolution( XSDataFloat(fRankingResolution)) xsDataBestCollectionPlan.setStrategySummary(xsDataStrategySummary) # Satistics xsTablesStatisticalPrediction = EDUtilsTable.getTableListFromTables( xsDataDnaTables, "statistical_prediction") for xsTableStatisticalPrediction in xsTablesStatisticalPrediction: if (xsTableStatisticalPrediction.getIndex() == xsTableCollectionStrategy.getIndex()): xsResolutionBinList = EDUtilsTable.getListsFromTable( xsTableStatisticalPrediction, "resolution_bin") xsDataStatisticalPrediction = XSDataBestStatisticalPrediction( ) for xsResolutionBinItemList in xsResolutionBinList: xsDataResolutionBin = self.resolutionBinItemListToResolutionBin( xsResolutionBinItemList) xsDataStatisticalPrediction.addResolutionBin( xsDataResolutionBin) xsDataBestCollectionPlan.setStatisticalPrediction( xsDataStatisticalPrediction) xsDataBestOutput.addCollectionPlan(xsDataBestCollectionPlan) return xsDataBestOutput