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): ...@@ -367,18 +367,20 @@ class TemplateMatching(object):
for detection in xcorr_results: for detection in xcorr_results:
time, amp, ccc = detection 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 duplicate = False
if i != len(self.events): tolerance = 0.1
ev_time, ev_amp, ev_template, ev_ccc = self.events[i] for e in self.events.irange_key(min_key=time-tolerance, max_key=time+tolerance):
if (ev_template == template+1 and ev_time, ev_amp, ev_template, ev_ccc = e
abs(ev_time - time) <= 0.1): #tolerance 0.1 seconds if (ev_template == template+1 and abs(ev_time - time) <= tolerance):
self.logger.info("duplicated event found (%s)" % str(self.events[i]) ) self.logger.info("Duplicated event found (%s, %d)" % (str(detection), template) )
continue duplicate = True
ev = (time, amp, template+1, ccc) break
new_events.append(ev) if not duplicate:
self.logger.debug('New events found (%s)' % str(ev) ) ev = (time, amp, template+1, ccc)
new_events.append(ev)
self.logger.debug('New events found (%s)' % str(ev) )
self.events.update(new_events) 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