[update] add linecolor settings to autoPyLoT figs

This commit is contained in:
Marcel Paffrath 2017-09-08 17:01:36 +02:00
parent 7ef784f2d2
commit 104a8dda64
5 changed files with 86 additions and 45 deletions

View File

@ -1991,26 +1991,35 @@ class MainWindow(QMainWindow):
'el_S1pick', 'el_S1pick',
'el_S2pick', 'el_S2pick',
'refSpick', 'refSpick',
'aicARHfig' 'aicARHfig',
'plot_style'
] ]
for key in self.fig_keys: for key in self.fig_keys:
if key == 'plot_style':
fig = self._style
else:
fig = Figure() fig = Figure()
self.fig_dict[key] = fig self.fig_dict[key] = fig
def init_canvas_dict(self): def init_canvas_dict(self):
self.canvas_dict = {} self.canvas_dict = {}
for key in self.fig_keys: for key in self.fig_keys:
if not key == 'plot_style':
self.canvas_dict[key] = PylotCanvas(self.fig_dict[key], parent=self) self.canvas_dict[key] = PylotCanvas(self.fig_dict[key], parent=self)
def init_fig_dict_wadatijack(self, eventIDs): def init_fig_dict_wadatijack(self, eventIDs):
self.fig_dict_wadatijack = {} self.fig_dict_wadatijack = {}
self.fig_keys_wadatijack = [ self.fig_keys_wadatijack = [
'jackknife', 'jackknife',
'wadati' 'wadati',
'plot_style'
] ]
for eventID in eventIDs: for eventID in eventIDs:
self.fig_dict_wadatijack[eventID] = {} self.fig_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack: for key in self.fig_keys_wadatijack:
if key == 'plot_style':
fig = self._style
else:
fig = Figure() fig = Figure()
self.fig_dict_wadatijack[eventID][key] = fig self.fig_dict_wadatijack[eventID][key] = fig
@ -2019,6 +2028,7 @@ class MainWindow(QMainWindow):
for eventID in self.fig_dict_wadatijack.keys(): for eventID in self.fig_dict_wadatijack.keys():
self.canvas_dict_wadatijack[eventID] = {} self.canvas_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack: for key in self.fig_keys_wadatijack:
if not key == 'plot_style':
self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key], self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key],
parent=self) parent=self)

View File

