Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop

This commit is contained in:
Marcel Paffrath 2017-08-09 14:16:45 +02:00
commit 5c6f1eb564
4 changed files with 69 additions and 13 deletions

View File

@ -65,8 +65,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
\n
Authors:\n
L. Kueperkoch (BESTEC GmbH, Landau i. d. Pfalz)\n
S. Wehling-Benatelli (Ruhr-Universitaet Bochum)\n
M. Paffrath (Ruhr-Universitaet Bochum)\n
S. Wehling-Benatelli (Ruhr-Universitaet Bochum)\n
{sp}
***********************************'''.format(version=_getVersionString(),
@ -456,7 +456,7 @@ if __name__ == "__main__":
parameters for autoPyLoT''')
parser.add_argument('-p', '-P', '--iplot', type=int,
action='store',
help='''Boolean flag for plotting: 0=none, 1=partial, 2=all''')
help='''optional, logical variable for plotting: 0=none, 1=partial, 2=all''')
parser.add_argument('-f', '-F', '--fnames', type=str,
action='store',
help='''optional, list of data file names''')
@ -468,7 +468,7 @@ if __name__ == "__main__":
help='''optional, save path for autoPyLoT output''')
parser.add_argument('-c', '-C', '--ncores', type=int,
action='store', default=0,
help='''optional, number of CPU cores used for parallel processing (default: all available)''')
help='''optional, number of CPU cores used for parallel processing (default: all available(=0))''')
cla = parser.parse_args()

View File

@ -28,6 +28,14 @@ def autopickevent(data, param, iplot=0, fig_dict=None, ncores=0, metadata=None,
stations = []
all_onsets = {}
input_tuples = []
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
# get some parameters for quality control from
# parameter input file (usually autoPyLoT.in).
@ -44,7 +52,7 @@ def autopickevent(data, param, iplot=0, fig_dict=None, ncores=0, metadata=None,
for station in stations:
topick = data.select(station=station)
if not iplot:
if iplot == None or iplot == 'None' or iplot == 0:
input_tuples.append((topick, param, apverbose, metadata, origin))
if iplot > 0:
all_onsets[station] = autopickstation(topick, param, verbose=apverbose,
@ -756,9 +764,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)