Compare commits

..

No commits in common. "3c6ea1ffd0e3fa6ce8adfc75cb2c001844ed958d" and "f41f24f6266de5b59870fb740d8162322a779a25" have entirely different histories.

2 changed files with 18 additions and 20 deletions

View File

@ -400,7 +400,7 @@ class SurveillanceBot(object):
st = self.data.get(get_full_seed_id(nwst_id)) st = self.data.get(get_full_seed_id(nwst_id))
if st: if st:
# TODO: this section failed once, adding try-except block for analysis and to prevent program from crashing # TODO: this section failed once, adding try-except block for analysis and to prevent program from crashing
try: #try:
endtime = UTCDateTime() endtime = UTCDateTime()
starttime = endtime - self.parameters.get('timespan') * 24 * 3600 starttime = endtime - self.parameters.get('timespan') * 24 * 3600
st = modify_stream_for_plot(st, parameters=self.parameters) st = modify_stream_for_plot(st, parameters=self.parameters)
@ -410,9 +410,9 @@ class SurveillanceBot(object):
set_axis_yticks(fig, self.parameters) set_axis_yticks(fig, self.parameters)
set_axis_color(fig) set_axis_color(fig)
plot_axis_thresholds(fig, self.parameters) plot_axis_thresholds(fig, self.parameters)
except Exception as e: # except Exception as e:
logging.error(f'Could not generate plot for {nwst_id}: {e}') # logging.error(f'Could not generate plot for {nwst_id}: {e}')
logging.error(traceback.format_exc()) # logging.debug(traceback.format_exc())
if len(fig.axes) > 0: if len(fig.axes) > 0:
ax = fig.axes[0] ax = fig.axes[0]
ax.set_title(f'Plot refreshed at (UTC) {UTCDateTime.now().strftime("%Y-%m-%d %H:%M:%S")}. ' ax.set_title(f'Plot refreshed at (UTC) {UTCDateTime.now().strftime("%Y-%m-%d %H:%M:%S")}. '

View File

@ -187,15 +187,13 @@ def set_axis_ylabels(fig, parameters):
ax.set_ylabel(channel_name) ax.set_ylabel(channel_name)
def set_axis_color(fig, color='0.8', shade_color='0.95'): def set_axis_color(fig, color='0.8'):
""" """
Set all axes (frame) of figure to specific color. Shade every second axis. Set all axes of figure to specific color
""" """
for i, ax in enumerate(fig.axes): for ax in fig.axes:
for key in ['bottom', 'top', 'right', 'left']: for key in ['bottom', 'top', 'right', 'left']:
ax.spines[key].set_color(color) ax.spines[key].set_color(color)
if i % 2:
ax.set_facecolor(shade_color)
def set_axis_yticks(fig, parameters): def set_axis_yticks(fig, parameters):
@ -260,7 +258,7 @@ def get_warn_states_pbox(soh_key: str, parameters: dict) -> list:
return [key for key in pb_dict.keys() if key > 1] return [key for key in pb_dict.keys() if key > 1]
def annotate_voltage_states(ax, parameters, pb_key, color='0.75'): def annotate_voltage_states(ax, parameters, pb_key):
for voltage, voltage_dict in parameters.get('POWBOX').get(pb_key).items(): for voltage, voltage_dict in parameters.get('POWBOX').get(pb_key).items():
if float(voltage) < 1: if float(voltage) < 1:
continue continue
@ -271,5 +269,5 @@ def annotate_voltage_states(ax, parameters, pb_key, color='0.75'):
out_string += ' | ' out_string += ' | '
out_string += f'{key}: {val}' out_string += f'{key}: {val}'
ax.annotate(out_string, (ax.get_xlim()[-1], voltage), color=color, fontsize='xx-small', ax.annotate(out_string, (ax.get_xlim()[-1], voltage), color='0.8', fontsize='xx-small',
horizontalalignment='right') horizontalalignment='right')