Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Marcel Paffrath 2017-09-18 11:24:57 +02:00
commit 8a2bb65581
3 changed files with 45 additions and 23 deletions

View File

@ -222,9 +222,9 @@ class AICcf(CharacteristicFunction):
x = self.getDataArray()
xnp = x[0].data
nn = np.isnan(xnp)
if len(nn) > 1:
xnp[nn] = 0
ind = np.where(~np.isnan(xnp))[0]
if ind.size:
xnp[:ind[0]] = xnp[ind[0]]
datlen = len(xnp)
k = np.arange(1, datlen)
cf = np.zeros(datlen)
@ -335,7 +335,8 @@ class ARZcf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
cf[io] = cf[ino[0][0]]
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf
self.xcf = x
@ -467,7 +468,8 @@ class ARHcf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
cf[io] = cf[ino[0][0]]
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf
self.xcf = xnp
@ -609,7 +611,8 @@ class AR3Ccf(CharacteristicFunction):
cf = tap * cf
io = np.where(cf == 0)
ino = np.where(cf > 0)
cf[io] = cf[ino[0][0]]
if np.size(ino):
cf[io] = cf[ino[0][0]]
self.cf = cf
self.xcf = xnp

View File

@ -591,6 +591,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
Ppicks = []
Spicks = []
SPtimes = []
stations = []
for key in list(pickdic.keys()):
if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4:
# calculate S-P time
@ -624,6 +625,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
ibad = 0
for key in list(pickdic.keys()):
if 'SPt' in pickdic[key]:
stations.append(key)
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
ii += 1
# check, if deviation is larger than adjusted
@ -684,15 +686,21 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
linecolor = 'k'
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if ibad > 0:
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if wfitflag == 0:
ax.plot(Ppicks, wdfit, color=linecolor, linewidth=0.7, label='Wadati 1')
ax.plot(Ppicks, wdfit+dttolerance, color='0.9', linewidth=0.5, label='Wadati 1 Tolerance')
ax.plot(Ppicks, wdfit-dttolerance, color='0.9', linewidth=0.5)
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.plot(checkedPpicks, checkedSPtimes, color=linecolor,
linewidth=0, marker='o', label='Reliable S-Picks')
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
for Ppick, SPtime, station in zip(Ppicks, SPtimes, stations):
ax.text(Ppick, SPtime + 0.01, '{0}'.format(station))
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
ax.legend(loc=1)
ax.legend(loc=1, numpoints=1)
else:
ax.set_title('Wadati-Diagram, %d S-P Times' % len(SPtimes))
@ -911,19 +919,22 @@ def checkPonsets(pickdic, dttolerance, jackfactor=5, iplot=0, fig_dict=None):
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(np.arange(0, len(Ppicks)), Ppicks, 'ro', markersize=14)
if len(badstations) < 1 and len(badjkstations) < 1:
ax.plot(np.arange(0, len(Ppicks)), Ppicks, 'go', markersize=14, label='Skipped P Picks')
else:
ax.plot(igood, np.array(Ppicks)[igood], 'go', markersize=14, label='Good P Picks')
ax.plot([0, len(Ppicks) - 1], [pmedian, pmedian], 'g',
linewidth=2, label='Median')
for i in range(0, len(Ppicks)):
ax.text(i, Ppicks[i] + 0.01, '{0}'.format(stations[i]))
if len(badstations) > 0:
ax.plot(ibad, np.array(Ppicks)[ibad], marker ='o', markerfacecolor='orange', markersize=14,
linestyle='None', label='Median Skipped P Picks')
if len(badjkstations) > 0:
ax.plot(badjk[0], np.array(Ppicks)[badjk], 'ro', markersize=14, label='Jackknife Skipped P Picks')
ax.plot(igood, np.array(Ppicks)[igood], 'go', markersize=14, label='Good P Picks')
ax.plot([0, len(Ppicks) - 1], [pmedian, pmedian], 'g', linewidth=2, label='Median')
ax.plot([0, len(Ppicks) - 1], [pmedian + dttolerance, pmedian + dttolerance], 'g--', linewidth=1.2,
dashes=[25, 25], label='Median Tolerance')
ax.plot([0, len(Ppicks) - 1], [pmedian - dttolerance, pmedian - dttolerance], 'g--', linewidth=1.2,
dashes=[25, 25])
for index, pick in enumerate(Ppicks):
ax.text(index, pick + 0.01, '{0}'.format(stations[i]))
ax.set_xlabel('Number of P Picks')
ax.set_ylabel('Onset Time [s] from 1.1.1970')
ax.legend(loc=1)
ax.legend(loc=1, numpoints=1)
ax.set_title('Jackknifing and Median Tests on P Onsets')
if plt_flag:
fig.show()

View File

@ -48,7 +48,8 @@ from pylot.core.pick.compare import Comparison
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \
SetChannelComponents
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt, \
check4rotated, check4doubled, check4gaps, remove_underscores
from autoPyLoT import autoPyLoT
from pylot.core.util.thread import Thread
@ -1601,6 +1602,7 @@ class PickDlg(QDialog):
return self.station
def getChannelID(self, key):
if key < 0: key = 0
return self.multicompfig.getPlotDict()[int(key)][1]
def getTraceID(self, channels):
@ -2493,6 +2495,7 @@ class TuneAutopicker(QWidget):
def init_stationlist(self):
self.stationBox = QtGui.QComboBox()
self.stationBox.setMaxVisibleItems(42)
self.trace_layout.addWidget(self.stationBox)
self.fill_stationbox()
self.figure_tabs.setCurrentIndex(0)
@ -2507,10 +2510,15 @@ class TuneAutopicker(QWidget):
fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames)
wfdat = self.data.getWFData() # all available streams
# remove possible underscores in station names
wfdat = remove_underscores(wfdat)
# rotate misaligned stations to ZNE
# check for gaps and doubled channels
check4gaps(wfdat)
check4doubled(wfdat)
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
# trim station components to same start value
trim_station_components(wfdat, trim_start=True, trim_end=False)
# rotate misaligned stations to ZNE
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
self.stationBox.clear()
stations = []
for trace in self.data.getWFData():