Skip to content
Snippets Groups Projects
Commit 37baa732 authored by Coda Phillips's avatar Coda Phillips
Browse files

Update outlier plotting

parent ed3937f5
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ def qc_day(qc_path): ...@@ -31,6 +31,7 @@ def qc_day(qc_path):
frame = cxs.combine_first(get_all_housekeeping(sum_path)) frame = cxs.combine_first(get_all_housekeeping(sum_path))
qc_frame = get_qc_frame(qc_path) qc_frame = get_qc_frame(qc_path)
frame = frame.combine_first(qc_frame) frame = frame.combine_first(qc_frame)
frame = frame.query('missingDataFlag == 0')
qc_frame_sum = qc_frame.sum(axis=0).to_string() qc_frame_sum = qc_frame.sum(axis=0).to_string()
...@@ -59,19 +60,19 @@ def plot_variable_qc(frame, loc, filename=None): ...@@ -59,19 +60,19 @@ def plot_variable_qc(frame, loc, filename=None):
if qc_loc not in frame.columns: if qc_loc not in frame.columns:
print('{qc_loc} not in frame'.format(qc_loc=qc_loc)) print('{qc_loc} not in frame'.format(qc_loc=qc_loc))
return return
if sum(frame[qc_loc]) > 0: if frame[qc_loc].sum() > 0:
fig = plt.figure(figsize=(50,5)) fig = plt.figure(figsize=(10,5))
plot_outliers(frame, frame[qc_loc] == 0, loc) plot_outliers(frame, frame[qc_loc], loc)
if filename is not None: if filename is not None:
save_plot(filename) save_plot(filename)
else: else:
return mpld3.fig_to_html(fig) return mpld3.fig_to_html(fig)
def plot_outliers(frame, qc_mask, loc): def plot_outliers(frame, qc_mask, loc):
if (~qc_mask).any(): if (~np.isnan(qc_mask) & qc_mask > 0).any():
frame.ix[qc_mask & (frame['qc_percent'] == 0), loc].plot(style='b.') frame.ix[(np.isnan(qc_mask) | (qc_mask == 0)) & (frame['qc_percent'] == 0), loc].plot(style='b.')
frame.ix[qc_mask & (frame['qc_percent'] > 0), loc].plot(style='k.', alpha=.2) frame.ix[(np.isnan(qc_mask) | (qc_mask == 0)) & (frame['qc_percent'] > 0), loc].plot(style='k.', alpha=.2)
frame.ix[~qc_mask, loc].plot(style='r.') frame.ix[~np.isnan(qc_mask) & (qc_mask > 0) & (frame['qc_percent'] > 0), loc].plot(style='r.')
plt.xlabel('Time') plt.xlabel('Time')
plt.title(loc) plt.title(loc)
......
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