diff --git a/locklost/plugins/refine.py b/locklost/plugins/refine.py index ca9359d1014a3e16a4ce6440ebbe942a0e81b92c..313a7383d7ca987664e7f90d6448fa1c38b52b6f 100644 --- a/locklost/plugins/refine.py +++ b/locklost/plugins/refine.py @@ -65,14 +65,20 @@ def plot_indicators(event, channel, refined_gps, threshold): linestyle='--', linewidth=2, ) + if y_ind[0] < threshold: + xyoffset = (8, 10) + valign = 'bottom' + else: + xyoffset = (8, -10) + valign = 'top' ax1.annotate( "threshold", - xy=(ax1.get_xlim()[-1], threshold), + xy=(ax1.get_xlim()[0], threshold), xycoords='data', - xytext=(-8, -10), + xytext=xyoffset, textcoords='offset points', - horizontalalignment='right', - verticalalignment='top', + horizontalalignment='left', + verticalalignment=valign, bbox=dict( boxstyle="round", fc="w", ec="green", alpha=0.95), ) @@ -193,8 +199,10 @@ def find_transition(channel, segment, std_threshold, minimum=None): else: logging.info("no threshold crossings, unable to resolve time") - # add a threshold for graphs if no crossing found - threshold = lower_threshold if threshold is None else threshold + # add a threshold to be diplayed on graphs if refinement failed + if threshold is None: + threshold = lower_threshold + return threshold, refined_gps