Merge branch 'develop' of ariadne.geophysik.rub.de:/data/git/pylot into develop

Merge necessary after commit before pull.
This commit is contained in:
Ludger Küperkoch 2015-06-23 12:02:51 +02:00
commit c35dd456fe

View File

@ -324,6 +324,9 @@ def getSNR(X, TSNR, t1):
print 'getSNR: Empty array isignal, check signal window!' print 'getSNR: Empty array isignal, check signal window!'
return return
# demean over entire snr window
x -= x[inoise[0]:isignal[-1]].mean()
# calculate ratios # calculate ratios
noiselevel = np.sqrt(np.mean(np.square(x[inoise]))) noiselevel = np.sqrt(np.mean(np.square(x[inoise])))
signallevel = np.sqrt(np.mean(np.square(x[isignal]))) signallevel = np.sqrt(np.mean(np.square(x[isignal])))
@ -352,9 +355,8 @@ def getnoisewin(t, t1, tnoise, tgap):
:type: float :type: float
''' '''
inoise = None
# get noise window # get noise window
inoise = np.where((t <= max([t1 - tgap, 0])) \ inoise, = np.where((t <= max([t1 - tgap, 0])) \
& (t >= max([t1 - tnoise - tgap, 0]))) & (t >= max([t1 - tnoise - tgap, 0])))
if np.size(inoise) < 1: if np.size(inoise) < 1:
print 'getnoisewin: Empty array inoise, check noise window!' print 'getnoisewin: Empty array inoise, check noise window!'
@ -377,9 +379,8 @@ def getsignalwin(t, t1, tsignal):
:type: float :type: float
''' '''
inoise = None
# get signal window # get signal window
isignal = np.where((t <= min([t1 + tsignal, len(t)])) \ isignal, = np.where((t <= min([t1 + tsignal, len(t)])) \
& (t >= t1)) & (t >= t1))
if np.size(isignal) < 1: if np.size(isignal) < 1:
print 'getsignalwin: Empty array isignal, check signal window!' print 'getsignalwin: Empty array isignal, check signal window!'
@ -395,8 +396,8 @@ def wadaticheck(pickdic, dttolerance, iplot):
: param: pickdic, dictionary containing picks and quality parameters : param: pickdic, dictionary containing picks and quality parameters
: type: dictionary : type: dictionary
: param: dttolerance, maximum adjusted deviation of S-P time from : param: dttolerance, maximum adjusted deviation of S-P time from
S-P time regression S-P time regression
: type: float : type: float
@ -425,15 +426,15 @@ def wadaticheck(pickdic, dttolerance, iplot):
if len(SPtimes) >= 3: if len(SPtimes) >= 3:
# calculate slope # calculate slope
p1 = np.polyfit(Ppicks, SPtimes, 1) p1 = np.polyfit(Ppicks, SPtimes, 1)
wdfit = np.polyval(p1, Ppicks) wdfit = np.polyval(p1, Ppicks)
wfitflag = 0 wfitflag = 0
# calculate vp/vs ratio before check # calculate vp/vs ratio before check
vpvsr = p1[0] + 1 vpvsr = p1[0] + 1
print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr print 'wadaticheck: Average Vp/Vs ratio before check:', vpvsr
checkedPpicks = [] checkedPpicks = []
checkedSpicks = [] checkedSpicks = []
checkedSPtimes = [] checkedSPtimes = []
@ -445,7 +446,7 @@ def wadaticheck(pickdic, dttolerance, iplot):
ii += 1 ii += 1
# check, if deviation is larger than adjusted # check, if deviation is larger than adjusted
if wddiff >= dttolerance: if wddiff >= dttolerance:
# mark onset and downgrade S-weight to 9 # mark onset and downgrade S-weight to 9
# (not used anymore) # (not used anymore)
marker = 'badWadatiCheck' marker = 'badWadatiCheck'
pickdic[key]['S']['weight'] = 9 pickdic[key]['S']['weight'] = 9
@ -461,7 +462,7 @@ def wadaticheck(pickdic, dttolerance, iplot):
pickdic[key]['S']['marked'] = marker pickdic[key]['S']['marked'] = marker
# calculate new slope # calculate new slope
p2 = np.polyfit(checkedPpicks, checkedSPtimes, 1) p2 = np.polyfit(checkedPpicks, checkedSPtimes, 1)
wdfit2 = np.polyval(p2, checkedPpicks) wdfit2 = np.polyval(p2, checkedPpicks)
@ -470,7 +471,7 @@ def wadaticheck(pickdic, dttolerance, iplot):
print 'wadaticheck: Average Vp/Vs ratio after check:', cvpvsr print 'wadaticheck: Average Vp/Vs ratio after check:', cvpvsr
checkedonsets = pickdic checkedonsets = pickdic
else: else:
print 'wadaticheck: Not enough S-P times available for reliable regression!' print 'wadaticheck: Not enough S-P times available for reliable regression!'
print 'Skip wadati check!' print 'Skip wadati check!'