GUI refinements, added 2D structure for plots, adde input filename specifications

This commit is contained in:
Marcel Paffrath 2016-07-12 14:09:08 +02:00
parent 55a589b525
commit c47bf7911a
11 changed files with 241 additions and 67 deletions

View File

@ -16,6 +16,7 @@ from vtk_tools_layout import *
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
@ -29,10 +30,10 @@ class gui_control(object):
self.seisArrayFigure = None
self.cancelpixmap = self.mainwindow.style().standardPixmap(QtGui.QStyle.SP_DialogCancelButton)
self.applypixmap = self.mainwindow.style().standardPixmap(QtGui.QStyle.SP_DialogApplyButton)
self.setInitStates()
self.addArrayPlot()
self.addSurfacePlot()
self.addStatPlots()
self.setInitStates()
self.mainUI.progressBar.setVisible(False)
self.printSurveyTextbox()
self.printSeisArrayTextbox()
@ -122,9 +123,13 @@ class gui_control(object):
self.connectButtons_gen_survey_min()
if qdialog.exec_():
obsdir = self.gen_new_survey_min.lineEdit_obs.text()
fstart = self.gen_new_survey_min.fstart.text()
fend = self.gen_new_survey_min.fend.text()
self.survey = activeSeismoPick.Survey(obsdir, seisArray = self.seisarray,
useDefaultParas = True)
useDefaultParas = True, fstart = fstart,
fend = fend)
self.setConnected2SurveyState(True)
self.setPickState(False)
return True
def gen_survey_fromSRfiles(self):
@ -137,15 +142,20 @@ class gui_control(object):
srcfile = self.gen_new_survey.lineEdit_src.text()
recfile = self.gen_new_survey.lineEdit_rec.text()
obsdir = self.gen_new_survey.lineEdit_obs.text()
fstart = self.gen_new_survey.fstart.text()
fend = self.gen_new_survey.fend.text()
self.survey = activeSeismoPick.Survey(obsdir, srcfile, recfile,
useDefaultParas = True)
useDefaultParas = True,
fstart = fstart, fend = fend)
self.setConnected2SurveyState(False)
return True
def addArrayPlot(self):
self.seisArrayFigure = Figure()
self.seisArrayCanvas = FigureCanvas(self.seisArrayFigure)
self.mainUI.horizontalLayout_tr.addWidget(self.seisArrayCanvas)
self.mainUI.verticalLayout_tr1.addWidget(self.seisArrayCanvas)
self.seisArrayToolbar = NavigationToolbar(self.seisArrayCanvas, self.mainwindow)
self.mainUI.verticalLayout_tr1.addWidget(self.seisArrayToolbar)
def addSurfacePlot(self):
self.surfaceFigure = Figure()
@ -155,10 +165,17 @@ class gui_control(object):
def addStatPlots(self):
self.statFigure_left = Figure()
self.statCanvas_left = FigureCanvas(self.statFigure_left)
self.mainUI.horizontalLayout_br.addWidget(self.statCanvas_left)
self.mainUI.verticalLayout_br1.addWidget(self.statCanvas_left)
self.statToolbar_left = NavigationToolbar(self.statCanvas_left, self.mainwindow)
self.mainUI.verticalLayout_br1.addWidget(self.statToolbar_left)
self.statFigure_right = Figure()
self.statCanvas_right = FigureCanvas(self.statFigure_right)
self.mainUI.horizontalLayout_br.addWidget(self.statCanvas_right)
self.mainUI.verticalLayout_br2.addWidget(self.statCanvas_right)
self.statToolbar_right = NavigationToolbar(self.statCanvas_right, self.mainwindow)
self.mainUI.verticalLayout_br2.addWidget(self.statToolbar_right)
self.addItems2StatsComboBox()
def addItems2StatsComboBox(self):
@ -206,12 +223,15 @@ class gui_control(object):
self.statAx_left = self.statFigure_left.add_subplot(111)
self.statAx_right = self.statFigure_right.add_subplot(111)
def enablePickedTools(self, bool):
def enablePickedTools(self, bool, twoDim = False):
self.mainUI.comboBox_stats.setEnabled(bool)
self.mainUI.comboBox_shots.setEnabled(bool)
self.mainUI.shot_left.setEnabled(bool)
self.mainUI.shot_right.setEnabled(bool)
self.mainUI.plot_shot.setEnabled(bool)
self.statToolbar_left.setEnabled(bool)
self.statToolbar_right.setEnabled(bool)
if not twoDim:
self.mainUI.comboBox_shots.setEnabled(bool)
self.mainUI.shot_left.setEnabled(bool)
self.mainUI.shot_right.setEnabled(bool)
self.mainUI.plot_shot.setEnabled(bool)
if bool == False:
self.mainUI.comboBox_shots.clear()
@ -228,10 +248,11 @@ class gui_control(object):
self.surfaceCanvas.draw()
def plotArray(self):
self.seisarray.plotArray2D(self.seisArrayAx, highlight_measured = True, plot_topo = True)
self.seisarray.plotArray2D(self.seisArrayAx, highlight_measured = True, plot_topo = True, twoDim = self.seisarray.twoDim)
def plotSurface(self):
self.seisarray.plotSurface3D(ax = self.surfaceAx, exag = True)
if not self.seisarray.twoDim:
self.seisarray.plotSurface3D(ax = self.surfaceAx, exag = True)
self.seisarray.plotArray3D(ax = self.surfaceAx, legend = False, markersize = 3)
def refreshPickedWidgets(self):
@ -244,8 +265,10 @@ class gui_control(object):
def InitPickedWidgets(self):
if self.checkPickState():
surveyUtils.plotScatterStats4Receivers(self.survey, self.mainUI.comboBox_stats.currentText(), self.statAx_left)
surveyUtils.plotScatterStats4Shots(self.survey, self.mainUI.comboBox_stats.currentText(), self.statAx_right)
surveyUtils.plotScatterStats4Receivers(self.survey, self.mainUI.comboBox_stats.currentText(),
self.statAx_left, twoDim = self.survey.twoDim)
surveyUtils.plotScatterStats4Shots(self.survey, self.mainUI.comboBox_stats.currentText(),
self.statAx_right, twoDim = self.survey.twoDim)
self.addItems2ShotsComboBox()
def printSurveyTextbox(self, init = True):
@ -294,7 +317,7 @@ class gui_control(object):
ncores = int(ui.ncores.value())
vmin = float(ui.lineEdit_vmin.text())
vmax = float(ui.lineEdit_vmax.text())
folm = float(ui.lineEdit_folm.text())
folm = float(ui.slider_folm.value())/100.
AIC = ui.checkBox_AIC.isChecked()
aicwindow = (int(ui.lineEdit_aicleft.text()), int(ui.lineEdit_aicright.text()))
return ncores, vmin, vmax, folm, AIC, aicwindow
@ -312,12 +335,16 @@ class gui_control(object):
self.survey.seisarray = self.seisarray
self.setConnected2SurveyState(True)
self.survey._initiate_SRfiles()
self.printSurveyTextbox(init = False)
print('Connected Seismic Array to active Survey object.')
def getMaxCPU(self):
import multiprocessing
return multiprocessing.cpu_count()
def refreshFolm(self):
self.picker_ui.label_folm.setText('%s %%'%self.picker_ui.slider_folm.value())
def callPicker(self):
if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.')
@ -329,6 +356,8 @@ class gui_control(object):
ui = Ui_picking_parameters()
ui.setupUi(Picking_parameters)
ui.ncores.setMaximum(self.getMaxCPU())
self.picker_ui = ui
QtCore.QObject.connect(self.picker_ui.slider_folm, QtCore.SIGNAL("valueChanged(int)"), self.refreshFolm)
try:
ncores, vmin, vmax, folm, AIC, aicwindow = self.getPickParameters(ui, Picking_parameters)
except TypeError:
@ -343,6 +372,7 @@ class gui_control(object):
folm = folm, HosAic = HosAic,
aicwindow = aicwindow, cores = ncores)
self.setPickState(True)
self.printSurveyTextbox(init = False)
def startFMTOMO(self):
if not self.checkSurveyState():
@ -614,7 +644,7 @@ class gui_control(object):
if state == True and self.checkSurveyState():
self.mainUI.picked_active.setPixmap(self.applypixmap)
self.refreshPickedWidgets()
self.enablePickedTools(True)
self.enablePickedTools(True, self.survey.twoDim)
self.survey.picked = True
elif state == True and self.checkSurveyState() is False:
self.printDialogMessage('No Survey defined.')
@ -631,8 +661,10 @@ class gui_control(object):
if state == True:
self.mainUI.seisarray_active.setPixmap(self.applypixmap)
self.refreshSeisArrayWidgets()
self.seisArrayToolbar.setEnabled(True)
elif state == False:
self.mainUI.seisarray_active.setPixmap(self.cancelpixmap)
self.seisArrayToolbar.setEnabled(False)
if self.seisArrayFigure is not None:
self.seisArrayFigure.clf()

