Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eva Schiffer
UW-Glance
Commits
7f4765c8
Commit
7f4765c8
authored
Feb 14, 2022
by
Eva Schiffer
Browse files
restyling the main report page to show more informaiton in a clearer tabular format
parent
a3d6a8d0
Changes
6
Hide whitespace changes
Inline
Side-by-side
pyglance/glance/compare.py
View file @
7f4765c8
...
...
@@ -722,7 +722,8 @@ def report_one_input_library_call (a_path, var_list=None,
# hang on to some info on our variable
variableInspections
[
displayName
]
=
{
VARIABLE_RUN_INFO_KEY
:
varRunInfo
VARIABLE_RUN_INFO_KEY
:
varRunInfo
,
VAR_SHAPE_KEY
:
variable_stats
[
"General Statistics"
][
"shape"
],
}
LOG
.
info
(
'
\t
generating report for: '
+
explanationName
)
...
...
@@ -1090,15 +1091,18 @@ def report_two_inputs_library_call (a_path, b_path, var_list=None,
if
runInfo
[
DO_MAKE_REPORT_KEY
]
:
# hang on to our good % and other info to describe our comparison
tempVarStats
=
variable_stats
.
dictionary_form
()
epsilonPassedPercent
=
(
1.0
-
epsilon_failed_fraction
)
*
100.0
finitePassedPercent
=
(
1.0
-
non_finite_fail_fraction
)
*
100.0
variableComparisons
[
displayName
]
=
{
PASSED_EPSILON_PERCENT_KEY
:
epsilonPassedPercent
,
FINITE_SIMILAR_PERCENT_KEY
:
finitePassedPercent
,
R_SQUARED_COEFF_VALUE_KEY
:
r_squared_value
,
VARIABLE_RUN_INFO_KEY
:
varRunInfo
VARIABLE_RUN_INFO_KEY
:
varRunInfo
,
VAR_SHAPE_KEY
:
tempVarStats
[
"General Statistics"
]
[
"shape"
],
}
variableStatsCollection
[
displayName
]
=
variable_stats
.
dictionary_form
()
# TODO, also image names?
variableStatsCollection
[
displayName
]
=
tempVarStats
LOG
.
info
(
'
\t
generating report for: '
+
explanationName
)
reportModule
.
generate_and_save_variable_report
(
files
,
...
...
pyglance/glance/constants.py
View file @
7f4765c8
...
...
@@ -196,6 +196,7 @@ VARIABLE_RUN_INFO_KEY = 'variable_run_info'
PASSED_EPSILON_PERCENT_KEY
=
'pass_epsilon_percent'
FINITE_SIMILAR_PERCENT_KEY
=
'finite_similar_percent'
R_SQUARED_COEFF_VALUE_KEY
=
'r_squared_correlation'
VAR_SHAPE_KEY
=
'variable_data_shape'
# image types
...
...
pyglance/glance/report-base.txt
View file @
7f4765c8
...
...
@@ -28,7 +28,7 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
td, th { padding-left: 0.5em; padding-right: 0.5em; }
.testfail,.testpass {
display: inline-block;
border: 4px solid black;
##
border: 4px solid black;
text-align: center;
width: 1.15em;
max-width: 1.15em;
...
...
pyglance/glance/report-inspectmain.txt
View file @
7f4765c8
...
...
@@ -32,24 +32,34 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
<blockquote>
<p>
## TODO replace the table with floating boxes at some point
<table>
<table>
<tr>
<th>Variable Name</th>
<th>Data Shape</th>
</tr>
% for variableKey in sorted(list(variables)) :
<%
# get some information about the variable, for convenience
tempVariableInfo = variables[variableKey]
tempVarRunInfo = tempVariableInfo[constants.VARIABLE_RUN_INFO_KEY]
technicalName = tempVarRunInfo[constants.VARIABLE_TECH_NAME_KEY]
varDisplayName = technicalName
if constants.DISPLAY_NAME_KEY in tempVarRunInfo :
varDisplayName = tempVarRunInfo[constants.DISPLAY_NAME_KEY]
varDataShape = str(tempVariableInfo[constants.VAR_SHAPE_KEY])
%>
<tr>
<td>
## for spacing
<a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a> <br>
</td>
<td>
Variable: <a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a> <br>
% if varDataShape is not None and len(varDataShape) > 0 :
${varDataShape}
%else :
--
% endif
</td>
</tr>
% endfor
...
...
pyglance/glance/report-main.txt
View file @
7f4765c8
...
...
@@ -65,59 +65,158 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
% if len(variables) > 0 :
<h3>Compared Variables</h3>
<h3>Comparison Results</h3>
## if we did pass/fail testing, give a summary of how things passed or failed
<%
# figure out our counts
numVars = len(variables)
numPass = 0
numFail = 0
allDidPass = True
allNone = None
numEpsilon = 0
numEpPercent = 0
for varKey in variables :
tmpDidPass = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.DID_VARIABLE_PASS_KEY]
numPass += 1 if tmpDidPass is not None and tmpDidPass else 0
numFail += 1 if tmpDidPass is not None and not tmpDidPass else 0
allDidPass = allDidPass and tmpDidPass if tmpDidPass is not None else allDidPass
allNone = None if allNone is None and tmpDidPass is None else False
tempEpsilon = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.EPSILON_KEY]
tempEpsilonPer = variables[varKey][constants.VARIABLE_RUN_INFO_KEY][constants.EPSILON_PERCENT_KEY]
numEpsilon += 1 if tempEpsilon is not None else 0
numEpPercent += 1 if tempEpsilonPer is not None else 0
%>
## only show the summary info if we did any comparisons at all
% if allNone is not None :
<p>
<table>
<tr>
<td>
<big>${numPass} / ${numVars} variables passed comparsion.</big>
</td>
<td>
<big>Overall, these files
%if allDidPass :
passed comparison.</td> <td><div class="testpass">✔</div>
%else :
failed comparison.</td> <td><div class="testfail">✘</div>
% endif
</big>
</td>
</tr>
</table>
</p>
% endif
## report on all the variables that were compared and give a basic stat idea of how well they did
<blockquote>
<p>
## TODO replace the table with floating boxes at some point
<table>
<table>
<tr>
## header row: Variable Name / Data Shape / Epsilon / Epsilon Percent / R-squared Correlation Coeff. / % within Epsilon(*) / % Matching in Finiteness / Status
<th>Variable<br>Name</th>
<th>Data Shape</th>
% if numEpsilon >= 1 :
<th>Epsilon</th>
% endif
% if numEpPercent >= 1 :
<th>Epsilon<br>Percent</th>
% endif
<th>R-squared<br>Correlation Coeff.</th>
<th>% within<br>Epsilon<sup>†</sup></th>
<th>% Matching<br>in Finiteness</th>
## only include the status column if we did any comparisons
% if allNone is not None :
<th>Status</th>
% endif
</tr>
% for variableKey in sorted(list(variables)) :
<%
# get some information about the variable, for convenience
tempVariableInfo = variables[variableKey]
tempVarRunInfo = tempVariableInfo[constants.VARIABLE_RUN_INFO_KEY]
technicalName = tempVarRunInfo[constants.VARIABLE_TECH_NAME_KEY]
varDisplayName = technicalName
if constants.DISPLAY_NAME_KEY in tempVarRunInfo :
varDisplayName = tempVarRunInfo[constants.DISPLAY_NAME_KEY]
rSquaredCorr = tempVariableInfo[constants.R_SQUARED_COEFF_VALUE_KEY]
passPercent = tempVariableInfo[constants.PASSED_EPSILON_PERCENT_KEY]
finiteSimilarPercent = tempVariableInfo[constants.FINITE_SIMILAR_PERCENT_KEY]
didPass = tempVarRunInfo [constants.DID_VARIABLE_PASS_KEY]
varDataShape = str(tempVariableInfo[constants.VAR_SHAPE_KEY])
%>
<tr>
<td><a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a></td>
<td>
% if didPass is not None :
%if didPass :
<div class="testpass">✔</div>
% if varDataShape is not None and len(varDataShape) > 0 :
${varDataShape}
%else :
--
% endif
</td>
% if numEpsilon >= 1 :
<td class="n">
% if tempVarRunInfo[constants.EPSILON_KEY] is not None :
${tempVarRunInfo[constants.EPSILON_KEY]}
%else :
--
% endif
</td>
% endif
% if numEpPercent >= 1 :
<td class="n">
% if tempVarRunInfo[constants.EPSILON_PERCENT_KEY] is not None :
${tempVarRunInfo[constants.EPSILON_PERCENT_KEY]}
%else :
<div class="testfail">✘</div>
--
% endif
</td>
% endif
<td class="n">
% if rSquaredCorr is not None and str(rSquaredCorr) != "nan" :
${rSquaredCorr}
%else :
--
% endif
</td>
<td>
Variable: <a href="${tempVarRunInfo[constants.VAR_REPORT_PATH_KEY]}">${varDisplayName}</a> <br>
Epsilon used: ${tempVarRunInfo[constants.EPSILON_KEY]} <br>
## if there is an epsilon percent, also show that
% if (constants.EPSILON_PERCENT_KEY in tempVarRunInfo) and (tempVarRunInfo[constants.EPSILON_PERCENT_KEY] is not None) :
Epsilon percent (of file A) used: ${tempVarRunInfo[constants.EPSILON_PERCENT_KEY]}% <br>
<td class="n">
% if passPercent is not None :
${report.make_formatted_display_string(passPercent, '%.6g')}
%else :
--
% endif
## if there's an r squared correlation value, also show that
% if rSquaredCorr is not None :
R-squared Correlation Coefficient: ${rSquaredCorr}<br>
</td>
<td class="n">
% if finiteSimilarPercent is not None :
${report.make_formatted_display_string(finiteSimilarPercent, '%.6g')}
%else :
--
% endif
Finite values within one epsilon of difference:
${report.make_formatted_display_string(passPercent, '%.6g')}%<br>
Data that matched in finite-ness between the files:
${report.make_formatted_display_string(finiteSimilarPercent, '%.6g')}%
</td>
% if allNone is not None :
<td>
% if didPass is not None :
%if didPass :
<div class="testpass">✔</div>
%else :
<div class="testfail">✘</div>
% endif
% endif
</td>
% endif
</tr>
% endfor
</table>
<br><br>
<small>† where data is finite</small>
</p>
</blockquote>
% endif
...
...
pyglance/glance/stats.py
View file @
7f4765c8
...
...
@@ -1018,7 +1018,7 @@ class StatisticalAnalysis (StatisticalData) :
min_r_squared
=
min_acceptable_r_squared
if
(
min_acceptable_r_squared
is
not
np
.
nan
)
else
min_acceptable_r_squared_default
# did we fail based on the r-squared correlation coefficient?
r_squared_value
=
None
if
(
min_r_squared
is
None
)
else
self
.
comparison
.
r_squared_correlation
r_squared_value
=
self
.
comparison
.
r_squared_correlation
passed_r_squared
=
None
if
(
min_r_squared
is
None
)
else
(
r_squared_value
>=
min_r_squared
)
passValues
.
append
(
passed_r_squared
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment