Skip to content
Snippets Groups Projects

Draft: WIP Positive/negative standard deviation refinement

Open Camilla Compton requested to merge camilla.compton/locklost:pos_neg_std into master
1 unresolved thread
1 file
+ 8
6
Compare changes
  • Side-by-side
  • Inline
@@ -9,7 +9,7 @@ from .. import data
##################################################
def plot_indicators(event, params, refined_gps=None, threshold=None):
def plot_indicators(event, channel, std_threshold, refined_gps=None, threshold=None):
"""Create graphs showing indicators of refined time.
"""
@@ -18,7 +18,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
channels = [
config.GRD_STATE_N_CHANNEL,
params['CHANNEL'],
channel,
]
window = config.REFINE_PLOT_WINDOWS['WIDE']
segment = Segment(*window).shift(t0)
@@ -43,7 +43,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
# plot indicator
color = 'blue'
label = params['CHANNEL']
label = channel
# filter data based on window
condition = np.logical_and(t0+window[0] <= t_ind, t_ind <= t0+window[1])
idx = np.argwhere(condition)
@@ -52,7 +52,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
ax1.plot(t-t0, y, label=label,
color=color, alpha=0.8, linewidth=2)
ax1.grid(True)
ax1.set_ylabel(params['CHANNEL'])
ax1.set_ylabel(channel)
ax1.yaxis.label.set_color(color)
ax1.set_xlabel('Time [s] since {}'.format(t0))
@@ -65,7 +65,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
linestyle='--',
linewidth=2,
)
if params['THRESHOLD'] > 0:
if std_threshold > 0: # should check as this will change if + or - std taken - REMOVE COMMENT
xyoffset = (8, 10)
valign = 'bottom'
else:
@@ -160,6 +160,7 @@ def find_transition(channel, segment, std_threshold, minimum=None):
"""
refined_gps = None
threshold = None
buf = data.fetch(channel, segment)[0]
# calculate mean and std using first 5 seconds of window
@@ -245,7 +246,8 @@ def refine_time(event):
logging.info("plotting indicators...")
plot_indicators(
event,
params,
params['CHANNEL'],
params['THRESHOLD'],
refined_gps=refined_gps,
threshold=threshold,
)
Loading