first working version of threaded tuneAutopicker

This commit is contained in:
Marcel Paffrath 2017-05-12 13:58:05 +02:00
parent 184983bc87
commit 12e6106227
4 changed files with 21 additions and 29 deletions

View File

@ -1 +1 @@
f58d1-dirty 1849-dirty

View File

@ -341,7 +341,7 @@ def autopickstation(wfstream, pickparam, verbose=False, iplot=0, fig_dict=None):
if iplot: if iplot:
key = 'el_Ppick' key = 'el_Ppick'
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot, fig_dict[key]) mpickP, iplot, fig=fig_dict[key])
else: else:
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot) mpickP, iplot)
@ -470,7 +470,7 @@ def autopickstation(wfstream, pickparam, verbose=False, iplot=0, fig_dict=None):
# of class AutoPicking # of class AutoPicking
key = 'aicARHfig' key = 'aicARHfig'
aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None, aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None,
aictsmoothS, fig_dict[key]) aictsmoothS, fig = fig_dict[key])
############################################################### ###############################################################
# go on with processing if AIC onset passes quality control # go on with processing if AIC onset passes quality control
if (aicarhpick.getSlope() >= minAICSslope and if (aicarhpick.getSlope() >= minAICSslope and

View File

@ -105,6 +105,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
if iplot > 1: if iplot > 1:
if not fig: if not fig:
print('New Figure.........................')
fig = plt.figure()#iplot) fig = plt.figure()#iplot)
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(t, x, 'k', label='Data') ax.plot(t, x, 'k', label='Data')
@ -128,10 +129,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
X[0].stats.station) X[0].stats.station)
ax.legend() ax.legend()
if iplot: return EPick, LPick, PickError
return EPick, LPick, PickError
else:
return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None): def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None):
@ -307,10 +305,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None):
ax2.set_xlabel('Time [s] since %s' % Xraw[0].stats.starttime) ax2.set_xlabel('Time [s] since %s' % Xraw[0].stats.starttime)
ax2.set_yticks([]) ax2.set_yticks([])
if iplot: return FM
return FM
else:
return FM
def crossings_nonzero_all(data): def crossings_nonzero_all(data):

View File

@ -1295,7 +1295,7 @@ class TuneAutopicker(QWidget):
self.p_tabs = QtGui.QTabWidget() self.p_tabs = QtGui.QTabWidget()
self.s_tabs = QtGui.QTabWidget() self.s_tabs = QtGui.QTabWidget()
self.layout.insertWidget(0, self.main_tabs) self.layout.insertWidget(0, self.main_tabs)
#self.init_tab_names() self.init_tab_names()
#self.fill_tabs(None) #self.fill_tabs(None)
def add_parameter(self): def add_parameter(self):
@ -1337,7 +1337,7 @@ class TuneAutopicker(QWidget):
self.layout.setStretch(1, 1) self.layout.setStretch(1, 1)
def init_tab_names(self): def init_tab_names(self):
self.ptb_names = ['aicFig', 'slenght', 'checkZ4S', 'refPpick', 'el_Ppick', 'fm_picker'] self.ptb_names = ['aicFig', 'slength', 'checkZ4s', 'refPpick', 'el_Ppick', 'fm_picker']
self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick'] self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick']
def fill_tabs(self, canvas_dict): def fill_tabs(self, canvas_dict):
@ -1356,26 +1356,23 @@ class TuneAutopicker(QWidget):
def fill_p_tabs(self, canvas_dict): def fill_p_tabs(self, canvas_dict):
for name in self.ptb_names: for name in self.ptb_names:
id = self.p_tabs.addTab(canvas_dict[name], name)
self.p_tabs.setTabEnabled(id, bool(self.fig_dict[name].axes))
try: try:
id = self.p_tabs.addTab(canvas_dict[name], name) self.fig_dict[name].tight_layout()
self.p_tabs.setTabEnabled(id, True) except:
figure.tight_layout() pass
except Exception as e:
id = self.p_tabs.addTab(QtGui.QWidget(), name)
self.p_tabs.setTabEnabled(id, False)
def fill_s_tabs(self, canvas_dict): def fill_s_tabs(self, canvas_dict):
for name in self.stb_names: for name in self.stb_names:
figure = self.fig_dict[name]
id = self.s_tabs.addTab(canvas_dict[name], name)
self.s_tabs.setTabEnabled(id, bool(self.fig_dict[name].axes))
try: try:
figure = self.fig_dict[name] self.fig_dict[name].tight_layout()
id = self.s_tabs.addTab(canvas_dict[name], name) except:
self.s_tabs.setTabEnabled(id, True) pass
figure.tight_layout()
except Exception as e:
id = self.s_tabs.addTab(QtGui.QWidget(), name)
self.s_tabs.setTabEnabled(id, False)
class PropertiesDlg(QDialog): class PropertiesDlg(QDialog):
def __init__(self, parent=None, infile=None): def __init__(self, parent=None, infile=None):
super(PropertiesDlg, self).__init__(parent) super(PropertiesDlg, self).__init__(parent)