added autopicks in 3 component windows, also added vertical dashed lines for autopicks for better visibility
This commit is contained in:
parent
0656a571cd
commit
085eee7d75
12
QtPyLoT.py
12
QtPyLoT.py
@ -821,7 +821,8 @@ class MainWindow(QMainWindow):
|
||||
pickDlg = PickDlg(self, infile=self.getinfile(),
|
||||
data=data.select(station=station),
|
||||
station=station,
|
||||
picks=self.getPicksOnStation(station))
|
||||
picks=self.getPicksOnStation(station, 'manual'),
|
||||
autopicks=self.getPicksOnStation(station, 'auto'))
|
||||
if pickDlg.exec_():
|
||||
self.setDirty(True)
|
||||
self.update_status('picks accepted ({0})'.format(station))
|
||||
@ -927,8 +928,8 @@ class MainWindow(QMainWindow):
|
||||
ax = self.getPlotWidget().axes
|
||||
ylims = np.array([-.5, +.5]) + plotID
|
||||
phase_col = {
|
||||
'P': ('c', 'c--', 'b-', 'bv', 'b^'),
|
||||
'S': ('m', 'm--', 'r-', 'rv', 'r^')
|
||||
'P': ('c', 'c--', 'b-', 'bv', 'b^', 'b'),
|
||||
'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r')
|
||||
}
|
||||
|
||||
stat_picks = self.getPicks(type=picktype)[station]
|
||||
@ -950,15 +951,16 @@ class MainWindow(QMainWindow):
|
||||
|
||||
if picktype == 'manual':
|
||||
ax.fill_between([epp, lpp], ylims[0], ylims[1],
|
||||
alpha=.5, color=colors[0])
|
||||
alpha=.25, color=colors[0])
|
||||
ax.plot([mpp - spe, mpp - spe], ylims, colors[1],
|
||||
[mpp, mpp], ylims, colors[2],
|
||||
[mpp + spe, mpp + spe], ylims, colors[1])
|
||||
elif picktype == 'auto':
|
||||
ax.plot(mpp, ylims[1], colors[3],
|
||||
mpp, ylims[0], colors[4])
|
||||
ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dashed')
|
||||
else:
|
||||
raise TypeError('Unknow picktype {0}'.format(picktype))
|
||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||
|
||||
def locate_event(self):
|
||||
"""
|
||||
|
@ -1 +1 @@
|
||||
3f7a-dirty
|
||||
0656-dirty
|
||||
|
@ -510,7 +510,7 @@ class WaveformWidget(FigureCanvas):
|
||||
|
||||
class PickDlg(QDialog):
|
||||
def __init__(self, parent=None, data=None, station=None, picks=None,
|
||||
rotate=False, infile=None):
|
||||
autopicks=None, rotate=False, infile=None):
|
||||
super(PickDlg, self).__init__(parent)
|
||||
|
||||
# initialize attributes
|
||||
@ -525,6 +525,10 @@ class PickDlg(QDialog):
|
||||
self.picks = picks
|
||||
else:
|
||||
self.picks = {}
|
||||
if autopicks:
|
||||
self.autopicks = autopicks
|
||||
else:
|
||||
self.autopicks = {}
|
||||
self.filteroptions = FILTERDEFAULTS
|
||||
self.pick_block = False
|
||||
|
||||
@ -571,7 +575,7 @@ class PickDlg(QDialog):
|
||||
self.setPlotLabels()
|
||||
|
||||
# draw picks if present
|
||||
self.drawPicks()
|
||||
self.drawAllPicks()
|
||||
|
||||
# connect button press event to an action
|
||||
self.cidpress = self.connectPressEvent(self.panPress)
|
||||
@ -794,8 +798,13 @@ class PickDlg(QDialog):
|
||||
wfdata = self.getWFData().select(component=component)
|
||||
return wfdata
|
||||
|
||||
def getPicks(self):
|
||||
def getPicks(self, picktype='manual'):
|
||||
if picktype == 'manual':
|
||||
return self.picks
|
||||
elif picktype == 'auto':
|
||||
return self.autopicks
|
||||
else:
|
||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||
|
||||
def resetPicks(self):
|
||||
self.picks = {}
|
||||
@ -1003,26 +1012,32 @@ class PickDlg(QDialog):
|
||||
olpp=olpp)
|
||||
self.getPlotWidget().plotWFData(wfdata=self.getWFData(),
|
||||
title=self.getStation())
|
||||
self.drawPicks()
|
||||
self.drawAllPicks()
|
||||
self.disconnectPressEvent()
|
||||
self.zoomAction.setEnabled(True)
|
||||
self.pick_block = self.togglePickBlocker()
|
||||
self.selectPhase.setCurrentIndex(-1)
|
||||
self.setPlotLabels()
|
||||
|
||||
def drawPicks(self, phase=None):
|
||||
def drawAllPicks(self):
|
||||
self.drawPicks(picktype='manual')
|
||||
self.drawPicks(picktype='auto')
|
||||
|
||||
def drawPicks(self, phase=None, picktype='manual'):
|
||||
# plotting picks
|
||||
ax = self.getPlotWidget().axes
|
||||
ylims = self.getGlobalLimits('y')
|
||||
phase_col = {'P': ('c', 'c--', 'b-'),
|
||||
'S': ('m', 'm--', 'r-')}
|
||||
if self.getPicks():
|
||||
if phase is not None and type(self.getPicks()[phase]) is dict:
|
||||
picks = self.getPicks()[phase]
|
||||
phase_col = {
|
||||
'P': ('c', 'c--', 'b-', 'bv', 'b^', 'b'),
|
||||
'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r')
|
||||
}
|
||||
if self.getPicks(picktype):
|
||||
if phase is not None and type(self.getPicks(picktype)[phase]) is dict:
|
||||
picks = self.getPicks(picktype)[phase]
|
||||
colors = phase_col[phase[0].upper()]
|
||||
elif phase is None:
|
||||
for phase in self.getPicks():
|
||||
self.drawPicks(phase)
|
||||
for phase in self.getPicks(picktype):
|
||||
self.drawPicks(phase, picktype)
|
||||
return
|
||||
else:
|
||||
return
|
||||
@ -1034,11 +1049,19 @@ class PickDlg(QDialog):
|
||||
lpp = picks['lpp'] - self.getStartTime()
|
||||
spe = picks['spe']
|
||||
|
||||
if picktype == 'manual':
|
||||
ax.fill_between([epp, lpp], ylims[0], ylims[1],
|
||||
alpha=.5, color=colors[0])
|
||||
alpha=.25, color=colors[0])
|
||||
ax.plot([mpp - spe, mpp - spe], ylims, colors[1],
|
||||
[mpp, mpp], ylims, colors[2],
|
||||
[mpp + spe, mpp + spe], ylims, colors[1])
|
||||
elif picktype == 'auto':
|
||||
ax.plot(mpp, ylims[1], colors[3],
|
||||
mpp, ylims[0], colors[4])
|
||||
ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dashed')
|
||||
else:
|
||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||
|
||||
|
||||
def panPress(self, gui_event):
|
||||
ax = self.getPlotWidget().axes
|
||||
@ -1101,7 +1124,7 @@ class PickDlg(QDialog):
|
||||
zoomx=self.getXLims(),
|
||||
zoomy=self.getYLims())
|
||||
self.setPlotLabels()
|
||||
self.drawPicks()
|
||||
self.drawAllPicks()
|
||||
self.draw()
|
||||
|
||||
def resetPlot(self):
|
||||
@ -1112,7 +1135,7 @@ class PickDlg(QDialog):
|
||||
zoomx=self.getXLims(),
|
||||
zoomy=self.getYLims())
|
||||
self.setPlotLabels()
|
||||
self.drawPicks()
|
||||
self.drawAllPicks()
|
||||
self.draw()
|
||||
|
||||
def setPlotLabels(self):
|
||||
|
Loading…
Reference in New Issue
Block a user