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

Merge branch 'gui-inspect' into 'master'

GUI "Display Statistics" works on single variable

See merge request !3
parents a037e671 60d3f35d
No related branches found
No related tags found
1 merge request!3GUI "Display Statistics" works on single variable
...@@ -60,8 +60,8 @@ class GlanceGUIStats (object) : ...@@ -60,8 +60,8 @@ class GlanceGUIStats (object) :
def sendStatsInfo (self) : def sendStatsInfo (self) :
""" """
our data listeners should be sent statistics information for a comparison our data listeners should be sent statistics information
of the currently selected variables (if possible) for the currently selected variable or variables (if possible)
may raise an IncompatableDataObjects exception if it is impossible to compare the given data may raise an IncompatableDataObjects exception if it is impossible to compare the given data
""" """
...@@ -73,7 +73,23 @@ class GlanceGUIStats (object) : ...@@ -73,7 +73,23 @@ class GlanceGUIStats (object) :
# get Data objects # get Data objects
aDataObject = self.dataModel.getVariableData(A_CONST, aVarName) aDataObject = self.dataModel.getVariableData(A_CONST, aVarName)
bDataObject = self.dataModel.getVariableData(B_CONST, bVarName) bDataObject = self.dataModel.getVariableData(B_CONST, bVarName)
if aDataObject is None and bDataObject is not None:
aDataObject, bDataObject = bDataObject, aDataObject
if aDataObject is not None and bDataObject is None:
return self.sendStatsInfoSingle(aVarName, aDataObject)
return self.sendStatsInfoPair(aVarName, bVarName, aDataObject, bDataObject)
def sendStatsInfoPair(self, aVarName, bVarName, aDataObject, bDataObject):
"""
send data listeners statistics information
for the currently selected variables
may raise an IncompatableDataObjects exception if it is impossible to compare the given data
"""
# check the minimum validity of our data; this call can raise an IncompatableDataObjects exception # check the minimum validity of our data; this call can raise an IncompatableDataObjects exception
dataobjects.DiffInfoObject.verifyDataCompatability(aDataObject, bDataObject, aVarName, bVarName) dataobjects.DiffInfoObject.verifyDataCompatability(aDataObject, bDataObject, aVarName, bVarName)
...@@ -97,6 +113,31 @@ class GlanceGUIStats (object) : ...@@ -97,6 +113,31 @@ class GlanceGUIStats (object) :
# tell my listeners to show the stats data we've collected # tell my listeners to show the stats data we've collected
for listener in self.statsListeners : for listener in self.statsListeners :
listener.displayStatsData(aVarName, bVarName, renderedText) listener.displayStatsData(aVarName, bVarName, renderedText)
def sendStatsInfoSingle(self, aVarName, aDataObject):
"""
send data listeners statistics information
for the currently selected variable
"""
LOG.info ("Constructing statistics for one variable")
# do the statistical analysis and collect the data that will be needed to render it nicely
tempAnalysis = stats.StatisticalInspectionAnalysis.withDataObjects(aDataObject)
# TODO, these constants should be moved into the gui_constants
tempInfo = { 'variable_name': aVarName }
kwargs = { 'runInfo': tempInfo,
'statGroups': tempAnalysis.dictionary_form() }
# use a mako template to render an html verion of the stats for display
templateLookup = TemplateLookup(directories=[resource_filename(__name__, ".")])
guiTemplate = Template(resource_string(__name__, "guistatsreport.txt"), lookup=templateLookup)
renderedText = guiTemplate.render(**kwargs)
# tell my listeners to show the stats data we've collected
for listener in self.statsListeners :
listener.displayStatsData(aVarName, None, renderedText)
def sendRawData (self, fileID) : def sendRawData (self, fileID) :
""" """
......
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