From a8db13095e72e7cdc70467f8318d6f3775ddc53b Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 12 Mar 2019 15:15:48 +0100 Subject: [PATCH] [update] merging picks in Data updated --- pylot/core/io/data.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index 82381126..7ff34482 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -86,9 +86,17 @@ class Data(object): if other.isNew() and not self.isNew(): picks_to_add = other.get_evt_data().picks old_picks = self.get_evt_data().picks - for pick in picks_to_add: - if pick not in old_picks: - old_picks.append(pick) + wf_ids_old = [pick.waveform_id for pick in old_picks] + for new_pick in picks_to_add: + wf_id = new_pick.waveform_id + if wf_id in wf_ids_old: + for old_pick in old_picks: + comparison = [old_pick.waveform_id == new_pick.waveform_id, + old_pick.phase_hint == new_pick.phase_hint, + old_pick.method_id == new_pick.method_id] + if all(comparison): + del(old_pick) + old_picks.append(new_pick) elif not other.isNew() and self.isNew(): new = other + self self.evtdata = new.get_evt_data()