Commit e018f966 authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

fix peak detection failures, improved time slicing

parent 1e0e750e
......@@ -119,13 +119,23 @@ def scan(
shift_tables.append(ifc.get_table(grid, receivers))
tshift_maxs.append(shift_tables[-1].max())
fsmooth_min = min(ifc.get_fsmooth() for ifc in ifcs)
tshift_max = max(tshift_maxs) * 1.0
tpad = max(ifc.get_tpad() for ifc in ifcs) + tshift_max
tpeaksearch = tshift_max + 1.0 / fsmooth_min
tinc = tshift_max * 10 + 3*tpad
tpad = max(ifc.get_tpad() for ifc in ifcs) + tshift_max + tpeaksearch
fsmooth_min = min(ifc.get_fsmooth() for ifc in ifcs)
tinc = tshift_max * 10. + 3.0 * tpad
tavail = p.tmax - p.tmin
tinc = min(tinc, tavail - 2.0 * tpad)
if tinc <= 0:
raise common.LassieError(
'available waveforms too short \n'
'required: %g s\n'
'available: %g s\n' % (2.*tpad, tavail))
blacklist = set(tuple(s.split('.')) for s in config.blacklist)
......@@ -208,7 +218,9 @@ def scan(
trs_debug = []
shift_maxs = []
for iifc, ifc in enumerate(ifcs):
dataset = ifc.preprocess(trs, wmin, wmax, tshift_max)
dataset = ifc.preprocess(
trs, wmin-tpeaksearch, wmax+tpeaksearch, tshift_max)
if not dataset:
continue
......@@ -249,8 +261,8 @@ def scan(
pdata.append((list(trs_selected), shift_table, ifc))
iwmin = int(round((wmin-t0) / deltat_cf))
iwmax = int(round((wmax-t0) / deltat_cf))
iwmin = int(round((wmin-tpeaksearch-t0) / deltat_cf))
iwmax = int(round((wmax+tpeaksearch-t0) / deltat_cf))
lengthout = iwmax - iwmin + 1
......@@ -295,13 +307,11 @@ def scan(
num.max(ydata_window),
num.median(ydata_window)))
tpeaks, apeaks = tr_stackmax.peaks(
config.detector_threshold, shift_max + 1.0/fsmooth_min)
tpeaks, apeaks = zip(*[(tpeak, apeak) for (tpeak, apeak) in zip(
*tr_stackmax.peaks(config.detector_threshold, tpeaksearch)) if
wmin <= tpeak and tpeak < wmax]) or ([], [])
for (tpeak, apeak) in zip(tpeaks, apeaks):
if not (wmin <= tpeak and tpeak < wmax):
continue
logger.info('detection: %s %g' % (
util.time_to_str(tpeak),
apeak))
......@@ -344,6 +354,7 @@ def scan(
return
tr_stackmax.chop(wmin, wmax)
io.save([tr_stackmax], 'stackmax/trace_%(tmin)s.mseed')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment