Compare commits

..

No commits in common. "486e3dc9c35198fe062716cf508e51fbad8dcad0" and "8d356050d7d0f4974da7fc0250dcbadb100f8ec8" have entirely different histories.

6 changed files with 28 additions and 31 deletions

View File

@ -76,7 +76,7 @@ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, pick_color_plt, \ full_range, readFilterInformation, 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, get_bool, get_None check_all_pylot, get_Bool, get_None
from pylot.core.util.gui import make_pen from pylot.core.util.gui import make_pen
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
@ -508,8 +508,6 @@ class MainWindow(QMainWindow):
logAction = self.createAction(self, "&Show Log", self.showLogWidget, logAction = self.createAction(self, "&Show Log", self.showLogWidget,
tip="""Display Log""") tip="""Display Log""")
logAction.setEnabled(use_logwidget)
# create button group for component selection # create button group for component selection
componentGroup = QActionGroup(self) componentGroup = QActionGroup(self)
@ -2295,7 +2293,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 get_bool(settings.value('large_dataset')): 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'
@ -3745,7 +3743,7 @@ class MainWindow(QMainWindow):
filename = fnm[0] + '.plp' filename = fnm[0] + '.plp'
self.project.parameter = self._inputs self.project.parameter = self._inputs
settings = QSettings() settings = QSettings()
autosaveXML = get_bool(settings.value('autosaveXML', True)) autosaveXML = get_Bool(settings.value('autosaveXML', True))
if autosaveXML: if autosaveXML:
self.exportEvents() self.exportEvents()
if not self.project.save(filename): return False if not self.project.save(filename): return False
@ -3769,7 +3767,7 @@ class MainWindow(QMainWindow):
self.metadata.clear_inventory() self.metadata.clear_inventory()
self.project.parameter = self._inputs self.project.parameter = self._inputs
settings = QSettings() settings = QSettings()
autosaveXML = get_bool(settings.value('autosaveXML', True)) autosaveXML = get_Bool(settings.value('autosaveXML', True))
if autosaveXML: if autosaveXML:
self.exportEvents() self.exportEvents()
if not self.project.save(): return False if not self.project.save(): return False

View File

@ -8,7 +8,7 @@ dependencies:
- numpy=1.22.3 - numpy=1.22.3
- obspy=1.3.0 - obspy=1.3.0
- pyqtgraph=0.12.4 - pyqtgraph=0.12.4
- pyside2>=5.13.2 - pyside2=5.13.2
- python=3.8.12 - python=3.8.12
- qt>=5.12.9 - qt=5.12.9
- scipy=1.8.0 - scipy=1.8.0

View File

@ -22,7 +22,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_quality_class getSNR, fmpicker, checkPonsets, wadaticheck, get_quality_class
from pylot.core.util.utils import getPatternLine, gen_Pool, \ from pylot.core.util.utils import getPatternLine, gen_Pool, \
get_bool, identifyPhaseID, get_None, correct_iplot get_Bool, identifyPhaseID, get_None, correct_iplot
def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None, ncores=0, metadata=None, origin=None): def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None, ncores=0, metadata=None, origin=None):
@ -477,7 +477,7 @@ class AutopickStation(object):
if self.pickparams["sstart"] < 0: if self.pickparams["sstart"] < 0:
self.pickparams["sstart"] = 0 self.pickparams["sstart"] = 0
if get_bool(self.pickparams["use_taup"]) is False: if get_Bool(self.pickparams["use_taup"]) is False:
# correct user mistake where a relative cuttime is selected (pstart < 0) but use of taupy is disabled/ has # correct user mistake where a relative cuttime is selected (pstart < 0) but use of taupy is disabled/ has
# not the required parameters # not the required parameters
exit_taupy() exit_taupy()
@ -525,7 +525,7 @@ class AutopickStation(object):
:rtype: dict :rtype: dict
""" """
if get_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:
try: try:
# modify pstart, pstop, sstart, sstop to be around theoretical onset if taupy should be used, # modify pstart, pstop, sstart, sstop to be around theoretical onset if taupy should be used,
# else do nothing # else do nothing
@ -544,7 +544,7 @@ class AutopickStation(object):
if self.horizontal_traces_exist(): if self.horizontal_traces_exist():
if (self.p_results.weight is not None and self.p_results.weight < 4) or \ if (self.p_results.weight is not None and self.p_results.weight < 4) or \
get_bool(self.pickparams.get('use_taup')): get_Bool(self.pickparams.get('use_taup')):
try: try:
self.pick_s_phase() self.pick_s_phase()
except MissingTraceException as mte: except MissingTraceException as mte:
@ -1148,7 +1148,7 @@ class AutopickStation(object):
''.format(self.s_results.weight, self.s_results.snr, self.s_results.snrdb)) ''.format(self.s_results.weight, self.s_results.snr, self.s_results.snrdb))
def pick_s_phase(self): def pick_s_phase(self):
if get_bool(self.pickparams.get('use_taup')) is True: if get_Bool(self.pickparams.get('use_taup')) is True:
cuttimesh = (self.pickparams.get('sstart'), self.pickparams.get('sstop')) cuttimesh = (self.pickparams.get('sstart'), self.pickparams.get('sstop'))
else: else:
# determine time window for calculating CF after P onset # determine time window for calculating CF after P onset