View File

@ -13,7 +13,7 @@ def picker(shot):
return picks
class Survey(object):
def __init__(self, path, sourcefile = None, receiverfile = None, seisArray = None, useDefaultParas=False):
def __init__(self, path, sourcefile = None, receiverfile = None, seisArray = None, useDefaultParas=False, fstart = None, fend = None):
'''
The Survey Class contains all shots [class: Seismicshot] of a survey
as well as the aquisition geometry and the topography.
@ -29,7 +29,7 @@ class Survey(object):
self._recfile = receiverfile
self._sourcefile = sourcefile
self._obsdir = path
self._generateSurvey()
self._generateSurvey(fstart, fend)
self._initiate_SRfiles()
if useDefaultParas == True:
self.setParametersForAllShots()
@ -74,27 +74,34 @@ class Survey(object):
self._coordsFromSeisArray()
else:
self._coordsFromFiles()
self.loadArray(self._obsdir, self._recile, self._sourcefile)
for shotnumber in self.data.keys():
shot = self.data[shotnumber]
shot.setShotnumber(shotnumber)
shot.setReceiverCoords(self._receiverCoords)
shot.setSourceCoords(self._sourceCoords[shotnumber])
def _generateSurvey(self):
def _generateSurvey(self, fstart = None, fend = None):
from obspy.core import read
shot_dict = {}
shotlist = self.getShotlist()
for shotnumber in shotlist: # loop over data files
# generate filenames and read manual picks to a list
fileending = '_pickle.dat'
#fileending = '.sg2'
obsfile = os.path.join(self._obsdir, str(shotnumber)) + fileending
if fend == None:
fend = '_pickle.dat'
obsfile = fstart + os.path.join(self._obsdir, str(shotnumber)) + fend
if obsfile not in shot_dict.keys():
shot_dict[shotnumber] = []
shot_dict[shotnumber] = seismicshot.SeismicShot(obsfile)
shot_dict[shotnumber].setParameters('shotnumber', shotnumber)
if self._check2D():
print('Survey is two dimensional!')
self.twoDim = True
else:
self.twoDim = False
self.data = shot_dict
print ("Generated Survey object for %d shots" % len(shotlist))
print ("Total number of traces: %d \n" % self.countAllTraces())
@ -143,6 +150,22 @@ class Survey(object):
"on removed traces." % (logfile))
outfile.close()
def _check2D(self):
if self.seisarray is None:
print('Check2D: No SeisArray defined')
return
if self.seisarray.check2D():
return True
else:
return False
def updateSeisArray(self, SeisArray):
if not type(SeisArray) == pylot.core.active.seismicArrayPreparation.SeisArray:
print('Wrong data type.')
return
self.seisarray = SeisArray
self._initiate_SRfiles()
def setParametersForAllShots(self, cutwindow=(0, 0.2), tmovwind=0.3,
tsignal=0.03, tgap=0.0007):
if (cutwindow == (0, 0.2) and tmovwind == 0.3 and

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'asp3d_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:29 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(1029, 858)
MainWindow.resize(1029, 1074)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@ -27,8 +27,8 @@ class Ui_MainWindow(object):
MainWindow.setWindowIcon(icon)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout_10 = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout_10.setObjectName("verticalLayout_10")
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)
@ -288,7 +288,11 @@ class Ui_MainWindow(object):
self.verticalLayout_right.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
self.verticalLayout_right.setObjectName("verticalLayout_right")
self.horizontalLayout_tr = QtGui.QHBoxLayout()
self.horizontalLayout_tr.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
self.horizontalLayout_tr.setObjectName("horizontalLayout_tr")
self.verticalLayout_tr1 = QtGui.QVBoxLayout()
self.verticalLayout_tr1.setObjectName("verticalLayout_tr1")
self.horizontalLayout_tr.addLayout(self.verticalLayout_tr1)
self.verticalLayout_right.addLayout(self.horizontalLayout_tr)
self.line_4 = QtGui.QFrame(self.centralwidget)
self.line_4.setFrameShape(QtGui.QFrame.HLine)
@ -352,9 +356,15 @@ class Ui_MainWindow(object):
self.verticalLayout_right.addLayout(self.horizontalLayout_3)
self.horizontalLayout_br = QtGui.QHBoxLayout()
self.horizontalLayout_br.setObjectName("horizontalLayout_br")
self.verticalLayout_br1 = QtGui.QVBoxLayout()
self.verticalLayout_br1.setObjectName("verticalLayout_br1")
self.horizontalLayout_br.addLayout(self.verticalLayout_br1)
self.verticalLayout_br2 = QtGui.QVBoxLayout()
self.verticalLayout_br2.setObjectName("verticalLayout_br2")
self.horizontalLayout_br.addLayout(self.verticalLayout_br2)
self.verticalLayout_right.addLayout(self.horizontalLayout_br)
self.formLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.verticalLayout_right)
self.verticalLayout_10.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, 1029, 23))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:29 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_seisarray_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:29 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_survey_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:29 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
@ -12,12 +12,12 @@ from PySide import QtCore, QtGui
class Ui_generate_survey(object):
def setupUi(self, generate_survey):
generate_survey.setObjectName("generate_survey")
generate_survey.resize(380, 160)
generate_survey.resize(382, 211)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
generate_survey.setWindowIcon(icon)
self.verticalLayout = QtGui.QVBoxLayout(generate_survey)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout_2 = QtGui.QVBoxLayout(generate_survey)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.gridLayout = QtGui.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.lineEdit_rec = QtGui.QLineEdit(generate_survey)
@ -47,12 +47,30 @@ class Ui_generate_survey(object):
self.pushButton_src = QtGui.QPushButton(generate_survey)
self.pushButton_src.setObjectName("pushButton_src")
self.gridLayout.addWidget(self.pushButton_src, 1, 2, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
self.verticalLayout_2.addLayout(self.gridLayout)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.label = QtGui.QLabel(generate_survey)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.fstart = QtGui.QLineEdit(generate_survey)
self.fstart.setObjectName("fstart")
self.horizontalLayout.addWidget(self.fstart)
self.label_obs_2 = QtGui.QLabel(generate_survey)
self.label_obs_2.setObjectName("label_obs_2")
self.horizontalLayout.addWidget(self.label_obs_2)
self.fend = QtGui.QLineEdit(generate_survey)
self.fend.setObjectName("fend")
self.horizontalLayout.addWidget(self.fend)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.buttonBox = QtGui.QDialogButtonBox(generate_survey)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.verticalLayout_2.addWidget(self.buttonBox)
self.retranslateUi(generate_survey)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), generate_survey.accept)
@ -110,4 +128,19 @@ class Ui_generate_survey(object):
self.label_src.setText(QtGui.QApplication.translate("generate_survey", "Source\n"
"File [?]", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_src.setText(QtGui.QApplication.translate("generate_survey", "Browse", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("generate_survey", "File structure:", None, QtGui.QApplication.UnicodeUTF8))
self.label_obs_2.setToolTip(QtGui.QApplication.translate("generate_survey", "<!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;\">Specifiy directory containing seismograms for each shot.</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.</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=\"-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;\">Shot number 100 containing seismograms for all traces with the name:</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;\">100_pickle.dat</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.label_obs_2.setText(QtGui.QApplication.translate("generate_survey", "*Shotnumber*", None, QtGui.QApplication.UnicodeUTF8))
self.fend.setText(QtGui.QApplication.translate("generate_survey", ".dat", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:29 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
@ -12,12 +12,12 @@ from PySide import QtCore, QtGui
class Ui_generate_survey_minimal(object):
def setupUi(self, generate_survey_minimal):
generate_survey_minimal.setObjectName("generate_survey_minimal")
generate_survey_minimal.resize(325, 83)
generate_survey_minimal.resize(382, 139)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
generate_survey_minimal.setWindowIcon(icon)
self.verticalLayout = QtGui.QVBoxLayout(generate_survey_minimal)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout_2 = QtGui.QVBoxLayout(generate_survey_minimal)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.gridLayout = QtGui.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.lineEdit_obs = QtGui.QLineEdit(generate_survey_minimal)
@ -29,12 +29,30 @@ class Ui_generate_survey_minimal(object):
self.pushButton_obs = QtGui.QPushButton(generate_survey_minimal)
self.pushButton_obs.setObjectName("pushButton_obs")
self.gridLayout.addWidget(self.pushButton_obs, 0, 2, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
self.verticalLayout_2.addLayout(self.gridLayout)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.label = QtGui.QLabel(generate_survey_minimal)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.fstart = QtGui.QLineEdit(generate_survey_minimal)
self.fstart.setObjectName("fstart")
self.horizontalLayout.addWidget(self.fstart)
self.label_obs_2 = QtGui.QLabel(generate_survey_minimal)
self.label_obs_2.setObjectName("label_obs_2")
self.horizontalLayout.addWidget(self.label_obs_2)
self.fend = QtGui.QLineEdit(generate_survey_minimal)
self.fend.setObjectName("fend")
self.horizontalLayout.addWidget(self.fend)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.buttonBox = QtGui.QDialogButtonBox(generate_survey_minimal)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.verticalLayout_2.addWidget(self.buttonBox)
self.retranslateUi(generate_survey_minimal)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), generate_survey_minimal.accept)
@ -58,4 +76,19 @@ class Ui_generate_survey_minimal(object):
self.label_obs.setText(QtGui.QApplication.translate("generate_survey_minimal", "Seismogram\n"
"Directory [?]", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_obs.setText(QtGui.QApplication.translate("generate_survey_minimal", "Browse", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("generate_survey_minimal", "File structure:", None, QtGui.QApplication.UnicodeUTF8))
self.label_obs_2.setToolTip(QtGui.QApplication.translate("generate_survey_minimal", "<!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;\">Specifiy directory containing seismograms for each shot.</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.</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=\"-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;\">Shot number 100 containing seismograms for all traces with the name:</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;\">100_pickle.dat</p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.label_obs_2.setText(QtGui.QApplication.translate("generate_survey_minimal", "*Shotnumber*", None, QtGui.QApplication.UnicodeUTF8))
self.fend.setText(QtGui.QApplication.translate("generate_survey_minimal", ".dat", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'picking_parameters_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:30 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
@ -12,10 +12,10 @@ from PySide import QtCore, QtGui
class Ui_picking_parameters(object):
def setupUi(self, picking_parameters):
picking_parameters.setObjectName("picking_parameters")
picking_parameters.resize(321, 253)
picking_parameters.resize(321, 254)
picking_parameters.setMinimumSize(QtCore.QSize(0, 0))
self.gridLayout = QtGui.QGridLayout(picking_parameters)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout_3 = QtGui.QVBoxLayout(picking_parameters)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.label_7 = QtGui.QLabel(picking_parameters)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -28,7 +28,7 @@ class Ui_picking_parameters(object):
font.setBold(True)
self.label_7.setFont(font)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 0, 0, 1, 1)
self.verticalLayout_3.addWidget(self.label_7)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtGui.QLabel(picking_parameters)
@ -45,7 +45,7 @@ class Ui_picking_parameters(object):
self.ncores.setMaximum(10000)
self.ncores.setObjectName("ncores")
self.horizontalLayout.addWidget(self.ncores)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
self.verticalLayout_3.addLayout(self.horizontalLayout)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.verticalLayout_2 = QtGui.QVBoxLayout()
@ -78,7 +78,7 @@ class Ui_picking_parameters(object):
self.lineEdit_vmax.setObjectName("lineEdit_vmax")
self.verticalLayout.addWidget(self.lineEdit_vmax)
self.horizontalLayout_3.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_4 = QtGui.QLabel(picking_parameters)
@ -89,11 +89,28 @@ class Ui_picking_parameters(object):
self.label_4.setSizePolicy(sizePolicy)
self.label_4.setObjectName("label_4")
self.horizontalLayout_4.addWidget(self.label_4)
self.lineEdit_folm = QtGui.QLineEdit(picking_parameters)
self.lineEdit_folm.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.lineEdit_folm.setObjectName("lineEdit_folm")
self.horizontalLayout_4.addWidget(self.lineEdit_folm)
self.gridLayout.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.slider_folm = QtGui.QSlider(picking_parameters)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.slider_folm.sizePolicy().hasHeightForWidth())
self.slider_folm.setSizePolicy(sizePolicy)
self.slider_folm.setMinimum(1)
self.slider_folm.setMaximum(100)
self.slider_folm.setProperty("value", 60)
self.slider_folm.setOrientation(QtCore.Qt.Horizontal)
self.slider_folm.setTickPosition(QtGui.QSlider.TicksBelow)
self.slider_folm.setTickInterval(10)
self.slider_folm.setObjectName("slider_folm")
self.horizontalLayout_2.addWidget(self.slider_folm)
self.label_folm = QtGui.QLabel(picking_parameters)
self.label_folm.setAlignment(QtCore.Qt.AlignCenter)
self.label_folm.setObjectName("label_folm")
self.horizontalLayout_2.addWidget(self.label_folm)
self.horizontalLayout_4.addLayout(self.horizontalLayout_2)
self.verticalLayout_3.addLayout(self.horizontalLayout_4)
self.horizontalLayout_5 = QtGui.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.label_5 = QtGui.QLabel(picking_parameters)
@ -109,7 +126,7 @@ class Ui_picking_parameters(object):
self.checkBox_AIC.setChecked(True)
self.checkBox_AIC.setObjectName("checkBox_AIC")
self.horizontalLayout_5.addWidget(self.checkBox_AIC)
self.gridLayout.addLayout(self.horizontalLayout_5, 4, 0, 1, 1)
self.verticalLayout_3.addLayout(self.horizontalLayout_5)
self.horizontalLayout_6 = QtGui.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.label_6 = QtGui.QLabel(picking_parameters)
@ -131,12 +148,12 @@ class Ui_picking_parameters(object):
self.lineEdit_aicright.setObjectName("lineEdit_aicright")
self.horizontalLayout_7.addWidget(self.lineEdit_aicright)
self.horizontalLayout_6.addLayout(self.horizontalLayout_7)
self.gridLayout.addLayout(self.horizontalLayout_6, 5, 0, 1, 1)
self.verticalLayout_3.addLayout(self.horizontalLayout_6)
self.buttonBox = QtGui.QDialogButtonBox(picking_parameters)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 6, 0, 1, 1)
self.verticalLayout_3.addWidget(self.buttonBox)
self.retranslateUi(picking_parameters)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), picking_parameters.accept)
@ -154,9 +171,9 @@ class Ui_picking_parameters(object):
self.label_3.setToolTip(QtGui.QApplication.translate("picking_parameters", "Maximum permitted direct velocity (apparent velocity!).", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("picking_parameters", "vmax [m/s] [?]", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit_vmax.setText(QtGui.QApplication.translate("picking_parameters", "5000", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setToolTip(QtGui.QApplication.translate("picking_parameters", "Value between 0 and 1 for threshold picking algorithm (Default = 0.6).", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setToolTip(QtGui.QApplication.translate("picking_parameters", "Value between 0 and 1 for threshold picking algorithm (Default = 60%).", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("picking_parameters", "Fraction of local maximum [?]", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit_folm.setText(QtGui.QApplication.translate("picking_parameters", "0.6", None, QtGui.QApplication.UnicodeUTF8))
self.label_folm.setText(QtGui.QApplication.translate("picking_parameters", "60 %", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setToolTip(QtGui.QApplication.translate("picking_parameters", "Use additional Akaike Information Criterion for picking.", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("picking_parameters", "AIC [?]", None, QtGui.QApplication.UnicodeUTF8))
self.label_6.setToolTip(QtGui.QApplication.translate("picking_parameters", "Samples before and after initial HOS pick.", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -28,6 +28,7 @@ class SeisArray(object):
self._init_interpolatable()
elif interpolatable == False:
self._init_normal()
self.set2D()
def _init_normal(self):
self.interpolatable = False
@ -84,6 +85,27 @@ class SeisArray(object):
gphoneNum = float(line.split()[2])
self._geophoneNumbers[traceID] = gphoneNum
def check2D(self):
x, y, z = self.getAllMeasuredPointsLists()
if self._check0(x) or self._check0(y):
return True
else:
return False
def set2D(self):
if self.check2D():
self.twoDim = True
else:
self.twoDim = False
def _check0(self, lst):
for element in lst:
if element == 0:
pass
else:
return False
return True
def _getReceiverlines(self):
return self._receiverlines
@ -816,7 +838,7 @@ class SeisArray(object):
print "Exported coordinates for %s traces to file > %s" % (count, filename)
recfile_out.close()
def plotArray2D(self, ax = None, 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, twoDim = False):
import matplotlib.pyplot as plt
if ax == None:
plt.interactive(True)
@ -843,7 +865,8 @@ class SeisArray(object):
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
ax.set_aspect('equal')
if twoDim == False:
ax.set_aspect('equal')
ax.legend(prop={'size':7})
if annotations == True:
for traceID in self.getReceiverCoordinates().keys():
@ -887,7 +910,7 @@ class SeisArray(object):
return ax
def plotSurface3D(self, ax=None, step=0.5, method='linear', exag=False):
def plotSurface3D(self, ax=None, step=0.5, method='linear', exag=False, twoDim = False):
from matplotlib import cm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
@ -917,7 +940,8 @@ class SeisArray(object):
if exag == False:
ax.set_zlim(-(max(x) - min(x) / 2), (max(x) - min(x) / 2))
ax.set_aspect('equal')
if twoDim == False:
ax.set_aspect('equal')
ax.set_xlabel('X [m]');
ax.set_ylabel('Y [m]');

View File

@ -155,7 +155,7 @@ def cleanUp(survey):
for shot in survey.data.values():
shot.traces4plot = {}
def plotScatterStats4Shots(survey, variable, ax = None):
def plotScatterStats4Shots(survey, variable, ax = None, twoDim = False):
"""
Statistics, scatter plot.
@ -210,7 +210,8 @@ def plotScatterStats4Shots(survey, variable, ax = None):
transform=ax.transAxes)
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
ax.set_aspect('equal')
if not twoDim:
ax.set_aspect('equal')
cbar = ax.figure.colorbar(sc)
cbar.set_label(variable)
@ -219,7 +220,7 @@ def plotScatterStats4Shots(survey, variable, ax = None):
fontsize='x-small', color='k')
def plotScatterStats4Receivers(survey, variable, ax = None):
def plotScatterStats4Receivers(survey, variable, ax = None, twoDim = False):
"""
Statistics, scatter plot.
@ -274,7 +275,8 @@ def plotScatterStats4Receivers(survey, variable, ax = None):
transform=ax.transAxes)
ax.set_xlabel('X [m]')
ax.set_ylabel('Y [m]')
ax.set_aspect('equal')
if not twoDim:
ax.set_aspect('equal')
cbar = ax.figure.colorbar(sc)
cbar.set_label(variable)

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'vtk_tools_layout.ui'
#
# Created: Thu Jul 7 14:25:26 2016
# Created: Tue Jul 12 14:03:30 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!