clean-up to meet coding conventions

This commit is contained in:
Sebastian Wehling-Benatelli 2015-06-29 16:14:11 +02:00
parent a46fb88282
commit 0fcd6fab9d

View File

@ -14,6 +14,8 @@ import matplotlib.pyplot as plt
from obspy.core import Stream, UTCDateTime
import warnings
import pdb
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
'''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
@ -471,7 +473,6 @@ def wadaticheck(pickdic, dttolerance, iplot):
Spicks.append(UTCSpick.timestamp)
SPtimes.append(spt)
if len(SPtimes) >= 3:
# calculate slope
p1 = np.polyfit(Ppicks, SPtimes, 1)
@ -503,7 +504,8 @@ def wadaticheck(pickdic, dttolerance, iplot):
checkedPpicks.append(checkedPpick.timestamp)
checkedSpick = UTCDateTime(pickdic[key]['S']['mpp'])
checkedSpicks.append(checkedSpick.timestamp)
checkedSPtime = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
checkedSPtime = pickdic[key]['S']['mpp'] - \
pickdic[key]['P']['mpp']
checkedSPtimes.append(checkedSPtime)
pickdic[key]['S']['marked'] = marker
@ -538,7 +540,8 @@ def wadaticheck(pickdic, dttolerance, iplot):
plt.title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
plt.legend([f1, f2, f3, f4], ['Skipped S-Picks', 'Wadati 1', \
'Reliable S-Picks', 'Wadati 2'], loc='best')
'Reliable S-Picks', 'Wadati 2'],
loc='best')
else:
plt.title('Wadati-Diagram, %d S-P Times' % len(SPtimes))
@ -623,7 +626,8 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot):
[minsiglevel, minsiglevel], 'g')
p5, = plt.plot([pick, pick], [min(x), max(x)], 'b', linewidth=2)
plt.legend([p1, p2, p3, p4, p5], ['Data', 'Envelope Noise Window', \
'Envelope Signal Window', 'Minimum Signal Level', \
'Envelope Signal Window',
'Minimum Signal Level', \
'Onset'], loc='best')
plt.xlabel('Time [s] since %s' % X[0].stats.starttime)
plt.ylabel('Counts')
@ -686,7 +690,8 @@ def checkPonsets(pickdic, dttolerance, iplot):
badstations = np.array(stations)[ibad]
print 'checkPonset: Skipped %d P onsets out of %d' % (len(badstations) \
+ len(badjkstations), len(stations))
+ len(badjkstations),
len(stations))
goodmarker = 'goodPonsetcheck'
badmarker = 'badPonsetcheck'
@ -726,6 +731,7 @@ def checkPonsets(pickdic, dttolerance, iplot):
return checkedonsets
def jackknife(X, phi, h):
'''
Function to calculate the Jackknife Estimator for a given quantity,
@ -790,7 +796,7 @@ def jackknife(X, phi, h):
return PHI_jack, PHI_pseudo, PHI_sub
if __name__ == '__main__':
import doctest
doctest.testmod()