Skip to content
Snippets Groups Projects
Commit df15b0dc authored by Camilla Compton's avatar Camilla Compton
Browse files

add logic to decide side of threshold annotation and clarify 'if threshold is None'

parent 36ae78a7
No related branches found
No related tags found
1 merge request!98Draft: WIP Positive/negative standard deviation refinement
......@@ -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
......
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