From 26e4fef9af8ea6eb28c73caa43f0a03952bc324c Mon Sep 17 00:00:00 2001 From: Camilla Compton <camilla.compton@ligo.org> Date: Wed, 20 May 2020 10:50:24 -0700 Subject: [PATCH] add threshold for graphs if refinment fails and edit annotate location --- locklost/plugins/refine.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/locklost/plugins/refine.py b/locklost/plugins/refine.py index 9cf2565c..abc377b1 100644 --- a/locklost/plugins/refine.py +++ b/locklost/plugins/refine.py @@ -67,11 +67,11 @@ def plot_indicators(event, channel, refined_gps, threshold): ) ax1.annotate( "threshold", - xy=(ax1.get_xlim()[0], threshold), + xy=(ax1.get_xlim()[-1], threshold), xycoords='data', - xytext=(8, -15), + xytext=(8, -10), textcoords='offset points', - horizontalalignment='left', + horizontalalignment='right', verticalalignment='top', bbox=dict( boxstyle="round", fc="w", ec="green", alpha=0.95), @@ -153,8 +153,8 @@ def find_transition(channel, segment, std_threshold, minimum=None): returns `threshold`, `refined_gps` tuple """ - refined_gps = None threshold = None + refined_gps = None buf = data.fetch(channel, segment)[0] # calculate mean and std using first 5 seconds of window @@ -191,9 +191,10 @@ def find_transition(channel, segment, std_threshold, minimum=None): logging.info("threshold: {}".format(threshold)) logging.info("refined time: {}".format(refined_gps)) else: - threshold = lower_threshold # to be shown on graphs 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 return threshold, refined_gps -- GitLab