[Bugfix] Control figure output of autoPyLoT via optional input argument iplot.

This commit is contained in:
Ludger Küperkoch 2017-08-09 13:17:54 +02:00
parent de5392ac33
commit 87b617b924
3 changed files with 57 additions and 9 deletions

View File

@ -756,9 +756,17 @@ def autopickstation(wfstream, pickparam, verbose=False,
'bad P onset, skipping S picking!')
##############################################################
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
if iplot > 0:
# plot vertical trace
if not fig_dict:
if fig_dict == None or fig_dict == 'None':
fig = plt.figure()
plt_flag = 1
else:

View File

@ -155,6 +155,14 @@ class AICPicker(AutoPicker):
self.slope = None
self.SNR = None
plt_flag = 0
try:
iplot = int(self.iplot)
except:
if self.iplot == True or self.iplot == 'True':
iplot = 2
else:
iplot = 0
# find NaN's
nn = np.isnan(self.cf)
if len(nn) > 1:
@ -243,7 +251,7 @@ class AICPicker(AutoPicker):
print("AICPicker: Maximum for slope determination right at the beginning of the window!")
print("Choose longer slope determination window!")
if self.iplot > 1:
if not self.fig:
if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.iplot) ### WHY? MP MP
plt_flag = 1
else:
@ -276,8 +284,8 @@ class AICPicker(AutoPicker):
self.SNR = None
self.slope = None
if self.iplot > 1:
if not self.fig:
if iplot > 1:
if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.iplot)
plt_flag = 1
else:
@ -338,6 +346,14 @@ class PragPicker(AutoPicker):
def calcPick(self):
try:
iplot = int(self.getiplot())
except:
if self.getiplot() == True or self.getiplot() == 'True':
iplot = 2
else:
iplot = 0
if self.getpick1() is not None:
print('PragPicker: Get most likely pick from HOS- or AR-CF using pragmatic picking algorithm ...')
@ -421,8 +437,8 @@ class PragPicker(AutoPicker):
self.Pick = None
pickflag = 0
if self.getiplot() > 1:
if not self.fig:
if iplot > 1:
if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.getiplot())
plt_flag = 1
else:

View File

@ -51,6 +51,14 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
EPick = None
PickError = None
plt_flag = 0
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
if verbosity:
print('earllatepicker: Get earliest and latest possible pick'
' relative to most likely pick ...')
@ -119,7 +127,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
PickError = symmetrize_error(diffti_te, diffti_tl)
if iplot > 1:
if not fig:
if fig == None or fig == 'None':
fig = plt.figure() # iplot)
plt_flag = 1
ax = fig.add_subplot(111)
@ -174,6 +182,14 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
'''
plt_flag = 0
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
warnings.simplefilter('ignore', np.RankWarning)
assert isinstance(Xraw, Stream), "%s is not a stream object" % str(Xraw)
@ -297,7 +313,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
print("fmpicker: Found polarity %s" % FM)
if iplot > 1:
if not fig:
if fig == None or fig == 'None':
fig = plt.figure() # iplot)
plt_flag = 1
ax1 = fig.add_subplot(211)
@ -698,6 +714,14 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
'''
plt_flag = 0
try:
iplot = int(self.iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
assert isinstance(X, Stream), "%s is not a stream object" % str(X)
print("Checking signal length ...")
@ -740,7 +764,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
returnflag = 0
if iplot > 1:
if not fig:
if fig == None or fig == 'None':
fig = plt.figure() # iplot)
plt_flag = 1
ax = fig.add_subplot(111)