Skip to content
Snippets Groups Projects
Commit 347a6ef8 authored by Eva Schiffer's avatar Eva Schiffer
Browse files

three column stats on gui comparisons

parent 0ccdb786
No related branches found
No related tags found
No related merge requests found
...@@ -101,10 +101,12 @@ class GlanceGUIStats (object) : ...@@ -101,10 +101,12 @@ class GlanceGUIStats (object) :
epsilon=self.dataModel.getEpsilon(), epsilon=self.dataModel.getEpsilon(),
epsilon_percent=self.dataModel.getEpsilonPercent()) epsilon_percent=self.dataModel.getEpsilonPercent())
# package up the data for the report # package up the data for the report
tempInfo = { constants.VARIABLE_TECH_NAME_KEY: aVarName, tempStatsDict = tempAnalysis.dictionary_form()
constants.VARIABLE_B_TECH_NAME_KEY: bVarName } tempInfo = { constants.VARIABLE_TECH_NAME_KEY: aVarName,
kwargs = { constants.RUN_INFO_DICT_KEY: tempInfo, constants.VARIABLE_B_TECH_NAME_KEY: bVarName }
constants.STATS_INFO_DICT_KEY: tempAnalysis.dictionary_form() } kwargs = { constants.RUN_INFO_DICT_KEY: tempInfo,
constants.STATS_INFO_DICT_KEY: tempStatsDict,
constants.GROUPED_STATS_INFO_DICT_KEY: stats.group_stats_by_file(tempStatsDict), }
# use a mako template to render an html verion of the stats for display # use a mako template to render an html verion of the stats for display
templateLookup = TemplateLookup(directories=[resource_filename(__name__, ".")]) templateLookup = TemplateLookup(directories=[resource_filename(__name__, ".")])
...@@ -125,9 +127,12 @@ class GlanceGUIStats (object) : ...@@ -125,9 +127,12 @@ class GlanceGUIStats (object) :
# do the statistical analysis and collect the data that will be needed to render it nicely # do the statistical analysis and collect the data that will be needed to render it nicely
tempAnalysis = stats.StatisticalInspectionAnalysis.withDataObjects(dataObject) tempAnalysis = stats.StatisticalInspectionAnalysis.withDataObjects(dataObject)
# package up the data for the report # package up the data for the report
tempStatsDict = tempAnalysis.dictionary_form()
tempInfo = { constants.VARIABLE_TECH_NAME_KEY: varName } tempInfo = { constants.VARIABLE_TECH_NAME_KEY: varName }
kwargs = { constants.RUN_INFO_DICT_KEY: tempInfo, kwargs = { constants.RUN_INFO_DICT_KEY: tempInfo,
constants.STATS_INFO_DICT_KEY: tempAnalysis.dictionary_form() } constants.STATS_INFO_DICT_KEY: tempStatsDict,
#constants.GROUPED_STATS_INFO_DICT_KEY: stats.group_stats_by_file(tempStatsDict), # FUTURE, we may want to do this some day, but it looks awful now
}
# use a mako template to render an html verion of the stats for display # use a mako template to render an html verion of the stats for display
templateLookup = TemplateLookup(directories=[resource_filename(__name__, ".")]) templateLookup = TemplateLookup(directories=[resource_filename(__name__, ".")])
......
...@@ -18,6 +18,7 @@ import shutil as shutil ...@@ -18,6 +18,7 @@ import shutil as shutil
import locale import locale
from glance.constants import * from glance.constants import *
import glance.stats as stats
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
...@@ -212,49 +213,6 @@ def generate_and_save_doc_page(definitions, outputPath) : ...@@ -212,49 +213,6 @@ def generate_and_save_doc_page(definitions, outputPath) :
return return
def group_stats_by_file(statGroups):
""" Group statistics by file
Where there are pairs of statistics in the form *_[ab] or [ab]_*, group
them together. So given
{ 'General Statistics': {
'min_a': -1,
'min_b': -10
'epsilon': 3
}
}
returns
{ 'General Statistics': {
'min': { 'a': -1. b: -10 },
'epsilon': { 'both':3 }
}
}
"""
def id_file(varname):
if varname[1] == "_":
return (varname[2:], varname[0])
if varname[-2] == "_":
return (varname[:-2], varname[-1])
return (varname, "both")
ret = {}
for groupname, group in statGroups.items():
ret[groupname] = {}
for var, val in group.items():
justvar, file = id_file(var)
#sys.stderr.write("{0} -> {1} {2}\n".format(var, justvar, file))
if justvar not in ret[groupname]:
ret[groupname][justvar] = { 'a':'', 'b':'', 'both':''}
ret[groupname][justvar][file] = val
return ret
def generate_and_save_concise_report(outputPath, reportFileName, def generate_and_save_concise_report(outputPath, reportFileName,
summaryInfo,): summaryInfo,):
""" """
...@@ -460,7 +418,7 @@ def generate_and_save_variable_report(files, ...@@ -460,7 +418,7 @@ def generate_and_save_variable_report(files,
runInfo = generalRunInfo.copy() runInfo = generalRunInfo.copy()
runInfo.update(variableRunInfo) runInfo.update(variableRunInfo)
groupedStats = group_stats_by_file(statGroups) groupedStats = stats.group_stats_by_file(statGroups)
# put all the info together in the kwargs # put all the info together in the kwargs
kwargs = { kwargs = {
......
...@@ -1112,6 +1112,49 @@ def get_comparison_doc_string ( ) : ...@@ -1112,6 +1112,49 @@ def get_comparison_doc_string ( ) :
def get_inspection_doc_string ( ) : def get_inspection_doc_string ( ) :
return '\n'.join( '%s:\n %s' % x for x in sorted(list(StatisticalInspectionAnalysis.doc_strings().items())) ) + '\n' return '\n'.join( '%s:\n %s' % x for x in sorted(list(StatisticalInspectionAnalysis.doc_strings().items())) ) + '\n'
def group_stats_by_file(statGroups):
""" Group statistics by file
Where there are pairs of statistics in the form *_[ab] or [ab]_*, group
them together. So given
{ 'General Statistics': {
'min_a': -1,
'min_b': -10
'epsilon': 3
}
}
returns
{ 'General Statistics': {
'min': { 'a': -1. b: -10 },
'epsilon': { 'both':3 }
}
}
"""
def id_file(varname):
if varname[1] == "_":
return (varname[2:], varname[0])
if varname[-2] == "_":
return (varname[:-2], varname[-1])
return (varname, "both")
ret = {}
for groupname, group in statGroups.items():
ret[groupname] = {}
for var, val in group.items():
justvar, file = id_file(var)
#sys.stderr.write("{0} -> {1} {2}\n".format(var, justvar, file))
if justvar not in ret[groupname]:
ret[groupname][justvar] = { 'a':'', 'b':'', 'both':''}
ret[groupname][justvar][file] = val
return ret
if __name__=='__main__': if __name__=='__main__':
import doctest import doctest
doctest.testmod() doctest.testmod()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment