successfully implemented a working version of QT postprocessing interface

This commit is contained in:
Marcel Paffrath 2016-08-24 14:58:51 +02:00
parent e51704f2b7
commit 135ac0ef80
11 changed files with 116 additions and 77 deletions

View File

@ -10,7 +10,7 @@ from PySide import QtCore, QtGui
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
from pylot.core.active.gui.asp3d_layout import * from pylot.core.active.gui.asp3d_layout import *
from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO, Call_VTK_dialog, Postprocessing from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO, Call_VTK_dialog, Postprocessing
from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU, printDialogMessage, continueDialogExists, continueDialogMessage
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
@ -80,10 +80,10 @@ class gui_control(object):
def gen_seisarray(self): def gen_seisarray(self):
disconnect = False disconnect = False
if self.checkSeisArrayState(): if self.checkSeisArrayState():
if not self.continueDialogExists('Seismic Array'): if not continueDialogExists('Seismic Array'):
return return
if self.checkConnected2SurveyState(): if self.checkConnected2SurveyState():
if not self.continueDialogMessage('Seismic Array connected to present Survey.\n' if not continueDialogMessage('Seismic Array connected to present Survey.\n'
'Continuation will disconnect the Seismic Array.'): 'Continuation will disconnect the Seismic Array.'):
return return
else: else:
@ -103,11 +103,11 @@ class gui_control(object):
def gen_survey(self): def gen_survey(self):
if self.checkSurveyState(): if self.checkSurveyState():
if not self.continueDialogExists('Survey'): if not continueDialogExists('Survey'):
return return
if self.checkSeisArrayState(): if self.checkSeisArrayState():
if len(self.seisarray.getSourceCoordinates()) > 0: if len(self.seisarray.getSourceCoordinates()) > 0:
if self.continueDialogMessage('Use geometry information of active Seismic Array?'): if continueDialogMessage('Use geometry information of active Seismic Array?'):
if self.gssa is None: if self.gssa is None:
self.gssa = Gen_Survey_from_SA(self.mainwindow, self.seisarray) self.gssa = Gen_Survey_from_SA(self.mainwindow, self.seisarray)
else: else:
@ -120,7 +120,7 @@ class gui_control(object):
self.setPickState(False) self.setPickState(False)
return return
else: else:
if not self.continueDialogMessage('Can not use current Seismic Array,' if not continueDialogMessage('Can not use current Seismic Array,'
' because there are no sources given.'): ' because there are no sources given.'):
return return
if self.gssr is None: if self.gssr is None:
@ -291,7 +291,7 @@ class gui_control(object):
def interpolate_receivers(self): def interpolate_receivers(self):
if not self.checkSeisArrayState(): if not self.checkSeisArrayState():
self.printDialogMessage('No Seismic Array defined.') printDialogMessage('No Seismic Array defined.')
return return
self.seisarray.interpolateAll() self.seisarray.interpolateAll()
self.refreshSeisArrayWidgets() self.refreshSeisArrayWidgets()
@ -304,13 +304,13 @@ class gui_control(object):
def connect2Survey(self): def connect2Survey(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
if not self.checkSeisArrayState(): if not self.checkSeisArrayState():
self.printDialogMessage('Got no Seismic Array.') printDialogMessage('Got no Seismic Array.')
return return
if self.checkConnected2SurveyState(): if self.checkConnected2SurveyState():
if not self.continueDialogMessage('Existing Survey already got Seismic Array object. Continue?'): if not continueDialogMessage('Existing Survey already got Seismic Array object. Continue?'):
return return
self.survey.seisarray = self.seisarray self.survey.seisarray = self.seisarray
self.setConnected2SurveyState(True) self.setConnected2SurveyState(True)
@ -320,10 +320,10 @@ class gui_control(object):
def startPicker(self): def startPicker(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
if self.checkPickState(): if self.checkPickState():
if not self.continueDialogMessage('Survey already picked. Continue?'): if not continueDialogMessage('Survey already picked. Continue?'):
return return
if self.autopicker is None: if self.autopicker is None:
@ -338,10 +338,10 @@ class gui_control(object):
def startFMTOMO(self): def startFMTOMO(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
if not self.checkPickState(): if not self.checkPickState():
self.printDialogMessage('Survey not picked.') printDialogMessage('Survey not picked.')
return return
if self.fmtomo is None: if self.fmtomo is None:
@ -361,7 +361,7 @@ class gui_control(object):
def postprocessing(self): def postprocessing(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
self.postprocessing = Postprocessing(self.mainwindow, self.survey) self.postprocessing = Postprocessing(self.mainwindow, self.survey)
#self.survey.plotAllPicks() #self.survey.plotAllPicks()
@ -370,7 +370,7 @@ class gui_control(object):
def load_survey(self): def load_survey(self):
if self.checkSurveyState(): if self.checkSurveyState():
if not self.continueDialogExists('Survey'): if not continueDialogExists('Survey'):
return return
filename = openFile() filename = openFile()
if filename is None: if filename is None:
@ -378,14 +378,14 @@ class gui_control(object):
try: try:
survey = activeSeismoPick.Survey.from_pickle(filename) survey = activeSeismoPick.Survey.from_pickle(filename)
except: except:
self.printDialogMessage('Could not load object %s.'%filename) printDialogMessage('Could not load object %s.'%filename)
return return
if not type(survey) == activeSeismoPick.Survey: if not type(survey) == activeSeismoPick.Survey:
self.printDialogMessage('Wrong input file of type %s, expected %s.' printDialogMessage('Wrong input file of type %s, expected %s.'
%(type(survey), activeSeismoPick.Survey)) %(type(survey), activeSeismoPick.Survey))
return return
if self.checkSeisArrayState() and survey.seisarray is not None: if self.checkSeisArrayState() and survey.seisarray is not None:
if not self.continueDialogMessage('Survey got existing Seismic Array.' if not continueDialogMessage('Survey got existing Seismic Array.'
' Do you want to overwrite the current Seismic Array?'): ' Do you want to overwrite the current Seismic Array?'):
return return
self.survey = survey self.survey = survey
@ -398,19 +398,19 @@ class gui_control(object):
self.seisarray = self.survey.seisarray self.seisarray = self.survey.seisarray
self.setConnected2SurveyState(True) self.setConnected2SurveyState(True)
self.setSeisArrayState(True) self.setSeisArrayState(True)
self.printDialogMessage('Loaded Survey with active Seismic Array.') printDialogMessage('Loaded Survey with active Seismic Array.')
else: else:
self.setConnected2SurveyState(False) self.setConnected2SurveyState(False)
self.setSeisArrayState(False) self.setSeisArrayState(False)
self.printDialogMessage('Loaded Survey.') printDialogMessage('Loaded Survey.')
def load_seisarray(self): def load_seisarray(self):
disconnect = False disconnect = False
if self.checkSeisArrayState(): if self.checkSeisArrayState():
if not self.continueDialogExists('Seismic Array'): if not continueDialogExists('Seismic Array'):
return return
if self.checkConnected2SurveyState(): if self.checkConnected2SurveyState():
if not self.continueDialogMessage('Seismic Array connected to present Survey.\n' if not continueDialogMessage('Seismic Array connected to present Survey.\n'
'Continuation will disconnect the Seismic Array.'): 'Continuation will disconnect the Seismic Array.'):
return return
else: else:
@ -423,10 +423,10 @@ class gui_control(object):
try: try:
seisarray = seismicArrayPreparation.SeisArray.from_pickle(filename) seisarray = seismicArrayPreparation.SeisArray.from_pickle(filename)
except: except:
self.printDialogMessage('Could not load object %s.'%filename) printDialogMessage('Could not load object %s.'%filename)
return return
if not type(seisarray) == seismicArrayPreparation.SeisArray: if not type(seisarray) == seismicArrayPreparation.SeisArray:
self.printDialogMessage('Wrong input file of type %s, expected %s.' printDialogMessage('Wrong input file of type %s, expected %s.'
%(type(seisarray), seismicArrayPreparation.SeisArray)) %(type(seisarray), seismicArrayPreparation.SeisArray))
return return
if disconnect: if disconnect:
@ -436,7 +436,7 @@ class gui_control(object):
def save_seisarray(self): def save_seisarray(self):
if not self.checkSeisArrayState(): if not self.checkSeisArrayState():
self.printDialogMessage('No Seismic Array defined.') printDialogMessage('No Seismic Array defined.')
return return
filename = saveFile() filename = saveFile()
if filename is None: if filename is None:
@ -445,7 +445,7 @@ class gui_control(object):
def save_survey(self): def save_survey(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
filename = saveFile() filename = saveFile()
if filename is None: if filename is None:
@ -478,7 +478,7 @@ class gui_control(object):
self.enablePickedTools(True, self.survey.twoDim) self.enablePickedTools(True, self.survey.twoDim)
self.survey.picked = True self.survey.picked = True
elif state == True and self.checkSurveyState() is False: elif state == True and self.checkSurveyState() is False:
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
elif state == False: elif state == False:
self.mainUI.picked_active.setPixmap(self.cancelpixmap) self.mainUI.picked_active.setPixmap(self.cancelpixmap)
@ -514,39 +514,10 @@ class gui_control(object):
def checkPickState(self): def checkPickState(self):
if not self.survey: if not self.survey:
self.printDialogMessage('No Survey defined.') printDialogMessage('No Survey defined.')
return return
return self.survey.picked return self.survey.picked
def printDialogMessage(self, message):
qmb = QtGui.QMessageBox()
qmb.setText(message)
qmb.setStandardButtons(QtGui.QMessageBox.Ok)
qmb.setIcon(QtGui.QMessageBox.Warning)
qmb.exec_()
def continueDialogExists(self, name):
qmb = QtGui.QMessageBox()
qmb.setText('%s object already exists. Overwrite?'%name)
qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
qmb.setIcon(QtGui.QMessageBox.Warning)
answer = qmb.exec_()
if answer == 1024:
return True
else:
return False
def continueDialogMessage(self, message):
qmb = QtGui.QMessageBox()
qmb.setText(message)
qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
qmb.setIcon(QtGui.QMessageBox.Warning)
answer = qmb.exec_()
if answer == 1024:
return True
else:
return False
def exitApp(self): def exitApp(self):
QtCore.QCoreApplication.instance().quit() QtCore.QCoreApplication.instance().quit()

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'asp3d_layout.ui' # Form implementation generated from reading ui file 'asp3d_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:12 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui' # Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:12 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_seisarray_layout.ui' # Form implementation generated from reading ui file 'generate_seisarray_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_survey_layout.ui' # Form implementation generated from reading ui file 'generate_survey_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui' # Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'picking_parameters_layout.ui' # Form implementation generated from reading ui file 'picking_parameters_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'postprocessing_layout.ui' # Form implementation generated from reading ui file 'postprocessing_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -38,8 +38,11 @@ class Ui_postprocessing(object):
sizePolicy.setHeightForWidth(self.pushButton_rect.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.pushButton_rect.sizePolicy().hasHeightForWidth())
self.pushButton_rect.setSizePolicy(sizePolicy) self.pushButton_rect.setSizePolicy(sizePolicy)
self.pushButton_rect.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButton_rect.setMaximumSize(QtCore.QSize(16777215, 30))
self.pushButton_rect.setCheckable(True) self.pushButton_rect.setCheckable(False)
self.pushButton_rect.setObjectName("pushButton_rect") self.pushButton_rect.setObjectName("pushButton_rect")
self.buttonGroup = QtGui.QButtonGroup(postprocessing)
self.buttonGroup.setObjectName("buttonGroup")
self.buttonGroup.addButton(self.pushButton_rect)
self.horizontalLayout_4.addWidget(self.pushButton_rect) self.horizontalLayout_4.addWidget(self.pushButton_rect)
self.pushButton_poly = QtGui.QPushButton(postprocessing) self.pushButton_poly = QtGui.QPushButton(postprocessing)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
@ -48,9 +51,20 @@ class Ui_postprocessing(object):
sizePolicy.setHeightForWidth(self.pushButton_poly.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.pushButton_poly.sizePolicy().hasHeightForWidth())
self.pushButton_poly.setSizePolicy(sizePolicy) self.pushButton_poly.setSizePolicy(sizePolicy)
self.pushButton_poly.setMaximumSize(QtCore.QSize(16777215, 30)) self.pushButton_poly.setMaximumSize(QtCore.QSize(16777215, 30))
self.pushButton_poly.setCheckable(True) self.pushButton_poly.setCheckable(False)
self.pushButton_poly.setObjectName("pushButton_poly") self.pushButton_poly.setObjectName("pushButton_poly")
self.buttonGroup.addButton(self.pushButton_poly)
self.horizontalLayout_4.addWidget(self.pushButton_poly) self.horizontalLayout_4.addWidget(self.pushButton_poly)
self.pushButton_undo = QtGui.QPushButton(postprocessing)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton_undo.sizePolicy().hasHeightForWidth())
self.pushButton_undo.setSizePolicy(sizePolicy)
self.pushButton_undo.setMaximumSize(QtCore.QSize(16777215, 30))
self.pushButton_undo.setCheckable(False)
self.pushButton_undo.setObjectName("pushButton_undo")
self.horizontalLayout_4.addWidget(self.pushButton_undo)
self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.verticalLayout_3.addLayout(self.horizontalLayout_4)
self.horizontalLayout_2.addLayout(self.verticalLayout_3) self.horizontalLayout_2.addLayout(self.verticalLayout_3)
self.line = QtGui.QFrame(postprocessing) self.line = QtGui.QFrame(postprocessing)
@ -153,6 +167,7 @@ class Ui_postprocessing(object):
self.label.setText(QtGui.QApplication.translate("postprocessing", "Selection", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("postprocessing", "Selection", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_rect.setText(QtGui.QApplication.translate("postprocessing", "Rectangle", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_rect.setText(QtGui.QApplication.translate("postprocessing", "Rectangle", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_poly.setText(QtGui.QApplication.translate("postprocessing", "Polygon", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_poly.setText(QtGui.QApplication.translate("postprocessing", "Polygon", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_undo.setText(QtGui.QApplication.translate("postprocessing", "Undo", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("postprocessing", "Action", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("postprocessing", "Action", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_plot.setText(QtGui.QApplication.translate("postprocessing", "Plot", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_plot.setText(QtGui.QApplication.translate("postprocessing", "Plot", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_delete.setText(QtGui.QApplication.translate("postprocessing", "Delete", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton_delete.setText(QtGui.QApplication.translate("postprocessing", "Delete", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'vtk_tools_layout.ui' # Form implementation generated from reading ui file 'vtk_tools_layout.ui'
# #
# Created: Wed Aug 24 13:12:00 2016 # Created: Wed Aug 24 14:38:13 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -48,6 +48,35 @@ def getMaxCPU():
import multiprocessing import multiprocessing
return multiprocessing.cpu_count() return multiprocessing.cpu_count()
def printDialogMessage(message):
qmb = QtGui.QMessageBox()
qmb.setText(message)
qmb.setStandardButtons(QtGui.QMessageBox.Ok)
qmb.setIcon(QtGui.QMessageBox.Warning)
qmb.exec_()
def continueDialogExists(name):
qmb = QtGui.QMessageBox()
qmb.setText('%s object already exists. Overwrite?'%name)
qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
qmb.setIcon(QtGui.QMessageBox.Warning)
answer = qmb.exec_()
if answer == 1024:
return True
else:
return False
def continueDialogMessage(message):
qmb = QtGui.QMessageBox()
qmb.setText(message)
qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
qmb.setIcon(QtGui.QMessageBox.Warning)
answer = qmb.exec_()
if answer == 1024:
return True
else:
return False
class Gen_SeisArray(object): class Gen_SeisArray(object):
def __init__(self, mainwindow): def __init__(self, mainwindow):
@ -606,6 +635,7 @@ class Postprocessing(object):
self.survey = survey self.survey = survey
self.init_widget() self.init_widget()
self.start_widget() self.start_widget()
self.inkByVal = 'snrlog'
def init_widget(self): def init_widget(self):
qwidget = QtGui.QWidget()# qwidget = QtGui.QWidget()#
@ -642,11 +672,11 @@ class Postprocessing(object):
self.ax = ax self.ax = ax
self.draw() self.draw()
def refreshPlot(self, inkByVal = 'snrlog'): def refreshPlot(self):
self.ax.clear() self.ax.clear()
ax = self.ax ax = self.ax
ax, cbar, sc = self.survey.createPlot(self.dists, self.picks, self.inkDict[inkByVal], ax, cbar, sc = self.survey.createPlot(self.dists, self.picks, self.inkDict[self.inkByVal],
inkByVal, ax = ax, cbar = self.cbar) self.inkByVal, ax = ax, cbar = self.cbar)
#self.cbar = self.figure.colorbar(sc, fraction=0.05) #self.cbar = self.figure.colorbar(sc, fraction=0.05)
self.draw() self.draw()
@ -663,6 +693,8 @@ class Postprocessing(object):
QtCore.QObject.connect(self.ui.pushButton_rect, QtCore.SIGNAL("clicked()"), self.chooseRect) QtCore.QObject.connect(self.ui.pushButton_rect, QtCore.SIGNAL("clicked()"), self.chooseRect)
QtCore.QObject.connect(self.ui.pushButton_poly, QtCore.SIGNAL("clicked()"), self.choosePoly) QtCore.QObject.connect(self.ui.pushButton_poly, QtCore.SIGNAL("clicked()"), self.choosePoly)
QtCore.QObject.connect(self.ui.pushButton_plot, QtCore.SIGNAL("clicked()"), self.plotPicks) QtCore.QObject.connect(self.ui.pushButton_plot, QtCore.SIGNAL("clicked()"), self.plotPicks)
QtCore.QObject.connect(self.ui.pushButton_delete, QtCore.SIGNAL("clicked()"), self.deleteSelected)
QtCore.QObject.connect(self.ui.pushButton_undo, QtCore.SIGNAL("clicked()"), self.undoSelection)
QtCore.QObject.connect(self.ui.pushButton_snr, QtCore.SIGNAL("clicked()"), self.refrSNR) QtCore.QObject.connect(self.ui.pushButton_snr, QtCore.SIGNAL("clicked()"), self.refrSNR)
QtCore.QObject.connect(self.ui.pushButton_pe, QtCore.SIGNAL("clicked()"), self.refrPE) QtCore.QObject.connect(self.ui.pushButton_pe, QtCore.SIGNAL("clicked()"), self.refrPE)
QtCore.QObject.connect(self.ui.pushButton_spe, QtCore.SIGNAL("clicked()"), self.refrSPE) QtCore.QObject.connect(self.ui.pushButton_spe, QtCore.SIGNAL("clicked()"), self.refrSPE)
@ -673,15 +705,32 @@ class Postprocessing(object):
def choosePoly(self): def choosePoly(self):
self.region.choosePolygon() self.region.choosePolygon()
def disconnectRect(self):
self.region.disconnectRect()
def disconnectPoly(self):
self.region.disconnectPoly()
def plotPicks(self): def plotPicks(self):
self.region.plotTracesInActiveRegions() self.region.plotTracesInActiveRegions()
def deleteSelected(self):
self.region.setAllActiveRegionsForDeletion()
message = 'Are you sure you want to delete all marked picks?'
if continueDialogMessage(message):
self.region.deleteAllMarkedPicks()
else:
self.region.refreshFigure()
def undoSelection(self):
self.region.deselectLastSelection()
def refrSNR(self): def refrSNR(self):
self.refreshPlot('snrlog') self.region.refreshLog10SNR()
def refrPE(self): def refrPE(self):
self.refreshPlot('pe') self.region.refreshPickerror()
def refrSPE(self): def refrSPE(self):
self.refreshPlot('spe') self.region.refreshSPE()

View File

@ -250,7 +250,8 @@ class regions(object):
return return
key = max(self.shots_found.keys()) key = max(self.shots_found.keys())
self.deselectSelection(key) self.deselectSelection(key)
self.refreshFigure()
def deselectSelection(self, key, color='green', alpha=0.1): def deselectSelection(self, key, color='green', alpha=0.1):
if key not in self.shots_found.keys(): if key not in self.shots_found.keys():
self.printOutput('No selection found.') self.printOutput('No selection found.')
@ -498,16 +499,19 @@ class regions(object):
def refreshLog10SNR(self, event=None): def refreshLog10SNR(self, event=None):
cbv = 'log10SNR' cbv = 'log10SNR'
self.cbv = cbv
self.refreshFigure(self, colorByVal=cbv) self.refreshFigure(self, colorByVal=cbv)
def refreshPickerror(self, event=None): def refreshPickerror(self, event=None):
cbv = 'pickerror' cbv = 'pickerror'
self.cbv = cbv
self.refreshFigure(self, colorByVal=cbv) self.refreshFigure(self, colorByVal=cbv)
def refreshSPE(self, event=None): def refreshSPE(self, event=None):
cbv = 'spe' cbv = 'spe'
self.cbv = cbv
self.refreshFigure(self, colorByVal=cbv) self.refreshFigure(self, colorByVal=cbv)
def refreshFigure(self, event=None, colorByVal=None): def refreshFigure(self, event=None, colorByVal=None):
if colorByVal == None: if colorByVal == None:
colorByVal = self.cbv colorByVal = self.cbv