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

snuffling: read and evaluate argmax indices trace

parent d5874b1c
......@@ -15,7 +15,7 @@ def detections_to_event_markers(fn_detections):
data = line.split()
i, t_d, t_t, apeak, latpeak, lonpeak, xpeak, ypeak, zpeak = data
lat, lon = orthodrome.ne_to_latlon(
float(latpeak), float(lonpeak), float(ypeak), float(xpeak))
float(latpeak), float(lonpeak), float(xpeak), float(ypeak))
t = util.str_to_time("%s %s" % (t_d, t_t))
label = "%s-%s" % (i, apeak)
e = model.Event(lat=lat, lon=lon, depth=float(zpeak)*1000.,
......@@ -74,9 +74,9 @@ class LassieSnuffling(Snuffling):
detector_default = 100.
self.set_name('Lassie investigate')
self.add_parameter(Param('Tsearch', 'tsearch', 1., 0.01, 100))
self.add_parameter(Param('Tsearch', 'tsearch', 20., 0.01, 100))
self.add_parameter(Param(
'Detector threshold', 'detector_threshold', detector_default, 100.,
'Detector threshold', 'detector_threshold', detector_default, 1.,
10000.))
self.add_parameter(Switch('Level Trace', 'level_trace', False))
self.add_parameter(Switch(
......@@ -93,6 +93,7 @@ class LassieSnuffling(Snuffling):
self.markers_compare = []
self.fig = None
self.fframe = None
self.grid = self.config.get_grid()
def mycleanup(self):
viewer = self.get_viewer()
......@@ -104,11 +105,14 @@ class LassieSnuffling(Snuffling):
def call(self):
self.mycleanup()
self.detections = []
i_detection = 0
for traces in self.chopper_selected_traces(
mode='all',
trace_selector=lambda x: x.station == "SMAX",
fallback=True):
for tr_stackmax in traces:
tr_i = filter(lambda x: x.location == 'i', traces)
tr_smax = filter(lambda x: x.location == '', traces)
for tr_i, tr_stackmax in zip(tr_i, tr_smax):
tpeaks, apeaks = tr_stackmax.peaks(
self.detector_threshold, self.tsearch)
......@@ -119,11 +123,16 @@ class LassieSnuffling(Snuffling):
tr_stackmax.data_len()) * self.detector_threshold)
self.add_trace(ltrace)
for t, a in zip(tpeaks, apeaks):
e = model.Event(time=t, name=str(a))
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)
self.detections.append(
gui_util.EventMarker(
event=e, kind=int(self.marker_kind[0])))
i_detection += 1
self.add_markers(self.detections)
if self.hold_figure:
......@@ -236,6 +245,8 @@ def snuffle(config):
s.config = _lassie_config
s.setup()
win.pile_viewer.viewer.add_snuffling(s, reloaded=True)
win.pile_viewer.viewer.add_blacklist_pattern('*.SMAX.i.*')
s.detections = detections_to_event_markers(
_lassie_config.detections_path)
s.add_markers(s.detections)
......
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