Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop
This commit is contained in:
commit
6a40eef3fc
12
QtPyLoT.py
12
QtPyLoT.py
@ -1669,10 +1669,22 @@ class MainWindow(QMainWindow):
|
|||||||
if event.pylot_picks and event.pylot_autopicks:
|
if event.pylot_picks and event.pylot_autopicks:
|
||||||
for station in event.pylot_picks:
|
for station in event.pylot_picks:
|
||||||
if station in event.pylot_autopicks:
|
if station in event.pylot_autopicks:
|
||||||
|
try:
|
||||||
autopick_p = event.pylot_autopicks[station]['P']['spe']
|
autopick_p = event.pylot_autopicks[station]['P']['spe']
|
||||||
|
except KeyError:
|
||||||
|
autopick_p = None
|
||||||
|
try:
|
||||||
manupick_p = event.pylot_picks[station]['P']['spe']
|
manupick_p = event.pylot_picks[station]['P']['spe']
|
||||||
|
except KeyError:
|
||||||
|
manupick_p = None
|
||||||
|
try:
|
||||||
autopick_s = event.pylot_autopicks[station]['S']['spe']
|
autopick_s = event.pylot_autopicks[station]['S']['spe']
|
||||||
|
except KeyError:
|
||||||
|
autopick_s = None
|
||||||
|
try:
|
||||||
manupick_s = event.pylot_picks[station]['S']['spe']
|
manupick_s = event.pylot_picks[station]['S']['spe']
|
||||||
|
except KeyError:
|
||||||
|
manupick_s = None
|
||||||
if autopick_p and manupick_p:
|
if autopick_p and manupick_p:
|
||||||
return True
|
return True
|
||||||
elif autopick_s and manupick_s:
|
elif autopick_s and manupick_s:
|
||||||
|
@ -228,8 +228,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
data=str(zdat))
|
data=str(zdat))
|
||||||
if verbose: print(msg)
|
if verbose: print(msg)
|
||||||
z_copy = zdat.copy()
|
z_copy = zdat.copy()
|
||||||
# filter and taper data
|
|
||||||
tr_filt = zdat[0].copy()
|
tr_filt = zdat[0].copy()
|
||||||
|
#remove constant offset from data to avoid unwanted filter response
|
||||||
|
tr_filt.detrend(type='demean')
|
||||||
|
# filter and taper data
|
||||||
tr_filt.filter('bandpass', freqmin=bpz1[0], freqmax=bpz1[1],
|
tr_filt.filter('bandpass', freqmin=bpz1[0], freqmax=bpz1[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
tr_filt.taper(max_percentage=0.05, type='hann')
|
tr_filt.taper(max_percentage=0.05, type='hann')
|
||||||
@ -364,6 +366,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
# filter and taper horizontal traces
|
# filter and taper horizontal traces
|
||||||
trH1_filt = edat.copy()
|
trH1_filt = edat.copy()
|
||||||
trH2_filt = ndat.copy()
|
trH2_filt = ndat.copy()
|
||||||
|
# remove constant offset from data to avoid unwanted filter response
|
||||||
|
trH1_filt.detrend(type='demean')
|
||||||
|
trH2_filt.detrend(type='demean')
|
||||||
trH1_filt.filter('bandpass', freqmin=bph1[0],
|
trH1_filt.filter('bandpass', freqmin=bph1[0],
|
||||||
freqmax=bph1[1],
|
freqmax=bph1[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
@ -424,6 +429,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
# re-filter waveform with larger bandpass
|
# re-filter waveform with larger bandpass
|
||||||
z_copy = zdat.copy()
|
z_copy = zdat.copy()
|
||||||
tr_filt = zdat[0].copy()
|
tr_filt = zdat[0].copy()
|
||||||
|
tr_filt.detrend(type='demean')
|
||||||
tr_filt.filter('bandpass', freqmin=bpz2[0], freqmax=bpz2[1],
|
tr_filt.filter('bandpass', freqmin=bpz2[0], freqmax=bpz2[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
tr_filt.taper(max_percentage=0.05, type='hann')
|
tr_filt.taper(max_percentage=0.05, type='hann')
|
||||||
@ -471,6 +477,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
else:
|
else:
|
||||||
fig = None
|
fig = None
|
||||||
linecolor = 'k'
|
linecolor = 'k'
|
||||||
|
fig._tight = True
|
||||||
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)
|
linecolor=linecolor)
|
||||||
@ -506,6 +513,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
|
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
|
||||||
else:
|
else:
|
||||||
fig = None
|
fig = None
|
||||||
|
fig._tight = True
|
||||||
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig, linecolor)
|
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)
|
||||||
@ -586,6 +594,8 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
# filter and taper data
|
# filter and taper data
|
||||||
trH1_filt = hdat[0].copy()
|
trH1_filt = hdat[0].copy()
|
||||||
trH2_filt = hdat[1].copy()
|
trH2_filt = hdat[1].copy()
|
||||||
|
trH1_filt.detrend(type='demean')
|
||||||
|
trH2_filt.detrend(type='demean')
|
||||||
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
||||||
@ -604,6 +614,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
trH1_filt = hdat[0].copy()
|
trH1_filt = hdat[0].copy()
|
||||||
trH2_filt = hdat[1].copy()
|
trH2_filt = hdat[1].copy()
|
||||||
trH3_filt = hdat[2].copy()
|
trH3_filt = hdat[2].copy()
|
||||||
|
trH1_filt.detrend(type='demean')
|
||||||
|
trH2_filt.detrend(type='demean')
|
||||||
|
trH3_filt.detrend(type='demean')
|
||||||
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
|
||||||
@ -671,6 +684,8 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
if algoS == 'ARH':
|
if algoS == 'ARH':
|
||||||
trH1_filt = hdat[0].copy()
|
trH1_filt = hdat[0].copy()
|
||||||
trH2_filt = hdat[1].copy()
|
trH2_filt = hdat[1].copy()
|
||||||
|
trH1_filt.detrend(type='demean')
|
||||||
|
trH2_filt.detrend(type='demean')
|
||||||
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
||||||
@ -686,6 +701,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
trH1_filt = hdat[0].copy()
|
trH1_filt = hdat[0].copy()
|
||||||
trH2_filt = hdat[1].copy()
|
trH2_filt = hdat[1].copy()
|
||||||
trH3_filt = hdat[2].copy()
|
trH3_filt = hdat[2].copy()
|
||||||
|
trH1_filt.detrend(type='demean')
|
||||||
|
trH2_filt.detrend(type='demean')
|
||||||
|
trH3_filt.detrend(type='demean')
|
||||||
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
||||||
zerophase=False)
|
zerophase=False)
|
||||||
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
|
||||||
@ -709,6 +727,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
else:
|
else:
|
||||||
fig = None
|
fig = None
|
||||||
linecolor = 'k'
|
linecolor = 'k'
|
||||||
|
fig._tight = True
|
||||||
refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS,
|
refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS,
|
||||||
tsmoothS, aicarhpick.getpick(), fig, linecolor)
|
tsmoothS, aicarhpick.getpick(), fig, linecolor)
|
||||||
mpickS = refSpick.getpick()
|
mpickS = refSpick.getpick()
|
||||||
@ -724,6 +743,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
else:
|
else:
|
||||||
fig = None
|
fig = None
|
||||||
linecolor = 'k'
|
linecolor = 'k'
|
||||||
|
fig._tight = True
|
||||||
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
|
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
|
||||||
tsnrh,
|
tsnrh,
|
||||||
mpickS, iplot,
|
mpickS, iplot,
|
||||||
@ -742,6 +762,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
else:
|
else:
|
||||||
fig = None
|
fig = None
|
||||||
linecolor = ''
|
linecolor = ''
|
||||||
|
fig._tight = True
|
||||||
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
|
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
|
||||||
tsnrh,
|
tsnrh,
|
||||||
mpickS, iplot,
|
mpickS, iplot,
|
||||||
@ -859,6 +880,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
else:
|
else:
|
||||||
fig = fig_dict['mainFig']
|
fig = fig_dict['mainFig']
|
||||||
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
|
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
|
||||||
|
fig._tight = True
|
||||||
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)
|
||||||
|
@ -23,6 +23,7 @@ import warnings
|
|||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from scipy.signal import argrelmax
|
||||||
from pylot.core.pick.charfuns import CharacteristicFunction
|
from pylot.core.pick.charfuns import CharacteristicFunction
|
||||||
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
||||||
|
|
||||||
@ -253,8 +254,12 @@ class AICPicker(AutoPicker):
|
|||||||
if len(dataslope) < 1:
|
if len(dataslope) < 1:
|
||||||
print('No data in slope window found!')
|
print('No data in slope window found!')
|
||||||
return
|
return
|
||||||
|
imaxs, = argrelmax(dataslope)
|
||||||
|
if imaxs.size:
|
||||||
|
imax = imaxs[0]
|
||||||
|
else:
|
||||||
imax = np.argmax(dataslope)
|
imax = np.argmax(dataslope)
|
||||||
iislope = islope[0][0:imax+1]
|
iislope = islope[0][0:imax + 1]
|
||||||
if len(iislope) < 2:
|
if len(iislope) < 2:
|
||||||
# calculate slope from initial onset to maximum of AIC function
|
# calculate slope from initial onset to maximum of AIC function
|
||||||
print("AICPicker: Not enough data samples left for slope calculation!")
|
print("AICPicker: Not enough data samples left for slope calculation!")
|
||||||
@ -304,6 +309,7 @@ class AICPicker(AutoPicker):
|
|||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
else:
|
else:
|
||||||
fig = self.fig
|
fig = self.fig
|
||||||
|
fig._tight = True
|
||||||
ax1 = fig.add_subplot(211)
|
ax1 = fig.add_subplot(211)
|
||||||
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
|
||||||
@ -473,6 +479,7 @@ class PragPicker(AutoPicker):
|
|||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
else:
|
else:
|
||||||
fig = self.fig
|
fig = self.fig
|
||||||
|
fig._tight = True
|
||||||
ax = fig.add_subplot(111)
|
ax = fig.add_subplot(111)
|
||||||
ax.plot(Tcfpick, cfipick, color=self._linecolor, linewidth=0.7, 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')
|
||||||
|
@ -616,6 +616,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
|
|||||||
checkedPpicks = []
|
checkedPpicks = []
|
||||||
checkedSpicks = []
|
checkedSpicks = []
|
||||||
checkedSPtimes = []
|
checkedSPtimes = []
|
||||||
|
badstations = []
|
||||||
# calculate deviations from Wadati regression
|
# calculate deviations from Wadati regression
|
||||||
ii = 0
|
ii = 0
|
||||||
ibad = 0
|
ibad = 0
|
||||||
@ -631,6 +632,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
|
|||||||
# # (not used anymore)
|
# # (not used anymore)
|
||||||
# marker = 'badWadatiCheck'
|
# marker = 'badWadatiCheck'
|
||||||
# pickdic[key]['S']['weight'] = 9
|
# pickdic[key]['S']['weight'] = 9
|
||||||
|
badstations.append(key)
|
||||||
ibad += 1
|
ibad += 1
|
||||||
else:
|
else:
|
||||||
marker = 'goodWadatiCheck'
|
marker = 'goodWadatiCheck'
|
||||||
@ -643,6 +645,8 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
|
|||||||
|
|
||||||
pickdic[key]['S']['marked'] = marker
|
pickdic[key]['S']['marked'] = marker
|
||||||
#pickdic[key]['S']['marked'] = marker
|
#pickdic[key]['S']['marked'] = marker
|
||||||
|
print("wadaticheck: the following stations failed the check:")
|
||||||
|
print(badstations)
|
||||||
|
|
||||||
if len(checkedPpicks) >= 3:
|
if len(checkedPpicks) >= 3:
|
||||||
# calculate new slope
|
# calculate new slope
|
||||||
@ -791,6 +795,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)
|
||||||
|
fig._tight = True
|
||||||
ax.plot(t, rms, color=linecolor, linewidth=0.7, 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')
|
||||||
@ -868,6 +873,7 @@ def checkPonsets(pickdic, dttolerance, jackfactor=5, iplot=0, fig_dict=None):
|
|||||||
print("checkPonsets: %d pick(s) deviate too much from median!" % len(ibad))
|
print("checkPonsets: %d pick(s) deviate too much from median!" % len(ibad))
|
||||||
print("checkPonsets: Skipped %d P pick(s) out of %d" % (len(badstations) \
|
print("checkPonsets: Skipped %d P pick(s) out of %d" % (len(badstations) \
|
||||||
+ len(badjkstations), len(stations)))
|
+ len(badjkstations), len(stations)))
|
||||||
|
print(badstations)
|
||||||
|
|
||||||
goodmarker = 'goodPonsetcheck'
|
goodmarker = 'goodPonsetcheck'
|
||||||
badmarker = 'badPonsetcheck'
|
badmarker = 'badPonsetcheck'
|
||||||
@ -1114,6 +1120,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'):
|
|||||||
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
||||||
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)
|
||||||
|
fig._tight = True
|
||||||
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=linecolor, linewidth=0.7)
|
ax.plot(t, trace.data, color=linecolor, linewidth=0.7)
|
||||||
name = str(trace.stats.channel) + ': {}'.format(rms)
|
name = str(trace.stats.channel) + ': {}'.format(rms)
|
||||||
|
@ -2469,6 +2469,12 @@ class TuneAutopicker(QWidget):
|
|||||||
# self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
|
# self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
|
||||||
# self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
|
# self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
|
||||||
|
|
||||||
|
def set_fig_dict(self, fig_dict):
|
||||||
|
for key, value in fig_dict.items():
|
||||||
|
if key is not 'mainFig':
|
||||||
|
value._tight = True
|
||||||
|
self.fig_dict = fig_dict
|
||||||
|
|
||||||
def init_main_layouts(self):
|
def init_main_layouts(self):
|
||||||
self.main_layout = QtGui.QVBoxLayout()
|
self.main_layout = QtGui.QVBoxLayout()
|
||||||
self.tune_layout = QtGui.QHBoxLayout()
|
self.tune_layout = QtGui.QHBoxLayout()
|
||||||
|
Loading…
Reference in New Issue
Block a user