[add] wadaticheck added to widget (problem:

picking weights showing wadati/jk check
will be lost on saving/loading XML)
This commit is contained in:
Marcel Paffrath 2017-08-23 11:51:59 +02:00
parent 0e650dfb75
commit 47a79c7660
4 changed files with 39 additions and 20 deletions

View File

@ -79,7 +79,7 @@ from pylot.core.util.event import Event
from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
WaveformWidget, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \
getDataType, ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, JackknifeWidget, AutoPickWidget
getDataType, ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget
from pylot.core.util.map_projection import map_projection
from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.thread import Thread, Worker
@ -1065,6 +1065,8 @@ class MainWindow(QMainWindow):
if ma_props[ma]:
for picks in ma_props[ma].values():
for phasename, pick in picks.items():
if not type(pick) in [dict, AttribDict]:
continue
if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4:
ma_count[ma] += 1
@ -2000,8 +2002,10 @@ class MainWindow(QMainWindow):
if not event:
continue
event.addAutopicks(result[eventID])
jkw = JackknifeWidget(self, self.canvas_dict_wadatijack[eventID]['jackknife'])
jkw = CanvasWidget(self, self.canvas_dict_wadatijack[eventID]['jackknife'])
wdw = CanvasWidget(self, self.canvas_dict_wadatijack[eventID]['wadati'])
self.apw.add_plot_widget(jkw, 'Jackknife', eventID)
self.apw.add_plot_widget(wdw, 'Wadati', eventID)
self.apw.update_plots()
self.drawPicks(picktype='auto')
self.draw()
@ -2126,6 +2130,7 @@ class MainWindow(QMainWindow):
stime = self.getStime()
for phase in stat_picks:
if phase == 'SPt': continue # wadati SP time
picks = stat_picks[phase]
if type(stat_picks[phase]) is not dict and type(stat_picks[phase]) is not AttribDict:
return
@ -2470,6 +2475,8 @@ class MainWindow(QMainWindow):
if ma_props[ma]:
for picks in ma_props[ma].values():
for phasename, pick in picks.items():
if not type(pick) in [dict, AttribDict]:
continue
if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4:
ma_count[ma] += 1

View File

@ -81,9 +81,10 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None,
# quality control
# median check and jackknife on P-onset times
jk_checked_onsets = checkPonsets(all_onsets, mdttolerance, 1, fig_dict_wadatijack)
return jk_checked_onsets
#return jk_checked_onsets
# check S-P times (Wadati)
return wadaticheck(jk_checked_onsets, wdttolerance, iplot, fig_dict_wadatijack)
wadationsets = wadaticheck(jk_checked_onsets, wdttolerance, 1, fig_dict_wadatijack)
return wadationsets
def call_autopickstation(input_tuple):

View File

@ -618,7 +618,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
ii = 0
ibad = 0
for key in pickdic:
if pickdic[key].has_key('SPt'):
if 'SPt' in pickdic[key]:
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
ii += 1
# check, if deviation is larger than adjusted
@ -662,21 +662,28 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
# plot results
if iplot > 0:
plt.figure() # iplot)
f1, = plt.plot(Ppicks, SPtimes, 'ro')
if wfitflag == 0:
f2, = plt.plot(Ppicks, wdfit, 'k')
f3, = plt.plot(checkedPpicks, checkedSPtimes, 'ko')
f4, = plt.plot(checkedPpicks, wdfit2, 'g')
plt.title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
plt.legend([f1, f2, f3, f4], ['Skipped S-Picks', 'Wadati 1',
'Reliable S-Picks', 'Wadati 2'], loc='best')
if fig_dict:
fig = fig_dict['wadati']
plt_flag = 0
else:
plt.title('Wadati-Diagram, %d S-P Times' % len(SPtimes))
fig = plt.figure()
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if wfitflag == 0:
ax.plot(Ppicks, wdfit, 'k', label='Wadati 1')
ax.plot(checkedPpicks, checkedSPtimes, 'ko', label='Reliable S-Picks')
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
ax.legend()
else:
ax.set_title('Wadati-Diagram, %d S-P Times' % len(SPtimes))
plt.ylabel('S-P Times [s]')
plt.xlabel('P Times [s]')
ax.set_ylabel('S-P Times [s]')
ax.set_xlabel('P Times [s]')
if plt_flag:
fig.show()
return checkedonsets

View File

@ -1701,7 +1701,7 @@ class PickDlg(QDialog):
else:
ylims = self.getPlotWidget().getYLims()
if self.getPicks(picktype):
if phase is not None:
if phase is not None and not phase == 'SPt':
if (type(self.getPicks(picktype)[phase]) is dict
or type(self.getPicks(picktype)[phase]) is AttribDict):
picks = self.getPicks(picktype)[phase]
@ -2012,7 +2012,7 @@ class PhasePlotWidget(FigureCanvas):
super(PhasePlotWidget, self).__init__(self.fig)
class JackknifeWidget(QWidget):
class CanvasWidget(QWidget):
'''
'''
@ -2152,6 +2152,8 @@ class AutoPickWidget(QWidget):
eventlist = [eventlist]
tooltip=''
for index, event in enumerate(eventlist):
if not event:
continue
tooltip += '{}'.format(event.pylot_id)
if not index + 1 == len(eventlist):
tooltip += '\n'
@ -2167,6 +2169,8 @@ class AutoPickWidget(QWidget):
for rb in self.rb_dict.values():
rb.setEnabled(bool)
self.start_button.setEnabled(bool)
self.eventbox.setEnabled(bool)
self.button_clear.setEnabled(bool)
class TuneAutopicker(QWidget):