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

fix error: threshold to be returned by refine_channel

parent 9b328d1f
No related branches found
No related tags found
2 merge requests!98Draft: WIP Positive/negative standard deviation refinement,!97Split up refine_time into two functions so the calculation can be called separately
......@@ -13,8 +13,9 @@ from .. import data
def refine_time(event):
"""Refine lock loss event time
Save refined time to event, create tag and graphs
"""
gps = event.transition_gps
refined_gps = None
# find indicator channel to use based on guardian state
......@@ -24,7 +25,8 @@ def refine_time(event):
window = config.REFINE_WINDOW
refined_gps = refine_channel(
# find threshold and refined time using indicator channel
threshold, refined_gps = refine_channel(
event,
params,
window,
......@@ -48,12 +50,11 @@ def refine_time(event):
)
def refine_channel(event, params, window):
"""Refine lockloss event time using channel specified
def refine_channel(event, params, window, refined_gps=None, threshold=None):
"""Refine lockloss event time using channel specified
"""
gps = event.transition_gps
refined_gps = None
channels = [
params['CHANNEL'],
......@@ -92,13 +93,16 @@ def refine_channel(event, params, window):
ind = np.min(inds)
refined_gps = buf.tarray[ind]
logging.info("refined time: {}".format(refined_gps))
return refined_gps
else:
logging.info("no threshold crossings, unable to resolve time")
return threshold, refined_gps
def plot_indicators(event, params, refined_gps=None, threshold=None):
"""Create graphs showing indicators of refined time
"""
t0 = event.transition_gps
trans = event.transition_index
......
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