Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
sebastianp 2016-08-04 16:07:47 +02:00
commit b72e16aaed
10 changed files with 294 additions and 245 deletions

View File

@ -9,8 +9,7 @@ matplotlib.rcParams['backend.qt4']='PySide'
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
from pylot.core.active.gui.asp3d_layout import * from pylot.core.active.gui.asp3d_layout import *
from pylot.core.active.gui.vtk_tools_layout import * from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO, Call_VTK_dialog
from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO
from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
@ -43,6 +42,7 @@ class gui_control(object):
self.gssr = None self.gssr = None
self.autopicker = None self.autopicker = None
self.fmtomo = None self.fmtomo = None
self.vtktools = None
def setInitStates(self): def setInitStates(self):
self.setPickState(False) self.setPickState(False)
@ -64,11 +64,18 @@ class gui_control(object):
QtCore.QObject.connect(self.mainUI.actionStart_FMTOMO_Simulation, QtCore.SIGNAL("triggered()"), self.startFMTOMO) QtCore.QObject.connect(self.mainUI.actionStart_FMTOMO_Simulation, QtCore.SIGNAL("triggered()"), self.startFMTOMO)
QtCore.QObject.connect(self.mainUI.actionVTK_Visualization, QtCore.SIGNAL("triggered()"), self.startVTKtools) QtCore.QObject.connect(self.mainUI.actionVTK_Visualization, QtCore.SIGNAL("triggered()"), self.startVTKtools)
QtCore.QObject.connect(self.mainUI.actionExit, QtCore.SIGNAL("triggered()"), self.exitApp) QtCore.QObject.connect(self.mainUI.actionExit, QtCore.SIGNAL("triggered()"), self.exitApp)
QtCore.QObject.connect(self.mainUI.actionFullscreen, QtCore.SIGNAL("triggered()"), self.fullscreen)
QtCore.QObject.connect(self.mainUI.comboBox_stats, QtCore.SIGNAL("activated(int)"), self.refreshPickedWidgets) QtCore.QObject.connect(self.mainUI.comboBox_stats, QtCore.SIGNAL("activated(int)"), self.refreshPickedWidgets)
QtCore.QObject.connect(self.mainUI.shot_left, QtCore.SIGNAL("clicked()"), self.decreaseShotnumber) QtCore.QObject.connect(self.mainUI.shot_left, QtCore.SIGNAL("clicked()"), self.decreaseShotnumber)
QtCore.QObject.connect(self.mainUI.shot_right, QtCore.SIGNAL("clicked()"), self.increaseShotnumber) QtCore.QObject.connect(self.mainUI.shot_right, QtCore.SIGNAL("clicked()"), self.increaseShotnumber)
QtCore.QObject.connect(self.mainUI.plot_shot, QtCore.SIGNAL("clicked()"), self.plotShot) QtCore.QObject.connect(self.mainUI.plot_shot, QtCore.SIGNAL("clicked()"), self.plotShot)
def fullscreen(self):
if self.mainUI.actionFullscreen.isChecked():
MainWindow.showFullScreen()
else:
MainWindow.showNormal()
def gen_seisarray(self): def gen_seisarray(self):
disconnect = False disconnect = False
if self.checkSeisArrayState(): if self.checkSeisArrayState():
@ -93,7 +100,6 @@ class gui_control(object):
self.setConnected2SurveyState(False) self.setConnected2SurveyState(False)
self.setSeisArrayState(True) self.setSeisArrayState(True)
def gen_survey(self): def gen_survey(self):
if self.checkSurveyState(): if self.checkSurveyState():
if not self.continueDialogExists('Survey'): if not self.continueDialogExists('Survey'):
@ -105,6 +111,7 @@ class gui_control(object):
self.gssa = Gen_Survey_from_SA(self.mainwindow, self.seisarray) self.gssa = Gen_Survey_from_SA(self.mainwindow, self.seisarray)
else: else:
self.gssa.start_dialog() self.gssa.start_dialog()
self.update_seisarray(self.seisarray)
if self.gssa.executed: if self.gssa.executed:
self.survey = self.gssa.get_survey() self.survey = self.gssa.get_survey()
self.initNewSurvey() self.initNewSurvey()
@ -126,13 +133,11 @@ class gui_control(object):
self.setSeisArrayState(True) self.setSeisArrayState(True)
self.setConnected2SurveyState(True) self.setConnected2SurveyState(True)
def initNewSurvey(self): def initNewSurvey(self):
self.survey.setArtificialPick(0, 0) # artificial pick at source origin self.survey.setArtificialPick(0, 0) # artificial pick at source origin
self.setSurveyState(True) self.setSurveyState(True)
self.setPickState(False) self.setPickState(False)
def addArrayPlot(self): def addArrayPlot(self):
self.seisArrayFigure = Figure() self.seisArrayFigure = Figure()
self.seisArrayCanvas = FigureCanvas(self.seisArrayFigure) self.seisArrayCanvas = FigureCanvas(self.seisArrayFigure)
@ -140,13 +145,11 @@ class gui_control(object):
self.seisArrayToolbar = NavigationToolbar(self.seisArrayCanvas, self.mainwindow) self.seisArrayToolbar = NavigationToolbar(self.seisArrayCanvas, self.mainwindow)
self.mainUI.verticalLayout_tr1.addWidget(self.seisArrayToolbar) self.mainUI.verticalLayout_tr1.addWidget(self.seisArrayToolbar)
def addSurfacePlot(self): def addSurfacePlot(self):
self.surfaceFigure = Figure() self.surfaceFigure = Figure()
self.surfaceCanvas = FigureCanvas(self.surfaceFigure) self.surfaceCanvas = FigureCanvas(self.surfaceFigure)
self.mainUI.horizontalLayout_tr.addWidget(self.surfaceCanvas) self.mainUI.horizontalLayout_tr.addWidget(self.surfaceCanvas)
def addStatPlots(self): def addStatPlots(self):
self.statFigure_left = Figure() self.statFigure_left = Figure()
self.statCanvas_left = FigureCanvas(self.statFigure_left) self.statCanvas_left = FigureCanvas(self.statFigure_left)
@ -154,7 +157,6 @@ class gui_control(object):
self.statToolbar_left = NavigationToolbar(self.statCanvas_left, self.mainwindow) self.statToolbar_left = NavigationToolbar(self.statCanvas_left, self.mainwindow)
self.mainUI.verticalLayout_br1.addWidget(self.statToolbar_left) self.mainUI.verticalLayout_br1.addWidget(self.statToolbar_left)
self.statFigure_right = Figure() self.statFigure_right = Figure()
self.statCanvas_right = FigureCanvas(self.statFigure_right) self.statCanvas_right = FigureCanvas(self.statFigure_right)
self.mainUI.verticalLayout_br2.addWidget(self.statCanvas_right) self.mainUI.verticalLayout_br2.addWidget(self.statCanvas_right)
@ -163,7 +165,6 @@ class gui_control(object):
self.addItems2StatsComboBox() self.addItems2StatsComboBox()
def addItems2StatsComboBox(self): def addItems2StatsComboBox(self):
self.mainUI.comboBox_stats.insertItem(0, 'picked traces') self.mainUI.comboBox_stats.insertItem(0, 'picked traces')
self.mainUI.comboBox_stats.insertItem(1, 'mean SNR') self.mainUI.comboBox_stats.insertItem(1, 'mean SNR')
@ -172,7 +173,6 @@ class gui_control(object):
self.mainUI.comboBox_stats.insertItem(4, 'median SPE') self.mainUI.comboBox_stats.insertItem(4, 'median SPE')
self.enablePickedTools(False) self.enablePickedTools(False)
def addItems2ShotsComboBox(self): def addItems2ShotsComboBox(self):
shotnumbers = self.survey.data.keys() shotnumbers = self.survey.data.keys()
shotnumbers.sort() shotnumbers.sort()
@ -180,7 +180,6 @@ class gui_control(object):
self.mainUI.comboBox_shots.insertItem(index, 'Shot: %s'%shotnumber) self.mainUI.comboBox_shots.insertItem(index, 'Shot: %s'%shotnumber)
self.mainUI.comboBox_shots.setMaxCount(len(shotnumbers)) self.mainUI.comboBox_shots.setMaxCount(len(shotnumbers))
def increaseShotnumber(self): def increaseShotnumber(self):
currentIndex = self.mainUI.comboBox_shots.currentIndex() currentIndex = self.mainUI.comboBox_shots.currentIndex()
maxindex = self.mainUI.comboBox_shots.maxCount() - 1 maxindex = self.mainUI.comboBox_shots.maxCount() - 1
@ -189,7 +188,6 @@ class gui_control(object):
else: else:
self.mainUI.comboBox_shots.setCurrentIndex(currentIndex + 1) self.mainUI.comboBox_shots.setCurrentIndex(currentIndex + 1)
def decreaseShotnumber(self): def decreaseShotnumber(self):
currentIndex = self.mainUI.comboBox_shots.currentIndex() currentIndex = self.mainUI.comboBox_shots.currentIndex()
maxindex = self.mainUI.comboBox_shots.maxCount() - 1 maxindex = self.mainUI.comboBox_shots.maxCount() - 1
@ -203,20 +201,16 @@ class gui_control(object):
shotnumber = int(self.mainUI.comboBox_shots.currentText().split()[1]) shotnumber = int(self.mainUI.comboBox_shots.currentText().split()[1])
self.survey.data[shotnumber].matshow() self.survey.data[shotnumber].matshow()
def addArrayAxes(self): def addArrayAxes(self):
self.seisArrayAx = self.seisArrayFigure.add_subplot(111) self.seisArrayAx = self.seisArrayFigure.add_subplot(111)
def addSurfaceAxes(self): def addSurfaceAxes(self):
self.surfaceAx = self.surfaceFigure.add_subplot(111, projection = '3d') self.surfaceAx = self.surfaceFigure.add_subplot(111, projection = '3d')
def addStatAxes(self): def addStatAxes(self):
self.statAx_left = self.statFigure_left.add_subplot(111) self.statAx_left = self.statFigure_left.add_subplot(111)
self.statAx_right = self.statFigure_right.add_subplot(111) self.statAx_right = self.statFigure_right.add_subplot(111)
def enablePickedTools(self, bool, twoDim = False): def enablePickedTools(self, bool, twoDim = False):
self.mainUI.comboBox_stats.setEnabled(bool) self.mainUI.comboBox_stats.setEnabled(bool)
self.statToolbar_left.setEnabled(bool) self.statToolbar_left.setEnabled(bool)
@ -229,31 +223,26 @@ class gui_control(object):
if bool == False: if bool == False:
self.mainUI.comboBox_shots.clear() self.mainUI.comboBox_shots.clear()
def replotArray(self): def replotArray(self):
self.seisArrayFigure.clf() self.seisArrayFigure.clf()
self.addArrayAxes() self.addArrayAxes()
self.plotArray() self.plotArray()
self.seisArrayCanvas.draw() self.seisArrayCanvas.draw()
def replotSurface(self): def replotSurface(self):
self.surfaceFigure.clf() self.surfaceFigure.clf()
self.addSurfaceAxes() self.addSurfaceAxes()
self.plotSurface() self.plotSurface()
self.surfaceCanvas.draw() self.surfaceCanvas.draw()
def plotArray(self): def plotArray(self):
self.seisarray.plotArray2D(self.seisArrayAx, highlight_measured = True, plot_topo = True, twoDim = self.seisarray.twoDim) self.seisarray.plotArray2D(self.seisArrayAx, highlight_measured = True, plot_topo = True, twoDim = self.seisarray.twoDim)
def plotSurface(self): def plotSurface(self):
if not self.seisarray.twoDim: if not self.seisarray.twoDim:
self.seisarray.plotSurface3D(ax = self.surfaceAx, exag = True) self.seisarray.plotSurface3D(ax = self.surfaceAx, exag = True)
self.seisarray.plotArray3D(ax = self.surfaceAx, legend = False, markersize = 3) self.seisarray.plotArray3D(ax = self.surfaceAx, legend = False, markersize = 3)
def InitPickedWidgets(self): def InitPickedWidgets(self):
if self.checkPickState(): if self.checkPickState():
surveyUtils.plotScatterStats4Receivers(self.survey, self.mainUI.comboBox_stats.currentText(), surveyUtils.plotScatterStats4Receivers(self.survey, self.mainUI.comboBox_stats.currentText(),
@ -262,7 +251,6 @@ class gui_control(object):
self.statAx_right, twoDim = self.survey.twoDim) self.statAx_right, twoDim = self.survey.twoDim)
self.addItems2ShotsComboBox() self.addItems2ShotsComboBox()
def refreshPickedWidgets(self): def refreshPickedWidgets(self):
self.statFigure_left.clf() self.statFigure_left.clf()
self.statFigure_right.clf() self.statFigure_right.clf()
@ -271,7 +259,6 @@ class gui_control(object):
self.statCanvas_left.draw() self.statCanvas_left.draw()
self.statCanvas_right.draw() self.statCanvas_right.draw()
def printSurveyTextbox(self, init = True): def printSurveyTextbox(self, init = True):
if init == True: if init == True:
surveytup = (0, 0, 0, 0) surveytup = (0, 0, 0, 0)
@ -287,7 +274,6 @@ class gui_control(object):
string = surveyTitle + surveyText string = surveyTitle + surveyText
self.mainUI.textBox_survey.setText(string) self.mainUI.textBox_survey.setText(string)
def printSeisArrayTextbox(self, init = True): def printSeisArrayTextbox(self, init = True):
if init == True: if init == True:
seistup = (0, 0, 0) seistup = (0, 0, 0)
@ -302,7 +288,6 @@ class gui_control(object):
string = seisArrayTitle + seisArrayText string = seisArrayTitle + seisArrayText
self.mainUI.textBox_seisarray.setText(string) self.mainUI.textBox_seisarray.setText(string)
def interpolate_receivers(self): def interpolate_receivers(self):
if not self.checkSeisArrayState(): if not self.checkSeisArrayState():
self.printDialogMessage('No Seismic Array defined.') self.printDialogMessage('No Seismic Array defined.')
@ -310,7 +295,6 @@ class gui_control(object):
self.seisarray.interpolateAll() self.seisarray.interpolateAll()
self.refreshSeisArrayWidgets() self.refreshSeisArrayWidgets()
def refreshSeisArrayWidgets(self): def refreshSeisArrayWidgets(self):
self.replotArray() self.replotArray()
self.replotSurface() self.replotSurface()
@ -333,7 +317,6 @@ class gui_control(object):
self.printSurveyTextbox(init = False) self.printSurveyTextbox(init = False)
print('Connected Seismic Array to active Survey object.') print('Connected Seismic Array to active Survey object.')
def startPicker(self): def startPicker(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') self.printDialogMessage('No Survey defined.')
@ -346,12 +329,12 @@ class gui_control(object):
self.autopicker = Call_autopicker(self.mainwindow, self.survey) self.autopicker = Call_autopicker(self.mainwindow, self.survey)
else: else:
self.autopicker.start_dialog() self.autopicker.start_dialog()
self.autopicker.update_survey(self.survey)
if self.autopicker.executed: if self.autopicker.executed:
self.setPickState(True) self.setPickState(True)
self.printSurveyTextbox(init = False) self.printSurveyTextbox(init = False)
def startFMTOMO(self): def startFMTOMO(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') self.printDialogMessage('No Survey defined.')
@ -364,117 +347,16 @@ class gui_control(object):
self.fmtomo = Call_FMTOMO(self.mainwindow, self.survey) self.fmtomo = Call_FMTOMO(self.mainwindow, self.survey)
else: else:
self.fmtomo.start_dialog() self.fmtomo.start_dialog()
self.fmtomo.update_survey(self.survey)
#if self.fmtomo.executed: #if self.fmtomo.executed:
def startVTKtools(self): def startVTKtools(self):
vtk_tools = QtGui.QDialog(self.mainwindow) if self.vtktools is None:
ui = Ui_vtk_tools() self.vtktools = Call_VTK_dialog(self.mainwindow)
ui.setupUi(vtk_tools)
self.vtk_tools_ui = ui
self.connectButtons_vtk_tools()
self.openVTKdialog(ui, vtk_tools)
def openVTKdialog(self, ui, vtk_tools):
vtk_tools.exec_()
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.pushButton_vtkout, QtCore.SIGNAL("clicked()"), self.newFileVTK)
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_parav, QtCore.SIGNAL("clicked()"), self.openFileParaview)
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)
QtCore.QObject.connect(self.vtk_tools_ui.radioButton_rel, QtCore.SIGNAL("clicked()"), self.activateVgref)
QtCore.QObject.connect(self.vtk_tools_ui.radioButton_abs, QtCore.SIGNAL("clicked()"), self.deactivateVgref)
def openFileParaview(self):
os.system('paraview %s &'%self.vtk_tools_ui.lineEdit_vgout.text())
def activateVgref(self):
self.vtk_tools_ui.lineEdit_vgref.setEnabled(True)
self.vtk_tools_ui.pushButton_vgref.setEnabled(True)
def deactivateVgref(self):
self.vtk_tools_ui.lineEdit_vgref.setEnabled(False)
self.vtk_tools_ui.pushButton_vgref.setEnabled(False)
def checkVgStartButton(self):
ui = self.vtk_tools_ui
if ui.radioButton_rel.isChecked():
if ui.lineEdit_vg.text() != '' and ui.lineEdit_vgref.text() != '':
ui.start_vg.setEnabled(True)
else: else:
ui.start_vg.setEnabled(False) self.vtktools.start_dialog()
if ui.radioButton_abs.isChecked():
if ui.lineEdit_vg.text() != '':
ui.start_vg.setEnabled(True)
else:
ui.start_vg.setEnabled(False)
def checkRaysStartButton(self):
ui = self.vtk_tools_ui
if ui.lineEdit_rays.text() != '' and ui.lineEdit_raysout.text() != '':
ui.start_rays.setEnabled(True)
else:
ui.start_rays.setEnabled(False)
def chooseVgrid(self):
self.vtk_tools_ui.lineEdit_vg.setText(openFile())
self.checkVgStartButton()
def chooseVgridref(self):
self.vtk_tools_ui.lineEdit_vgref.setText(openFile())
self.checkVgStartButton()
def chooseRaysIn(self):
self.vtk_tools_ui.lineEdit_rays.setText(openFile())
self.checkRaysStartButton()
def chooseRaysOutDir(self):
self.vtk_tools_ui.lineEdit_raysout.setText(browseDir())
self.checkRaysStartButton()
def startvgvtk(self):
ui = self.vtk_tools_ui
if ui.lineEdit_vgout.text() == '':
if not self.printDialogMessage('Please specify output filename.'):
return
if ui.radioButton_abs.isChecked():
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
outputfile = ui.lineEdit_vgout.text(),
absOrRel='abs')
elif ui.radioButton_rel.isChecked():
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
outputfile = ui.lineEdit_vgout.text(),
absOrRel='rel',
inputfileref = ui.lineEdit_vgref.text())
def startraysvtk(self):
ui = self.vtk_tools_ui
fmtomoUtils.rays2VTK(ui.lineEdit_rays.text(), ui.lineEdit_raysout.text())
def newFileVTK(self):
self.vtk_tools_ui.lineEdit_vgout.setText(saveFile())
def postprocessing(self): def postprocessing(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
@ -520,7 +402,6 @@ class gui_control(object):
self.setSeisArrayState(False) self.setSeisArrayState(False)
self.printDialogMessage('Loaded Survey.') self.printDialogMessage('Loaded Survey.')
def load_seisarray(self): def load_seisarray(self):
disconnect = False disconnect = False
if self.checkSeisArrayState(): if self.checkSeisArrayState():
@ -551,7 +432,6 @@ class gui_control(object):
self.seisarray = seisarray self.seisarray = seisarray
self.setSeisArrayState(True) self.setSeisArrayState(True)
def save_seisarray(self): def save_seisarray(self):
if not self.checkSeisArrayState(): if not self.checkSeisArrayState():
self.printDialogMessage('No Seismic Array defined.') self.printDialogMessage('No Seismic Array defined.')
@ -561,7 +441,6 @@ class gui_control(object):
return return
self.seisarray.saveSeisArray(filename) self.seisarray.saveSeisArray(filename)
def save_survey(self): def save_survey(self):
if not self.checkSurveyState(): if not self.checkSurveyState():
self.printDialogMessage('No Survey defined.') self.printDialogMessage('No Survey defined.')
@ -571,7 +450,6 @@ class gui_control(object):
return return
self.survey.saveSurvey(filename) self.survey.saveSurvey(filename)
def setSurveyState(self, state): def setSurveyState(self, state):
if state == True: if state == True:
self.mainUI.survey_active.setPixmap(self.applypixmap) self.mainUI.survey_active.setPixmap(self.applypixmap)
@ -579,21 +457,18 @@ class gui_control(object):
elif state == False: elif state == False:
self.mainUI.survey_active.setPixmap(self.cancelpixmap) self.mainUI.survey_active.setPixmap(self.cancelpixmap)
def checkSurveyState(self): def checkSurveyState(self):
if self.survey == None: if self.survey == None:
return False return False
else: else:
return True return True
def checkSeisArrayState(self): def checkSeisArrayState(self):
if self.seisarray == None: if self.seisarray == None:
return False return False
else: else:
return True return True
def setPickState(self, state): def setPickState(self, state):
if state == True and self.checkSurveyState(): if state == True and self.checkSurveyState():
self.mainUI.picked_active.setPixmap(self.applypixmap) self.mainUI.picked_active.setPixmap(self.applypixmap)
@ -611,7 +486,6 @@ class gui_control(object):
self.enablePickedTools(False) self.enablePickedTools(False)
self.survey.picked = False self.survey.picked = False
def setSeisArrayState(self, state): def setSeisArrayState(self, state):
if state == True: if state == True:
self.mainUI.seisarray_active.setPixmap(self.applypixmap) self.mainUI.seisarray_active.setPixmap(self.applypixmap)
@ -623,14 +497,12 @@ class gui_control(object):
if self.seisArrayFigure is not None: if self.seisArrayFigure is not None:
self.seisArrayFigure.clf() self.seisArrayFigure.clf()
def setConnected2SurveyState(self, state): def setConnected2SurveyState(self, state):
if state == True: if state == True:
self.mainUI.seisarray_on_survey_active.setPixmap(self.applypixmap) self.mainUI.seisarray_on_survey_active.setPixmap(self.applypixmap)
elif state == False: elif state == False:
self.mainUI.seisarray_on_survey_active.setPixmap(self.cancelpixmap) self.mainUI.seisarray_on_survey_active.setPixmap(self.cancelpixmap)
def checkConnected2SurveyState(self): def checkConnected2SurveyState(self):
if self.checkSurveyState(): if self.checkSurveyState():
if self.survey.seisarray != None: if self.survey.seisarray != None:
@ -638,14 +510,12 @@ class gui_control(object):
else: else:
return False return False
def checkPickState(self): def checkPickState(self):
if not self.survey: if not self.survey:
self.printDialogMessage('No Survey defined.') self.printDialogMessage('No Survey defined.')
return return
return self.survey.picked return self.survey.picked
def printDialogMessage(self, message): def printDialogMessage(self, message):
qmb = QtGui.QMessageBox() qmb = QtGui.QMessageBox()
qmb.setText(message) qmb.setText(message)
@ -653,7 +523,6 @@ class gui_control(object):
qmb.setIcon(QtGui.QMessageBox.Warning) qmb.setIcon(QtGui.QMessageBox.Warning)
qmb.exec_() qmb.exec_()
def continueDialogExists(self, name): def continueDialogExists(self, name):
qmb = QtGui.QMessageBox() qmb = QtGui.QMessageBox()
qmb.setText('%s object already exists. Overwrite?'%name) qmb.setText('%s object already exists. Overwrite?'%name)
@ -665,7 +534,6 @@ class gui_control(object):
else: else:
return False return False
def continueDialogMessage(self, message): def continueDialogMessage(self, message):
qmb = QtGui.QMessageBox() qmb = QtGui.QMessageBox()
qmb.setText(message) qmb.setText(message)
@ -677,7 +545,6 @@ class gui_control(object):
else: else:
return False return False
def exitApp(self): def exitApp(self):
QtCore.QCoreApplication.instance().quit() QtCore.QCoreApplication.instance().quit()
@ -687,8 +554,7 @@ if __name__ == "__main__":
MainWindow = QtGui.QMainWindow() MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow() ui = Ui_MainWindow()
ui.setupUi(MainWindow) ui.setupUi(MainWindow)
MainWindow.show() MainWindow.showMaximized()
gui = gui_control() gui = gui_control()
sys.exit(app.exec_()) sys.exit(app.exec_())

View File

@ -49,17 +49,19 @@ class Tomo3d(object):
os.system('ln -s %s %s'%(filename, linkname)) os.system('ln -s %s %s'%(filename, linkname))
def buildObsdata(self): def buildObsdata(self):
os.system('obsdata') p = subprocess.Popen(os.path.join(self.cwd, 'obsdata'), shell=True)
p.wait()
os.system('mv sources.in sourcesref.in') os.system('mv sources.in sourcesref.in')
def defFMMParas(self): def defFMMParas(self):
''' '''
Initiates parameters for the forward calculation. Initiates parameters for the forward calculation.
''' '''
# Comments coppied from FMTOMO.
# Name of fast marching program # Name of fast marching program
self.fmm = '{0}/fm3d'.format(self.cwd) self.fmm = os.path.join(self.cwd, 'fm3d')
# Name of program calculating Frechet derivatives # Name of program calculating Frechet derivatives
self.frechgen = '{0}/frechgen'.format(self.cwd) self.frechgen = os.path.join(self.cwd, 'frechgen')
# Name of current velocity/inversion grid # Name of current velocity/inversion grid
self.cvg = 'vgrids.in' self.cvg = 'vgrids.in'
# Name of current interfaces grid # Name of current interfaces grid
@ -116,7 +118,7 @@ class Tomo3d(object):
Default: pwd Default: pwd
''' '''
if directory == None: if directory == None:
directory = os.path.join(os.getcwd(), self.simuldir) directory = self.simuldir
os.chdir(directory) os.chdir(directory)
self.cwd = directory self.cwd = directory

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'asp3d_layout.ui' # Form implementation generated from reading ui file 'asp3d_layout.ui'
# #
# Created: Wed Jul 27 11:15:05 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -13,7 +13,7 @@ class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.setEnabled(True) MainWindow.setEnabled(True)
MainWindow.resize(1029, 1074) MainWindow.resize(1280, 1024)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
@ -273,7 +273,7 @@ class Ui_MainWindow(object):
self.gridLayout.addLayout(self.formLayout, 0, 0, 1, 1) self.gridLayout.addLayout(self.formLayout, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow) self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1029, 23)) self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
self.menuFile = QtGui.QMenu(self.menubar) self.menuFile = QtGui.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile") self.menuFile.setObjectName("menuFile")
@ -287,6 +287,8 @@ class Ui_MainWindow(object):
self.menuSimulation.setObjectName("menuSimulation") self.menuSimulation.setObjectName("menuSimulation")
self.menuTools = QtGui.QMenu(self.menubar) self.menuTools = QtGui.QMenu(self.menubar)
self.menuTools.setObjectName("menuTools") self.menuTools.setObjectName("menuTools")
self.menuView = QtGui.QMenu(self.menubar)
self.menuView.setObjectName("menuView")
MainWindow.setMenuBar(self.menubar) MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar") self.statusbar.setObjectName("statusbar")
@ -321,6 +323,9 @@ class Ui_MainWindow(object):
self.actionSeismic_Array = QtGui.QAction(MainWindow) self.actionSeismic_Array = QtGui.QAction(MainWindow)
self.actionSeismic_Array.setEnabled(False) self.actionSeismic_Array.setEnabled(False)
self.actionSeismic_Array.setObjectName("actionSeismic_Array") self.actionSeismic_Array.setObjectName("actionSeismic_Array")
self.actionFullscreen = QtGui.QAction(MainWindow)
self.actionFullscreen.setCheckable(True)
self.actionFullscreen.setObjectName("actionFullscreen")
self.menuFile.addSeparator() self.menuFile.addSeparator()
self.menuFile.addAction(self.actionExit) self.menuFile.addAction(self.actionExit)
self.menuSeismic_Array.addAction(self.actionGenerate_new_Seismic_Array) self.menuSeismic_Array.addAction(self.actionGenerate_new_Seismic_Array)
@ -336,12 +341,14 @@ class Ui_MainWindow(object):
self.menuPicking.addAction(self.actionPostprocessing) self.menuPicking.addAction(self.actionPostprocessing)
self.menuSimulation.addAction(self.actionStart_FMTOMO_Simulation) self.menuSimulation.addAction(self.actionStart_FMTOMO_Simulation)
self.menuTools.addAction(self.actionVTK_Visualization) self.menuTools.addAction(self.actionVTK_Visualization)
self.menuView.addAction(self.actionFullscreen)
self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuSurvey.menuAction()) self.menubar.addAction(self.menuSurvey.menuAction())
self.menubar.addAction(self.menuSeismic_Array.menuAction()) self.menubar.addAction(self.menuSeismic_Array.menuAction())
self.menubar.addAction(self.menuPicking.menuAction()) self.menubar.addAction(self.menuPicking.menuAction())
self.menubar.addAction(self.menuSimulation.menuAction()) self.menubar.addAction(self.menuSimulation.menuAction())
self.menubar.addAction(self.menuTools.menuAction()) self.menubar.addAction(self.menuTools.menuAction())
self.menubar.addAction(self.menuView.menuAction())
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
@ -365,6 +372,7 @@ class Ui_MainWindow(object):
self.menuPicking.setTitle(QtGui.QApplication.translate("MainWindow", "Picking", None, QtGui.QApplication.UnicodeUTF8)) self.menuPicking.setTitle(QtGui.QApplication.translate("MainWindow", "Picking", None, QtGui.QApplication.UnicodeUTF8))
self.menuSimulation.setTitle(QtGui.QApplication.translate("MainWindow", "Inversion", None, QtGui.QApplication.UnicodeUTF8)) self.menuSimulation.setTitle(QtGui.QApplication.translate("MainWindow", "Inversion", None, QtGui.QApplication.UnicodeUTF8))
self.menuTools.setTitle(QtGui.QApplication.translate("MainWindow", "Tools", None, QtGui.QApplication.UnicodeUTF8)) self.menuTools.setTitle(QtGui.QApplication.translate("MainWindow", "Tools", None, QtGui.QApplication.UnicodeUTF8))
self.menuView.setTitle(QtGui.QApplication.translate("MainWindow", "View", None, QtGui.QApplication.UnicodeUTF8))
self.actionLoad_Seismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Load Seismic Array", None, QtGui.QApplication.UnicodeUTF8)) self.actionLoad_Seismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Load Seismic Array", None, QtGui.QApplication.UnicodeUTF8))
self.actionSave_Seismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Save Seismic Array", None, QtGui.QApplication.UnicodeUTF8)) self.actionSave_Seismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Save Seismic Array", None, QtGui.QApplication.UnicodeUTF8))
self.actionLoad_Survey.setText(QtGui.QApplication.translate("MainWindow", "Load Survey", None, QtGui.QApplication.UnicodeUTF8)) self.actionLoad_Survey.setText(QtGui.QApplication.translate("MainWindow", "Load Survey", None, QtGui.QApplication.UnicodeUTF8))
@ -379,4 +387,5 @@ class Ui_MainWindow(object):
self.actionStart_FMTOMO_Simulation.setText(QtGui.QApplication.translate("MainWindow", "Start FMTOMO Simulation", None, QtGui.QApplication.UnicodeUTF8)) self.actionStart_FMTOMO_Simulation.setText(QtGui.QApplication.translate("MainWindow", "Start FMTOMO Simulation", None, QtGui.QApplication.UnicodeUTF8))
self.actionVTK_Visualization.setText(QtGui.QApplication.translate("MainWindow", "VTK Visualization", None, QtGui.QApplication.UnicodeUTF8)) self.actionVTK_Visualization.setText(QtGui.QApplication.translate("MainWindow", "VTK Visualization", None, QtGui.QApplication.UnicodeUTF8))
self.actionSeismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Seismic Array", None, QtGui.QApplication.UnicodeUTF8)) self.actionSeismic_Array.setText(QtGui.QApplication.translate("MainWindow", "Seismic Array", None, QtGui.QApplication.UnicodeUTF8))
self.actionFullscreen.setText(QtGui.QApplication.translate("MainWindow", "Fullscreen", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui' # Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
# #
# Created: Wed Jul 27 11:15:05 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # 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' # Form implementation generated from reading ui file 'generate_seisarray_layout.ui'
# #
# Created: Wed Jul 27 11:15:06 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # 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' # Form implementation generated from reading ui file 'generate_survey_layout.ui'
# #
# Created: Wed Jul 27 11:15:06 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # 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_minimal.ui' # Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui'
# #
# Created: Wed Jul 27 11:15:06 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'picking_parameters_layout.ui' # Form implementation generated from reading ui file 'picking_parameters_layout.ui'
# #
# Created: Wed Jul 27 11:15:06 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -12,7 +12,7 @@ from PySide import QtCore, QtGui
class Ui_picking_parameters(object): class Ui_picking_parameters(object):
def setupUi(self, picking_parameters): def setupUi(self, picking_parameters):
picking_parameters.setObjectName("picking_parameters") picking_parameters.setObjectName("picking_parameters")
picking_parameters.resize(400, 700) picking_parameters.resize(422, 798)
picking_parameters.setMinimumSize(QtCore.QSize(0, 700)) picking_parameters.setMinimumSize(QtCore.QSize(0, 700))
self.verticalLayout_4 = QtGui.QVBoxLayout(picking_parameters) self.verticalLayout_4 = QtGui.QVBoxLayout(picking_parameters)
self.verticalLayout_4.setObjectName("verticalLayout_4") self.verticalLayout_4.setObjectName("verticalLayout_4")
@ -156,9 +156,35 @@ class Ui_picking_parameters(object):
self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.line.setObjectName("line") self.line.setObjectName("line")
self.verticalLayout_snr.addWidget(self.line) self.verticalLayout_snr.addWidget(self.line)
self.horizontalLayout_9 = QtGui.QHBoxLayout()
self.horizontalLayout_9.setObjectName("horizontalLayout_9")
self.label_8 = QtGui.QLabel(picking_parameters) self.label_8 = QtGui.QLabel(picking_parameters)
self.label_8.setObjectName("label_8") self.label_8.setObjectName("label_8")
self.verticalLayout_snr.addWidget(self.label_8) self.horizontalLayout_9.addWidget(self.label_8)
self.radioButton_const = QtGui.QRadioButton(picking_parameters)
self.radioButton_const.setChecked(True)
self.radioButton_const.setObjectName("radioButton_const")
self.horizontalLayout_9.addWidget(self.radioButton_const)
self.radioButton_dyn = QtGui.QRadioButton(picking_parameters)
self.radioButton_dyn.setObjectName("radioButton_dyn")
self.horizontalLayout_9.addWidget(self.radioButton_dyn)
self.verticalLayout_snr.addLayout(self.horizontalLayout_9)
self.horizontalLayout_10 = QtGui.QHBoxLayout()
self.horizontalLayout_10.setObjectName("horizontalLayout_10")
self.label_13 = QtGui.QLabel(picking_parameters)
self.label_13.setObjectName("label_13")
self.horizontalLayout_10.addWidget(self.label_13)
self.doubleSpinBox_constSNR = QtGui.QDoubleSpinBox(picking_parameters)
self.doubleSpinBox_constSNR.setMaximumSize(QtCore.QSize(100, 16777215))
self.doubleSpinBox_constSNR.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.doubleSpinBox_constSNR.setDecimals(1)
self.doubleSpinBox_constSNR.setMinimum(1.0)
self.doubleSpinBox_constSNR.setMaximum(10000.0)
self.doubleSpinBox_constSNR.setSingleStep(0.1)
self.doubleSpinBox_constSNR.setProperty("value", 8.0)
self.doubleSpinBox_constSNR.setObjectName("doubleSpinBox_constSNR")
self.horizontalLayout_10.addWidget(self.doubleSpinBox_constSNR)
self.verticalLayout_snr.addLayout(self.horizontalLayout_10)
self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2 = QtGui.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout_2.setObjectName("gridLayout_2")
self.label_9 = QtGui.QLabel(picking_parameters) self.label_9 = QtGui.QLabel(picking_parameters)
@ -185,22 +211,26 @@ class Ui_picking_parameters(object):
self.p2.setDecimals(6) self.p2.setDecimals(6)
self.p2.setMinimum(-100.0) self.p2.setMinimum(-100.0)
self.p2.setMaximum(100.0) self.p2.setMaximum(100.0)
self.p2.setSingleStep(0.0001) self.p2.setSingleStep(0.001)
self.p2.setProperty("value", -0.0007) self.p2.setProperty("value", -0.0007)
self.p2.setObjectName("p2") self.p2.setObjectName("p2")
self.gridLayout_2.addWidget(self.p2, 2, 3, 1, 1) self.gridLayout_2.addWidget(self.p2, 2, 3, 1, 1)
self.shift_dist = QtGui.QSpinBox(picking_parameters) self.shift_dist = QtGui.QSpinBox(picking_parameters)
self.shift_dist.setMinimum(-10000)
self.shift_dist.setMaximum(10000) self.shift_dist.setMaximum(10000)
self.shift_dist.setProperty("value", 30) self.shift_dist.setProperty("value", 30)
self.shift_dist.setObjectName("shift_dist") self.shift_dist.setObjectName("shift_dist")
self.gridLayout_2.addWidget(self.shift_dist, 1, 1, 1, 1) self.gridLayout_2.addWidget(self.shift_dist, 1, 1, 1, 1)
self.shift_snr = QtGui.QSpinBox(picking_parameters) self.shift_snr = QtGui.QSpinBox(picking_parameters)
self.shift_snr.setMinimum(-10000)
self.shift_snr.setMaximum(10000) self.shift_snr.setMaximum(10000)
self.shift_snr.setProperty("value", 100) self.shift_snr.setProperty("value", 100)
self.shift_snr.setObjectName("shift_snr") self.shift_snr.setObjectName("shift_snr")
self.gridLayout_2.addWidget(self.shift_snr, 1, 3, 1, 1) self.gridLayout_2.addWidget(self.shift_snr, 1, 3, 1, 1)
self.verticalLayout_snr.addLayout(self.gridLayout_2) self.verticalLayout_snr.addLayout(self.gridLayout_2)
self.verticalLayout_4.addLayout(self.verticalLayout_snr) self.verticalLayout_4.addLayout(self.verticalLayout_snr)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_4.addItem(spacerItem)
self.vlayout_plot = QtGui.QVBoxLayout() self.vlayout_plot = QtGui.QVBoxLayout()
self.vlayout_plot.setObjectName("vlayout_plot") self.vlayout_plot.setObjectName("vlayout_plot")
self.verticalLayout_4.addLayout(self.vlayout_plot) self.verticalLayout_4.addLayout(self.vlayout_plot)
@ -236,7 +266,10 @@ class Ui_picking_parameters(object):
"(only if AIC checked)", None, QtGui.QApplication.UnicodeUTF8)) "(only if AIC checked)", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit_aicleft.setText(QtGui.QApplication.translate("picking_parameters", "15", None, QtGui.QApplication.UnicodeUTF8)) self.lineEdit_aicleft.setText(QtGui.QApplication.translate("picking_parameters", "15", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit_aicright.setText(QtGui.QApplication.translate("picking_parameters", "0", None, QtGui.QApplication.UnicodeUTF8)) self.lineEdit_aicright.setText(QtGui.QApplication.translate("picking_parameters", "0", None, QtGui.QApplication.UnicodeUTF8))
self.label_8.setText(QtGui.QApplication.translate("picking_parameters", "SNR threshold (advanced)", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setText(QtGui.QApplication.translate("picking_parameters", "SNR threshold", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_const.setText(QtGui.QApplication.translate("picking_parameters", "constant", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_dyn.setText(QtGui.QApplication.translate("picking_parameters", "dynamic (advanced)", None, QtGui.QApplication.UnicodeUTF8))
self.label_13.setText(QtGui.QApplication.translate("picking_parameters", "Constant SNR threshold:", None, QtGui.QApplication.UnicodeUTF8))
self.label_9.setText(QtGui.QApplication.translate("picking_parameters", "Shift distance", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setText(QtGui.QApplication.translate("picking_parameters", "Shift distance", None, QtGui.QApplication.UnicodeUTF8))
self.label_10.setText(QtGui.QApplication.translate("picking_parameters", "p1", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setText(QtGui.QApplication.translate("picking_parameters", "p1", None, QtGui.QApplication.UnicodeUTF8))
self.label_11.setText(QtGui.QApplication.translate("picking_parameters", "Shift SNR", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setText(QtGui.QApplication.translate("picking_parameters", "Shift SNR", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'vtk_tools_layout.ui' # Form implementation generated from reading ui file 'vtk_tools_layout.ui'
# #
# Created: Wed Jul 27 11:15:06 2016 # Created: Thu Aug 4 13:55:47 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2 # by: pyside-uic 0.2.15 running on PySide 1.2.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -8,6 +8,8 @@ from generate_survey_layout_minimal import Ui_generate_survey_minimal
from generate_seisarray_layout import Ui_generate_seisarray from generate_seisarray_layout import Ui_generate_seisarray
from picking_parameters_layout import Ui_picking_parameters from picking_parameters_layout import Ui_picking_parameters
from fmtomo_parameters_layout import Ui_fmtomo_parameters from fmtomo_parameters_layout import Ui_fmtomo_parameters
from pylot.core.active.gui.vtk_tools_layout import Ui_vtk_tools
import numpy as np import numpy as np
import matplotlib import matplotlib
@ -43,6 +45,7 @@ def getMaxCPU():
import multiprocessing import multiprocessing
return multiprocessing.cpu_count() return multiprocessing.cpu_count()
class Gen_SeisArray(object): class Gen_SeisArray(object):
def __init__(self, mainwindow): def __init__(self, mainwindow):
self.mainwindow = mainwindow self.mainwindow = mainwindow
@ -62,7 +65,6 @@ class Gen_SeisArray(object):
self.connectButtons() self.connectButtons()
def start_dialog(self): def start_dialog(self):
self.init_last_selection()
if self.qdialog.exec_(): if self.qdialog.exec_():
self.refresh_selection() self.refresh_selection()
if self.ui.radioButton_interpolatable.isChecked(): if self.ui.radioButton_interpolatable.isChecked():
@ -83,11 +85,6 @@ class Gen_SeisArray(object):
self.recfile = self.ui.lineEdit_rec.text() self.recfile = self.ui.lineEdit_rec.text()
self.ptsfile = self.ui.lineEdit_pts.text() self.ptsfile = self.ui.lineEdit_pts.text()
def init_last_selection(self):
self.ui.lineEdit_src.setText(self.srcfile)
self.ui.lineEdit_rec.setText(self.recfile)
self.ui.lineEdit_pts.setText(self.ptsfile)
def get_seisarray(self): def get_seisarray(self):
if self.seisarray is not None: if self.seisarray is not None:
return self.seisarray return self.seisarray
@ -107,7 +104,6 @@ class Gen_SeisArray(object):
self.ui.lineEdit_pts.setText(openFile('Open measured points file.')) self.ui.lineEdit_pts.setText(openFile('Open measured points file.'))
class Gen_Survey_from_SA(object): class Gen_Survey_from_SA(object):
def __init__(self, mainwindow, seisarray): def __init__(self, mainwindow, seisarray):
self.mainwindow = mainwindow self.mainwindow = mainwindow
@ -128,7 +124,6 @@ class Gen_Survey_from_SA(object):
self.connectButtons() self.connectButtons()
def start_dialog(self): def start_dialog(self):
self.init_last_selection()
if self.qdialog.exec_(): if self.qdialog.exec_():
self.refresh_selection() self.refresh_selection()
self.survey = activeSeismoPick.Survey(self.obsdir, seisArray = self.seisarray, self.survey = activeSeismoPick.Survey(self.obsdir, seisArray = self.seisarray,
@ -139,16 +134,14 @@ class Gen_Survey_from_SA(object):
self.refresh_selection() self.refresh_selection()
self.executed = False self.executed = False
def update_seisarray(self, seisarray):
self.seisarray = seisarray
def refresh_selection(self): def refresh_selection(self):
self.obsdir = self.ui.lineEdit_obs.text() self.obsdir = self.ui.lineEdit_obs.text()
self.fstart = self.ui.fstart.text() self.fstart = self.ui.fstart.text()
self.fend = self.ui.fend.text() self.fend = self.ui.fend.text()
def init_last_selection(self):
self.ui.lineEdit_obs.setText(self.obsdir)
self.ui.fstart.setText(self.fstart)
self.ui.fend.setText(self.fend)
def get_survey(self): def get_survey(self):
return self.survey return self.survey
@ -180,7 +173,6 @@ class Gen_Survey_from_SR(object):
self.connectButtons() self.connectButtons()
def start_dialog(self): def start_dialog(self):
self.init_last_selection()
if self.qdialog.exec_(): if self.qdialog.exec_():
self.refresh_selection() self.refresh_selection()
self.survey = activeSeismoPick.Survey(self.obsdir, self.srcfile, self.recfile, self.survey = activeSeismoPick.Survey(self.obsdir, self.srcfile, self.recfile,
@ -198,13 +190,6 @@ class Gen_Survey_from_SR(object):
self.fstart = self.ui.fstart.text() self.fstart = self.ui.fstart.text()
self.fend = self.ui.fend.text() self.fend = self.ui.fend.text()
def init_last_selection(self):
self.ui.lineEdit_obs.setText(self.obsdir)
self.ui.lineEdit_src.setText(self.srcfile)
self.ui.lineEdit_rec.setText(self.recfile)
self.ui.fstart.setText(self.fstart)
self.ui.fend.setText(self.fend)
def get_survey(self): def get_survey(self):
return self.survey return self.survey
@ -223,14 +208,17 @@ class Gen_Survey_from_SR(object):
self.ui.lineEdit_rec.setText(openFile('Open receiverfile.')) self.ui.lineEdit_rec.setText(openFile('Open receiverfile.'))
class Call_autopicker(object): class Call_autopicker(object):
def __init__(self, mainwindow, survey): def __init__(self, mainwindow, survey):
self.mainwindow = mainwindow self.mainwindow = mainwindow
self.survey = survey self.survey = survey
self.maxSRdist = None self.maxSRdist = None
self.dists_p = []
self.snr_p = []
self.lines = []
self.init_dialog() self.init_dialog()
self.refresh_selection() self.refresh_selection()
self.enableDynSNR(False)
self.start_dialog() self.start_dialog()
def init_dialog(self): def init_dialog(self):
@ -240,7 +228,7 @@ class Call_autopicker(object):
ui.ncores.setMaximum(getMaxCPU()) ui.ncores.setMaximum(getMaxCPU())
self.ui = ui self.ui = ui
self.qdialog = qdialog self.qdialog = qdialog
self.initDynSNRplot() self.initSNRplot()
self.connectButtons() self.connectButtons()
def getMaxSRdist(self): def getMaxSRdist(self):
@ -254,14 +242,17 @@ class Call_autopicker(object):
self.maxSRdist = max(SRdists) self.maxSRdist = max(SRdists)
return self.maxSRdist return self.maxSRdist
def initDynSNRplot(self): def update_survey(self, survey):
self.survey = survey
def initSNRplot(self):
self.snrFig = Figure() self.snrFig = Figure()
self.snrCanvas = FigureCanvas(self.snrFig) self.snrCanvas = FigureCanvas(self.snrFig)
self.ui.vlayout_plot.addWidget(self.snrCanvas) self.ui.vlayout_plot.addWidget(self.snrCanvas)
self.snrToolbar = NavigationToolbar(self.snrCanvas, self.mainwindow) self.snrToolbar = NavigationToolbar(self.snrCanvas, self.mainwindow)
self.ui.vlayout_plot.addWidget(self.snrToolbar) self.ui.vlayout_plot.addWidget(self.snrToolbar)
def plotDynSNR(self): def prepFigure(self, refresh = True):
fig = self.snrFig fig = self.snrFig
if fig.axes == []: if fig.axes == []:
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
@ -271,35 +262,103 @@ class Call_autopicker(object):
ax = fig.axes[0] ax = fig.axes[0]
xlim = ax.get_xlim() xlim = ax.get_xlim()
ylim = ax.get_ylim() ylim = ax.get_ylim()
ax.clear() #ax.clear()
if not refresh:
self.plotPicks(ax)
else:
self.clear_lines()
return fig, ax, xlim, ylim
def clear_lines(self):
for line in self.lines:
line.remove()
self.lines = []
def finishFigure(self, ax, xlim, ylim):
ax.set_xlim(xlim)
ax.set_ylim(ylim)
def finishNewFigure(self, ax):
xlim = None
ylim = None
ax.set_xlabel('Distance [m]')
ax.set_ylabel('SNR')
return xlim, ylim
def plotPicks(self, ax):
if self.survey.picked:
if self.dists_p == [] or self.snr_p == []:
for shot in self.survey.data.values():
for traceID in shot.getTraceIDlist():
self.dists_p.append(shot.getDistance(traceID))
self.snr_p.append(shot.getSNR(traceID)[0])
ax.scatter(self.dists_p, self.snr_p, s = 0.5, c='k')
def plotConstSNR(self, refresh = True):
fig, ax, xlim, ylim = self.prepFigure(refresh)
snrthreshold = float(self.ui.doubleSpinBox_constSNR.text())
line = ax.hlines(snrthreshold, 0, self.getMaxSRdist(), 'b')
self.lines.append(line)
if refresh == False:
xlim, ylim = self.finishNewFigure(ax)
if self.survey.picked:
self.finishFigure(ax, xlim, ylim)
self.snrCanvas.draw()
def plotDynSNR(self, refresh = True):
fig, ax, xlim, ylim = self.prepFigure(refresh)
snrthresholds = [] snrthresholds = []
dists_p = []; snr_p = []
shiftSNR = float(self.ui.shift_snr.value()) shiftSNR = float(self.ui.shift_snr.value())
shiftDist = float(self.ui.shift_dist.value()) shiftDist = float(self.ui.shift_dist.value())
p1 = float(self.ui.p1.value()) p1 = float(self.ui.p1.value())
p2 = float(self.ui.p2.value()) p2 = float(self.ui.p2.value())
dists = np.arange(0, self.getMaxSRdist() + 1, 1) dists = np.arange(0, self.getMaxSRdist() + 1, 1)
if self.survey.picked:
for shot in self.survey.data.values():
for traceID in shot.getTraceIDlist():
dists_p.append(shot.getDistance(traceID))
snr_p.append(shot.getSNR(traceID)[0])
ax.scatter(dists_p, snr_p, s = 0.5, c='k')
for dist in dists: for dist in dists:
dist += shiftDist dist += shiftDist
snrthresholds.append(surveyUtils.snr_fit_func(surveyUtils.get_fit_fn(p1, p2), dist, shiftSNR)) snrthresholds.append(surveyUtils.snr_fit_func(surveyUtils.get_fit_fn(p1, p2), dist, shiftSNR))
ax.plot(dists, snrthresholds) self.lines = ax.plot(dists, snrthresholds, 'b')
ax.set_xlabel('Distance [m]')
ax.set_ylabel('SNR') if refresh == False:
ax.set_xlim(xlim) xlim, ylim = self.finishNewFigure(ax)
ax.set_ylim(ylim)
if self.survey.picked:
self.finishFigure(ax, xlim, ylim)
self.snrCanvas.draw() self.snrCanvas.draw()
def plotSNR(self, refresh = True):
if self.ui.radioButton_const.isChecked():
self.plotConstSNR(refresh)
if self.ui.radioButton_dyn.isChecked():
self.plotDynSNR(refresh)
def snr_toggle(self):
if self.ui.radioButton_const.isChecked():
self.enableDynSNR(False)
self.enableConstSNR(True)
if self.ui.radioButton_dyn.isChecked():
self.enableConstSNR(False)
self.enableDynSNR(True)
self.plotSNR(refresh = True)
def enableDynSNR(self, bool):
self.ui.shift_dist.setEnabled(bool)
self.ui.shift_snr.setEnabled(bool)
self.ui.p1.setEnabled(bool)
self.ui.p2.setEnabled(bool)
def enableConstSNR(self, bool):
self.ui.doubleSpinBox_constSNR.setEnabled(bool)
def start_dialog(self): def start_dialog(self):
self.init_last_selection() self.plotSNR(refresh = False)
self.plotDynSNR()
if self.qdialog.exec_(): if self.qdialog.exec_():
self.refresh_selection() self.refresh_selection()
@ -317,9 +376,11 @@ class Call_autopicker(object):
#QtGui.qApp.processEvents() # test #QtGui.qApp.processEvents() # test
self.executed = True self.executed = True
self.clear_lines()
else: else:
self.refresh_selection() self.refresh_selection()
self.executed = False self.executed = False
self.clear_lines()
def refreshFolm(self): def refreshFolm(self):
self.ui.label_folm.setText('%s %%'%self.ui.slider_folm.value()) self.ui.label_folm.setText('%s %%'%self.ui.slider_folm.value())
@ -336,25 +397,15 @@ class Call_autopicker(object):
self.p1 = float(self.ui.p1.value()) self.p1 = float(self.ui.p1.value())
self.p2 = float(self.ui.p2.value()) self.p2 = float(self.ui.p2.value())
def init_last_selection(self):
self.ui.ncores.setValue(self.ncores)
self.ui.lineEdit_vmin.setText(str(self.vmin))
self.ui.lineEdit_vmax.setText(str(self.vmax))
self.ui.slider_folm.setValue(self.folm)
self.ui.checkBox_AIC.setChecked(self.AIC)
self.ui.lineEdit_aicleft.setText(str(self.aicwindow[0]))
self.ui.lineEdit_aicright.setText(str(self.aicwindow[1]))
self.ui.shift_snr.setValue(self.shiftSNR)
self.ui.shift_snr.setValue(self.shiftDist)
self.ui.p1.setValue(self.p1)
self.ui.p2.setValue(self.p2)
def connectButtons(self): def connectButtons(self):
QtCore.QObject.connect(self.ui.slider_folm, QtCore.SIGNAL("valueChanged(int)"), self.refreshFolm) QtCore.QObject.connect(self.ui.slider_folm, QtCore.SIGNAL("valueChanged(int)"), self.refreshFolm)
QtCore.QObject.connect(self.ui.shift_snr, QtCore.SIGNAL("valueChanged(int)"), self.plotDynSNR) QtCore.QObject.connect(self.ui.shift_snr, QtCore.SIGNAL("valueChanged(int)"), self.plotSNR)
QtCore.QObject.connect(self.ui.shift_dist, QtCore.SIGNAL("valueChanged(int)"), self.plotDynSNR) QtCore.QObject.connect(self.ui.shift_dist, QtCore.SIGNAL("valueChanged(int)"), self.plotSNR)
QtCore.QObject.connect(self.ui.p1, QtCore.SIGNAL("valueChanged(double)"), self.plotDynSNR) QtCore.QObject.connect(self.ui.p1, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
QtCore.QObject.connect(self.ui.p2, QtCore.SIGNAL("valueChanged(double)"), self.plotDynSNR) QtCore.QObject.connect(self.ui.p2, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
QtCore.QObject.connect(self.ui.doubleSpinBox_constSNR, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR)
QtCore.QObject.connect(self.ui.radioButton_const, QtCore.SIGNAL("clicked()"), self.snr_toggle)
QtCore.QObject.connect(self.ui.radioButton_dyn, QtCore.SIGNAL("clicked()"), self.snr_toggle)
def chooseObsdir(self): def chooseObsdir(self):
self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.')) self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.'))
@ -366,7 +417,6 @@ class Call_autopicker(object):
self.ui.lineEdit_rec.setText(openFile('Open receiverfile.')) self.ui.lineEdit_rec.setText(openFile('Open receiverfile.'))
class Call_FMTOMO(object): class Call_FMTOMO(object):
def __init__(self, mainwindow, survey): def __init__(self, mainwindow, survey):
self.mainwindow = mainwindow self.mainwindow = mainwindow
@ -385,7 +435,6 @@ class Call_FMTOMO(object):
self.connectButtons() self.connectButtons()
def start_dialog(self): def start_dialog(self):
self.init_last_selection()
if self.qdialog.exec_(): if self.qdialog.exec_():
self.refresh_selection() self.refresh_selection()
@ -412,6 +461,9 @@ class Call_FMTOMO(object):
self.refresh_selection() self.refresh_selection()
self.executed = False self.executed = False
def update_survey(self, survey):
self.survey = survey
def refresh_selection(self): def refresh_selection(self):
self.fmtomo_dir = self.ui.fmtomo_dir.text() self.fmtomo_dir = self.ui.fmtomo_dir.text()
self.nIter = int(self.ui.nIter.value()) self.nIter = int(self.ui.nIter.value())
@ -425,22 +477,6 @@ class Call_FMTOMO(object):
self.simuldir = self.ui.simuldir.text() self.simuldir = self.ui.simuldir.text()
self.picks_dir = os.path.join(self.simuldir, 'picks') self.picks_dir = os.path.join(self.simuldir, 'picks')
def init_last_selection(self):
self.ui.fmtomo_dir.setText(self.fmtomo_dir)
self.ui.nIter.setValue(self.nIter)
self.ui.nproc.setValue(self.nproc)
self.ui.btop.setText(str(self.btop))
self.ui.bbot.setText(str(self.bbot))
self.ui.pgrid_x.setValue(self.propgrid[0])
self.ui.pgrid_y.setValue(self.propgrid[1])
self.ui.pgrid_z.setValue(self.propgrid[2])
self.ui.invgrid_x.setValue(self.vgrid[0])
self.ui.invgrid_y.setValue(self.vgrid[1])
self.ui.invgrid_z.setValue(self.vgrid[2])
self.ui.cushion.setValue(self.cushionfactor)
self.ui.customgrid.setText(self.customgrid)
self.ui.simuldir.setText(self.simuldir)
def connectButtons(self): def connectButtons(self):
QtCore.QObject.connect(self.ui.browse_tomodir, QtCore.SIGNAL("clicked()"), self.chooseFMTOMOdir) QtCore.QObject.connect(self.ui.browse_tomodir, QtCore.SIGNAL("clicked()"), self.chooseFMTOMOdir)
QtCore.QObject.connect(self.ui.browse_customgrid, QtCore.SIGNAL("clicked()"), self.chooseCustomgrid) QtCore.QObject.connect(self.ui.browse_customgrid, QtCore.SIGNAL("clicked()"), self.chooseCustomgrid)
@ -456,5 +492,108 @@ class Call_FMTOMO(object):
self.ui.simuldir.setText(browseDir()) self.ui.simuldir.setText(browseDir())
class Call_VTK_dialog(object):
def __init__(self, mainwindow):
self.mainwindow = mainwindow
self.init_dialog()
self.refresh_selection()
self.start_dialog()
def init_dialog(self):
qdialog = QtGui.QDialog(self.mainwindow)
ui = Ui_vtk_tools()
ui.setupUi(qdialog)
self.ui = ui
self.qdialog = qdialog
self.connectButtons()
def start_dialog(self):
self.qdialog.exec_()
self.refresh_selection()
def refresh_selection(self):
self.vg = self.ui.lineEdit_vg.text()
self.vgout = self.ui.lineEdit_vgout.text()
self.rays = self.ui.lineEdit_rays.text()
self.raysout = self.ui.lineEdit_raysout.text()
def checkVgStartButton(self):
ui = self.ui
if ui.radioButton_rel.isChecked():
if ui.lineEdit_vg.text() != '' and ui.lineEdit_vgref.text() != '':
ui.start_vg.setEnabled(True)
else:
ui.start_vg.setEnabled(False)
if ui.radioButton_abs.isChecked():
if ui.lineEdit_vg.text() != '':
ui.start_vg.setEnabled(True)
else:
ui.start_vg.setEnabled(False)
def checkRaysStartButton(self):
ui = self.ui
if ui.lineEdit_rays.text() != '' and ui.lineEdit_raysout.text() != '':
ui.start_rays.setEnabled(True)
else:
ui.start_rays.setEnabled(False)
def connectButtons(self):
QtCore.QObject.connect(self.ui.pushButton_vg, QtCore.SIGNAL("clicked()"), self.chooseVgrid)
QtCore.QObject.connect(self.ui.pushButton_vgref, QtCore.SIGNAL("clicked()"), self.chooseVgridref)
QtCore.QObject.connect(self.ui.pushButton_rays, QtCore.SIGNAL("clicked()"), self.chooseRaysIn)
QtCore.QObject.connect(self.ui.pushButton_raysout, QtCore.SIGNAL("clicked()"), self.chooseRaysOutDir)
QtCore.QObject.connect(self.ui.pushButton_vtkout, QtCore.SIGNAL("clicked()"), self.newFileVTK)
QtCore.QObject.connect(self.ui.pushButton_parav, QtCore.SIGNAL("clicked()"), self.openFileParaview)
QtCore.QObject.connect(self.ui.start_vg, QtCore.SIGNAL("clicked()"), self.startvgvtk)
QtCore.QObject.connect(self.ui.start_rays, QtCore.SIGNAL("clicked()"), self.startraysvtk)
QtCore.QObject.connect(self.ui.radioButton_rel, QtCore.SIGNAL("clicked()"), self.activateVgref)
QtCore.QObject.connect(self.ui.radioButton_abs, QtCore.SIGNAL("clicked()"), self.deactivateVgref)
def openFileParaview(self):
os.system('paraview %s &'%self.ui.lineEdit_vgout.text())
def activateVgref(self):
self.ui.lineEdit_vgref.setEnabled(True)
self.ui.pushButton_vgref.setEnabled(True)
def deactivateVgref(self):
self.ui.lineEdit_vgref.setEnabled(False)
self.ui.pushButton_vgref.setEnabled(False)
def chooseVgrid(self):
self.ui.lineEdit_vg.setText(openFile())
self.checkVgStartButton()
def chooseVgridref(self):
self.ui.lineEdit_vgref.setText(openFile())
self.checkVgStartButton()
def chooseRaysIn(self):
self.ui.lineEdit_rays.setText(openFile())
self.checkRaysStartButton()
def chooseRaysOutDir(self):
self.ui.lineEdit_raysout.setText(browseDir())
self.checkRaysStartButton()
def startvgvtk(self):
ui = self.ui
if ui.lineEdit_vgout.text() == '':
return
if ui.radioButton_abs.isChecked():
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
outputfile = ui.lineEdit_vgout.text(),
absOrRel='abs')
elif ui.radioButton_rel.isChecked():
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
outputfile = ui.lineEdit_vgout.text(),
absOrRel='rel',
inputfileref = ui.lineEdit_vgref.text())
def startraysvtk(self):
ui = self.ui
fmtomoUtils.rays2VTK(ui.lineEdit_rays.text(), ui.lineEdit_raysout.text())
def newFileVTK(self):
self.ui.lineEdit_vgout.setText(saveFile())