@ -322,9 +322,11 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'aicFig' key = 'aicFig'
if fig_dict: if fig_dict:
fig = fig_dict[key] fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig) linecolor = 'k'
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig, linecolor=linecolor)
# add pstart and pstop to aic plot # add pstart and pstop to aic plot
if fig: if fig:
for ax in fig.axes: for ax in fig.axes:
@ -347,12 +349,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'slength' key = 'slength'
if fig_dict: if fig_dict:
fig = fig_dict[key] fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz, Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength / 2, minsiglength / 2,
nfacsl, minpercent, iplot, nfacsl, minpercent, iplot,
fig) fig, linecolor)
else: else:
# filter and taper horizontal traces # filter and taper horizontal traces
trH1_filt = edat.copy() trH1_filt = edat.copy()
@ -369,12 +373,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
zne += trH2_filt zne += trH2_filt
if fig_dict: if fig_dict:
fig = fig_dict['slength'] fig = fig_dict['slength']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz, Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength, minsiglength,
nfacsl, minpercent, iplot, nfacsl, minpercent, iplot,
fig) fig, linecolor)
if Pflag == 1: if Pflag == 1:
# check for spuriously picked S onset # check for spuriously picked S onset
@ -387,10 +393,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot > 1: if iplot > 1:
if fig_dict: if fig_dict:
fig = fig_dict['checkZ4s'] fig = fig_dict['checkZ4s']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checkZ4S(zne, aicpick.getpick(), zfac, Pflag = checkZ4S(zne, aicpick.getpick(), zfac,
tsnrz[2], iplot, fig) tsnrz[2], iplot, fig, linecolor)
if Pflag == 0: if Pflag == 0:
Pmarker = 'SinsteadP' Pmarker = 'SinsteadP'
Pweight = 9 Pweight = 9
@ -442,10 +450,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
algoP=algoP) algoP=algoP)
if fig_dict: if fig_dict:
fig = fig_dict['refPpick'] fig = fig_dict['refPpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
refPpick = PragPicker(cf2, tsnrz, pickwinP, iplot, ausP, tsmoothP, refPpick = PragPicker(cf2, tsnrz, pickwinP, iplot, ausP, tsmoothP,
aicpick.getpick(), fig) aicpick.getpick(), fig, linecolor)
mpickP = refPpick.getpick() mpickP = refPpick.getpick()
############################################################# #############################################################
if mpickP is not None: if mpickP is not None:
@ -454,10 +464,13 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_Ppick'] fig = fig_dict['el_Ppick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot, fig=fig) mpickP, iplot, fig=fig,
linecolor=linecolor)
else: else:
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot) mpickP, iplot)
@ -487,9 +500,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['fm_picker'] fig = fig_dict['fm_picker']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig) FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig, linecolor)
else: else:
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot) FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot)
else: else:
@ -624,10 +638,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# of class AutoPicking # of class AutoPicking
if fig_dict: if fig_dict:
fig = fig_dict['aicARHfig'] fig = fig_dict['aicARHfig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None, aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None,
aictsmoothS, fig=fig) aictsmoothS, fig=fig, linecolor=linecolor)
############################################################### ###############################################################
# go on with processing if AIC onset passes quality control # go on with processing if AIC onset passes quality control
slope = aicarhpick.getSlope() slope = aicarhpick.getSlope()
@ -686,10 +702,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# get refined onset time from CF2 using class Picker # get refined onset time from CF2 using class Picker
if fig_dict: if fig_dict:
fig = fig_dict['refSpick'] fig = fig_dict['refSpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS, refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS,
tsmoothS, aicarhpick.getpick(), fig) tsmoothS, aicarhpick.getpick(), fig, linecolor)
mpickS = refSpick.getpick() mpickS = refSpick.getpick()
############################################################# #############################################################
if mpickS is not None: if mpickS is not None:
@ -699,12 +717,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_S1pick'] fig = fig_dict['el_S1pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS, epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
mpickS, iplot, mpickS, iplot,
fig=fig) fig=fig,
linecolor=linecolor)
else: else:
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS, epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
@ -714,12 +735,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_S2pick'] fig = fig_dict['el_S2pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = ''
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS, epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
mpickS, iplot, mpickS, iplot,
fig=fig) fig=fig,
linecolor=linecolor)
else: else:
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS, epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
@ -828,8 +852,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if fig_dict == None or fig_dict == 'None': if fig_dict == None or fig_dict == 'None':
fig = plt.figure() fig = plt.figure()
plt_flag = 1 plt_flag = 1
linecolor = 'k'
else: else:
fig = fig_dict['mainFig'] fig = fig_dict['mainFig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
ax1 = fig.add_subplot(311) ax1 = fig.add_subplot(311)
tdata = np.arange(0, zdat[0].stats.npts / tr_filt.stats.sampling_rate, tdata = np.arange(0, zdat[0].stats.npts / tr_filt.stats.sampling_rate,
tr_filt.stats.delta) tr_filt.stats.delta)
@ -837,7 +863,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(tr_filt.data) - len(tdata) wfldiff = len(tr_filt.data) - len(tdata)
if wfldiff < 0: if wfldiff < 0:
tdata = tdata[0:len(tdata) - abs(wfldiff)] tdata = tdata[0:len(tdata) - abs(wfldiff)]
ax1.plot(tdata, tr_filt.data / max(tr_filt.data), 'k', label='Data') ax1.plot(tdata, tr_filt.data / max(tr_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
ax1.plot(cf1.getTimeArray(), cf1.getCF() / max(cf1.getCF()), ax1.plot(cf1.getTimeArray(), cf1.getCF() / max(cf1.getCF()),
'b', label='CF1') 'b', label='CF1')
@ -896,7 +922,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH1_filt.data) - len(th1data) wfldiff = len(trH1_filt.data) - len(th1data)
if wfldiff < 0: if wfldiff < 0:
th1data = th1data[0:len(th1data) - abs(wfldiff)] th1data = th1data[0:len(th1data) - abs(wfldiff)]
ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), 'k', label='Data') ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
ax2.plot(arhcf1.getTimeArray(), ax2.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1') arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')
@ -945,7 +971,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH2_filt.data) - len(th2data) wfldiff = len(trH2_filt.data) - len(th2data)
if wfldiff < 0: if wfldiff < 0:
th2data = th2data[0:len(th2data) - abs(wfldiff)] th2data = th2data[0:len(th2data) - abs(wfldiff)]
ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), 'k', label='Data') ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
p22, = ax3.plot(arhcf1.getTimeArray(), p22, = ax3.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1') arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')

View File

