WIP autopicker tuning
added default parameters and widget to show/edit them
This commit is contained in:
parent
aeaa13e277
commit
7d56e15ccf
@ -1 +1 @@
|
||||
2991-dirty
|
||||
aeaa-dirty
|
||||
|
363
pylot/core/io/default_parameters.py
Normal file
363
pylot/core/io/default_parameters.py
Normal file
@ -0,0 +1,363 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
defaults = {'rootpath': {'type': str,
|
||||
'tooltip': 'project path',
|
||||
'value': ''},
|
||||
|
||||
'datapath': {'type': str,
|
||||
'tooltip': 'data path',
|
||||
'value': ''},
|
||||
|
||||
'database': {'type': str,
|
||||
'tooltip': 'name of data base',
|
||||
'value': ''},
|
||||
|
||||
'eventID': {'type': str,
|
||||
'tooltip': 'event ID for single event processing',
|
||||
'value': ''},
|
||||
|
||||
'invdir': {'type': str,
|
||||
'tooltip': 'full path to inventory or dataless-seed file',
|
||||
'value': ''},
|
||||
|
||||
'datastructure': {'type': str,
|
||||
'tooltip': 'choose data structure',
|
||||
'value': 'PILOT'},
|
||||
|
||||
'apverbose': {'type': bool,
|
||||
'tooltip': "choose 'True' or 'False' for terminal output",
|
||||
'value': True},
|
||||
|
||||
'nllocbin': {'type': str,
|
||||
'tooltip': 'path to NLLoc executable',
|
||||
'value': ''},
|
||||
|
||||
'nllocroot': {'type': str,
|
||||
'tooltip': 'root of NLLoc-processing directory',
|
||||
'value': ''},
|
||||
|
||||
'phasefile': {'type': str,
|
||||
'tooltip': 'name of autoPyLoT-output phase file for NLLoc',
|
||||
'value': 'AUTOPHASES.obs'},
|
||||
|
||||
'ctrfile': {'type': str,
|
||||
'tooltip': 'name of autoPyLoT-output control file for NLLoc',
|
||||
'value': 'Insheim_min1d2015_auto.in'},
|
||||
|
||||
'ttpatter': {'type': str,
|
||||
'tooltip': 'pattern of NLLoc ttimes from grid',
|
||||
'value': 'ttime'},
|
||||
|
||||
'outpatter': {'type': str,
|
||||
'tooltip': 'pattern of NLLoc-output file',
|
||||
'value': 'AUTOLOC_nlloc'},
|
||||
|
||||
'vp': {'type': float,
|
||||
'tooltip': 'average P-wave velocity',
|
||||
'value': 3530.},
|
||||
|
||||
'rho': {'type': float,
|
||||
'tooltip': 'average rock density [kg/m^3]',
|
||||
'value': 2500.},
|
||||
|
||||
'Qp': {'type': (float, float),
|
||||
'tooltip': 'quality factor for P waves (Qp*f^a); list(Qp, a)',
|
||||
'value': (300., 0.8)},
|
||||
|
||||
'focmecin': {'type': str,
|
||||
'tooltip': 'name of focmec input file containing derived polarities',
|
||||
'value': 'AUTOFOCMEC_AIC_HOS4_ARH.in'},
|
||||
|
||||
'pstart': {'type': float,
|
||||
'tooltip': 'start time [s] for calculating CF for P-picking',
|
||||
'value': 15.0},
|
||||
|
||||
'pstop': {'type': float,
|
||||
'tooltip': 'end time [s] for calculating CF for P-picking',
|
||||
'value': 60.0},
|
||||
|
||||
'sstart': {'type': float,
|
||||
'tooltip': 'start time [s] relative to P-onset for calculating CF for S-picking',
|
||||
'value': -1.0},
|
||||
|
||||
'sstop': {'type': float,
|
||||
'tooltip': 'end time [s] after P-onset for calculating CF for S-picking',
|
||||
'value': 10.0},
|
||||
|
||||
'bpz1': {'type': (float, float),
|
||||
'tooltip': 'lower/upper corner freq. of first band pass filter Z-comp. [Hz]',
|
||||
'value': (2, 20)},
|
||||
|
||||
'bpz2': {'type': (float, float),
|
||||
'tooltip': 'lower/upper corner freq. of second band pass filter Z-comp. [Hz]',
|
||||
'value': (2, 30)},
|
||||
|
||||
'bph1': {'type': (float, float),
|
||||
'tooltip': 'lower/upper corner freq. of first band pass filter H-comp. [Hz]',
|
||||
'value': (2, 15)},
|
||||
|
||||
'bph2': {'type': (float, float),
|
||||
'tooltip': 'lower/upper corner freq. of second band pass filter z-comp. [Hz]',
|
||||
'value': (2, 20)},
|
||||
|
||||
'algoP': {'type': str,
|
||||
'tooltip': 'choose algorithm for P-onset determination (HOS, ARZ, or AR3)',
|
||||
'value': 'HOS'},
|
||||
|
||||
'tlta': {'type': float,
|
||||
'tooltip': 'for HOS-/AR-AIC-picker, length of LTA window [s]',
|
||||
'value': 7.0},
|
||||
|
||||
'hosorder': {'type': int,
|
||||
'tooltip': 'for HOS-picker, order of Higher Order Statistics',
|
||||
'value': 4},
|
||||
|
||||
'Parorder': {'type': int,
|
||||
'tooltip': 'for AR-picker, order of AR process of Z-component',
|
||||
'value': 2},
|
||||
|
||||
'tdet1z': {'type': float,
|
||||
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 1st pick',
|
||||
'value': 1.2},
|
||||
|
||||
'tpred1z': {'type': float,
|
||||
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 1st pick',
|
||||
'value': 0.4},
|
||||
|
||||
'tdet2z': {'type': float,
|
||||
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 2nd pick',
|
||||
'value': 0.6},
|
||||
|
||||
'tpred2z': {'type': float,
|
||||
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 2nd pick',
|
||||
'value': 0.2},
|
||||
|
||||
'addnoise': {'type': float,
|
||||
'tooltip': 'add noise to seismogram for stable AR prediction',
|
||||
'value': 0.001},
|
||||
|
||||
'tsnrz': {'type': (float, float, float, float),
|
||||
'tooltip': 'for HOS/AR, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
||||
'value': (3, 0.1, 0.5, 1.0)},
|
||||
|
||||
'pickwinP': {'type': float,
|
||||
'tooltip': 'for initial AIC pick, length of P-pick window [s]',
|
||||
'value': 3.0},
|
||||
|
||||
'Precalcwin': {'type': float,
|
||||
'tooltip': 'for HOS/AR, window length [s] for recalculation of CF (relative to 1st pick)',
|
||||
'value': 6.0},
|
||||
|
||||
'aictsmooth': {'type': float,
|
||||
'tooltip': 'for HOS/AR, take average of samples for smoothing of AIC-function [s]',
|
||||
'value': 0.2},
|
||||
|
||||
'tsmoothP': {'type': float,
|
||||
'tooltip': 'for HOS/AR, take average of samples for smoothing CF [s]',
|
||||
'value': 0.1},
|
||||
|
||||
'ausP': {'type': float,
|
||||
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (P)',
|
||||
'value': 0.001},
|
||||
|
||||
'nfacP': {'type': float,
|
||||
'tooltip': 'for HOS/AR, noise factor for noise level determination (P)',
|
||||
'value': 1.3},
|
||||
|
||||
'algoS': {'type': str,
|
||||
'tooltip': 'choose algorithm for S-onset determination (ARH or AR3)',
|
||||
'value': 'ARH'},
|
||||
|
||||
'tdet1h': {'type': float,
|
||||
'tooltip': 'for HOS/AR, length of AR-determination window [s], H-components, 1st pick',
|
||||
'value': 0.8},
|
||||
|
||||
'tpred1h': {'type': float,
|
||||
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 1st pick',
|
||||
'value': 0.4},
|
||||
|
||||
'tdet2h': {'type': float,
|
||||
'tooltip': 'for HOS/AR, length of AR-determinaton window [s], H-components, 2nd pick',
|
||||
'value': 0.6},
|
||||
|
||||
'tpred2h': {'type': float,
|
||||
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 2nd pick',
|
||||
'value': 0.3},
|
||||
|
||||
'Sarorder': {'type': int,
|
||||
'tooltip': 'for AR-picker, order of AR process of H-components',
|
||||
'value': 4},
|
||||
|
||||
'Srecalcwin': {'type': float,
|
||||
'tooltip': 'for AR-picker, window length [s] for recalculation of CF (2nd pick) (H)',
|
||||
'value': 5.0},
|
||||
|
||||
'pickwinS': {'type': float,
|
||||
'tooltip': 'for initial AIC pick, length of S-pick window [s]',
|
||||
'value': 3.0},
|
||||
|
||||
'tsnrh': {'type': (float, float, float, float),
|
||||
'tooltip': 'for ARH/AR3, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
||||
'value': (2, 0.2, 1.5, 0.5)},
|
||||
|
||||
'aictsmoothS': {'type': float,
|
||||
'tooltip': 'for AIC-picker, take average of samples for smoothing of AIC-function [s]',
|
||||
'value': 0.5},
|
||||
|
||||
'tsmoothS': {'type': float,
|
||||
'tooltip': 'for AR-picker, take average of samples for smoothing CF [s] (S)',
|
||||
'value': 0.7},
|
||||
|
||||
'ausS': {'type': float,
|
||||
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (S)',
|
||||
'value': 0.9},
|
||||
|
||||
'nfacS': {'type': float,
|
||||
'tooltip': 'for AR-picker, noise factor for noise level determination (S)',
|
||||
'value': 1.5},
|
||||
|
||||
'minfmweight': {'type': int,
|
||||
'tooltip': 'minimum required P weight for first-motion determination',
|
||||
'value': 1},
|
||||
|
||||
'minFMSNR': {'type': float,
|
||||
'tooltip': 'miniumum required SNR for first-motion determination',
|
||||
'value': 2.},
|
||||
|
||||
'fmpickwin': {'type': float,
|
||||
'tooltip': 'pick window around P onset for calculating zero crossings',
|
||||
'value': 0.2},
|
||||
|
||||
'timeerrorsP': {'type': (float, float, float, float),
|
||||
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for P',
|
||||
'value': (0.01, 0.02, 0.04, 0.08)},
|
||||
|
||||
'timeerrorsS': {'type': (float, float, float, float),
|
||||
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for S',
|
||||
'value': (0.04, 0.08, 0.16, 0.32)},
|
||||
|
||||
'minAICPslope': {'type': float,
|
||||
'tooltip': 'below this slope [counts/s] the initial P pick is rejected',
|
||||
'value': 0.8},
|
||||
|
||||
'minAICPSNR': {'type': float,
|
||||
'tooltip': 'below this SNR the initial P pick is rejected',
|
||||
'value': 1.1},
|
||||
|
||||
'minAICSslope': {'type': float,
|
||||
'tooltip': 'below this slope [counts/s] the initial S pick is rejected',
|
||||
'value': 1.},
|
||||
|
||||
'minAICSSNR': {'type': float,
|
||||
'tooltip': 'below this SNR the initial S pick is rejected',
|
||||
'value': 1.5},
|
||||
|
||||
'minsiglength': {'type': float,
|
||||
'tooltip': 'length of signal part for which amplitudes must exceed noiselevel [s]',
|
||||
'value': 1.},
|
||||
|
||||
'noisefactor': {'type': float,
|
||||
'tooltip': 'noiselevel*noisefactor=threshold',
|
||||
'value': 1.0},
|
||||
|
||||
'minpercent': {'type': float,
|
||||
'tooltip': 'required percentage of amplitudes exceeding threshold',
|
||||
'value': 10.},
|
||||
|
||||
'zfac': {'type': float,
|
||||
'tooltip': 'P-amplitude must exceed at least zfac times RMS-S amplitude',
|
||||
'value': 1.5},
|
||||
|
||||
'mdttolerance': {'type': float,
|
||||
'tooltip': 'maximum allowed deviation of P picks from median [s]',
|
||||
'value': 6.0},
|
||||
|
||||
'wdttolerance': {'type': float,
|
||||
'tooltip': 'maximum allowed deviation from Wadati-diagram',
|
||||
'value': 1.0}
|
||||
}
|
||||
|
||||
settings_main={
|
||||
'dirs':[
|
||||
'rootpath',
|
||||
'datapath',
|
||||
'database',
|
||||
'eventID',
|
||||
'invdir',
|
||||
'datastructure',
|
||||
'apverbose'],
|
||||
'nlloc':[
|
||||
'nllocbin',
|
||||
'nllocroot',
|
||||
'phasefile',
|
||||
'ctrfile',
|
||||
'ttpatter',
|
||||
'outpatter'],
|
||||
'smoment':[
|
||||
'vp',
|
||||
'rho',
|
||||
'Qp'],
|
||||
'focmec':[
|
||||
'focmecin'],
|
||||
'pick':[
|
||||
'pstart',
|
||||
'pstop',
|
||||
'sstart',
|
||||
'sstop',
|
||||
'bpz1',
|
||||
'bpz2',
|
||||
'bph1',
|
||||
'bph2']
|
||||
}
|
||||
|
||||
settings_special_pick={
|
||||
'z':[
|
||||
'algoP',
|
||||
'tlta',
|
||||
'hosorder',
|
||||
'Parorder',
|
||||
'tdet1z',
|
||||
'tpred1z',
|
||||
'tdet2z',
|
||||
'tpred2z',
|
||||
'addnoise',
|
||||
'tsnrz',
|
||||
'pickwinP',
|
||||
'Precalcwin',
|
||||
'aictsmooth',
|
||||
'tsmoothP',
|
||||
'ausP',
|
||||
'nfacP'],
|
||||
'h':[
|
||||
'algoS',
|
||||
'tdet1h',
|
||||
'tpred1h',
|
||||
'tdet2h',
|
||||
'tpred2h',
|
||||
'Sarorder',
|
||||
'Srecalcwin',
|
||||
'pickwinS',
|
||||
'tsnrh',
|
||||
'aictsmoothS',
|
||||
'tsmoothS',
|
||||
'ausS',
|
||||
'nfacS'],
|
||||
'fm':[
|
||||
'minfmweight',
|
||||
'minFMSNR',
|
||||
'fmpickwin'],
|
||||
'quality':[
|
||||
'timeerrorsP',
|
||||
'timeerrorsS',
|
||||
'minAICPslope',
|
||||
'minAICPSNR',
|
||||
'minAICSslope',
|
||||
'minAICSSNR',
|
||||
'minsiglength',
|
||||
'noisefactor',
|
||||
'minpercent',
|
||||
'zfac',
|
||||
'mdttolerance',
|
||||
'wdttolerance']
|
||||
}
|
@ -109,10 +109,6 @@ class AutoPickParameter(object):
|
||||
|
||||
def __init_subsettings(self):
|
||||
self._settings_main=default_parameters.settings_main
|
||||
self._settings_nlloc=default_parameters.settings_nlloc
|
||||
self._settings_smoment=default_parameters.settings_smoment
|
||||
self._settings_focmec=default_parameters.settings_focmec
|
||||
self._settings_common_pick=default_parameters.settings_common_pick
|
||||
self._settings_special_pick=default_parameters.settings_special_pick
|
||||
|
||||
# String representation of the object
|
||||
@ -168,45 +164,32 @@ class AutoPickParameter(object):
|
||||
def get_main_para_names(self):
|
||||
return self._settings_main
|
||||
|
||||
def get_nlloc_para_names(self):
|
||||
return self._settings_nlloc
|
||||
|
||||
def get_seis_moment_para_names(self):
|
||||
return self._settings_smoment
|
||||
|
||||
def get_focmec_para_names(self):
|
||||
return self._settings_focmec
|
||||
|
||||
def get_common_pick_names(self):
|
||||
return self._settings_common_pick
|
||||
|
||||
def get_special_pick_names(self):
|
||||
def get_special_para_names(self):
|
||||
return self._settings_special_pick
|
||||
|
||||
def get_all_para_names(self):
|
||||
all_names=[]
|
||||
all_names += self.get_main_para_names()['dirs']
|
||||
all_names += self.get_main_para_names()['nlloc']
|
||||
all_names += self.get_main_para_names()['smoment']
|
||||
all_names += self.get_main_para_names()['focmec']
|
||||
all_names += self.get_main_para_names()['pick']
|
||||
all_names += self.get_special_para_names()['z']
|
||||
all_names += self.get_special_para_names()['h']
|
||||
all_names += self.get_special_para_names()['fm']
|
||||
all_names += self.get_special_para_names()['quality']
|
||||
return all_names
|
||||
|
||||
def checkValue(self, param, value):
|
||||
is_type = type(value)
|
||||
expect_type = self.get_defaults()[param]['type']
|
||||
if not is_type == expect_type and not is_type == tuple:
|
||||
message = 'Type check failed for param: {}, is type: {}, expected type:{}'
|
||||
message = message.format(param, is_type, expect_type)
|
||||
raise TypeError(message)
|
||||
|
||||
# main_settings = parameter[:8]
|
||||
# main_settings
|
||||
# paramter[8]
|
||||
# parameter[8]
|
||||
# parameter[8:14]
|
||||
# nlloc_settings = parameter[8:14]
|
||||
# len(nlloc_settings)
|
||||
# sm_settings = parameter[14:17]
|
||||
# sm_settings
|
||||
# fmec_settings = parmeter[17]
|
||||
# fmec_settings = parameter[17]
|
||||
# fmec_settings
|
||||
# common_picker_settings = parameter[18:26]
|
||||
# common_picker_settings
|
||||
# special_picker_settings = parameter[18:]
|
||||
|
||||
|
||||
|
||||
def setParam(self, **kwargs):
|
||||
for param, value in kwargs.items():
|
||||
self.__setitem__(param, value)
|
||||
# print(self)
|
||||
def setParam(self, param, value):
|
||||
self.__setitem__(param, value)
|
||||
|
||||
@staticmethod
|
||||
def _printParameterError(errmsg):
|
||||
|
@ -1589,12 +1589,12 @@ class AutoPickParaBox(QtGui.QWidget):
|
||||
self.tabs = QtGui.QTabWidget()
|
||||
self.layout = QtGui.QHBoxLayout()
|
||||
self.layout.addWidget(self.tabs)
|
||||
self.boxes = {}
|
||||
self.setLayout(self.layout)
|
||||
self.add_main_parameters_tab()
|
||||
self.add_special_pick_parameters_tab()
|
||||
|
||||
def init_boxes(self, parameter_names, defaults=True):
|
||||
self.boxes = {}
|
||||
grid = QtGui.QGridLayout()
|
||||
|
||||
for index1, name in enumerate(parameter_names):
|
||||
@ -1603,7 +1603,7 @@ class AutoPickParaBox(QtGui.QWidget):
|
||||
default_item = self.ap.get_defaults()[name]
|
||||
tooltip = default_item['tooltip']
|
||||
tooltip += ' | type: {}'.format(default_item['type'])
|
||||
if type(default_item['type']) == str:
|
||||
if not type(default_item['type']) == tuple:
|
||||
if defaults:
|
||||
value = default_item['value']
|
||||
typ = default_item['type']
|
||||
@ -1624,21 +1624,22 @@ class AutoPickParaBox(QtGui.QWidget):
|
||||
return grid
|
||||
|
||||
def create_box(self, value, typ, tooltip):
|
||||
if typ == 'str':
|
||||
if typ == str:
|
||||
box = QtGui.QLineEdit()
|
||||
box.setText(value)
|
||||
elif typ == 'float':
|
||||
elif typ == float:
|
||||
box = QtGui.QDoubleSpinBox()
|
||||
box.setMaximum(100*value)
|
||||
box.setValue(value)
|
||||
elif typ == int:
|
||||
box = QtGui.QSpinBox()
|
||||
box.setMaximum(100*value)
|
||||
box.setValue(value)
|
||||
elif typ == 'int':
|
||||
box = QtGui.QSpinBox()
|
||||
box.setMaximum(100*value)
|
||||
box.setValue(value)
|
||||
elif typ == 'bool':
|
||||
elif typ == bool:
|
||||
box = QtGui.QCheckBox()
|
||||
box.setChecked(value)
|
||||
#box.setToolTip(tooltip)
|
||||
else:
|
||||
raise TypeError('Unrecognized type {}'.format(typ))
|
||||
return box
|
||||
|
||||
def create_multi_box(self, boxes):
|
||||
@ -1660,29 +1661,33 @@ class AutoPickParaBox(QtGui.QWidget):
|
||||
self.tabs.addTab(scrollA, name)
|
||||
|
||||
def add_main_parameters_tab(self):
|
||||
|
||||
vb_layout = QtGui.QVBoxLayout()
|
||||
vb_layout.addWidget(self.gen_headline('Directories'))
|
||||
vb_layout.addLayout(self.init_boxes(self.ap.get_main_para_names()))
|
||||
vb_layout.addWidget(self.gen_h_seperator())
|
||||
|
||||
vb_layout.addWidget(self.gen_headline('NLLoc'))
|
||||
vb_layout.addLayout(self.init_boxes(self.ap.get_nlloc_para_names()))
|
||||
vb_layout.addWidget(self.gen_h_seperator())
|
||||
|
||||
vb_layout.addWidget(self.gen_headline('Seismic Moment'))
|
||||
vb_layout.addLayout(self.init_boxes(self.ap.get_seis_moment_para_names()))
|
||||
vb_layout.addWidget(self.gen_h_seperator())
|
||||
|
||||
vb_layout.addWidget(self.gen_headline('Focal Mechanism'))
|
||||
vb_layout.addLayout(self.init_boxes(self.ap.get_focmec_para_names()))
|
||||
vb_layout.addWidget(self.gen_h_seperator())
|
||||
|
||||
vb_layout.addWidget(self.gen_headline('Pick Settings'))
|
||||
vb_layout.addLayout(self.init_boxes(self.ap.get_common_pick_names()))
|
||||
|
||||
self.add_to_layout(vb_layout, 'Directories',
|
||||
self.ap.get_main_para_names()['dirs'])
|
||||
self.add_to_layout(vb_layout, 'NLLoc',
|
||||
self.ap.get_main_para_names()['nlloc'])
|
||||
self.add_to_layout(vb_layout, 'Seismic Moment',
|
||||
self.ap.get_main_para_names()['smoment'])
|
||||
self.add_to_layout(vb_layout, 'Focal Mechanism',
|
||||
self.ap.get_main_para_names()['focmec'])
|
||||
self.add_to_layout(vb_layout, 'Pick Settings',
|
||||
self.ap.get_main_para_names()['pick'],
|
||||
False)
|
||||
self.add_tab(vb_layout, 'Main Settings')
|
||||
|
||||
def add_special_pick_parameters_tab(self):
|
||||
vb_layout = QtGui.QVBoxLayout()
|
||||
self.add_to_layout(vb_layout, 'Z-component',
|
||||
self.ap.get_special_para_names()['z'])
|
||||
self.add_to_layout(vb_layout, 'H-components',
|
||||
self.ap.get_special_para_names()['h'])
|
||||
self.add_to_layout(vb_layout, 'First-motion picker',
|
||||
self.ap.get_special_para_names()['fm'])
|
||||
self.add_to_layout(vb_layout, 'Quality assessment',
|
||||
self.ap.get_special_para_names()['quality'],
|
||||
False)
|
||||
self.add_tab(vb_layout, 'Advanced Settings')
|
||||
|
||||
def gen_h_seperator(self):
|
||||
seperator = QtGui.QFrame()
|
||||
seperator.setFrameShape(QtGui.QFrame.HLine)
|
||||
@ -1695,11 +1700,34 @@ class AutoPickParaBox(QtGui.QWidget):
|
||||
label.setFont(font)
|
||||
return label
|
||||
|
||||
def add_special_pick_parameters_tab(self):
|
||||
grid = self.init_boxes(self.ap.get_special_pick_names())
|
||||
self.add_tab(grid, 'Advanced Settings')
|
||||
|
||||
|
||||
def add_to_layout(self, layout, name, items, seperator=True):
|
||||
layout.addWidget(self.gen_headline(name))
|
||||
layout.addLayout(self.init_boxes(items))
|
||||
if seperator:
|
||||
layout.addWidget(self.gen_h_seperator())
|
||||
|
||||
def update_params(self):
|
||||
for param in self.ap.get_all_para_names():
|
||||
box = self.boxes[param]
|
||||
value = self.getValue(box)
|
||||
self.ap.checkValue(param, value)
|
||||
self.ap.setParam(param, value)
|
||||
|
||||
def getValue(self, box):
|
||||
if type(box) == QtGui.QLineEdit:
|
||||
value = str(box.text())
|
||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
||||
value = box.value()
|
||||
elif type(box) == QtGui.QCheckBox:
|
||||
value = box.isChecked()
|
||||
elif type(box) == list:
|
||||
value = []
|
||||
for b in box:
|
||||
value.append(self.getValue(b))
|
||||
value = tuple(value)
|
||||
return value
|
||||
|
||||
|
||||
class ParametersTab(PropTab):
|
||||
def __init__(self, parent=None, infile=None):
|
||||
super(ParametersTab, self).__init__(parent)
|
||||
|
Loading…
Reference in New Issue
Block a user