diff --git a/pylot/core/active/ActiveSeismoPick3D_GUI.py b/pylot/core/active/ActiveSeismoPick3D_GUI.py index e39e4c8d..b91caada 100755 --- a/pylot/core/active/ActiveSeismoPick3D_GUI.py +++ b/pylot/core/active/ActiveSeismoPick3D_GUI.py @@ -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()) diff --git a/pylot/core/active/asp3d_layout.py b/pylot/core/active/asp3d_layout.py index a1830674..9b48dea7 100644 --- a/pylot/core/active/asp3d_layout.py +++ b/pylot/core/active/asp3d_layout.py @@ -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)) diff --git a/pylot/core/active/fmtomo_parameters_layout.py b/pylot/core/active/fmtomo_parameters_layout.py index 1c11112b..70c8a32a 100644 --- a/pylot/core/active/fmtomo_parameters_layout.py +++ b/pylot/core/active/fmtomo_parameters_layout.py @@ -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! diff --git a/pylot/core/active/generate_seisarray_layout.py b/pylot/core/active/generate_seisarray_layout.py index 0d6d75e1..9bb3173f 100644 --- a/pylot/core/active/generate_seisarray_layout.py +++ b/pylot/core/active/generate_seisarray_layout.py @@ -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", "\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", "\n" "\n" -"

Load measured receiver input file. The input file must be in the following format:

\n" +"

Load normal measured receiver input file. The input file must be in the following format:

\n" +"

\n" +"

Containing in each line, separated by spaces:

\n" +"

\n" +"

[trace ID (int)] [X (float)] [Y (float)] [Z (float)]

\n" +"

\n" +"

For example:

\n" +"

Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).

\n" +"

\n" +"

50 10.5 20.4 30.3

", 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", "\n" +"\n" +"

Load measured receiver input file that can be interpolated. The input file must be in the following format:

\n" "

\n" "

Containing in each line, separated by spaces:

\n" "

\n" @@ -109,7 +138,7 @@ class Ui_generate_seisarray(object): "

Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).

\n" "

\n" "

50 2 3 10.5 20.4 30.3

", 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", "\n" "\n" +"

Load normal measured receiver input file. The input file must be in the following format:

\n" +"

\n" +"

Containing in each line, separated by spaces:

\n" +"

\n" +"

[trace ID (int)] [X (float)] [Y (float)] [Z (float)]

\n" +"

\n" +"

For example:

\n" +"

Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).

\n" +"

\n" +"

50 10.5 20.4 30.3

", 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", "\n" +"\n" +"

Load measured receiver input file that can be interpolated. The input file must be in the following format:

\n" +"

\n" +"

Containing in each line, separated by spaces:

\n" +"

\n" +"

[trace ID (int)] [receiver line ID (int)] [number of the geophone on receiver line (int)] [X (float)] [Y (float)] [Z (float)]

\n" +"

\n" +"

For example:

\n" +"

Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).

\n" +"

\n" +"

50 2 3 10.5 20.4 30.3

", 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)) +