@ -35,7 +35,7 @@ class AutoPicker(object):
warnings.simplefilter('ignore') warnings.simplefilter('ignore')
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None): def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None, linecolor='k'):
''' '''
:param: cf, characteristic function, on which the picking algorithm is applied :param: cf, characteristic function, on which the picking algorithm is applied
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object :type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
@ -62,7 +62,8 @@ class AutoPicker(object):
''' '''
assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf) assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf)
self._linecolor = linecolor
self._pickcolor_p = 'b'
self.cf = cf.getCF() self.cf = cf.getCF()
self.Tcf = cf.getTimeArray() self.Tcf = cf.getTimeArray()
self.Data = cf.getXCF() self.Data = cf.getXCF()
@ -264,13 +265,13 @@ class AICPicker(AutoPicker):
print("Choose longer slope determination window!") print("Choose longer slope determination window!")
if self.iplot > 1: if self.iplot > 1:
if self.fig == None or self.fig == 'None': if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.iplot) ### WHY? MP MP fig = plt.figure()
plt_flag = 1 plt_flag = 1
else: else:
fig = self.fig fig = self.fig
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
x = self.Data[0].data x = self.Data[0].data
ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data') ax.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF') ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
ax.legend(loc=1) ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
@ -307,7 +308,7 @@ class AICPicker(AutoPicker):
x = self.Data[0].data x = self.Data[0].data
if len(self.Tcf) > len(self.Data[0].data): # why? LK if len(self.Tcf) > len(self.Data[0].data): # why? LK
self.Tcf = self.Tcf[0:len(self.Tcf)-1] self.Tcf = self.Tcf[0:len(self.Tcf)-1]
ax1.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data') ax1.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax1.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF') ax1.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
if self.Pick is not None: if self.Pick is not None:
ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick') ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick')
@ -317,7 +318,7 @@ class AICPicker(AutoPicker):
if self.Pick is not None: if self.Pick is not None:
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.plot(self.Tcf, x, 'k', label='Data') ax2.plot(self.Tcf, x, color=self._linecolor, linewidth=0.7, label='Data')
ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0, ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0,
label='Signal Window') label='Signal Window')
@ -473,10 +474,10 @@ class PragPicker(AutoPicker):
else: else:
fig = self.fig fig = self.fig
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(Tcfpick, cfipick, 'k', label='CF') ax.plot(Tcfpick, cfipick, color=self._linecolor, linewidth=0.7, label='CF')
ax.plot(Tcfpick, cfsmoothipick, 'r', label='Smoothed CF') ax.plot(Tcfpick, cfsmoothipick, 'r', label='Smoothed CF')
if pickflag > 0: if pickflag > 0:
ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], 'b', linewidth=2, label='Pick') ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], self._pickcolor_p, linewidth=2, label='Pick')
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax.set_yticks([]) ax.set_yticks([])
ax.set_title(self.Data[0].stats.station) ax.set_title(self.Data[0].stats.station)

View File

