[edit] decreased unwanted verbosity

This commit is contained in:
Sebastian Wehling-Benatelli 2016-05-20 10:11:40 +02:00
parent 54b557930f
commit 08df7c3304
3 changed files with 12 additions and 9 deletions

View File

@ -331,7 +331,7 @@ class SeismicShot(object):
self.picks[traceID]['spe']) = earllatepicker(self.getSingleStream(traceID), self.picks[traceID]['spe']) = earllatepicker(self.getSingleStream(traceID),
nfac, (tnoise, tgap, tsignal), nfac, (tnoise, tgap, tsignal),
self.getPickIncludeRemoved(traceID), self.getPickIncludeRemoved(traceID),
stealthMode=True) stealth_mode=True)
if self.picks[traceID]['epp'] < 0: if self.picks[traceID]['epp'] < 0:
self.picks[traceID]['epp'] self.picks[traceID]['epp']

View File

@ -343,7 +343,7 @@ def reassess_pilot_event(root_dir, event_id, out_dir=None, fn_param=None, verbos
default.get('tsnrz' if phase == 'P' else 'tsnrh'), default.get('tsnrz' if phase == 'P' else 'tsnrh'),
Pick1=rel_pick, Pick1=rel_pick,
iplot=None, iplot=None,
stealthMode=True) stealth_mode=True)
if epp is None or lpp is None: if epp is None or lpp is None:
continue continue
epp = stime + epp epp = stime + epp

View File

@ -16,7 +16,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime from obspy.core import Stream, UTCDateTime
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode=False): def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealth_mode=False):
''' '''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009) Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level, as reasonable uncertainties. Latest possible pick is based on noise level,
@ -45,8 +45,9 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode=False):
LPick = None LPick = None
EPick = None EPick = None
PickError = None PickError = None
if stealthMode is False: if stealth_mode is False:
print 'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...' print('earllatepicker: Get earliest and latest possible pick'
' relative to most likely pick ...')
x = X[0].data x = X[0].data
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate, t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
@ -62,8 +63,9 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode=False):
ilup, = np.where(x[isignal] > nlevel) ilup, = np.where(x[isignal] > nlevel)
ildown, = np.where(x[isignal] < -nlevel) ildown, = np.where(x[isignal] < -nlevel)
if not ilup.size and not ildown.size: if not ilup.size and not ildown.size:
print ("earllatepicker: Signal lower than noise level!") if stealth_mode is False:
print ("Skip this trace!") print ("earllatepicker: Signal lower than noise level!\n"
"Skip this trace!")
return LPick, EPick, PickError return LPick, EPick, PickError
il = min(np.min(ilup) if ilup.size else float('inf'), il = min(np.min(ilup) if ilup.size else float('inf'),
np.min(ildown) if ildown.size else float('inf')) np.min(ildown) if ildown.size else float('inf'))
@ -78,7 +80,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode=False):
# if EPick stays NaN the signal window size will be doubled # if EPick stays NaN the signal window size will be doubled
while np.isnan(EPick): while np.isnan(EPick):
if count > 0: if count > 0:
if stealthMode is False: if stealth_mode is False:
print("\nearllatepicker: Doubled signal window size %s time(s) " print("\nearllatepicker: Doubled signal window size %s time(s) "
"because of NaN for earliest pick." % count) "because of NaN for earliest pick." % count)
isigDoubleWinStart = pis[-1] + 1 isigDoubleWinStart = pis[-1] + 1
@ -87,7 +89,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode=False):
if (isigDoubleWinStart + len(pis)) < X[0].data.size: if (isigDoubleWinStart + len(pis)) < X[0].data.size:
pis = np.concatenate((pis, isignalDoubleWin)) pis = np.concatenate((pis, isignalDoubleWin))
else: else:
print("Could not double signal window. Index out of bounds.") if stealth_mode is False:
print("Could not double signal window. Index out of bounds.")
break break
count += 1 count += 1
# determine all zero crossings in signal window (demeaned) # determine all zero crossings in signal window (demeaned)