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:
key = 'el_Ppick'
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot, fig_dict[key])
mpickP, iplot, fig=fig_dict[key])
else:
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot)
@ -470,7 +470,7 @@ def autopickstation(wfstream, pickparam, verbose=False, iplot=0, fig_dict=None):
# of class AutoPicking
key = 'aicARHfig'
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
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 not fig:
print('New Figure.........................')
fig = plt.figure()#iplot)
ax = fig.add_subplot(111)
ax.plot(t, x, 'k', label='Data')
@ -128,9 +129,6 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False, fig=Non
X[0].stats.station)
ax.legend()
if iplot:
return EPick, LPick, PickError
else:
return EPick, LPick, PickError
@ -307,9 +305,6 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None):
ax2.set_xlabel('Time [s] since %s' % Xraw[0].stats.starttime)
ax2.set_yticks([])
if iplot:
return FM
else:
return FM

View File

@ -1295,7 +1295,7 @@ class TuneAutopicker(QWidget):
self.p_tabs = QtGui.QTabWidget()
self.s_tabs = QtGui.QTabWidget()
self.layout.insertWidget(0, self.main_tabs)
#self.init_tab_names()
self.init_tab_names()
#self.fill_tabs(None)
def add_parameter(self):
@ -1337,7 +1337,7 @@ class TuneAutopicker(QWidget):
self.layout.setStretch(1, 1)
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']
def fill_tabs(self, canvas_dict):
@ -1356,25 +1356,22 @@ class TuneAutopicker(QWidget):
def fill_p_tabs(self, canvas_dict):
for name in self.ptb_names:
try:
id = self.p_tabs.addTab(canvas_dict[name], name)
self.p_tabs.setTabEnabled(id, True)
figure.tight_layout()
except Exception as e:
id = self.p_tabs.addTab(QtGui.QWidget(), name)
self.p_tabs.setTabEnabled(id, False)
self.p_tabs.setTabEnabled(id, bool(self.fig_dict[name].axes))
try:
self.fig_dict[name].tight_layout()
except:
pass
def fill_s_tabs(self, canvas_dict):
for name in self.stb_names:
try:
figure = self.fig_dict[name]
id = self.s_tabs.addTab(canvas_dict[name], name)
self.s_tabs.setTabEnabled(id, True)
figure.tight_layout()
except Exception as e:
id = self.s_tabs.addTab(QtGui.QWidget(), name)
self.s_tabs.setTabEnabled(id, False)
self.s_tabs.setTabEnabled(id, bool(self.fig_dict[name].axes))
try:
self.fig_dict[name].tight_layout()
except:
pass
class PropertiesDlg(QDialog):
def __init__(self, parent=None, infile=None):