@ -15,7 +15,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime from obspy.core import Stream, UTCDateTime
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None): def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecolor='k'):
''' '''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009) Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level, as reasonable uncertainties. Latest possible pick is based on noise level,
@ -131,16 +131,16 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(t, x, 'k', label='Data') ax.plot(t, x, color=linecolor, linewidth=0.7, label='Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window') ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], '--k', label='Noise Level') ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], color=linecolor, linewidth=0.7, linestyle='dashed', label='Noise Level')
ax.plot(t[pis[zc]], np.zeros(len(zc)), '*g', ax.plot(t[pis[zc]], np.zeros(len(zc)), '*g',
markersize=14, label='Zero Crossings') markersize=14, label='Zero Crossings')
ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], '--k') ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], color=linecolor, linewidth=0.7, linestyle='dashed')
ax.plot([Pick1, Pick1], [max(x), -max(x)], 'b', linewidth=2, label='mpp') ax.plot([Pick1, Pick1], [max(x), -max(x)], 'b', linewidth=2, label='mpp')
ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], '--k', label='lpp') ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='lpp')
ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], '--k', label='epp') ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='epp')
ax.plot([Pick1 + PickError, Pick1 + PickError], ax.plot([Pick1 + PickError, Pick1 + PickError],
[max(x) / 2, -max(x) / 2], 'r--', label='spe') [max(x) / 2, -max(x) / 2], 'r--', label='spe')
ax.plot([Pick1 - PickError, Pick1 - PickError], ax.plot([Pick1 - PickError, Pick1 - PickError],
@ -160,7 +160,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
return EPick, LPick, PickError return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None): def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
''' '''
Function to derive first motion (polarity) of given phase onset Pick. Function to derive first motion (polarity) of given phase onset Pick.
Calculation is based on zero crossings determined within time window pickwin Calculation is based on zero crossings determined within time window pickwin
@ -324,7 +324,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax1 = fig.add_subplot(211) ax1 = fig.add_subplot(211)
ax1.plot(t, xraw, 'k') ax1.plot(t, xraw, color=linecolor, linewidth=0.7)
ax1.plot([Pick, Pick], [max(xraw), -max(xraw)], 'b', linewidth=2, label='Pick') ax1.plot([Pick, Pick], [max(xraw), -max(xraw)], 'b', linewidth=2, label='Pick')
if P1 is not None: if P1 is not None:
ax1.plot(t[islope1], xraw[islope1], label='Slope Window') ax1.plot(t[islope1], xraw[islope1], label='Slope Window')
@ -338,7 +338,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.set_title('First-Motion Determination, Filtered Data') ax2.set_title('First-Motion Determination, Filtered Data')
ax2.plot(t, xfilt, 'k') ax2.plot(t, xfilt, color=linecolor, linewidth=0.7)
ax2.plot([Pick, Pick], [max(xfilt), -max(xfilt)], 'b', ax2.plot([Pick, Pick], [max(xfilt), -max(xfilt)], 'b',
linewidth=2) linewidth=2)
if P2 is not None: if P2 is not None:
@ -668,15 +668,18 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
if iplot > 0: if iplot > 0:
if fig_dict: if fig_dict:
fig = fig_dict['wadati'] fig = fig_dict['wadati']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
plt_flag = 0 plt_flag = 0
else: else:
fig = plt.figure() fig = plt.figure()
linecolor = 'k'
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks') ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if wfitflag == 0: if wfitflag == 0:
ax.plot(Ppicks, wdfit, 'k', label='Wadati 1') ax.plot(Ppicks, wdfit, color=linecolor, linewidth=0.7, label='Wadati 1')
ax.plot(checkedPpicks, checkedSPtimes, 'ko', label='Reliable S-Picks') ax.plot(checkedPpicks, checkedSPtimes, color=linecolor,
linewidth=0, marker='o', label='Reliable S-Picks')
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2') ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \ ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr)) 'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
@ -699,7 +702,7 @@ def RMS(X):
return np.sqrt(np.sum(np.power(X, 2)) / len(X)) return np.sqrt(np.sum(np.power(X, 2)) / len(X))
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None): def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None, linecolor='k'):
''' '''
Function to detect spuriously picked noise peaks. Function to detect spuriously picked noise peaks.
Uses RMS trace of all 3 components (if available) to determine, Uses RMS trace of all 3 components (if available) to determine,
@ -785,7 +788,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(t, rms, 'k', label='RMS Data') ax.plot(t, rms, color=linecolor, linewidth=0.7, label='RMS Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window') ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]], ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]],
@ -975,7 +978,7 @@ def jackknife(X, phi, h):
return PHI_jack, PHI_pseudo, PHI_sub return PHI_jack, PHI_pseudo, PHI_sub
def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'):
''' '''
Function to compare energy content of vertical trace with Function to compare energy content of vertical trace with
energy content of horizontal traces to detect spuriously energy content of horizontal traces to detect spuriously
@ -1103,7 +1106,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(3, 1, i + 1, sharex=ax1) ax = fig.add_subplot(3, 1, i + 1, sharex=ax1)
ax.plot(t, abs(trace.data), color='b', label='abs') ax.plot(t, abs(trace.data), color='b', label='abs')
ax.plot(t, trace.data, color='k') ax.plot(t, trace.data, color=linecolor, linewidth=0.7)
name = str(trace.stats.channel) + ': {}'.format(rms) name = str(trace.stats.channel) + ': {}'.format(rms)
ax.plot([pick, pick + checkwin], [rms, rms], 'r', label='RMS {}'.format(name)) ax.plot([pick, pick + checkwin], [rms, rms], 'r', label='RMS {}'.format(name))
ax.plot([pick, pick], ax.get_ylim(), 'm', label='Pick') ax.plot([pick, pick], ax.get_ylim(), 'm', label='Pick')

View File

@ -2766,6 +2766,7 @@ class TuneAutopicker(QWidget):
'locflag': 0, 'locflag': 0,
'savexml': False} 'savexml': False}
for key in self.fig_dict.keys(): for key in self.fig_dict.keys():
if not key == 'plot_style':
self.fig_dict[key].clear() self.fig_dict[key].clear()
self.ap_thread = Thread(self, autoPyLoT, arg=args, self.ap_thread = Thread(self, autoPyLoT, arg=args,
progressText='Picking trace...', progressText='Picking trace...',