[rename] real_Bool/real_None -> get_Bool/get_None
This commit is contained in:
parent
2687d6cdef
commit
2d775fa1b9
4
PyLoT.py
4
PyLoT.py
@ -77,7 +77,7 @@ from pylot.core.util.utils import fnConstructor, getLogin, \
|
|||||||
full_range, readFilterInformation, make_pen, pick_color_plt, \
|
full_range, readFilterInformation, make_pen, pick_color_plt, \
|
||||||
pick_linestyle_plt, identifyPhaseID, excludeQualityClasses, \
|
pick_linestyle_plt, identifyPhaseID, excludeQualityClasses, \
|
||||||
transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
|
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.util.event import Event
|
||||||
from pylot.core.io.location import create_creation_info, create_event
|
from pylot.core.io.location import create_creation_info, create_event
|
||||||
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
||||||
@ -2137,7 +2137,7 @@ class MainWindow(QMainWindow):
|
|||||||
# wfst += self.get_data().getWFData().select(component=alter_comp)
|
# wfst += self.get_data().getWFData().select(component=alter_comp)
|
||||||
plotWidget = self.getPlotWidget()
|
plotWidget = self.getPlotWidget()
|
||||||
self.adjustPlotHeight()
|
self.adjustPlotHeight()
|
||||||
if real_Bool(settings.value('large_dataset')) == True:
|
if get_Bool(settings.value('large_dataset')) == True:
|
||||||
self.plot_method = 'fast'
|
self.plot_method = 'fast'
|
||||||
else:
|
else:
|
||||||
self.plot_method = 'normal'
|
self.plot_method = 'normal'
|
||||||
|
10
autoPyLoT.py
10
autoPyLoT.py
@ -27,7 +27,7 @@ from pylot.core.util.dataprocessing import restitute_data, Metadata
|
|||||||
from pylot.core.util.defaults import SEPARATOR
|
from pylot.core.util.defaults import SEPARATOR
|
||||||
from pylot.core.util.event import Event
|
from pylot.core.util.event import Event
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
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
|
check4rotated
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
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)
|
sp=sp_info)
|
||||||
print(splash)
|
print(splash)
|
||||||
|
|
||||||
parameter = real_None(parameter)
|
parameter = get_None(parameter)
|
||||||
inputfile = real_None(inputfile)
|
inputfile = get_None(inputfile)
|
||||||
eventid = real_None(eventid)
|
eventid = get_None(eventid)
|
||||||
|
|
||||||
fig_dict = None
|
fig_dict = None
|
||||||
fig_dict_wadatijack = None
|
fig_dict_wadatijack = None
|
||||||
@ -152,7 +152,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
|||||||
datastructure.setExpandFields(exf)
|
datastructure.setExpandFields(exf)
|
||||||
|
|
||||||
# check if default location routine NLLoc is available and all stations are used
|
# 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
|
locflag = 1
|
||||||
# get NLLoc-root path
|
# get NLLoc-root path
|
||||||
nllocroot = parameter.get('nllocroot')
|
nllocroot = parameter.get('nllocroot')
|
||||||
|
@ -20,7 +20,7 @@ from pylot.core.pick.picker import AICPicker, PragPicker
|
|||||||
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
|
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
|
||||||
getSNR, fmpicker, checkPonsets, wadaticheck, get_pickparams, get_quality_class
|
getSNR, fmpicker, checkPonsets, wadaticheck, get_pickparams, get_quality_class
|
||||||
from pylot.core.util.utils import getPatternLine, gen_Pool,\
|
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.taup import TauPyModel
|
||||||
from obspy import Trace
|
from obspy import Trace
|
||||||
@ -272,7 +272,7 @@ class AutopickStation(object):
|
|||||||
self.pickparams = copy.deepcopy(pickparam)
|
self.pickparams = copy.deepcopy(pickparam)
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
self.iplot = correct_iplot(iplot)
|
self.iplot = correct_iplot(iplot)
|
||||||
self.fig_dict = real_None(fig_dict)
|
self.fig_dict = get_None(fig_dict)
|
||||||
self.metadata = metadata
|
self.metadata = metadata
|
||||||
self.origin = origin
|
self.origin = origin
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ class AutopickStation(object):
|
|||||||
# save filtered trace in instance for later plotting
|
# save filtered trace in instance for later plotting
|
||||||
self.tr_filt_z_bpz2 = tr_filt
|
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
|
Lc = np.inf
|
||||||
try:
|
try:
|
||||||
# modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing
|
# modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing
|
||||||
|
@ -13,7 +13,7 @@ import numpy as np
|
|||||||
from scipy.signal import argrelmax
|
from scipy.signal import argrelmax
|
||||||
from obspy.core import Stream, UTCDateTime
|
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'):
|
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:
|
try:
|
||||||
iplot = int(iplot)
|
iplot = int(iplot)
|
||||||
except:
|
except:
|
||||||
if real_Bool(iplot):
|
if get_Bool(iplot):
|
||||||
iplot = 2
|
iplot = 2
|
||||||
else:
|
else:
|
||||||
iplot = 0
|
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)
|
PickError = symmetrize_error(diffti_te, diffti_tl)
|
||||||
|
|
||||||
if iplot > 1:
|
if iplot > 1:
|
||||||
if real_None(fig) is None:
|
if get_None(fig) is None:
|
||||||
fig = plt.figure() # iplot)
|
fig = plt.figure() # iplot)
|
||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
fig._tight = True
|
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)
|
print("fmpicker: Found polarity %s" % FM)
|
||||||
|
|
||||||
if iplot > 1:
|
if iplot > 1:
|
||||||
if real_None(fig) is None:
|
if get_None(fig) is None:
|
||||||
fig = plt.figure() # iplot)
|
fig = plt.figure() # iplot)
|
||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
fig._tight = True
|
fig._tight = True
|
||||||
@ -800,7 +800,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
|
|||||||
try:
|
try:
|
||||||
iplot = int(iplot)
|
iplot = int(iplot)
|
||||||
except:
|
except:
|
||||||
if real_Bool(iplot):
|
if get_Bool(iplot):
|
||||||
iplot = 2
|
iplot = 2
|
||||||
else:
|
else:
|
||||||
iplot = 0
|
iplot = 0
|
||||||
@ -852,7 +852,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
|
|||||||
returnflag = 0
|
returnflag = 0
|
||||||
|
|
||||||
if iplot > 1:
|
if iplot > 1:
|
||||||
if real_None(fig) is None:
|
if get_None(fig) is None:
|
||||||
fig = plt.figure() # iplot)
|
fig = plt.figure() # iplot)
|
||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
fig._tight = True
|
fig._tight = True
|
||||||
@ -1114,7 +1114,7 @@ def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'):
|
|||||||
try:
|
try:
|
||||||
iplot = int(iplot)
|
iplot = int(iplot)
|
||||||
except:
|
except:
|
||||||
if real_Bool(iplot):
|
if get_Bool(iplot):
|
||||||
iplot = 2
|
iplot = 2
|
||||||
else:
|
else:
|
||||||
iplot = 0
|
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],
|
t = np.linspace(diff_dict[key], trace.stats.endtime - trace.stats.starttime + diff_dict[key],
|
||||||
trace.stats.npts)
|
trace.stats.npts)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
if real_None(fig) is None:
|
if get_None(fig) is None:
|
||||||
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
ax1 = fig.add_subplot(3, 1, i + 1)
|
ax1 = fig.add_subplot(3, 1, i + 1)
|
||||||
ax = ax1
|
ax = ax1
|
||||||
ax.set_title('CheckZ4S, Station %s' % zdat[0].stats.station)
|
ax.set_title('CheckZ4S, Station %s' % zdat[0].stats.station)
|
||||||
else:
|
else:
|
||||||
if real_None(fig) is None:
|
if get_None(fig) is None:
|
||||||
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
fig = plt.figure() # self.iplot) ### WHY? MP MP
|
||||||
plt_flag = 1
|
plt_flag = 1
|
||||||
ax = fig.add_subplot(3, 1, i + 1, sharex=ax1)
|
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))
|
first_motion_params = dict(zip(first_motion_names, fm_parameter_values))
|
||||||
signal_length_params = dict(zip(signal_length_names, sl_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
|
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
|
# set initial quality to 4 (worst) and change only if one condition is hit
|
||||||
quality = 4
|
quality = 4
|
||||||
|
|
||||||
if real_None(uncertainty) is None:
|
if get_None(uncertainty) is None:
|
||||||
return quality
|
return quality
|
||||||
|
|
||||||
if uncertainty <= Errors[0]:
|
if uncertainty <= Errors[0]:
|
||||||
|
@ -315,7 +315,7 @@ def fnConstructor(s):
|
|||||||
return fn
|
return fn
|
||||||
|
|
||||||
|
|
||||||
def real_None(value):
|
def get_None(value):
|
||||||
"""
|
"""
|
||||||
Convert "None" to None
|
Convert "None" to None
|
||||||
:param value:
|
:param value:
|
||||||
@ -329,7 +329,7 @@ def real_None(value):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def real_Bool(value):
|
def get_Bool(value):
|
||||||
"""
|
"""
|
||||||
Convert string representations of bools to their true boolean value
|
Convert string representations of bools to their true boolean value
|
||||||
:param value:
|
:param value:
|
||||||
@ -1231,7 +1231,7 @@ def correct_iplot(iplot):
|
|||||||
try:
|
try:
|
||||||
iplot = int(iplot)
|
iplot = int(iplot)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if real_Bool(iplot):
|
if get_Bool(iplot):
|
||||||
iplot = 2
|
iplot = 2
|
||||||
else:
|
else:
|
||||||
iplot = 0
|
iplot = 0
|
||||||
|
@ -51,7 +51,7 @@ from pylot.core.util.utils import prepTimeAxis, full_range, demeanTrace, isSorte
|
|||||||
pick_linestyle_plt, pick_color_plt, \
|
pick_linestyle_plt, pick_color_plt, \
|
||||||
check4rotated, check4doubled, merge_stream, identifyPhase, \
|
check4rotated, check4doubled, merge_stream, identifyPhase, \
|
||||||
loopIdentifyPhase, trim_station_components, transformFilteroptions2String, \
|
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 autoPyLoT import autoPyLoT
|
||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
from pylot.core.util.dataprocessing import Metadata
|
from pylot.core.util.dataprocessing import Metadata
|
||||||
@ -1812,7 +1812,7 @@ class PickDlg(QDialog):
|
|||||||
self.sChannels.triggered.connect(self.updateChannelSettingsS)
|
self.sChannels.triggered.connect(self.updateChannelSettingsS)
|
||||||
|
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
self.autoFilterAction.setChecked(real_Bool(settings.value('autoFilter')))
|
self.autoFilterAction.setChecked(get_Bool(settings.value('autoFilter')))
|
||||||
|
|
||||||
# create other widget elements
|
# create other widget elements
|
||||||
phaseitems = [None] + list(FILTERDEFAULTS.keys())
|
phaseitems = [None] + list(FILTERDEFAULTS.keys())
|
||||||
@ -2287,7 +2287,7 @@ class PickDlg(QDialog):
|
|||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
phaseID = self.getPhaseID(phase)
|
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]
|
filteroptions = self.filteroptions[phaseID]
|
||||||
else:
|
else:
|
||||||
filteroptions = getAutoFilteroptions(phaseID, self.parameter)
|
filteroptions = getAutoFilteroptions(phaseID, self.parameter)
|
||||||
@ -2938,7 +2938,7 @@ class PickDlg(QDialog):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def getChannelSettingsP(channel):
|
def getChannelSettingsP(channel):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
rval = real_Bool(settings.value('p_channel_{}'.format(channel)))
|
rval = get_Bool(settings.value('p_channel_{}'.format(channel)))
|
||||||
compclass = settings.value('compclass')
|
compclass = settings.value('compclass')
|
||||||
components = ['Z']
|
components = ['Z']
|
||||||
for component in components[:]:
|
for component in components[:]:
|
||||||
@ -2953,7 +2953,7 @@ class PickDlg(QDialog):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def getChannelSettingsS(channel):
|
def getChannelSettingsS(channel):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
rval = real_Bool(settings.value('s_channel_{}'.format(channel)))
|
rval = get_Bool(settings.value('s_channel_{}'.format(channel)))
|
||||||
compclass = settings.value('compclass')
|
compclass = settings.value('compclass')
|
||||||
components = ['N', 'E']
|
components = ['N', 'E']
|
||||||
for component in components[:]:
|
for component in components[:]:
|
||||||
@ -5068,7 +5068,7 @@ class FilterOptionsDialog(QDialog):
|
|||||||
'S': QtGui.QGroupBox('S Filter')}
|
'S': QtGui.QGroupBox('S Filter')}
|
||||||
|
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
overwriteFilter = real_Bool(settings.value('useGuiFilter'))
|
overwriteFilter = get_Bool(settings.value('useGuiFilter'))
|
||||||
|
|
||||||
self.overwriteFilterCheckbox = QCheckBox('Overwrite filteroptions')
|
self.overwriteFilterCheckbox = QCheckBox('Overwrite filteroptions')
|
||||||
self.overwriteFilterCheckbox.setToolTip('Overwrite filter settings for refined pick with GUI settings')
|
self.overwriteFilterCheckbox.setToolTip('Overwrite filter settings for refined pick with GUI settings')
|
||||||
|
Loading…
Reference in New Issue
Block a user