View File

@ -15,7 +15,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime from obspy.core import Stream, UTCDateTime
from scipy.signal import argrelmax from scipy.signal import argrelmax
from pylot.core.util.utils import get_bool, get_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'):
@ -62,8 +62,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol
plt_flag = 0 plt_flag = 0
try: try:
iplot = int(iplot) iplot = int(iplot)
except ValueError: except:
if get_bool(iplot): if get_Bool(iplot):
iplot = 2 iplot = 2
else: else:
iplot = 0 iplot = 0
@ -816,7 +816,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
try: try:
iplot = int(iplot) iplot = int(iplot)
except: except:
if get_bool(iplot): if get_Bool(iplot):
iplot = 2 iplot = 2
else: else:
iplot = 0 iplot = 0
@ -1130,7 +1130,7 @@ def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'):
try: try:
iplot = int(iplot) iplot = int(iplot)
except: except:
if get_bool(iplot): if get_Bool(iplot):
iplot = 2 iplot = 2
else: else:
iplot = 0 iplot = 0
@ -1499,7 +1499,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'] = get_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

View File

@ -327,7 +327,7 @@ def get_None(value):
return value return value
def get_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:
@ -335,14 +335,13 @@ def get_bool(value):
:return: true boolean value :return: true boolean value
:rtype: bool :rtype: bool
""" """
if type(value) is bool: if value in ['True', 'true']:
return value
elif value in ['True', 'true']:
return True return True
elif value in ['False', 'false']: elif value in ['False', 'false']:
return False return False
else: else:
return bool(value) return value
def four_digits(year): def four_digits(year):
""" """
@ -1169,7 +1168,7 @@ def correct_iplot(iplot):
try: try:
iplot = int(iplot) iplot = int(iplot)
except ValueError: except ValueError:
if get_bool(iplot): if get_Bool(iplot):
iplot = 2 iplot = 2
else: else:
iplot = 0 iplot = 0

View File

@ -53,7 +53,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, get_bool, get_None, pick_color, getAutoFilteroptions, SetChannelComponents, \ identifyPhaseID, get_Bool, get_None, pick_color, getAutoFilteroptions, SetChannelComponents, \
station_id_remove_channel 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
@ -1876,7 +1876,7 @@ class PickDlg(QDialog):
self.sChannels.triggered.connect(self.updateChannelSettingsS) self.sChannels.triggered.connect(self.updateChannelSettingsS)
settings = QSettings() settings = QSettings()
self.autoFilterAction.setChecked(get_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())
@ -2355,7 +2355,7 @@ class PickDlg(QDialog):
settings = QSettings() settings = QSettings()
phaseID = self.getPhaseID(phase) phaseID = self.getPhaseID(phase)
if get_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)
@ -3025,7 +3025,7 @@ class PickDlg(QDialog):
@staticmethod @staticmethod
def getChannelSettingsP(channel): def getChannelSettingsP(channel):
settings = QSettings() settings = QSettings()
rval = get_bool(settings.value('p_channel_{}'.format(channel))) rval = get_Bool(settings.value('p_channel_{}'.format(channel)))
compclass = SetChannelComponents.from_qsettings(settings) compclass = SetChannelComponents.from_qsettings(settings)
components = ['Z'] components = ['Z']
for component in components[:]: for component in components[:]:
@ -3040,7 +3040,7 @@ class PickDlg(QDialog):
@staticmethod @staticmethod
def getChannelSettingsS(channel): def getChannelSettingsS(channel):
settings = QSettings() settings = QSettings()
rval = get_bool(settings.value('s_channel_{}'.format(channel))) rval = get_Bool(settings.value('s_channel_{}'.format(channel)))
compclass = SetChannelComponents.from_qsettings(settings) compclass = SetChannelComponents.from_qsettings(settings)
components = ['N', 'E'] components = ['N', 'E']
for component in components[:]: for component in components[:]:
@ -5194,7 +5194,7 @@ class FilterOptionsDialog(QDialog):
'S': QtWidgets.QGroupBox('S Filter')} 'S': QtWidgets.QGroupBox('S Filter')}
settings = QSettings() settings = QSettings()
overwriteFilter = get_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')