Skip to content
Snippets Groups Projects
Commit e296f75d authored by Jameson Rollins's avatar Jameson Rollins
Browse files

Merge branch 'refine_fix' into 'master'

Only refine time if new lockloss time is before ISC_LOCK lockloss

Closes #109 and #168

See merge request jameson.rollins/locklost!105
parents 8f3ea65f acc219f7
No related branches found
No related tags found
No related merge requests found
......@@ -141,12 +141,14 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
fig.savefig(outpath)
def find_transition(channel, segment, std_threshold, minimum=None):
def find_transition(channel, segment, std_threshold, max_time, minimum=None):
"""Find transition in channel
`segment` is the time segment to search, `std_threshold` is the % std
from mean defining the transition threshold, `minimum` is an optional
minimum value that the channel will be checked against.
from mean defining the transition threshold, `max_time` is the event.gps
lockloss gps time from the GRD state transition used as a maximum
refined time, `minimum` is an optional minimum value that the channel
will be checked against.
returns `threshold`, `refined_gps` tuple
......@@ -176,9 +178,9 @@ def find_transition(channel, segment, std_threshold, minimum=None):
else:
if std_threshold > 0:
inds = np.where(buf.data > threshold)[0]
inds = np.where((buf.data > threshold) & (buf.tarray < max_time))[0]
else:
inds = np.where(buf.data < threshold)[0]
inds = np.where((buf.data < threshold) & (buf.tarray < max_time))[0]
if inds.any():
ind = np.min(inds)
......@@ -211,6 +213,7 @@ def refine_time(event):
[params['CHANNEL'],],
segment,
params['THRESHOLD'],
event.gps,
params['MINIMUM'],
)
......
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