added parameters tab to TuneAutopicker widget. Enabled direct call of autoPyLoT with AP-Settings object
This commit is contained in:
parent
d96bc3c621
commit
862fb3240a
20
autoPyLoT.py
20
autoPyLoT.py
@ -29,7 +29,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
|||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
|
|
||||||
|
|
||||||
def autoPyLoT(inputfile, fnames=None, savepath=None, iplot=0):
|
def autoPyLoT(parameter=None, inputfile=None, fnames=None, savepath=None, iplot=0):
|
||||||
"""
|
"""
|
||||||
Determine phase onsets automatically utilizing the automatic picking
|
Determine phase onsets automatically utilizing the automatic picking
|
||||||
algorithms by Kueperkoch et al. 2010/2012.
|
algorithms by Kueperkoch et al. 2010/2012.
|
||||||
@ -55,8 +55,22 @@ def autoPyLoT(inputfile, fnames=None, savepath=None, iplot=0):
|
|||||||
***********************************'''.format(version=_getVersionString())
|
***********************************'''.format(version=_getVersionString())
|
||||||
print(splash)
|
print(splash)
|
||||||
|
|
||||||
# reading parameter file
|
if not parameter:
|
||||||
|
if inputfile:
|
||||||
parameter = AutoPickParameter(inputfile)
|
parameter = AutoPickParameter(inputfile)
|
||||||
|
else:
|
||||||
|
print('No parameters set and no input file given. Choose either of both.')
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if not type(parameter) == AutoPickParameter:
|
||||||
|
print('Wrong input type for parameter: {}'.format(type(parameter)))
|
||||||
|
return
|
||||||
|
if inputfile:
|
||||||
|
print('Parameters set and input file given. Choose either of both.')
|
||||||
|
return
|
||||||
|
|
||||||
|
# reading parameter file
|
||||||
|
|
||||||
|
|
||||||
data = Data()
|
data = Data()
|
||||||
|
|
||||||
@ -79,7 +93,7 @@ def autoPyLoT(inputfile, fnames=None, savepath=None, iplot=0):
|
|||||||
datastructure.setExpandFields(exf)
|
datastructure.setExpandFields(exf)
|
||||||
|
|
||||||
# check if default location routine NLLoc is available
|
# check if default location routine NLLoc is available
|
||||||
if parameter.hasParam('nllocbin'):
|
if parameter['nllocbin']:
|
||||||
locflag = 1
|
locflag = 1
|
||||||
# get NLLoc-root path
|
# get NLLoc-root path
|
||||||
nllocroot = parameter.get('nllocroot')
|
nllocroot = parameter.get('nllocroot')
|
||||||
|
@ -1 +1 @@
|
|||||||
7d56-dirty
|
d96b-dirty
|
||||||
|
@ -117,7 +117,7 @@ class AutoPickParameter(object):
|
|||||||
|
|
||||||
# Boolean test
|
# Boolean test
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
return self.__parameter
|
return bool(self.__parameter)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return self.__parameter[key]
|
return self.__parameter[key]
|
||||||
|
@ -1269,15 +1269,19 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
|
|
||||||
class TuneAutopicker(QWidget):
|
class TuneAutopicker(QWidget):
|
||||||
def __init__(self, fig_dict, station, parent=None):
|
def __init__(self, fig_dict, station, ap, parent=None):
|
||||||
QtGui.QWidget.__init__(self, parent)
|
QtGui.QWidget.__init__(self, parent)
|
||||||
if not station in fig_dict:
|
if not station in fig_dict:
|
||||||
print('Station not found')
|
print('Station not found')
|
||||||
return
|
return
|
||||||
|
self.ap = ap
|
||||||
self.fd = fig_dict[station]
|
self.fd = fig_dict[station]
|
||||||
self.layout = QtGui.QHBoxLayout()
|
self.layout = QtGui.QHBoxLayout()
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
self.init_figure_tabs()
|
self.init_figure_tabs()
|
||||||
|
self.add_parameter()
|
||||||
|
self.layout.setStretch(0,3)
|
||||||
|
self.layout.setStretch(1,1)
|
||||||
|
|
||||||
def init_figure_tabs(self):
|
def init_figure_tabs(self):
|
||||||
self.main_tabs = QtGui.QTabWidget()
|
self.main_tabs = QtGui.QTabWidget()
|
||||||
@ -1287,6 +1291,10 @@ class TuneAutopicker(QWidget):
|
|||||||
self.init_tab_names()
|
self.init_tab_names()
|
||||||
self.fill_tabs()
|
self.fill_tabs()
|
||||||
|
|
||||||
|
def add_parameter(self):
|
||||||
|
self.parameters = AutoPickParaBox(self.ap)
|
||||||
|
self.layout.addWidget(self.parameters)
|
||||||
|
|
||||||
def init_tab_names(self):
|
def init_tab_names(self):
|
||||||
self.ptb_names = ['aicFig', 'slenght', 'checkZ4S', 'refPpick', 'el_Ppick', 'fm_picker']
|
self.ptb_names = ['aicFig', 'slenght', 'checkZ4S', 'refPpick', 'el_Ppick', 'fm_picker']
|
||||||
self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick']
|
self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick']
|
||||||
@ -1302,15 +1310,27 @@ class TuneAutopicker(QWidget):
|
|||||||
|
|
||||||
def fill_p_tabs(self):
|
def fill_p_tabs(self):
|
||||||
for name in self.ptb_names:
|
for name in self.ptb_names:
|
||||||
|
try:
|
||||||
figure = self.fd[name]
|
figure = self.fd[name]
|
||||||
self.p_tabs.addTab(figure.canvas, name)
|
id = self.p_tabs.addTab(figure.canvas, name)
|
||||||
|
self.p_tabs.setTabEnabled(id, True)
|
||||||
figure.tight_layout()
|
figure.tight_layout()
|
||||||
|
except Exception as e:
|
||||||
|
id = self.p_tabs.addTab(QtGui.QWidget(), name)
|
||||||
|
self.p_tabs.setTabEnabled(id, False)
|
||||||
|
print('Could not initiate figure {}.'.format(name))
|
||||||
|
|
||||||
def fill_s_tabs(self):
|
def fill_s_tabs(self):
|
||||||
for name in self.stb_names:
|
for name in self.stb_names:
|
||||||
|
try:
|
||||||
figure = self.fd[name]
|
figure = self.fd[name]
|
||||||
self.s_tabs.addTab(figure.canvas, name)
|
id = self.s_tabs.addTab(figure.canvas, name)
|
||||||
|
self.s_tabs.setTabEnabled(id, True)
|
||||||
figure.tight_layout()
|
figure.tight_layout()
|
||||||
|
except Exception as e:
|
||||||
|
id = self.s_tabs.addTab(QtGui.QWidget(), name)
|
||||||
|
self.s_tabs.setTabEnabled(id, False)
|
||||||
|
print('Could not initiate figure {}.'.format(name))
|
||||||
|
|
||||||
|
|
||||||
class PropertiesDlg(QDialog):
|
class PropertiesDlg(QDialog):
|
||||||
|
Loading…
Reference in New Issue
Block a user