Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
UW-Glance
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eva Schiffer
UW-Glance
Commits
347a6ef8
Commit
347a6ef8
authored
3 years ago
by
Eva Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
three column stats on gui comparisons
parent
0ccdb786
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyglance/glance/gui_statsprovider.py
+10
-5
10 additions, 5 deletions
pyglance/glance/gui_statsprovider.py
pyglance/glance/report.py
+2
-44
2 additions, 44 deletions
pyglance/glance/report.py
pyglance/glance/stats.py
+43
-0
43 additions, 0 deletions
pyglance/glance/stats.py
with
55 additions
and
49 deletions
pyglance/glance/gui_statsprovider.py
+
10
−
5
View file @
347a6ef8
...
@@ -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__
,
"
.
"
)])
...
...
This diff is collapsed.
Click to expand it.
pyglance/glance/report.py
+
2
−
44
View file @
347a6ef8
...
@@ -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
=
{
...
...
This diff is collapsed.
Click to expand it.
pyglance/glance/stats.py
+
43
−
0
View file @
347a6ef8
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment