Skip to content
Snippets Groups Projects
Commit 77a6274e authored by Luca Scarabello's avatar Luca Scarabello
Browse files

mpi bug fix: duplicated events

parent d611d100
No related branches found
Tags v0.4.2
No related merge requests found
......@@ -367,18 +367,20 @@ class TemplateMatching(object):
for detection in xcorr_results:
time, amp, ccc = detection
#
# Check the same event has not already been found (because of chuks overlapping)
# Check the same event has not already been found (because of chunks overlapping)
#
i = self.events.bisect_key_left(time) # Locate the leftmost value exactly equal to time
if i != len(self.events):
ev_time, ev_amp, ev_template, ev_ccc = self.events[i]
if (ev_template == template+1 and
abs(ev_time - time) <= 0.1): #tolerance 0.1 seconds
self.logger.info("duplicated event found (%s)" % str(self.events[i]) )
continue
ev = (time, amp, template+1, ccc)
new_events.append(ev)
self.logger.debug('New events found (%s)' % str(ev) )
duplicate = False
tolerance = 0.1
for e in self.events.irange_key(min_key=time-tolerance, max_key=time+tolerance):
ev_time, ev_amp, ev_template, ev_ccc = e
if (ev_template == template+1 and abs(ev_time - time) <= tolerance):
self.logger.info("Duplicated event found (%s, %d)" % (str(detection), template) )
duplicate = True
break
if not duplicate:
ev = (time, amp, template+1, ccc)
new_events.append(ev)
self.logger.debug('New events found (%s)' % str(ev) )
self.events.update(new_events)
......
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