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