[rename] real_Bool/real_None -> get_Bool/get_None

This commit is contained in:
2019-06-24 15:04:40 +02:00
parent 2687d6cdef
commit 2d775fa1b9
6 changed files with 30 additions and 30 deletions

View File

@@ -20,7 +20,7 @@ from pylot.core.pick.picker import AICPicker, PragPicker
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
getSNR, fmpicker, checkPonsets, wadaticheck, get_pickparams, get_quality_class
from pylot.core.util.utils import getPatternLine, gen_Pool,\
real_Bool, identifyPhaseID, real_None, correct_iplot
get_Bool, identifyPhaseID, get_None, correct_iplot
from obspy.taup import TauPyModel
from obspy import Trace
@@ -272,7 +272,7 @@ class AutopickStation(object):
self.pickparams = copy.deepcopy(pickparam)
self.verbose = verbose
self.iplot = correct_iplot(iplot)
self.fig_dict = real_None(fig_dict)
self.fig_dict = get_None(fig_dict)
self.metadata = metadata
self.origin = origin
@@ -779,7 +779,7 @@ class AutopickStation(object):
# save filtered trace in instance for later plotting
self.tr_filt_z_bpz2 = tr_filt
if real_Bool(self.pickparams['use_taup']) is True and self.origin is not None:
if get_Bool(self.pickparams['use_taup']) is True and self.origin is not None:
Lc = np.inf
try:
# modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing

View File

@@ -13,7 +13,7 @@ import numpy as np
from scipy.signal import argrelmax
from obspy.core import Stream, UTCDateTime
from pylot.core.util.utils import real_Bool, real_None, SetChannelComponents
from pylot.core.util.utils import get_Bool, get_None, SetChannelComponents
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecolor='k'):
@@ -61,7 +61,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol
try:
iplot = int(iplot)
except:
if real_Bool(iplot):
if get_Bool(iplot):
iplot = 2
else:
iplot = 0
@@ -134,7 +134,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol
PickError = symmetrize_error(diffti_te, diffti_tl)
if iplot > 1:
if real_None(fig) is None:
if get_None(fig) is None:
fig = plt.figure() # iplot)
plt_flag = 1
fig._tight = True
@@ -332,7 +332,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
print("fmpicker: Found polarity %s" % FM)
if iplot > 1:
if real_None(fig) is None:
if get_None(fig) is None:
fig = plt.figure() # iplot)
plt_flag = 1
fig._tight = True
@@ -800,7 +800,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
try:
iplot = int(iplot)
except:
if real_Bool(iplot):
if get_Bool(iplot):
iplot = 2
else:
iplot = 0
@@ -852,7 +852,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
returnflag = 0
if iplot > 1:
if real_None(fig) is None:
if get_None(fig) is None:
fig = plt.figure() # iplot)
plt_flag = 1
fig._tight = True
@@ -1114,7 +1114,7 @@ def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'):
try:
iplot = int(iplot)
except:
if real_Bool(iplot):
if get_Bool(iplot):
iplot = 2
else:
iplot = 0
@@ -1195,14 +1195,14 @@ def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'):
t = np.linspace(diff_dict[key], trace.stats.endtime - trace.stats.starttime + diff_dict[key],
trace.stats.npts)
if i == 0:
if real_None(fig) is None:
if get_None(fig) is None:
fig = plt.figure() # self.iplot) ### WHY? MP MP
plt_flag = 1
ax1 = fig.add_subplot(3, 1, i + 1)
ax = ax1
ax.set_title('CheckZ4S, Station %s' % zdat[0].stats.station)
else:
if real_None(fig) is None:
if get_None(fig) is None:
fig = plt.figure() # self.iplot) ### WHY? MP MP
plt_flag = 1
ax = fig.add_subplot(3, 1, i + 1, sharex=ax1)
@@ -1475,7 +1475,7 @@ def get_pickparams(pickparam):
first_motion_params = dict(zip(first_motion_names, fm_parameter_values))
signal_length_params = dict(zip(signal_length_names, sl_parameter_values))
p_params['use_taup'] = real_Bool(p_params['use_taup'])
p_params['use_taup'] = get_Bool(p_params['use_taup'])
return p_params, s_params, first_motion_params, signal_length_params
@@ -1483,7 +1483,7 @@ def getQualityFromUncertainty(uncertainty, Errors):
# set initial quality to 4 (worst) and change only if one condition is hit
quality = 4
if real_None(uncertainty) is None:
if get_None(uncertainty) is None:
return quality
if uncertainty <= Errors[0]:

