[update] tuneAutoPicker color/pick visualisation
This commit is contained in:
parent
c70222972c
commit
e9ce9635e0
@ -2092,6 +2092,14 @@ class MainWindow(QMainWindow):
|
|||||||
self.tap.fill_tabs(picked=True)
|
self.tap.fill_tabs(picked=True)
|
||||||
for canvas in self.canvas_dict.values():
|
for canvas in self.canvas_dict.values():
|
||||||
canvas.setZoomBorders2content()
|
canvas.setZoomBorders2content()
|
||||||
|
if self.tap.pylot_picks:
|
||||||
|
station = self.tap.get_current_station()
|
||||||
|
p_pick = self.tap.pylot_picks[station]['P']
|
||||||
|
s_pick = self.tap.pylot_picks[station]['S']
|
||||||
|
self.tap.pickDlg.autopicks['P_tuning'] = p_pick
|
||||||
|
self.tap.pickDlg.autopicks['S_tuning'] = s_pick
|
||||||
|
self.tap.pickDlg.drawPicks(phase='P_tuning', picktype='auto', picks=p_pick)
|
||||||
|
self.tap.pickDlg.drawPicks(phase='S_tuning', picktype='auto', picks=s_pick)
|
||||||
|
|
||||||
def autoPick(self):
|
def autoPick(self):
|
||||||
autosave = self.get_current_event_path()
|
autosave = self.get_current_event_path()
|
||||||
|
@ -1255,8 +1255,8 @@ class PickDlg(QDialog):
|
|||||||
self.plot_arrivals_button.setCheckable(True)
|
self.plot_arrivals_button.setCheckable(True)
|
||||||
|
|
||||||
# create accept/reject button
|
# create accept/reject button
|
||||||
self.accept_button = QPushButton('&Accept Picks')
|
self.accept_button = QPushButton('&Accept')
|
||||||
self.reject_button = QPushButton('&Reject Picks')
|
self.reject_button = QPushButton('&Reject')
|
||||||
self.disable_ar_buttons()
|
self.disable_ar_buttons()
|
||||||
|
|
||||||
# add hotkeys
|
# add hotkeys
|
||||||
@ -1280,10 +1280,20 @@ class PickDlg(QDialog):
|
|||||||
_dialtoolbar.addSeparator()
|
_dialtoolbar.addSeparator()
|
||||||
_dialtoolbar.addAction(self.resetPicksAction)
|
_dialtoolbar.addAction(self.resetPicksAction)
|
||||||
if self._embedded:
|
if self._embedded:
|
||||||
|
manu_label = QLabel('Manual Onsets:')
|
||||||
|
manu_label.setStyleSheet('QLabel {'
|
||||||
|
'padding:2px;'
|
||||||
|
'padding-left:5px}')
|
||||||
|
_dialtoolbar.addWidget(manu_label)
|
||||||
_dialtoolbar.addWidget(self.accept_button)
|
_dialtoolbar.addWidget(self.accept_button)
|
||||||
_dialtoolbar.addWidget(self.reject_button)
|
_dialtoolbar.addWidget(self.reject_button)
|
||||||
else:
|
else:
|
||||||
_dialtoolbar.addWidget(self.nextStation)
|
_dialtoolbar.addWidget(self.nextStation)
|
||||||
|
est_label = QLabel('Estimated onsets:')
|
||||||
|
est_label.setStyleSheet('QLabel {'
|
||||||
|
'padding:2px;'
|
||||||
|
'padding-left:5px}')
|
||||||
|
_dialtoolbar.addWidget(est_label)
|
||||||
_dialtoolbar.addWidget(self.plot_arrivals_button)
|
_dialtoolbar.addWidget(self.plot_arrivals_button)
|
||||||
|
|
||||||
# layout the innermost widget
|
# layout the innermost widget
|
||||||
@ -1930,13 +1940,14 @@ class PickDlg(QDialog):
|
|||||||
self.drawPicks(picktype='manual')
|
self.drawPicks(picktype='manual')
|
||||||
self.drawPicks(picktype='auto')
|
self.drawPicks(picktype='auto')
|
||||||
|
|
||||||
def drawPicks(self, phase=None, picktype='manual', textOnly=False):
|
def drawPicks(self, phase=None, picktype='manual', textOnly=False, picks=None):
|
||||||
# plotting picks
|
# plotting picks
|
||||||
ax = self.multicompfig.axes[0]
|
ax = self.multicompfig.axes[0]
|
||||||
if not textOnly:
|
if not textOnly:
|
||||||
ylims = self.multicompfig.getGlobalLimits(ax, 'y')
|
ylims = self.multicompfig.getGlobalLimits(ax, 'y')
|
||||||
else:
|
else:
|
||||||
ylims = ax.get_ylim()
|
ylims = ax.get_ylim()
|
||||||
|
if not picks:
|
||||||
if self.getPicks(picktype):
|
if self.getPicks(picktype):
|
||||||
if phase is not None and not phase == 'SPt':
|
if phase is not None and not phase == 'SPt':
|
||||||
if (type(self.getPicks(picktype)[phase]) is dict
|
if (type(self.getPicks(picktype)[phase]) is dict
|
||||||
@ -2458,6 +2469,7 @@ class TuneAutopicker(QWidget):
|
|||||||
self.fig_dict = self.parent().fig_dict
|
self.fig_dict = self.parent().fig_dict
|
||||||
self.data = Data()
|
self.data = Data()
|
||||||
self.pdlg_widget = None
|
self.pdlg_widget = None
|
||||||
|
self.pylot_picks = None
|
||||||
self.init_main_layouts()
|
self.init_main_layouts()
|
||||||
self.init_eventlist()
|
self.init_eventlist()
|
||||||
self.init_figure_tabs()
|
self.init_figure_tabs()
|
||||||
@ -2469,6 +2481,7 @@ class TuneAutopicker(QWidget):
|
|||||||
self.add_log()
|
self.add_log()
|
||||||
self.set_stretch()
|
self.set_stretch()
|
||||||
self.resize(1280, 720)
|
self.resize(1280, 720)
|
||||||
|
self._manual_pick_plots = []
|
||||||
if hasattr(self.parent(), 'metadata'):
|
if hasattr(self.parent(), 'metadata'):
|
||||||
self.metadata = self.parent().metadata
|
self.metadata = self.parent().metadata
|
||||||
else:
|
else:
|
||||||
@ -2630,6 +2643,7 @@ class TuneAutopicker(QWidget):
|
|||||||
self.pickDlg.update_picks.connect(self.fill_stationbox)
|
self.pickDlg.update_picks.connect(self.fill_stationbox)
|
||||||
self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
|
self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
|
||||||
self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
|
self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
|
||||||
|
self.pickDlg.update_picks.connect(self.plot_manual_picks_to_figs)
|
||||||
self.pdlg_widget = QtGui.QWidget(self)
|
self.pdlg_widget = QtGui.QWidget(self)
|
||||||
hl = QtGui.QHBoxLayout()
|
hl = QtGui.QHBoxLayout()
|
||||||
self.pdlg_widget.setLayout(hl)
|
self.pdlg_widget.setLayout(hl)
|
||||||
@ -2647,10 +2661,23 @@ class TuneAutopicker(QWidget):
|
|||||||
self.parent().drawPicks(station)
|
self.parent().drawPicks(station)
|
||||||
self.parent().draw()
|
self.parent().draw()
|
||||||
|
|
||||||
|
def clear_plotitem(self, plotitem):
|
||||||
|
if type(plotitem) == list:
|
||||||
|
for item in plotitem:
|
||||||
|
self.clear_plotitem(item)
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
plotitem.remove()
|
||||||
|
except Exception as e:
|
||||||
|
print('Warning could not remove item {}: {}'.format(plotitem, e))
|
||||||
|
|
||||||
def plot_manual_picks_to_figs(self):
|
def plot_manual_picks_to_figs(self):
|
||||||
picks = self.get_current_event_picks(self.get_current_station())
|
picks = self.get_current_event_picks(self.get_current_station())
|
||||||
if not picks:
|
if not picks:
|
||||||
return
|
return
|
||||||
|
for plotitem in self._manual_pick_plots:
|
||||||
|
self.clear_plotitem(plotitem)
|
||||||
|
self._manual_pick_plots = []
|
||||||
st = self.data.getWFData()
|
st = self.data.getWFData()
|
||||||
tr = st.select(station=self.get_current_station())[0]
|
tr = st.select(station=self.get_current_station())[0]
|
||||||
starttime = tr.stats.starttime
|
starttime = tr.stats.starttime
|
||||||
@ -2669,39 +2696,40 @@ class TuneAutopicker(QWidget):
|
|||||||
('refSpick', 0),
|
('refSpick', 0),
|
||||||
('el_S1pick', 0),
|
('el_S1pick', 0),
|
||||||
('el_S2pick', 0)]
|
('el_S2pick', 0)]
|
||||||
|
qualityPpick = getQualityFromUncertainty(picks['P']['spe'], self.parameter['timeerrorsP'])
|
||||||
|
qualitySpick = getQualityFromUncertainty(picks['S']['spe'], self.parameter['timeerrorsS'])
|
||||||
for p_ax in p_axes:
|
for p_ax in p_axes:
|
||||||
axes = self.parent().fig_dict[p_ax[0]].axes
|
axes = self.parent().fig_dict[p_ax[0]].axes
|
||||||
if not axes:
|
if not axes:
|
||||||
continue
|
continue
|
||||||
ax = axes[p_ax[1]]
|
ax = axes[p_ax[1]]
|
||||||
self.plot_manual_Ppick_to_ax(ax, (picks['P']['mpp'] - starttime))
|
self.plot_manual_pick_to_ax(ax=ax, picks=picks, phase='P',
|
||||||
|
starttime=starttime, quality=qualityPpick)
|
||||||
for s_ax in s_axes:
|
for s_ax in s_axes:
|
||||||
axes = self.parent().fig_dict[s_ax[0]].axes
|
axes = self.parent().fig_dict[s_ax[0]].axes
|
||||||
if not axes:
|
if not axes:
|
||||||
continue
|
continue
|
||||||
ax = axes[s_ax[1]]
|
ax = axes[s_ax[1]]
|
||||||
self.plot_manual_Spick_to_ax(ax, (picks['S']['mpp'] - starttime))
|
self.plot_manual_pick_to_ax(ax=ax, picks=picks, phase='S',
|
||||||
|
starttime=starttime, quality=qualitySpick)
|
||||||
|
for canvas in self.parent().canvas_dict.values():
|
||||||
|
canvas.draw()
|
||||||
|
|
||||||
|
def plot_manual_pick_to_ax(self, ax, picks, phase, starttime, quality):
|
||||||
|
mpp = picks[phase]['mpp'] - starttime
|
||||||
|
color = pick_color_plt('manual', phase, quality)
|
||||||
|
|
||||||
def plot_manual_Ppick_to_ax(self, ax, pick):
|
|
||||||
y_top = 0.9 * ax.get_ylim()[1]
|
y_top = 0.9 * ax.get_ylim()[1]
|
||||||
y_bot = 0.9 * ax.get_ylim()[0]
|
y_bot = 0.9 * ax.get_ylim()[0]
|
||||||
ax.vlines(pick, y_bot, y_top,
|
self._manual_pick_plots.append(ax.vlines(mpp, y_bot, y_top,
|
||||||
color='teal', linewidth=2, label='manual P Onset')
|
color=color, linewidth=2,
|
||||||
ax.plot([pick - 0.5, pick + 0.5],
|
label='manual {} Onset (quality: {})'.format(phase, quality)))
|
||||||
[y_bot, y_bot], linewidth=2, color='teal')
|
self._manual_pick_plots.append(ax.plot([mpp - 0.5, mpp + 0.5],
|
||||||
ax.plot([pick - 0.5, pick + 0.5],
|
[y_bot, y_bot], linewidth=2,
|
||||||
[y_top, y_top], linewidth=2, color='teal')
|
color=color))
|
||||||
ax.legend(loc=1)
|
self._manual_pick_plots.append(ax.plot([mpp - 0.5, mpp + 0.5],
|
||||||
|
[y_top, y_top], linewidth=2,
|
||||||
def plot_manual_Spick_to_ax(self, ax, pick):
|
color=color))
|
||||||
y_top = 0.9 * ax.get_ylim()[1]
|
|
||||||
y_bot = 0.9 * ax.get_ylim()[0]
|
|
||||||
ax.vlines(pick, y_bot, y_top,
|
|
||||||
color='magenta', linewidth=2, label='manual S Onset')
|
|
||||||
ax.plot([pick - 0.5, pick + 0.5],
|
|
||||||
[y_bot, y_bot], linewidth=2, color='magenta')
|
|
||||||
ax.plot([pick - 0.5, pick + 0.5],
|
|
||||||
[y_top, y_top], linewidth=2, color='magenta')
|
|
||||||
ax.legend(loc=1)
|
ax.legend(loc=1)
|
||||||
|
|
||||||
def fill_tabs(self, event=None, picked=False):
|
def fill_tabs(self, event=None, picked=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user