[bugfix] calculation of hybrid picks (auto+manual) for array_map called too often taking a lot of time

This commit is contained in:
Marcel Paffrath 2019-11-27 10:56:40 +01:00
parent be1e49fa57
commit a9135ec483
2 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import obspy import obspy
@ -33,6 +34,7 @@ class Array_map(QtGui.QWidget):
self.picks = None self.picks = None
self.picks_dict = None self.picks_dict = None
self.autopicks_dict = None self.autopicks_dict = None
self.hybrids_dict = None
self.eventLoc = None self.eventLoc = None
self.figure = figure self.figure = figure
self.picks_rel = {} self.picks_rel = {}
@ -45,13 +47,12 @@ class Array_map(QtGui.QWidget):
self._style = None if not hasattr(parent, '_style') else parent._style self._style = None if not hasattr(parent, '_style') else parent._style
# self.show() # self.show()
@property def update_hybrids_dict(self):
def hybrids_dict(self): self.hybrids_dict = self.picks_dict.copy()
hybrids_dict = self.picks_dict.copy()
for station, pick in self.autopicks_dict.items(): for station, pick in self.autopicks_dict.items():
if not station in hybrids_dict.keys(): if not station in self.hybrids_dict.keys():
hybrids_dict[station] = pick self.hybrids_dict[station] = pick
return hybrids_dict return self.hybrids_dict
def init_map(self): def init_map(self):
self.init_colormap() self.init_colormap()
@ -77,6 +78,7 @@ class Array_map(QtGui.QWidget):
self.pickInfo(ind) self.pickInfo(ind)
def deletePick(self, ind): def deletePick(self, ind):
self.update_hybrids_dict()
for index in ind: for index in ind:
network, station = self._station_onpick_ids[index].split('.')[:2] network, station = self._station_onpick_ids[index].split('.')[:2]
try: try:
@ -118,6 +120,7 @@ class Array_map(QtGui.QWidget):
self.canvas.draw() self.canvas.draw()
def pickInfo(self, ind): def pickInfo(self, ind):
self.update_hybrids_dict()
for index in ind: for index in ind:
network, station = self._station_onpick_ids[index].split('.')[:2] network, station = self._station_onpick_ids[index].split('.')[:2]
dic = self.current_picks_dict()[station] dic = self.current_picks_dict()[station]
@ -266,6 +269,7 @@ class Array_map(QtGui.QWidget):
def init_picks(self): def init_picks(self):
def get_picks(station_dict): def get_picks(station_dict):
self.update_hybrids_dict()
picks = {} picks = {}
# selected phase # selected phase
phase = self.comboBox_phase.currentText() phase = self.comboBox_phase.currentText()

View File

@ -63,5 +63,5 @@ def array_map_worker(input_dict):
if __name__ == '__main__': if __name__ == '__main__':
#main('/home/marcel/pylot_m7_mantle_correlated.plp', f_ext='_0.5Hz') #main('/home/marcel/pylot_m7_mantle_correlated.plp', f_ext='_0.5Hz')
main('/home/marcel/alparray_m7_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz') main('E:\Shared\AlpArray\\test_aa.plp', f_ext='_correlated_0.5Hz', ncores=1)
#main('/home/marcel/alparray_m6.5-6.9_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz') #main('/home/marcel/alparray_m6.5-6.9_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz')