[rename] real_Bool/real_None -> get_Bool/get_None

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

View File

@ -77,7 +77,7 @@ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, make_pen, pick_color_plt, \
pick_linestyle_plt, identifyPhaseID, excludeQualityClasses, \
transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
check_all_pylot, real_Bool, SetChannelComponents
check_all_pylot, get_Bool, SetChannelComponents
from pylot.core.util.event import Event
from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
@ -2137,7 +2137,7 @@ class MainWindow(QMainWindow):
# wfst += self.get_data().getWFData().select(component=alter_comp)
plotWidget = self.getPlotWidget()
self.adjustPlotHeight()
if real_Bool(settings.value('large_dataset')) == True:
if get_Bool(settings.value('large_dataset')) == True:
self.plot_method = 'fast'
else:
self.plot_method = 'normal'

View File

@ -27,7 +27,7 @@ from pylot.core.util.dataprocessing import restitute_data, Metadata
from pylot.core.util.defaults import SEPARATOR
from pylot.core.util.event import Event
from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.utils import real_None, trim_station_components, check4gaps, check4doubled, \
from pylot.core.util.utils import get_None, trim_station_components, check4gaps, check4doubled, \
check4rotated
from pylot.core.util.version import get_git_version as _getVersionString
@ -89,9 +89,9 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
sp=sp_info)
print(splash)
parameter = real_None(parameter)
inputfile = real_None(inputfile)
eventid = real_None(eventid)
parameter = get_None(parameter)
inputfile = get_None(inputfile)
eventid = get_None(eventid)
fig_dict = None
fig_dict_wadatijack = None
@ -152,7 +152,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
datastructure.setExpandFields(exf)
# check if default location routine NLLoc is available and all stations are used
if real_None(parameter['nllocbin']) and station == 'all':
if get_None(parameter['nllocbin']) and station == 'all':
locflag = 1
# get NLLoc-root path
nllocroot = parameter.get('nllocroot')

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')