further GUI implementations, plot of seismic array in main window
This commit is contained in:
parent
8393f283c7
commit
806b974011
@ -1,6 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import matplotlib
|
||||
matplotlib.use('Qt4Agg')
|
||||
matplotlib.rcParams['backend.qt4']='PySide'
|
||||
|
||||
from PySide import QtCore, QtGui, QtCore
|
||||
from asp3d_layout import *
|
||||
from fmtomo_parameters_layout import *
|
||||
@ -9,6 +13,10 @@ from generate_seisarray_layout import *
|
||||
from picking_parameters_layout import *
|
||||
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
|
||||
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.figure import Figure
|
||||
|
||||
class gui_control(object):
|
||||
def __init__(self):
|
||||
self.mainwindow = MainWindow
|
||||
@ -19,6 +27,7 @@ class gui_control(object):
|
||||
self.cancelpixmap = self.mainwindow.style().standardPixmap(QtGui.QStyle.SP_DialogCancelButton)
|
||||
self.applypixmap = self.mainwindow.style().standardPixmap(QtGui.QStyle.SP_DialogApplyButton)
|
||||
self.setInitStates()
|
||||
self.addArrayPlot()
|
||||
|
||||
def setInitStates(self):
|
||||
self.setPickState(False)
|
||||
@ -57,6 +66,7 @@ class gui_control(object):
|
||||
self.seisarray.addSourceLocations(srcfile)
|
||||
if len(ptsfile) > 0:
|
||||
self.seisarray.addMeasuredTopographyPoints(ptsfile)
|
||||
self.reprintArray()
|
||||
self.setSeisArrayState(True)
|
||||
|
||||
def gen_survey(self):
|
||||
@ -78,6 +88,12 @@ class gui_control(object):
|
||||
surveyUtils.setDynamicFittedSNR(self.survey.getShotDict())
|
||||
self.setSurveyState(True)
|
||||
|
||||
def addArrayPlot(self):
|
||||
self.seisArrayFigure = Figure()
|
||||
self.seisArrayCanvas = FigureCanvas(self.seisArrayFigure)
|
||||
self.mainUI.verticalLayout_right.addWidget(self.seisArrayCanvas)
|
||||
self.seisArrayAx = self.seisArrayFigure.add_subplot(111)
|
||||
|
||||
def interpolate_receivers(self):
|
||||
if not self.checkSeisArrayState():
|
||||
self.printDialogMessage('No Seismic Array defined.')
|
||||
@ -230,8 +246,13 @@ class gui_control(object):
|
||||
self.seisarray = self.survey.seisarray
|
||||
self.setConnected2SurveyState(True)
|
||||
self.setSeisArrayState(True)
|
||||
self.reprintArray()
|
||||
self.printDialogMessage('Loaded Survey with active Seismic Array.')
|
||||
|
||||
def reprintArray(self):
|
||||
self.seisArrayAx.clear()
|
||||
self.seisarray.plotArray2D(self.seisArrayAx)
|
||||
|
||||
def load_seisarray(self):
|
||||
if self.checkSeisArrayState():
|
||||
if not self.continueDialogExists('Seismic Array'):
|
||||
@ -249,6 +270,7 @@ class gui_control(object):
|
||||
%(type(survey), seismicArrayPreparation.SeisArray))
|
||||
return
|
||||
self.seisarray = seisarray
|
||||
self.reprintArray()
|
||||
self.setSeisArrayState(True)
|
||||
|
||||
def save_seisarray(self):
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'asp3d_layout.ui'
|
||||
#
|
||||
# Created: Thu Jun 16 12:18:04 2016
|
||||
# Created: Tue Jun 21 13:22:35 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -13,7 +13,7 @@ class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.setEnabled(True)
|
||||
MainWindow.resize(300, 585)
|
||||
MainWindow.resize(800, 600)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
@ -27,7 +27,13 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setWindowIcon(icon)
|
||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.verticalLayout_5 = QtGui.QVBoxLayout(self.centralwidget)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.centralwidget)
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.horizontalLayout_outer = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_outer.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
|
||||
self.horizontalLayout_outer.setObjectName("horizontalLayout_outer")
|
||||
self.verticalLayout_5 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
|
||||
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
@ -204,12 +210,11 @@ class Ui_MainWindow(object):
|
||||
self.postprocessing = QtGui.QPushButton(self.centralwidget)
|
||||
self.postprocessing.setObjectName("postprocessing")
|
||||
self.verticalLayout_3.addWidget(self.postprocessing)
|
||||
self.verticalLayout_5.addLayout(self.verticalLayout_3)
|
||||
self.line_2 = QtGui.QFrame(self.centralwidget)
|
||||
self.line_2.setFrameShape(QtGui.QFrame.HLine)
|
||||
self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.line_2.setObjectName("line_2")
|
||||
self.verticalLayout_5.addWidget(self.line_2)
|
||||
self.verticalLayout_3.addWidget(self.line_2)
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.label_8 = QtGui.QLabel(self.centralwidget)
|
||||
@ -230,10 +235,17 @@ class Ui_MainWindow(object):
|
||||
self.fmtomo = QtGui.QPushButton(self.centralwidget)
|
||||
self.fmtomo.setObjectName("fmtomo")
|
||||
self.verticalLayout_4.addWidget(self.fmtomo)
|
||||
self.verticalLayout_5.addLayout(self.verticalLayout_4)
|
||||
self.verticalLayout_3.addLayout(self.verticalLayout_4)
|
||||
self.verticalLayout_5.addLayout(self.verticalLayout_3)
|
||||
self.horizontalLayout_outer.addLayout(self.verticalLayout_5)
|
||||
self.verticalLayout_right = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_right.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
|
||||
self.verticalLayout_right.setObjectName("verticalLayout_right")
|
||||
self.horizontalLayout_outer.addLayout(self.verticalLayout_right)
|
||||
self.horizontalLayout_4.addLayout(self.horizontalLayout_outer)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 300, 23))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtGui.QStatusBar(MainWindow)
|
||||
|
@ -783,11 +783,12 @@ class SeisArray(object):
|
||||
print "Exported coordinates for %s traces to file > %s" % (count, filename)
|
||||
recfile_out.close()
|
||||
|
||||
def plotArray2D(self, plot_topo=False, highlight_measured=False, annotations=True, pointsize=10):
|
||||
def plotArray2D(self, ax = None, plot_topo=False, highlight_measured=False, annotations=True, pointsize=10):
|
||||
import matplotlib.pyplot as plt
|
||||
plt.interactive(True)
|
||||
fig = plt.figure()
|
||||
ax = plt.axes()
|
||||
if ax == None:
|
||||
plt.interactive(True)
|
||||
fig = plt.figure()
|
||||
ax = plt.axes()
|
||||
xmt, ymt, zmt = self.getMeasuredTopoLists()
|
||||
xsc, ysc, zsc = self.getSourceLocsLists()
|
||||
xmr, ymr, zmr = self.getMeasuredReceiverLists()
|
||||
@ -803,11 +804,14 @@ class SeisArray(object):
|
||||
if highlight_measured == True:
|
||||
ax.plot(xmr, ymr, 'r.', markersize=pointsize, label='measured receivers')
|
||||
|
||||
plt.title('2D plot of seismic array %s' % self.recfile)
|
||||
ax.text(0.5, 1.05,'2D plot of seismic array\n %s'%self.recfile,
|
||||
horizontalalignment='center', verticalalignment='center',
|
||||
transform=ax.transAxes)
|
||||
#plt.title('2D plot of seismic array %s' % self.recfile)
|
||||
ax.set_xlabel('X [m]')
|
||||
ax.set_ylabel('Y [m]')
|
||||
ax.set_aspect('equal')
|
||||
plt.legend()
|
||||
ax.legend()
|
||||
if annotations == True:
|
||||
for traceID in self.getReceiverCoordinates().keys():
|
||||
ax.annotate((' ' + str(traceID)), xy=(self._getXreceiver(traceID), self._getYreceiver(traceID)),
|
||||
|
Loading…
Reference in New Issue
Block a user