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
+ 5
6
Compare changes
  • Side-by-side
  • Inline
@@ -75,7 +75,8 @@ def refine_calculate(event, params, window, refined_gps=None, threshold=None):
logging.info("locked mean/stddev: {}/{}".format(lock_mean, lock_stdd))
# lock loss threshold is when moves past % threshold of std
threshold = lock_stdd * params['THRESHOLD'] + lock_mean
upper_threshold = lock_stdd * abs(params['THRESHOLD']) + lock_mean
lower_threshold = lock_stdd * -abs(params['THRESHOLD']) + lock_mean
""" I dont think this part is useful and may confuse pos/neg check and is
already sorted out below at no threshold crossings, unable to resolve time"
@@ -84,7 +85,6 @@ def refine_calculate(event, params, window, refined_gps=None, threshold=None):
else:
threshold = max(threshold, min(buf.data))
"""
logging.info("threshold: {}".format(threshold))
# if the mean is less than the nominal full lock value then abort,
# as this isn't a clean lock
@@ -92,14 +92,13 @@ def refine_calculate(event, params, window, refined_gps=None, threshold=None):
logging.info("channel mean below minimum, unable to resolve time")
else:
if params['THRESHOLD'] > 0:
inds = np.where(buf.data > threshold)[0]
else:
inds = np.where(buf.data < threshold)[0]
inds_above = np.where(buf.data > threshold_upper)[0]
inds_below = np.where(buf.data < threshold_lower)[0]
if inds.any():
ind = np.min(inds)
refined_gps = buf.tarray[ind]
logging.info("threshold: {}".format(threshold))
logging.info("refined time: {}".format(refined_gps))
else:
logging.info("no threshold crossings, unable to resolve time")
Loading