[Bugfix]: Check for key S and be sure to get element weight for pick
dictionary.
This commit is contained in:
parent
b7795ca562
commit
e64135c7a8
@ -269,6 +269,14 @@ def picksdict_from_picks(evt):
|
||||
msg = str(e) + ',\n falling back to symmetric uncertainties'
|
||||
lpp = mpp + spe
|
||||
epp = mpp - spe
|
||||
warnings.warn(msg)
|
||||
phase['mpp'] = mpp
|
||||
phase['epp'] = epp
|
||||
phase['lpp'] = lpp
|
||||
phase['spe'] = spe
|
||||
try:
|
||||
phase['weight'] = weight
|
||||
except:
|
||||
# get onset weight from uncertainty
|
||||
infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
|
||||
print('Using default input file {}'.format(infile))
|
||||
@ -278,11 +286,6 @@ def picksdict_from_picks(evt):
|
||||
elif pick.phase_hint == 'S':
|
||||
errors = parameter['timeerrorsS']
|
||||
weight = get_quality_class(spe, errors)
|
||||
warnings.warn(msg)
|
||||
phase['mpp'] = mpp
|
||||
phase['epp'] = epp
|
||||
phase['lpp'] = lpp
|
||||
phase['spe'] = spe
|
||||
phase['weight'] = weight
|
||||
phase['channel'] = channel
|
||||
phase['network'] = network
|
||||
@ -782,6 +785,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
|
||||
Ponset = arrivals[key]['P']['mpp']
|
||||
Prt = Ponset - stime # onset time relative to source time
|
||||
fid.write('%s %6.3f 1 P\n' % (key, Prt))
|
||||
if arrivals[key].has_key('S'):
|
||||
# S onsets
|
||||
if arrivals[key]['S']['weight'] < 4:
|
||||
Sonset = arrivals[key]['S']['mpp']
|
||||
|
@ -316,8 +316,13 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
|
||||
islope2 = np.where((t >= Pick) & (t <= Pick + t[imax2]))
|
||||
# calculate slope as polynomal fit of order 1
|
||||
xslope2 = np.arange(0, len(xfilt[islope2]), 1)
|
||||
try:
|
||||
P2 = np.polyfit(xslope2, xfilt[islope2], 1)
|
||||
datafit2 = np.polyval(P2, xslope2)
|
||||
except ValueError as e:
|
||||
emsg = 'fmpicker: polyfit failed: {}'.format(e)
|
||||
print(emsg)
|
||||
return FM
|
||||
|
||||
# compare results
|
||||
if P1 is not None and P2 is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user