busy adding VTK tools to main UI
This commit is contained in:
parent
5c7123af66
commit
0be69de6f7
@ -12,6 +12,7 @@ from generate_survey_layout import *
|
||||
from generate_survey_layout_minimal import *
|
||||
from generate_seisarray_layout import *
|
||||
from picking_parameters_layout import *
|
||||
from vtk_tools_layout import *
|
||||
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
|
||||
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
@ -50,6 +51,7 @@ class gui_control(object):
|
||||
QtCore.QObject.connect(self.mainUI.picker, QtCore.SIGNAL("clicked()"), self.callPicker)
|
||||
QtCore.QObject.connect(self.mainUI.postprocessing, QtCore.SIGNAL("clicked()"), self.postprocessing)
|
||||
QtCore.QObject.connect(self.mainUI.fmtomo, QtCore.SIGNAL("clicked()"), self.startFMTOMO)
|
||||
QtCore.QObject.connect(self.mainUI.vtk_tools, QtCore.SIGNAL("clicked()"), self.startVTKtools)
|
||||
QtCore.QObject.connect(self.mainUI.comboBox, QtCore.SIGNAL("activated(int)"), self.replotStat)
|
||||
|
||||
def gen_seisarray(self):
|
||||
@ -73,7 +75,10 @@ class gui_control(object):
|
||||
srcfile = self.gen_new_seisarray.lineEdit_src.text()
|
||||
recfile = self.gen_new_seisarray.lineEdit_rec.text()
|
||||
ptsfile = self.gen_new_seisarray.lineEdit_pts.text()
|
||||
self.seisarray = seismicArrayPreparation.SeisArray(recfile)
|
||||
if self.gen_new_seisarray.radioButton_interpolatable.isChecked():
|
||||
self.seisarray = seismicArrayPreparation.SeisArray(recfile, True)
|
||||
elif self.gen_new_seisarray.radioButton_normal.isChecked():
|
||||
self.seisarray = seismicArrayPreparation.SeisArray(recfile, False)
|
||||
if len(srcfile) > 0:
|
||||
self.seisarray.addSourceLocations(srcfile)
|
||||
if len(ptsfile) > 0:
|
||||
@ -247,6 +252,9 @@ class gui_control(object):
|
||||
if not self.checkSurveyState():
|
||||
self.printDialogMessage('No Survey defined.')
|
||||
return
|
||||
if not self.checkPickState():
|
||||
self.printDialogMessage('Survey not picked.')
|
||||
return
|
||||
fmtomo_parameters = QtGui.QDialog(self.mainwindow)
|
||||
ui = Ui_fmtomo_parameters()
|
||||
ui.setupUi(fmtomo_parameters)
|
||||
@ -256,6 +264,15 @@ class gui_control(object):
|
||||
self.connectButtons_startFMTOMO()
|
||||
self.getFMTOMOparameters(ui, fmtomo_parameters)
|
||||
|
||||
def startVTKtools(self):
|
||||
vtk_tools = QtGui.QDialog(self.mainwindow)
|
||||
ui = Ui_vtk_tools()
|
||||
ui.setupUi(vtk_tools)
|
||||
|
||||
self.vtk_tools_ui = ui
|
||||
self.connectButtons_vtk_tools()
|
||||
#self.getFMTOMOparameters(ui, fmtomo_parameters)
|
||||
|
||||
def getFMTOMOparameters(self, ui, fmtomo_parameters):
|
||||
if fmtomo_parameters.exec_():
|
||||
fmtomo_dir = ui.fmtomo_dir.text()
|
||||
@ -291,6 +308,40 @@ class gui_control(object):
|
||||
QtCore.QObject.connect(self.fmtomo_parameters_ui.browse_customgrid, QtCore.SIGNAL("clicked()"), self.chooseCustomgrid)
|
||||
QtCore.QObject.connect(self.fmtomo_parameters_ui.browse_simuldir, QtCore.SIGNAL("clicked()"), self.chooseSimuldir)
|
||||
|
||||
def connectButtons_vtk_tools(self):
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_vg, QtCore.SIGNAL("clicked()"), self.chooseVgrid)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_vgref, QtCore.SIGNAL("clicked()"), self.chooseVgridref)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_rays, QtCore.SIGNAL("clicked()"), self.chooseRaysIn)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_raysout, QtCore.SIGNAL("clicked()"), self.chooseRaysOutDir)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.start_vg, QtCore.SIGNAL("clicked()"), self.startvgvtk)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.start_rays, QtCore.SIGNAL("clicked()"), self.startraysvtk)
|
||||
|
||||
def chooseVgrid(self):
|
||||
self.vtk_tools_ui.lineEdit_vg.setText(self.openFile())
|
||||
|
||||
def chooseVgridref(self):
|
||||
self.vtk_tools_ui.lineEdit_vgref.setText(self.openFile())
|
||||
|
||||
def chooseRaysIn(self):
|
||||
self.vtk_tools_ui.lineEdit_rays.setText(self.openFile())
|
||||
|
||||
def chooseRaysOutDir(self):
|
||||
self.vtk_tools_ui.lineEdit_raysout.setText(self.browseDir())
|
||||
|
||||
def startvgvtk(self):
|
||||
if self.vtk_tools_ui.radioButton_abs.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = self.vtk_tools_ui.lineEdit_vg.text(),
|
||||
outputfile = 'vgrids_rel.vtk',
|
||||
absOrRel='abs')
|
||||
elif self.vtk_tools_ui.radioButton_rel.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = self.vtk_tools_ui.lineEdit_vg.text(),
|
||||
outputfile = 'vgrids_rel.vtk',
|
||||
absOrRel='rel',
|
||||
inputfileref = self.vtk_tools_ui.lineEdit_vgref.text())
|
||||
|
||||
def startraysvtk(self):
|
||||
fmtomoUtils.rays2VTK()
|
||||
|
||||
def chooseFMTOMOdir(self):
|
||||
self.fmtomo_parameters_ui.fmtomo_dir.setText(self.browseDir())
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'asp3d_layout.ui'
|
||||
#
|
||||
# Created: Tue Jun 28 14:40:06 2016
|
||||
# Created: Tue Jul 5 13:55:55 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -27,8 +27,8 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setWindowIcon(icon)
|
||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.centralwidget)
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.gridLayout = QtGui.QGridLayout(self.centralwidget)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.formLayout = QtGui.QFormLayout()
|
||||
self.formLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
|
||||
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
|
||||
@ -237,6 +237,24 @@ class Ui_MainWindow(object):
|
||||
self.fmtomo = QtGui.QPushButton(self.centralwidget)
|
||||
self.fmtomo.setObjectName("fmtomo")
|
||||
self.verticalLayout_4.addWidget(self.fmtomo)
|
||||
self.label_9 = QtGui.QLabel(self.centralwidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth())
|
||||
self.label_9.setSizePolicy(sizePolicy)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Sans Serif")
|
||||
font.setPointSize(10)
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_9.setFont(font)
|
||||
self.label_9.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_9.setObjectName("label_9")
|
||||
self.verticalLayout_4.addWidget(self.label_9)
|
||||
self.vtk_tools = QtGui.QPushButton(self.centralwidget)
|
||||
self.vtk_tools.setObjectName("vtk_tools")
|
||||
self.verticalLayout_4.addWidget(self.vtk_tools)
|
||||
self.verticalLayout_3.addLayout(self.verticalLayout_4)
|
||||
self.verticalLayout_5.addLayout(self.verticalLayout_3)
|
||||
self.formLayout.setLayout(0, QtGui.QFormLayout.LabelRole, self.verticalLayout_5)
|
||||
@ -259,7 +277,7 @@ class Ui_MainWindow(object):
|
||||
self.horizontalLayout_br.setObjectName("horizontalLayout_br")
|
||||
self.verticalLayout_right.addLayout(self.horizontalLayout_br)
|
||||
self.formLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.verticalLayout_right)
|
||||
self.horizontalLayout_4.addLayout(self.formLayout)
|
||||
self.gridLayout.addLayout(self.formLayout, 0, 0, 1, 1)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 905, 23))
|
||||
@ -304,4 +322,7 @@ class Ui_MainWindow(object):
|
||||
self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Simulation", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.fmtomo.setToolTip(QtGui.QApplication.translate("MainWindow", "Set parameters and call Fast Marching Tomography algorithm.", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.fmtomo.setText(QtGui.QApplication.translate("MainWindow", "FMTOMO Simulation", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_9.setText(QtGui.QApplication.translate("MainWindow", "Visualization", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.vtk_tools.setToolTip(QtGui.QApplication.translate("MainWindow", "Set parameters and call Fast Marching Tomography algorithm.", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.vtk_tools.setText(QtGui.QApplication.translate("MainWindow", "VTK tools", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
|
||||
#
|
||||
# Created: Tue Jun 28 14:40:06 2016
|
||||
# Created: Tue Jul 5 13:55:55 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: Tue Jun 28 14:40:06 2016
|
||||
# Created: Tue Jul 5 13:55:55 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_generate_seisarray(object):
|
||||
def setupUi(self, generate_seisarray):
|
||||
generate_seisarray.setObjectName("generate_seisarray")
|
||||
generate_seisarray.resize(400, 221)
|
||||
generate_seisarray.resize(403, 221)
|
||||
generate_seisarray.setMinimumSize(QtCore.QSize(400, 220))
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
@ -23,14 +23,27 @@ class Ui_generate_seisarray(object):
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.label_rec = QtGui.QLabel(generate_seisarray)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_rec.sizePolicy().hasHeightForWidth())
|
||||
self.label_rec.setSizePolicy(sizePolicy)
|
||||
self.label_rec.setToolTip("")
|
||||
self.label_rec.setObjectName("label_rec")
|
||||
self.verticalLayout_4.addWidget(self.label_rec)
|
||||
self.horizontalLayout.addWidget(self.label_rec)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.radioButton_normal = QtGui.QRadioButton(generate_seisarray)
|
||||
self.radioButton_normal.setChecked(True)
|
||||
self.radioButton_normal.setObjectName("radioButton_normal")
|
||||
self.horizontalLayout.addWidget(self.radioButton_normal)
|
||||
self.radioButton_interpolatable = QtGui.QRadioButton(generate_seisarray)
|
||||
self.radioButton_interpolatable.setObjectName("radioButton_interpolatable")
|
||||
self.horizontalLayout.addWidget(self.radioButton_interpolatable)
|
||||
self.verticalLayout_4.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.lineEdit_rec = QtGui.QLineEdit(generate_seisarray)
|
||||
@ -95,11 +108,27 @@ class Ui_generate_seisarray(object):
|
||||
|
||||
def retranslateUi(self, generate_seisarray):
|
||||
generate_seisarray.setWindowTitle(QtGui.QApplication.translate("generate_seisarray", "Generate new Seismic Array", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_rec.setToolTip(QtGui.QApplication.translate("generate_seisarray", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
self.label_rec.setText(QtGui.QApplication.translate("generate_seisarray", "Measured Receivers", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_normal.setToolTip(QtGui.QApplication.translate("generate_seisarray", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Load<span style=\" font-weight:600;\"> measured </span>receiver input file. The input file must be in the following format:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Load <span style=\" font-weight:600;\">normal </span>measured receiver input file. The input file must be in the following format:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Containing in each line, separated by spaces:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">[trace ID (int)] [X (float)] [Y (float)] [Z (float)]</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">For example:</span></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50 10.5 20.4 30.3</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_normal.setText(QtGui.QApplication.translate("generate_seisarray", "normal [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_interpolatable.setToolTip(QtGui.QApplication.translate("generate_seisarray", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Load<span style=\" font-weight:600;\"> </span>measured receiver input file that can be <span style=\" font-weight:600;\">interpolated</span>. The input file must be in the following format:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Containing in each line, separated by spaces:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
@ -109,7 +138,7 @@ class Ui_generate_seisarray(object):
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50 2 3 10.5 20.4 30.3</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_rec.setText(QtGui.QApplication.translate("generate_seisarray", "Measured Receivers [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_interpolatable.setText(QtGui.QApplication.translate("generate_seisarray", "interpolatable [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_rec.setText(QtGui.QApplication.translate("generate_seisarray", "Browse", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_src.setToolTip(QtGui.QApplication.translate("generate_seisarray", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_survey_layout.ui'
|
||||
#
|
||||
# Created: Tue Jun 28 14:40:06 2016
|
||||
# Created: Tue Jul 5 13:55:56 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: Tue Jun 28 14:40:07 2016
|
||||
# Created: Tue Jul 5 13:55:56 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: Tue Jun 28 14:40:07 2016
|
||||
# Created: Tue Jul 5 13:55:56 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -17,18 +17,29 @@ class SeisArray(object):
|
||||
Note: Source and Receiver files for FMTOMO will be generated by the Survey object (because traveltimes will be added directly).
|
||||
'''
|
||||
|
||||
def __init__(self, recfile):
|
||||
def __init__(self, recfile, interpolatable = False):
|
||||
self.recfile = recfile
|
||||
self._receiverlines = {}
|
||||
self._receiverCoords = {}
|
||||
self._measuredReceivers = {}
|
||||
self._measuredTopo = {}
|
||||
self._sourceCoords = {}
|
||||
self._geophoneNumbers = {}
|
||||
self._receiverlist = open(self.recfile, 'r').readlines()
|
||||
self._generateReceiverlines()
|
||||
self._setReceiverCoords()
|
||||
if interpolatable == True:
|
||||
self._init_interpolatable()
|
||||
elif interpolatable == False:
|
||||
self._init_normal()
|
||||
|
||||
def _init_normal(self):
|
||||
self.interpolatable = False
|
||||
self._setReceiverCoords_normal()
|
||||
|
||||
def _init_interpolatable(self):
|
||||
self.interpolatable = True
|
||||
self._receiverlines = {}
|
||||
self._geophoneNumbers = {}
|
||||
self._setReceiverCoords_interp()
|
||||
self._setGeophoneNumbers()
|
||||
self._generateReceiverlines()
|
||||
|
||||
def _generateReceiverlines(self):
|
||||
'''
|
||||
@ -42,9 +53,10 @@ class SeisArray(object):
|
||||
self._receiverlines[lineID] = []
|
||||
self._receiverlines[lineID].append(traceID)
|
||||
|
||||
def _setReceiverCoords(self):
|
||||
def _setReceiverCoords_interp(self):
|
||||
'''
|
||||
Fills the three x, y, z dictionaries with measured coordinates
|
||||
in case of interpolatable measured input data.
|
||||
'''
|
||||
for line in self._getReceiverlist():
|
||||
traceID = int(line.split()[0])
|
||||
@ -54,6 +66,18 @@ class SeisArray(object):
|
||||
self._receiverCoords[traceID] = (x, y, z)
|
||||
self._measuredReceivers[traceID] = (x, y, z)
|
||||
|
||||
def _setReceiverCoords_normal(self):
|
||||
'''
|
||||
Fills the three x, y, z dictionaries with measured coordinates
|
||||
'''
|
||||
for line in self._getReceiverlist():
|
||||
traceID = int(line.split()[0])
|
||||
x = float(line.split()[1])
|
||||
y = float(line.split()[2])
|
||||
z = float(line.split()[3])
|
||||
self._receiverCoords[traceID] = (x, y, z)
|
||||
self._measuredReceivers[traceID] = (x, y, z)
|
||||
|
||||
def _setGeophoneNumbers(self):
|
||||
for line in self._getReceiverlist():
|
||||
traceID = int(line.split()[0])
|
||||
@ -159,10 +183,17 @@ class SeisArray(object):
|
||||
self._getReceiverValue(traceID1, coordinate) - self._getReceiverValue(traceID2, coordinate)) / num_spaces
|
||||
return mean_distance
|
||||
|
||||
def checkInterpolatable(self):
|
||||
if self.interpolatable == False:
|
||||
print('Not interpolatable.')
|
||||
return self.interpolatable
|
||||
|
||||
def interpolateValues(self, coordinate):
|
||||
'''
|
||||
Interpolates and sets all values (linear) for coordinate = 'X', 'Y' or 'Z'
|
||||
'''
|
||||
if not self.checkInterpolatable():
|
||||
return
|
||||
for lineID in self._getReceiverlines().keys():
|
||||
number_measured = len(self._getReceiverlines()[lineID])
|
||||
for index, traceID1 in enumerate(self._getReceiverlines()[lineID]):
|
||||
@ -314,6 +345,8 @@ class SeisArray(object):
|
||||
self.interpolateValues(coordinate)
|
||||
|
||||
def interpolateAll(self):
|
||||
if not self.checkInterpolatable():
|
||||
return
|
||||
self._interpolateXY4rec()
|
||||
self.interpZcoords4rec()
|
||||
print('Interpolated receiver locations.')
|
||||
@ -811,7 +844,7 @@ class SeisArray(object):
|
||||
ax.set_xlabel('X [m]')
|
||||
ax.set_ylabel('Y [m]')
|
||||
ax.set_aspect('equal')
|
||||
ax.legend()
|
||||
ax.legend(prop={'size':7})
|
||||
if annotations == True:
|
||||
for traceID in self.getReceiverCoordinates().keys():
|
||||
ax.annotate((' ' + str(traceID)), xy=(self._getXreceiver(traceID), self._getYreceiver(traceID)),
|
||||
|
188
pylot/core/active/vtk_tools_layout.py
Normal file
188
pylot/core/active/vtk_tools_layout.py
Normal file
@ -0,0 +1,188 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'vtk_tools_layout.ui'
|
||||
#
|
||||
# Created: Tue Jul 5 13:55:56 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
class Ui_vtk_tools(object):
|
||||
def setupUi(self, vtk_tools):
|
||||
vtk_tools.setObjectName("vtk_tools")
|
||||
vtk_tools.resize(406, 407)
|
||||
self.verticalLayout_8 = QtGui.QVBoxLayout(vtk_tools)
|
||||
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.verticalLayout_4 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.label_rec = QtGui.QLabel(vtk_tools)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_rec.sizePolicy().hasHeightForWidth())
|
||||
self.label_rec.setSizePolicy(sizePolicy)
|
||||
self.label_rec.setToolTip("")
|
||||
self.label_rec.setObjectName("label_rec")
|
||||
self.horizontalLayout.addWidget(self.label_rec)
|
||||
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.radioButton_abs = QtGui.QRadioButton(vtk_tools)
|
||||
self.radioButton_abs.setChecked(True)
|
||||
self.radioButton_abs.setObjectName("radioButton_abs")
|
||||
self.horizontalLayout.addWidget(self.radioButton_abs)
|
||||
self.radioButton_rel = QtGui.QRadioButton(vtk_tools)
|
||||
self.radioButton_rel.setObjectName("radioButton_rel")
|
||||
self.horizontalLayout.addWidget(self.radioButton_rel)
|
||||
self.verticalLayout_4.addLayout(self.horizontalLayout)
|
||||
self.verticalLayout_6 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_6.setObjectName("verticalLayout_6")
|
||||
self.label_3 = QtGui.QLabel(vtk_tools)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.verticalLayout_6.addWidget(self.label_3)
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.lineEdit_vg = QtGui.QLineEdit(vtk_tools)
|
||||
self.lineEdit_vg.setObjectName("lineEdit_vg")
|
||||
self.horizontalLayout_2.addWidget(self.lineEdit_vg)
|
||||
self.pushButton_vg = QtGui.QPushButton(vtk_tools)
|
||||
self.pushButton_vg.setObjectName("pushButton_vg")
|
||||
self.horizontalLayout_2.addWidget(self.pushButton_vg)
|
||||
self.verticalLayout_6.addLayout(self.horizontalLayout_2)
|
||||
self.verticalLayout_4.addLayout(self.verticalLayout_6)
|
||||
self.verticalLayout_7 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_7.setObjectName("verticalLayout_7")
|
||||
self.label_4 = QtGui.QLabel(vtk_tools)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.verticalLayout_7.addWidget(self.label_4)
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.lineEdit_vgref = QtGui.QLineEdit(vtk_tools)
|
||||
self.lineEdit_vgref.setEnabled(False)
|
||||
self.lineEdit_vgref.setObjectName("lineEdit_vgref")
|
||||
self.horizontalLayout_4.addWidget(self.lineEdit_vgref)
|
||||
self.pushButton_vgref = QtGui.QPushButton(vtk_tools)
|
||||
self.pushButton_vgref.setEnabled(False)
|
||||
self.pushButton_vgref.setObjectName("pushButton_vgref")
|
||||
self.horizontalLayout_4.addWidget(self.pushButton_vgref)
|
||||
self.verticalLayout_7.addLayout(self.horizontalLayout_4)
|
||||
self.start_vg = QtGui.QPushButton(vtk_tools)
|
||||
self.start_vg.setEnabled(False)
|
||||
self.start_vg.setObjectName("start_vg")
|
||||
self.verticalLayout_7.addWidget(self.start_vg)
|
||||
self.verticalLayout_4.addLayout(self.verticalLayout_7)
|
||||
self.verticalLayout.addLayout(self.verticalLayout_4)
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.line = QtGui.QFrame(vtk_tools)
|
||||
self.line.setFrameShape(QtGui.QFrame.HLine)
|
||||
self.line.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
self.verticalLayout_2.addWidget(self.line)
|
||||
self.label_src = QtGui.QLabel(vtk_tools)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_src.sizePolicy().hasHeightForWidth())
|
||||
self.label_src.setSizePolicy(sizePolicy)
|
||||
self.label_src.setObjectName("label_src")
|
||||
self.verticalLayout_2.addWidget(self.label_src)
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.label = QtGui.QLabel(vtk_tools)
|
||||
self.label.setObjectName("label")
|
||||
self.verticalLayout_3.addWidget(self.label)
|
||||
self.horizontalLayout_6 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
|
||||
self.lineEdit_rays = QtGui.QLineEdit(vtk_tools)
|
||||
self.lineEdit_rays.setObjectName("lineEdit_rays")
|
||||
self.horizontalLayout_6.addWidget(self.lineEdit_rays)
|
||||
self.pushButton_rays = QtGui.QPushButton(vtk_tools)
|
||||
self.pushButton_rays.setObjectName("pushButton_rays")
|
||||
self.horizontalLayout_6.addWidget(self.pushButton_rays)
|
||||
self.verticalLayout_3.addLayout(self.horizontalLayout_6)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout_3)
|
||||
self.verticalLayout_5 = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||
self.label_2 = QtGui.QLabel(vtk_tools)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.verticalLayout_5.addWidget(self.label_2)
|
||||
self.horizontalLayout_5 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.lineEdit_raysout = QtGui.QLineEdit(vtk_tools)
|
||||
self.lineEdit_raysout.setObjectName("lineEdit_raysout")
|
||||
self.horizontalLayout_5.addWidget(self.lineEdit_raysout)
|
||||
self.pushButton_raysout = QtGui.QPushButton(vtk_tools)
|
||||
self.pushButton_raysout.setObjectName("pushButton_raysout")
|
||||
self.horizontalLayout_5.addWidget(self.pushButton_raysout)
|
||||
self.verticalLayout_5.addLayout(self.horizontalLayout_5)
|
||||
self.start_rays = QtGui.QPushButton(vtk_tools)
|
||||
self.start_rays.setEnabled(False)
|
||||
self.start_rays.setObjectName("start_rays")
|
||||
self.verticalLayout_5.addWidget(self.start_rays)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout_5)
|
||||
self.verticalLayout.addLayout(self.verticalLayout_2)
|
||||
self.verticalLayout_8.addLayout(self.verticalLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(vtk_tools)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.verticalLayout_8.addWidget(self.buttonBox)
|
||||
|
||||
self.retranslateUi(vtk_tools)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), vtk_tools.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), vtk_tools.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(vtk_tools)
|
||||
|
||||
def retranslateUi(self, vtk_tools):
|
||||
vtk_tools.setWindowTitle(QtGui.QApplication.translate("vtk_tools", "VTK tools", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_rec.setText(QtGui.QApplication.translate("vtk_tools", "Velocity grid to VTK", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_abs.setToolTip(QtGui.QApplication.translate("vtk_tools", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Load <span style=\" font-weight:600;\">normal </span>measured receiver input file. The input file must be in the following format:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Containing in each line, separated by spaces:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">[trace ID (int)] [X (float)] [Y (float)] [Z (float)]</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">For example:</span></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50 10.5 20.4 30.3</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_abs.setText(QtGui.QApplication.translate("vtk_tools", "absolute [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_rel.setToolTip(QtGui.QApplication.translate("vtk_tools", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Load<span style=\" font-weight:600;\"> </span>measured receiver input file that can be <span style=\" font-weight:600;\">interpolated</span>. The input file must be in the following format:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Containing in each line, separated by spaces:</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">[trace ID (int)] [receiver line ID (int)] [number of the geophone on receiver line (int)] [X (float)] [Y (float)] [Z (float)]</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">For example:</span></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).</p>\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50 2 3 10.5 20.4 30.3</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButton_rel.setText(QtGui.QApplication.translate("vtk_tools", "relative [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_3.setText(QtGui.QApplication.translate("vtk_tools", "Browse for velocity grid file (\'vgrids.in\'):", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_vg.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_4.setText(QtGui.QApplication.translate("vtk_tools", "Browse for reference velocity grid file (\'vgridsref.in\'):", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_vgref.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.start_vg.setText(QtGui.QApplication.translate("vtk_tools", "Start", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_src.setToolTip(QtGui.QApplication.translate("vtk_tools", "Create VTK files from the FMTOMO output file \'rays.dat\'.\n"
|
||||
"This will generate one file of ray paths for each individual source.", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_src.setText(QtGui.QApplication.translate("vtk_tools", "Rays to VTK [?]", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("vtk_tools", "Browse for input file (\'rays.dat\'):", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_rays.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("vtk_tools", "Specify output directory:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.pushButton_raysout.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.start_rays.setText(QtGui.QApplication.translate("vtk_tools", "Start", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
Loading…
Reference in New Issue
Block a user