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

View File

@ -591,6 +591,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
Ppicks = [] Ppicks = []
Spicks = [] Spicks = []
SPtimes = [] SPtimes = []
stations = []
for key in list(pickdic.keys()): for key in list(pickdic.keys()):
if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4: if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4:
# calculate S-P time # calculate S-P time
@ -624,6 +625,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
ibad = 0 ibad = 0
for key in list(pickdic.keys()): for key in list(pickdic.keys()):
if 'SPt' in pickdic[key]: if 'SPt' in pickdic[key]:
stations.append(key)
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii]) wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
ii += 1 ii += 1
# check, if deviation is larger than adjusted # check, if deviation is larger than adjusted
@ -684,15 +686,21 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
linecolor = 'k' linecolor = 'k'
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
if ibad > 0:
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, color=linecolor, linewidth=0.7, label='Wadati 1') 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, ax.plot(checkedPpicks, checkedSPtimes, color=linecolor,
linewidth=0, marker='o', label='Reliable S-Picks') 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,' \ 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))
ax.legend(loc=1) ax.legend(loc=1, numpoints=1)
else: else:
ax.set_title('Wadati-Diagram, %d S-P Times' % len(SPtimes)) 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 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(np.arange(0, len(Ppicks)), Ppicks, 'ro', markersize=14) if len(badstations) > 0:
if len(badstations) < 1 and len(badjkstations) < 1: ax.plot(ibad, np.array(Ppicks)[ibad], marker ='o', markerfacecolor='orange', markersize=14,
ax.plot(np.arange(0, len(Ppicks)), Ppicks, 'go', markersize=14, label='Skipped P Picks') linestyle='None', label='Median Skipped P Picks')
else: 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(igood, np.array(Ppicks)[igood], 'go', markersize=14, label='Good P Picks')
ax.plot([0, len(Ppicks) - 1], [pmedian, pmedian], 'g', ax.plot([0, len(Ppicks) - 1], [pmedian, pmedian], 'g', linewidth=2, label='Median')
linewidth=2, label='Median') ax.plot([0, len(Ppicks) - 1], [pmedian + dttolerance, pmedian + dttolerance], 'g--', linewidth=1.2,
for i in range(0, len(Ppicks)): dashes=[25, 25], label='Median Tolerance')
ax.text(i, Ppicks[i] + 0.01, '{0}'.format(stations[i])) 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_xlabel('Number of P Picks')
ax.set_ylabel('Onset Time [s] from 1.1.1970') 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') ax.set_title('Jackknifing and Median Tests on P Onsets')
if plt_flag: if plt_flag:
fig.show() fig.show()

View File

@ -48,7 +48,8 @@ from pylot.core.pick.compare import Comparison
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \ from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \
SetChannelComponents SetChannelComponents
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \ 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 autoPyLoT import autoPyLoT
from pylot.core.util.thread import Thread from pylot.core.util.thread import Thread
@ -1601,6 +1602,7 @@ class PickDlg(QDialog):
return self.station return self.station
def getChannelID(self, key): def getChannelID(self, key):
if key < 0: key = 0
return self.multicompfig.getPlotDict()[int(key)][1] return self.multicompfig.getPlotDict()[int(key)][1]
def getTraceID(self, channels): def getTraceID(self, channels):
@ -2493,6 +2495,7 @@ class TuneAutopicker(QWidget):
def init_stationlist(self): def init_stationlist(self):
self.stationBox = QtGui.QComboBox() self.stationBox = QtGui.QComboBox()
self.stationBox.setMaxVisibleItems(42)
self.trace_layout.addWidget(self.stationBox) self.trace_layout.addWidget(self.stationBox)
self.fill_stationbox() self.fill_stationbox()
self.figure_tabs.setCurrentIndex(0) self.figure_tabs.setCurrentIndex(0)
@ -2507,10 +2510,15 @@ class TuneAutopicker(QWidget):
fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox) fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames) self.data.setWFData(fnames)
wfdat = self.data.getWFData() # all available streams 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 to same start value
trim_station_components(wfdat, trim_start=True, trim_end=False) 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() self.stationBox.clear()
stations = [] stations = []
for trace in self.data.getWFData(): for trace in self.data.getWFData():