added constant SNR possibility (plotting), changed replotting structure
This commit is contained in:
parent
3efb237452
commit
30049baf94
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'asp3d_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:05 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:05 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_seisarray_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:06 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_survey_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:06 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:06 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'picking_parameters_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:06 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -12,7 +12,7 @@ from PySide import QtCore, QtGui
|
||||
class Ui_picking_parameters(object):
|
||||
def setupUi(self, picking_parameters):
|
||||
picking_parameters.setObjectName("picking_parameters")
|
||||
picking_parameters.resize(400, 700)
|
||||
picking_parameters.resize(422, 798)
|
||||
picking_parameters.setMinimumSize(QtCore.QSize(0, 700))
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout(picking_parameters)
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
@ -156,9 +156,35 @@ class Ui_picking_parameters(object):
|
||||
self.line.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
self.verticalLayout_snr.addWidget(self.line)
|
||||
self.horizontalLayout_9 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_9.setObjectName("horizontalLayout_9")
|
||||
self.label_8 = QtGui.QLabel(picking_parameters)
|
||||
self.label_8.setObjectName("label_8")
|
||||
self.verticalLayout_snr.addWidget(self.label_8)
|
||||
self.horizontalLayout_9.addWidget(self.label_8)
|
||||
self.radioButton_const = QtGui.QRadioButton(picking_parameters)
|
||||
self.radioButton_const.setChecked(True)
|
||||
self.radioButton_const.setObjectName("radioButton_const")
|
||||
self.horizontalLayout_9.addWidget(self.radioButton_const)
|
||||
self.radioButton_dyn = QtGui.QRadioButton(picking_parameters)
|
||||
self.radioButton_dyn.setObjectName("radioButton_dyn")
|
||||
self.horizontalLayout_9.addWidget(self.radioButton_dyn)
|
||||
self.verticalLayout_snr.addLayout(self.horizontalLayout_9)
|
||||
self.horizontalLayout_10 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_10.setObjectName("horizontalLayout_10")
|
||||
self.label_13 = QtGui.QLabel(picking_parameters)
|
||||
self.label_13.setObjectName("label_13")
|
||||
self.horizontalLayout_10.addWidget(self.label_13)
|
||||
self.doubleSpinBox_constSNR = QtGui.QDoubleSpinBox(picking_parameters)
|
||||
self.doubleSpinBox_constSNR.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.doubleSpinBox_constSNR.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.doubleSpinBox_constSNR.setDecimals(1)
|
||||
self.doubleSpinBox_constSNR.setMinimum(1.0)
|
||||
self.doubleSpinBox_constSNR.setMaximum(10000.0)
|
||||
self.doubleSpinBox_constSNR.setSingleStep(0.1)
|
||||
self.doubleSpinBox_constSNR.setProperty("value", 8.0)
|
||||
self.doubleSpinBox_constSNR.setObjectName("doubleSpinBox_constSNR")
|
||||
self.horizontalLayout_10.addWidget(self.doubleSpinBox_constSNR)
|
||||
self.verticalLayout_snr.addLayout(self.horizontalLayout_10)
|
||||
self.gridLayout_2 = QtGui.QGridLayout()
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.label_9 = QtGui.QLabel(picking_parameters)
|
||||
@ -185,22 +211,26 @@ class Ui_picking_parameters(object):
|
||||
self.p2.setDecimals(6)
|
||||
self.p2.setMinimum(-100.0)
|
||||
self.p2.setMaximum(100.0)
|
||||
self.p2.setSingleStep(0.0001)
|
||||
self.p2.setSingleStep(0.001)
|
||||
self.p2.setProperty("value", -0.0007)
|
||||
self.p2.setObjectName("p2")
|
||||
self.gridLayout_2.addWidget(self.p2, 2, 3, 1, 1)
|
||||
self.shift_dist = QtGui.QSpinBox(picking_parameters)
|
||||
self.shift_dist.setMinimum(-10000)
|
||||
self.shift_dist.setMaximum(10000)
|
||||
self.shift_dist.setProperty("value", 30)
|
||||
self.shift_dist.setObjectName("shift_dist")
|
||||
self.gridLayout_2.addWidget(self.shift_dist, 1, 1, 1, 1)
|
||||
self.shift_snr = QtGui.QSpinBox(picking_parameters)
|
||||
self.shift_snr.setMinimum(-10000)
|
||||
self.shift_snr.setMaximum(10000)
|
||||
self.shift_snr.setProperty("value", 100)
|
||||
self.shift_snr.setObjectName("shift_snr")
|
||||
self.gridLayout_2.addWidget(self.shift_snr, 1, 3, 1, 1)
|
||||
self.verticalLayout_snr.addLayout(self.gridLayout_2)
|
||||
self.verticalLayout_4.addLayout(self.verticalLayout_snr)
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout_4.addItem(spacerItem)
|
||||
self.vlayout_plot = QtGui.QVBoxLayout()
|
||||
self.vlayout_plot.setObjectName("vlayout_plot")
|
||||
self.verticalLayout_4.addLayout(self.vlayout_plot)
|
||||
@ -236,7 +266,10 @@ class Ui_picking_parameters(object):
|
||||
"(only if AIC checked)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lineEdit_aicleft.setText(QtGui.QApplication.translate("picking_parameters", "15", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lineEdit_aicright.setText(QtGui.QApplication.translate("picking_parameters", "0", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_8.setText(QtGui.QApplication.translate("picking_parameters", "SNR threshold (advanced)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_8.setText(QtGui.QApplication.translate("picking_parameters", "SNR threshold", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_const.setText(QtGui.QApplication.translate("picking_parameters", "constant", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_dyn.setText(QtGui.QApplication.translate("picking_parameters", "dynamic (advanced)", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_13.setText(QtGui.QApplication.translate("picking_parameters", "Constant SNR threshold:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_9.setText(QtGui.QApplication.translate("picking_parameters", "Shift distance", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_10.setText(QtGui.QApplication.translate("picking_parameters", "p1", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_11.setText(QtGui.QApplication.translate("picking_parameters", "Shift SNR", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'vtk_tools_layout.ui'
|
||||
#
|
||||
# Created: Wed Jul 27 11:15:06 2016
|
||||
# Created: Thu Aug 4 12:07:57 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -210,8 +210,12 @@ class Call_autopicker(object):
|
||||
self.mainwindow = mainwindow
|
||||
self.survey = survey
|
||||
self.maxSRdist = None
|
||||
self.dists_p = []
|
||||
self.snr_p = []
|
||||
self.lines = []
|
||||
self.init_dialog()
|
||||
self.refresh_selection()
|
||||
self.enableDynSNR(False)
|
||||
self.start_dialog()
|
||||
|
||||
def init_dialog(self):
|
||||
@ -221,7 +225,7 @@ class Call_autopicker(object):
|
||||
ui.ncores.setMaximum(getMaxCPU())
|
||||
self.ui = ui
|
||||
self.qdialog = qdialog
|
||||
self.initDynSNRplot()
|
||||
self.initSNRplot()
|
||||
self.connectButtons()
|
||||
|
||||
def getMaxSRdist(self):
|
||||
@ -235,14 +239,14 @@ class Call_autopicker(object):
|
||||
self.maxSRdist = max(SRdists)
|
||||
return self.maxSRdist
|
||||
|
||||
def initDynSNRplot(self):
|
||||
def initSNRplot(self):
|
||||
self.snrFig = Figure()
|
||||
self.snrCanvas = FigureCanvas(self.snrFig)
|
||||
self.ui.vlayout_plot.addWidget(self.snrCanvas)
|
||||
self.snrToolbar = NavigationToolbar(self.snrCanvas, self.mainwindow)
|
||||
self.ui.vlayout_plot.addWidget(self.snrToolbar)
|
||||
|
||||
def plotDynSNR(self):
|
||||
def prepFigure(self, refresh = True):
|
||||
fig = self.snrFig
|
||||
if fig.axes == []:
|
||||
ax = fig.add_subplot(111)
|
||||
@ -252,34 +256,96 @@ class Call_autopicker(object):
|
||||
ax = fig.axes[0]
|
||||
xlim = ax.get_xlim()
|
||||
ylim = ax.get_ylim()
|
||||
ax.clear()
|
||||
#ax.clear()
|
||||
if not refresh:
|
||||
self.plotPicks(ax)
|
||||
else:
|
||||
for line in self.lines:
|
||||
line.remove()
|
||||
self.lines = []
|
||||
|
||||
return fig, ax, xlim, ylim
|
||||
|
||||
def finishFigure(self, ax, xlim, ylim):
|
||||
ax.set_xlim(xlim)
|
||||
ax.set_ylim(ylim)
|
||||
|
||||
def finishNewFigure(self, ax):
|
||||
xlim = None
|
||||
ylim = None
|
||||
ax.set_xlabel('Distance [m]')
|
||||
ax.set_ylabel('SNR')
|
||||
return xlim, ylim
|
||||
|
||||
def plotPicks(self, ax):
|
||||
if self.survey.picked:
|
||||
if self.dists_p == [] or self.snr_p == []:
|
||||
for shot in self.survey.data.values():
|
||||
for traceID in shot.getTraceIDlist():
|
||||
self.dists_p.append(shot.getDistance(traceID))
|
||||
self.snr_p.append(shot.getSNR(traceID)[0])
|
||||
|
||||
ax.scatter(self.dists_p, self.snr_p, s = 0.5, c='k')
|
||||
|
||||
def plotConstSNR(self, refresh = True):
|
||||
fig, ax, xlim, ylim = self.prepFigure(refresh)
|
||||
|
||||
snrthreshold = float(self.ui.doubleSpinBox_constSNR.text())
|
||||
line = ax.hlines(snrthreshold, 0, self.getMaxSRdist(), 'b')
|
||||
self.lines.append(line)
|
||||
|
||||
if refresh == False:
|
||||
xlim, ylim = self.finishNewFigure(ax)
|
||||
|
||||
self.finishFigure(ax, xlim, ylim)
|
||||
self.snrCanvas.draw()
|
||||
|
||||
def plotDynSNR(self, refresh = True):
|
||||
fig, ax, xlim, ylim = self.prepFigure(refresh)
|
||||
snrthresholds = []
|
||||
dists_p = []; snr_p = []
|
||||
shiftSNR = float(self.ui.shift_snr.value())
|
||||
shiftDist = float(self.ui.shift_dist.value())
|
||||
p1 = float(self.ui.p1.value())
|
||||
p2 = float(self.ui.p2.value())
|
||||
dists = np.arange(0, self.getMaxSRdist() + 1, 1)
|
||||
if self.survey.picked:
|
||||
for shot in self.survey.data.values():
|
||||
for traceID in shot.getTraceIDlist():
|
||||
dists_p.append(shot.getDistance(traceID))
|
||||
snr_p.append(shot.getSNR(traceID)[0])
|
||||
|
||||
ax.scatter(dists_p, snr_p, s = 0.5, c='k')
|
||||
|
||||
for dist in dists:
|
||||
dist += shiftDist
|
||||
snrthresholds.append(surveyUtils.snr_fit_func(surveyUtils.get_fit_fn(p1, p2), dist, shiftSNR))
|
||||
ax.plot(dists, snrthresholds)
|
||||
ax.set_xlabel('Distance [m]')
|
||||
ax.set_ylabel('SNR')
|
||||
ax.set_xlim(xlim)
|
||||
ax.set_ylim(ylim)
|
||||
self.lines = ax.plot(dists, snrthresholds, 'b')
|
||||
|
||||
if refresh == False:
|
||||
xlim, ylim = self.finishNewFigure(ax)
|
||||
|
||||
self.finishFigure(ax, xlim, ylim)
|
||||
self.snrCanvas.draw()
|
||||
|
||||
def plotSNR(self, refresh = True):
|
||||
if self.ui.radioButton_const.isChecked():
|
||||
self.plotConstSNR(refresh)
|
||||
if self.ui.radioButton_dyn.isChecked():
|
||||
self.plotDynSNR(refresh)
|
||||
|
||||
def snr_toggle(self):
|
||||
if self.ui.radioButton_const.isChecked():
|
||||
self.enableDynSNR(False)
|
||||
self.enableConstSNR(True)
|
||||
if self.ui.radioButton_dyn.isChecked():
|
||||
self.enableConstSNR(False)
|
||||
self.enableDynSNR(True)
|
||||
self.plotSNR(refresh = True)
|
||||
|
||||
def enableDynSNR(self, bool):
|
||||
self.ui.shift_dist.setEnabled(bool)
|
||||
self.ui.shift_snr.setEnabled(bool)
|
||||
self.ui.p1.setEnabled(bool)
|
||||
self.ui.p2.setEnabled(bool)
|
||||
|
||||
def enableConstSNR(self, bool):
|
||||
self.ui.doubleSpinBox_constSNR.setEnabled(bool)
|
||||
|
||||
def start_dialog(self):
|
||||
self.plotDynSNR()
|
||||
self.plotSNR(refresh = False)
|
||||
if self.qdialog.exec_():
|
||||
self.refresh_selection()
|
||||
|
||||
@ -318,10 +384,13 @@ class Call_autopicker(object):
|
||||
|
||||
def connectButtons(self):
|
||||
QtCore.QObject.connect(self.ui.slider_folm, QtCore.SIGNAL("valueChanged(int)"), self.refreshFolm)
|
||||
QtCore.QObject.connect(self.ui.shift_snr, QtCore.SIGNAL("valueChanged(int)"), self.plotDynSNR)
|
||||
QtCore.QObject.connect(self.ui.shift_dist, QtCore.SIGNAL("valueChanged(int)"), self.plotDynSNR)
|
||||
QtCore.QObject.connect(self.ui.p1, QtCore.SIGNAL("valueChanged(double)"), self.plotDynSNR)
|
||||
QtCore.QObject.connect(self.ui.p2, QtCore.SIGNAL("valueChanged(double)"), self.plotDynSNR)
|
||||
QtCore.QObject.connect(self.ui.shift_snr, QtCore.SIGNAL("valueChanged(int)"), self.plotSNR)
|
||||
QtCore.QObject.connect(self.ui.shift_dist, QtCore.SIGNAL("valueChanged(int)"), self.plotSNR)
|
||||
QtCore.QObject.connect(self.ui.p1, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
|
||||
QtCore.QObject.connect(self.ui.p2, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
|
||||
QtCore.QObject.connect(self.ui.doubleSpinBox_constSNR, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
|
||||
QtCore.QObject.connect(self.ui.radioButton_const, QtCore.SIGNAL("clicked()"), self.snr_toggle)
|
||||
QtCore.QObject.connect(self.ui.radioButton_dyn, QtCore.SIGNAL("clicked()"), self.snr_toggle)
|
||||
|
||||
def chooseObsdir(self):
|
||||
self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.'))
|
||||
|
Loading…
Reference in New Issue
Block a user