preparations for QT repicking interface

This commit is contained in:
Marcel Paffrath 2016-08-26 14:31:09 +02:00
parent 135ac0ef80
commit eb1d7c07a0
4 changed files with 66 additions and 10 deletions

View File

@ -13,6 +13,7 @@ from picking_parameters_layout import Ui_picking_parameters
from fmtomo_parameters_layout import Ui_fmtomo_parameters from fmtomo_parameters_layout import Ui_fmtomo_parameters
from vtk_tools_layout import Ui_vtk_tools from vtk_tools_layout import Ui_vtk_tools
from postprocessing_layout import Ui_postprocessing from postprocessing_layout import Ui_postprocessing
from repicking_layout import Ui_repicking
from pylot.core.active.surveyPlotTools import regions from pylot.core.active.surveyPlotTools import regions
@ -734,3 +735,39 @@ class Postprocessing(object):
def refrSPE(self): def refrSPE(self):
self.region.refreshSPE() self.region.refreshSPE()
class Repicking(object):
def __init__(self, mainwindow, region, shot, traceID):
self.mainwindow = mainwindow
self.region = region
self.shot = shot
self.traceID = traceID
self.init_dialog()
self.start_dialog()
def init_dialog(self):
qdialog = QtGui.QDialog(self.mainwindow)
ui = Ui_repicking()
ui.setupUi(qdialog)
self.ui = ui
self.qdialog = qdialog
self.connectButtons()
def start_dialog(self):
self.qdialog.exec_()
def connectButtons(self):
QtCore.QObject.connect(self.ui.pushButton_repick, QtCore.SIGNAL("clicked()"), self.repick)
QtCore.QObject.connect(self.ui.pushButton_delete, QtCore.SIGNAL("clicked()"), self.delete)
def initPlot(self):
self.figure = Figure()
self.canvas = FigureCanvas(self.figure)
self.ui.verticalLayout_plot.addWidget(self.canvas)
self.toolbar = NavigationToolbar(self.canvas, self.mainwindow)
self.ui.verticalLayout_plot.addWidget(self.toolbar)
def plot(self):
self.shot.plot_traces(self.traceID, figure = self.figure, buttons = False)
self.ax = ax
self.draw()

View File

@ -679,7 +679,7 @@ class SeismicShot(object):
ax.legend() ax.legend()
ax.text(0.05, 0.9, 'SNR: %s' % snr, transform=ax.transAxes) ax.text(0.05, 0.9, 'SNR: %s' % snr, transform=ax.transAxes)
def plot_traces(self, traceID): def plot_traces(self, traceID, figure = None, buttons = True):
from matplotlib.widgets import Button from matplotlib.widgets import Button
def onclick(event): def onclick(event):
@ -704,17 +704,33 @@ class SeismicShot(object):
def cleanup(event): def cleanup(event):
self.traces4plot[traceID] = {} self.traces4plot[traceID] = {}
folm = self.folm def addButtons(fig):
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
axb1 = fig.add_axes([0.15, 0.91, 0.05, 0.03]) axb1 = fig.add_axes([0.15, 0.91, 0.05, 0.03])
axb2 = fig.add_axes([0.22, 0.91, 0.05, 0.03]) axb2 = fig.add_axes([0.22, 0.91, 0.05, 0.03])
button1 = Button(axb1, 'repick', color='red', hovercolor='grey') button1 = Button(axb1, 'repick', color='red', hovercolor='grey')
button1.on_clicked(connectButton) button1.on_clicked(connectButton)
button2 = Button(axb2, 'delete', color='green', hovercolor='grey') button2 = Button(axb2, 'delete', color='green', hovercolor='grey')
button2.on_clicked(rmPick) button2.on_clicked(rmPick)
return axb1, axb2, button1, button2
folm = self.folm
if figure == None:
fig = plt.figure()
else:
fig = figure
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
if buttons:
axb1, axb2, button1, button2 = addButtons(fig)
else:
axb1 = None
axb2 = None
button1 = None
button2 = None
fig.canvas.mpl_connect('close_event', cleanup) fig.canvas.mpl_connect('close_event', cleanup)
self.traces4plot[traceID] = dict(fig=fig, ax1=ax1, ax2=ax2, axb1=axb1, axb2=axb2, button1=button1, self.traces4plot[traceID] = dict(fig=fig, ax1=ax1, ax2=ax2, axb1=axb1, axb2=axb2, button1=button1,

View File

@ -373,7 +373,7 @@ class regions(object):
self.highlightPick(self.shot_dict[shotnumber], traceID) self.highlightPick(self.shot_dict[shotnumber], traceID)
self.drawFigure() self.drawFigure()
def plotTracesInActiveRegions(self, event=None, keys='all', maxfigures=20): def plotTracesInActiveRegions(self, event=None, keys='all', maxfigures=20, qt = False):
''' '''
Plots all traces in the active region or for all specified keys. Plots all traces in the active region or for all specified keys.
@ -383,6 +383,9 @@ class regions(object):
:param: maxfigures, maximum value of figures opened :param: maxfigures, maximum value of figures opened
:type: int :type: int
''' '''
if qt:
from pylot.core.active.gui import Repicking
count = 0 count = 0
if keys == 'all': if keys == 'all':
keys = self.shots_found.keys() keys = self.shots_found.keys()