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 vtk_tools_layout import Ui_vtk_tools
from postprocessing_layout import Ui_postprocessing
from repicking_layout import Ui_repicking
from pylot.core.active.surveyPlotTools import regions
@ -734,3 +735,39 @@ class Postprocessing(object):
def refrSPE(self):
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.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
def onclick(event):
@ -704,17 +704,33 @@ class SeismicShot(object):
def cleanup(event):
self.traces4plot[traceID] = {}
def addButtons(fig):
axb1 = fig.add_axes([0.15, 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.on_clicked(connectButton)
button2 = Button(axb2, 'delete', color='green', hovercolor='grey')
button2.on_clicked(rmPick)
return axb1, axb2, button1, button2
folm = self.folm
fig = plt.figure()
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)
axb1 = fig.add_axes([0.15, 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.on_clicked(connectButton)
button2 = Button(axb2, 'delete', color='green', hovercolor='grey')
button2.on_clicked(rmPick)
if buttons:
axb1, axb2, button1, button2 = addButtons(fig)
else:
axb1 = None
axb2 = None
button1 = None
button2 = None
fig.canvas.mpl_connect('close_event', cleanup)
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.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.
@ -383,6 +383,9 @@ class regions(object):
:param: maxfigures, maximum value of figures opened
:type: int
'''
if qt:
from pylot.core.active.gui import Repicking
count = 0
if keys == 'all':
keys = self.shots_found.keys()

View File

@ -72,7 +72,7 @@ def plotFittedSNR(dists, snrthresholds, snrs, snrBestFit):
plt.ylabel('SNR')
plt.legend()
def setDynamicFittedSNR(shot_dict, shiftdist=30, shiftSNR=100, p1=0.004, p2=-0.0007):
"""
Set SNR values for a dictionary containing Seismicshots (e.g. survey.getShotDict())