Compare commits
	
		
			2 Commits
		
	
	
		
			f41f24f626
			...
			3c6ea1ffd0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3c6ea1ffd0 | |||
| fde000ec0d | 
@ -400,7 +400,7 @@ class SurveillanceBot(object):
 | 
			
		||||
        st = self.data.get(get_full_seed_id(nwst_id))
 | 
			
		||||
        if st:
 | 
			
		||||
            # TODO: this section failed once, adding try-except block for analysis and to prevent program from crashing
 | 
			
		||||
            #try:
 | 
			
		||||
            try:
 | 
			
		||||
                endtime = UTCDateTime()
 | 
			
		||||
                starttime = endtime - self.parameters.get('timespan') * 24 * 3600
 | 
			
		||||
                st = modify_stream_for_plot(st, parameters=self.parameters)
 | 
			
		||||
@ -410,9 +410,9 @@ class SurveillanceBot(object):
 | 
			
		||||
                set_axis_yticks(fig, self.parameters)
 | 
			
		||||
                set_axis_color(fig)
 | 
			
		||||
                plot_axis_thresholds(fig, self.parameters)
 | 
			
		||||
            # except Exception as e:
 | 
			
		||||
            #     logging.error(f'Could not generate plot for {nwst_id}: {e}')
 | 
			
		||||
            #     logging.debug(traceback.format_exc())
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                logging.error(f'Could not generate plot for {nwst_id}: {e}')
 | 
			
		||||
                logging.error(traceback.format_exc())
 | 
			
		||||
            if len(fig.axes) > 0:
 | 
			
		||||
                ax = fig.axes[0]
 | 
			
		||||
                ax.set_title(f'Plot refreshed at (UTC) {UTCDateTime.now().strftime("%Y-%m-%d %H:%M:%S")}. '
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								utils.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								utils.py
									
									
									
									
									
								
							@ -187,13 +187,15 @@ def set_axis_ylabels(fig, parameters):
 | 
			
		||||
            ax.set_ylabel(channel_name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def set_axis_color(fig, color='0.8'):
 | 
			
		||||
def set_axis_color(fig, color='0.8', shade_color='0.95'):
 | 
			
		||||
    """
 | 
			
		||||
    Set all axes of figure to specific color
 | 
			
		||||
    Set all axes (frame) of figure to specific color. Shade every second axis.
 | 
			
		||||
    """
 | 
			
		||||
    for ax in fig.axes:
 | 
			
		||||
    for i, ax in enumerate(fig.axes):
 | 
			
		||||
        for key in ['bottom', 'top', 'right', 'left']:
 | 
			
		||||
            ax.spines[key].set_color(color)
 | 
			
		||||
        if i % 2:
 | 
			
		||||
            ax.set_facecolor(shade_color)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def set_axis_yticks(fig, parameters):
 | 
			
		||||
@ -258,7 +260,7 @@ def get_warn_states_pbox(soh_key: str, parameters: dict) -> list:
 | 
			
		||||
    return [key for key in pb_dict.keys() if key > 1]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def annotate_voltage_states(ax, parameters, pb_key):
 | 
			
		||||
def annotate_voltage_states(ax, parameters, pb_key, color='0.75'):
 | 
			
		||||
    for voltage, voltage_dict in parameters.get('POWBOX').get(pb_key).items():
 | 
			
		||||
        if float(voltage) < 1:
 | 
			
		||||
            continue
 | 
			
		||||
@ -269,5 +271,5 @@ def annotate_voltage_states(ax, parameters, pb_key):
 | 
			
		||||
                    out_string += ' | '
 | 
			
		||||
                out_string += f'{key}: {val}'
 | 
			
		||||
 | 
			
		||||
        ax.annotate(out_string, (ax.get_xlim()[-1], voltage), color='0.8', fontsize='xx-small',
 | 
			
		||||
        ax.annotate(out_string, (ax.get_xlim()[-1], voltage), color=color, fontsize='xx-small',
 | 
			
		||||
                    horizontalalignment='right')
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user