Commit e39775fc authored by Marius Kriegerowski's avatar Marius Kriegerowski
Browse files

snufflings: backward compatibility

parent ee896d80
......@@ -106,16 +106,21 @@ class LassieSnuffling(Snuffling):
self.mycleanup()
self.detections = []
i_detection = 0
zpeak = 0.
lat = 0.
lon = 0.
for traces in self.chopper_selected_traces(
mode='all',
trace_selector=lambda x: x.station == "SMAX",
fallback=True):
tr_i = filter(lambda x: x.location == 'i', traces)
tr_smax = filter(lambda x: x.location == '', traces)
tr_i = filter(lambda x: x.location == 'i', traces)
if not tr_i:
tr_i = [None] * len(tr_smax)
for tr_i, tr_stackmax in zip(tr_i, tr_smax):
tpeaks, apeaks = tr_stackmax.peaks(
self.detector_threshold, self.tsearch)
if self.level_trace:
ltrace = tr_stackmax.copy(data=False)
ltrace.set_ydata(
......@@ -123,9 +128,10 @@ class LassieSnuffling(Snuffling):
tr_stackmax.data_len()) * self.detector_threshold)
self.add_trace(ltrace)
for t, a in zip(tpeaks, apeaks):
lat, lon, xpeak, ypeak, zpeak = self.grid.index_to_location(
tr_i(t)[1])
lat, lon = orthodrome.ne_to_latlon(lat, lon, xpeak, ypeak)
if tr_i:
lat, lon, xpeak, ypeak, zpeak = self.grid.index_to_location(
tr_i(t)[1])
lat, lon = orthodrome.ne_to_latlon(lat, lon, xpeak, ypeak)
e = model.Event(
time=t, name="%s-%s" % (i_detection, a), lat=lat,
lon=lon, depth=zpeak)
......
Supports Markdown
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