Debugging: If no P-Pick was determined, no plot of of horizontal data comes up.

This commit is contained in:
Ludger Küperkoch 2015-06-22 14:59:57 +02:00
parent eb153679ba
commit 99a5a4499a

View File

@ -14,13 +14,12 @@ import numpy as np
from pylot.core.pick.Picker import *
from pylot.core.pick.CharFuns import *
def run_autopicking(wfstream, pickparam):
"""
param: wfstream
:param: wfstream
:type: `~obspy.core.stream.Stream`
param: pickparam
:param: pickparam
:type: container of picking parameters from input file,
usually autoPyLoT.in
"""
@ -95,6 +94,7 @@ def run_autopicking(wfstream, pickparam):
aicSflag = 0
aicPflag = 0
Sflag = 0
# split components
zdat = wfstream.select(component="Z")
@ -218,10 +218,12 @@ def run_autopicking(wfstream, pickparam):
print 'run_autopicking: P-weight: %d, SNR: %f, SNR[dB]: %f, ' \
'Polarity: %s' % (Pweight, SNRP, SNRPdB, FM)
Sflag = 1
else:
print 'Bad initial (AIC) P-pick, skip this onset!'
print 'AIC-SNR=', aicpick.getSNR(), 'AIC-Slope=', aicpick.getSlope()
Sflag = 0
else:
print 'run_autopicking: No vertical component data available, ' \
@ -463,6 +465,7 @@ def run_autopicking(wfstream, pickparam):
plt.ylabel('Normalized Counts')
plt.suptitle(tr_filt.stats.starttime)
if len(edat) > 1 and len(ndat) > 1 and Sflag == 1:
# plot horizontal traces
plt.subplot(3, 1, 2)
th1data = np.arange(0,
@ -557,14 +560,23 @@ def run_autopicking(wfstream, pickparam):
raw_input()
plt.close()
##########################################################################
# calculate "real" onset times
if mpickP is not None:
lpickP = zdat[0].stats.starttime + lpickP
epickP = zdat[0].stats.starttime + epickP
mpickP = zdat[0].stats.starttime + mpickP
if mpickS is not None:
lpickS = edat[0].stats.starttime + lpickS
epickS = edat[0].stats.starttime + epickS
mpickS = edat[0].stats.starttime + mpickS
# create dictionary
# for P phase
phase = 'P'
phasepick = {'lpp': lpickP, 'epp': epickP, 'mpp': mpickP, 'spe': Perror, \
'snr': SNRP, 'snrdb': SNRPdB, 'weight': Pweight, 'fm': FM}
picks = {phase: phasepick}
#stationID = tr_filt.stats.station
#onsets = {stationID: picks}
# add S phase
phase = 'S'
phasepick = {'lpp': lpickS, 'epp': epickS, 'mpp': mpickS, 'spe': Serror, \