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
fd7d8ceb
Commit
fd7d8ceb
authored
3 years ago
by
Eva Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
warn the user if they ask for a scatter or hex plot and have too much data for that to be practical
parent
310e43ea
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyglance/glance/figures.py
+20
-0
20 additions, 0 deletions
pyglance/glance/figures.py
pyglance/glance/gui_controller.py
+4
-4
4 additions, 4 deletions
pyglance/glance/gui_controller.py
pyglance/glance/gui_figuremanager.py
+39
-14
39 additions, 14 deletions
pyglance/glance/gui_figuremanager.py
with
63 additions
and
18 deletions
pyglance/glance/figures.py
+
20
−
0
View file @
fd7d8ceb
...
...
@@ -224,6 +224,15 @@ def _plot_tag_data_mapped(plotting_axes, input_c_projection, tagData, x, y, addE
return
numMismatchPoints
def
check_data_amount_for_scatter_plot
(
num_data_points
,)
:
"""
Is the given amount too much data for a scatter plot?
return True if this is an ok amount and False if we won
'
t make a scatter plot with this much data
"""
return
True
if
num_data_points
<
MAX_SCATTER_PLOT_DATA
else
False
# build a scatter plot of the x,y points
def
create_scatter_plot
(
dataX
,
dataY
,
title_str
,
xLabel
,
yLabel
,
badMask
=
None
,
epsilon
=
None
,
units_x
=
None
,
units_y
=
None
)
:
"""
...
...
@@ -247,6 +256,7 @@ def create_scatter_plot(dataX, dataY, title_str, xLabel, yLabel, badMask=None, e
units_x
=
units_x
,
units_y
=
units_y
)
else
:
LOG
.
warn
(
"
Too much data present to allow creation of scatter plot for
\"
"
+
title_str
+
"
\"
. Plot will not be created.
"
)
fff
return
to_return
...
...
@@ -411,6 +421,16 @@ def create_density_scatter_plot(dataX, dataY,
return
figure_obj
def
check_data_amount_for_hex_plot
(
num_data_points
,
):
"""
Is the given amount too much data for a hex plot?
return True if this is an ok amount and False if we won
'
t make a hex plot with this much data
"""
return
True
if
num_data_points
<
MAX_HEX_PLOT_DATA
else
False
# build a hexbin plot of the x,y points and show the density of the point distribution
def
create_hexbin_plot
(
dataX
,
dataY
,
title_str
,
xLabel
,
yLabel
,
epsilon
=
None
,
units_x
=
None
,
units_y
=
None
)
:
...
...
This diff is collapsed.
Click to expand it.
pyglance/glance/gui_controller.py
+
4
−
4
View file @
fd7d8ceb
...
...
@@ -7,7 +7,7 @@ Created by evas Oct 2011.
Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
"""
import
sys
,
logging
,
traceback
import
sys
,
logging
from
PyQt5.QtWidgets
import
QApplication
...
...
@@ -19,6 +19,7 @@ import glance.gui_figuremanager as gui_figs
from
glance.gui_constants
import
A_CONST
,
B_CONST
from
glance.data
import
IncompatableDataObjects
from
glance.io
import
IONonnumericalTypeError
from
glance.gui_figuremanager
import
TooMuchDataForPlot
LOG
=
logging
.
getLogger
(
__name__
)
...
...
@@ -258,9 +259,8 @@ class GlanceGUIController (object) :
try
:
self
.
figs
.
spawnPlot
()
except
(
IncompatableDataObjects
,
ValueError
)
as
idove
:
self
.
handleWarning
(
str
(
idove
))
#raise
except
(
IncompatableDataObjects
,
ValueError
,
TooMuchDataForPlot
,)
as
error
:
self
.
handleWarning
(
str
(
error
))
################# end of methods to handle user input reporting #################
...
...
This diff is collapsed.
Click to expand it.
pyglance/glance/gui_figuremanager.py
+
39
−
14
View file @
fd7d8ceb
...
...
@@ -80,6 +80,23 @@ NEEDED_DATA_PER_PLOT = \
HEX_PLOT
:
{
A_CONST
,
B_CONST
,},
}
class
TooMuchDataForPlot
(
Exception
):
"""
An exception to be used when there
'
s too much data to practically provide a plot when requested
"""
def
__init__
(
self
,
dataSize
):
"""
create this exception, giving a message based on the file path
"""
self
.
message
=
str
(
"
Unable to create requested plot. The data size of
"
+
str
(
dataSize
)
+
"
was too large for the requested plot type.
"
)
def
__str__
(
self
):
return
self
.
message
class
GlanceGUIFigures
(
object
)
:
"""
This class handles creating figures for the glance gui.
...
...
@@ -583,13 +600,17 @@ class GlanceGUIFigures (object) :
if
imageType
==
SCATTER
:
cleanMismatchMask
=
diffData
.
diff_data_object
.
masks
.
mismatch_mask
[
tempCleanMask
]
tempFigure
=
figures
.
create_scatter_plot
(
aDataClean
,
bDataClean
,
"
Value in File A vs Value in File B
"
,
"
File A Value for
"
+
aVarName
,
"
File B Value for
"
+
bVarName
,
badMask
=
cleanMismatchMask
,
epsilon
=
self
.
dataModel
.
getEpsilon
(),
units_x
=
aUnitsText
,
units_y
=
bUnitsText
)
if
figures
.
check_data_amount_for_scatter_plot
(
aDataClean
.
size
)
:
tempFigure
=
figures
.
create_scatter_plot
(
aDataClean
,
bDataClean
,
"
Value in File A vs Value in File B
"
,
"
File A Value for
"
+
aVarName
,
"
File B Value for
"
+
bVarName
,
badMask
=
cleanMismatchMask
,
epsilon
=
self
.
dataModel
.
getEpsilon
(),
units_x
=
aUnitsText
,
units_y
=
bUnitsText
)
else
:
# this is too much data to make a scatter plot, warn the user
raise
TooMuchDataForPlot
(
aDataClean
.
size
)
elif
imageType
==
D_SCATTER
:
...
...
@@ -601,13 +622,17 @@ class GlanceGUIFigures (object) :
units_x
=
aUnitsText
,
units_y
=
bUnitsText
)
else
:
tempFigure
=
figures
.
create_hexbin_plot
(
aDataClean
,
bDataClean
,
"
Value in File A vs Value in File B
"
,
"
File A Value for
"
+
aVarName
,
"
File B Value for
"
+
bVarName
,
epsilon
=
self
.
dataModel
.
getEpsilon
(),
units_x
=
aUnitsText
,
units_y
=
bUnitsText
)
if
figures
.
check_data_amount_for_hex_plot
(
aDataClean
.
size
)
:
tempFigure
=
figures
.
create_hexbin_plot
(
aDataClean
,
bDataClean
,
"
Value in File A vs Value in File B
"
,
"
File A Value for
"
+
aVarName
,
"
File B Value for
"
+
bVarName
,
epsilon
=
self
.
dataModel
.
getEpsilon
(),
units_x
=
aUnitsText
,
units_y
=
bUnitsText
)
else
:
# this is too much data to make a hex plot, warn the user
raise
TooMuchDataForPlot
(
aDataClean
.
size
)
plt
.
draw
()
...
...
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