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

add an upper and lower threshold based on +/- abs(thresh) in refine.py

parent 5d6b5a0f
No related branches found
No related tags found
1 merge request!98Draft: WIP Positive/negative standard deviation refinement
This commit is part of merge request !98. Comments created here will be created in the context of that merge request.
......@@ -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")
......
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