-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lot of progress today. General polish, colors on visualization, bug f…
…ixes, added missing values test.
- Loading branch information
1 parent
72c37ae
commit 0d8092c
Showing
14 changed files
with
146 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,63 @@ | ||
from bokeh.plotting import figure, output_file, show, save | ||
from bokeh.embed import components | ||
from bokeh.models import BoxAnnotation | ||
from bokeh.palettes import Category20 | ||
from Backend.Classes.Flagging import * | ||
|
||
class VisBuilder(): | ||
def __init__(self): | ||
# FlagMgr = Flag('../SessionFiles/Flagging_Config.json') | ||
self.FlagMgr = Flag() | ||
pass | ||
|
||
def rmvMissingValues(self, y, flags=None): | ||
for i, val in enumerate(y): | ||
if val == -9999.0: | ||
if flags[i] == self.FlagMgr.returnFlag('Missing Value Test'): | ||
y[i] = float('nan') | ||
|
||
return y | ||
|
||
|
||
def BuildLineChart(self, x, y, flags=None): | ||
# build color palette | ||
flagCodes = self.FlagMgr.returnAllFlagsAsArr() | ||
colorMap = Category20[len(flagCodes)] | ||
|
||
# remove missing values | ||
y = self.rmvMissingValues(y) | ||
if flags is not None: | ||
y = self.rmvMissingValues(y, flags) | ||
|
||
p = figure(title="Line", x_axis_type='datetime', plot_width=700, plot_height=400) | ||
p.line(x=x, y=y) | ||
|
||
i = 0 | ||
|
||
print("gets here?") | ||
|
||
while i < len(x)-1: | ||
if 'OK' in flags[i]: | ||
i += 1 | ||
|
||
else: | ||
badrng_st = x[i] | ||
st = i | ||
|
||
while i < len(x)-2 and 'OK' not in flags[i]: | ||
while i < len(x)-2 and self.FlagMgr.returnGoodFlag() not in flags[i]: | ||
i += 1 | ||
|
||
badrng_end = x[i] | ||
end = i | ||
|
||
|
||
if (end - st) <= 1: | ||
badrng_st = x[st-1] | ||
badrng_end = x[end+1] | ||
|
||
color = None | ||
for c, flag in enumerate(flagCodes): | ||
print(flag['code'], flags[st], flush=True) | ||
if flag['code'] == flags[st]: | ||
color = colorMap[c] | ||
break | ||
|
||
i += 1 | ||
|
||
print(color, flush=True) | ||
|
||
badbox = BoxAnnotation(left=badrng_st, right=badrng_end, fill_alpha=0.4, fill_color='red') | ||
badbox = BoxAnnotation(left=badrng_st, right=badrng_end, fill_alpha=0.4, fill_color=color) | ||
p.add_layout(badbox) | ||
|
||
return components(p) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.