View File

@@ -315,7 +315,7 @@ def fnConstructor(s):
return fn
def real_None(value):
def get_None(value):
"""
Convert "None" to None
:param value:
@@ -329,7 +329,7 @@ def real_None(value):
return value
def real_Bool(value):
def get_Bool(value):
"""
Convert string representations of bools to their true boolean value
:param value:
@@ -1231,7 +1231,7 @@ def correct_iplot(iplot):
try:
iplot = int(iplot)
except ValueError:
if real_Bool(iplot):
if get_Bool(iplot):
iplot = 2
else:
iplot = 0

View File

@@ -51,7 +51,7 @@ from pylot.core.util.utils import prepTimeAxis, full_range, demeanTrace, isSorte
pick_linestyle_plt, pick_color_plt, \
check4rotated, check4doubled, merge_stream, identifyPhase, \
loopIdentifyPhase, trim_station_components, transformFilteroptions2String, \
identifyPhaseID, real_Bool, pick_color, getAutoFilteroptions, SetChannelComponents, station_id_remove_channel
identifyPhaseID, get_Bool, pick_color, getAutoFilteroptions, SetChannelComponents, station_id_remove_channel
from autoPyLoT import autoPyLoT
from pylot.core.util.thread import Thread
from pylot.core.util.dataprocessing import Metadata
@@ -1812,7 +1812,7 @@ class PickDlg(QDialog):
self.sChannels.triggered.connect(self.updateChannelSettingsS)
settings = QSettings()
self.autoFilterAction.setChecked(real_Bool(settings.value('autoFilter')))
self.autoFilterAction.setChecked(get_Bool(settings.value('autoFilter')))
# create other widget elements
phaseitems = [None] + list(FILTERDEFAULTS.keys())
@@ -2287,7 +2287,7 @@ class PickDlg(QDialog):
settings = QSettings()
phaseID = self.getPhaseID(phase)
if real_Bool(settings.value('useGuiFilter')) or gui_filter:
if get_Bool(settings.value('useGuiFilter')) or gui_filter:
filteroptions = self.filteroptions[phaseID]
else:
filteroptions = getAutoFilteroptions(phaseID, self.parameter)
@@ -2938,7 +2938,7 @@ class PickDlg(QDialog):
@staticmethod
def getChannelSettingsP(channel):
settings = QSettings()
rval = real_Bool(settings.value('p_channel_{}'.format(channel)))
rval = get_Bool(settings.value('p_channel_{}'.format(channel)))
compclass = settings.value('compclass')
components = ['Z']
for component in components[:]:
@@ -2953,7 +2953,7 @@ class PickDlg(QDialog):
@staticmethod
def getChannelSettingsS(channel):
settings = QSettings()
rval = real_Bool(settings.value('s_channel_{}'.format(channel)))
rval = get_Bool(settings.value('s_channel_{}'.format(channel)))
compclass = settings.value('compclass')
components = ['N', 'E']
for component in components[:]:
@@ -5068,7 +5068,7 @@ class FilterOptionsDialog(QDialog):
'S': QtGui.QGroupBox('S Filter')}
settings = QSettings()
overwriteFilter = real_Bool(settings.value('useGuiFilter'))
overwriteFilter = get_Bool(settings.value('useGuiFilter'))
self.overwriteFilterCheckbox = QCheckBox('Overwrite filteroptions')
self.overwriteFilterCheckbox.setToolTip('Overwrite filter settings for refined pick with GUI settings')