got working window layout for postprocessing (no functions yet)
This commit is contained in:
parent
9f15376fd8
commit
28d2464aee
@ -9,7 +9,7 @@ matplotlib.rcParams['backend.qt4']='PySide'
|
||||
from PySide import QtCore, QtGui
|
||||
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
|
||||
from pylot.core.active.gui.asp3d_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, Call_VTK_dialog, Postprocessing
|
||||
from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU
|
||||
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
@ -43,6 +43,7 @@ class gui_control(object):
|
||||
self.autopicker = None
|
||||
self.fmtomo = None
|
||||
self.vtktools = None
|
||||
self.postprocessing = None
|
||||
|
||||
def setInitStates(self):
|
||||
self.setPickState(False)
|
||||
@ -362,8 +363,9 @@ class gui_control(object):
|
||||
if not self.checkSurveyState():
|
||||
self.printDialogMessage('No Survey defined.')
|
||||
return
|
||||
self.survey.plotAllPicks()
|
||||
self.refreshPickedWidgets() # wait until finished
|
||||
self.postprocessing = Postprocessing(self.mainwindow, self.survey)
|
||||
#self.survey.plotAllPicks()
|
||||
#self.refreshPickedWidgets() # wait until finished
|
||||
|
||||
|
||||
def load_survey(self):
|
||||
|
@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
import math
|
||||
import numpy as np
|
||||
from pylot.core.active import seismicshot
|
||||
from pylot.core.active.surveyUtils import cleanUp
|
||||
@ -672,10 +673,29 @@ class Survey(object):
|
||||
'''
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
plt.interactive(True)
|
||||
from pylot.core.active.surveyPlotTools import regions
|
||||
|
||||
dist, pick, snrlog, pickerror, spe = self.preparePlotAllPicks(plotRemoved)
|
||||
|
||||
color = {'log10SNR': snrlog,
|
||||
'pickerror': pickerror,
|
||||
'spe': spe}
|
||||
self.color = color
|
||||
if refreshPlot is False:
|
||||
ax, cbar, sc = self.createPlot(dist, pick, color[colorByVal],
|
||||
label='%s' % colorByVal)
|
||||
region = regions(ax, cbar, self)
|
||||
ax.legend()
|
||||
return (ax, region)
|
||||
if refreshPlot is True:
|
||||
ax, cbar, sc = self.createPlot(dist, pick, color[colorByVal],
|
||||
label='%s' % colorByVal, ax=ax,
|
||||
cbar=cbar)
|
||||
ax.legend()
|
||||
return ax
|
||||
|
||||
def preparePlotAllPicks(self, plotRemoved = False):
|
||||
dist = []
|
||||
pick = []
|
||||
snrlog = []
|
||||
@ -693,22 +713,8 @@ class Survey(object):
|
||||
pickerror.append(shot.getPickError(traceID))
|
||||
spe.append(shot.getSymmetricPickError(traceID))
|
||||
|
||||
color = {'log10SNR': snrlog,
|
||||
'pickerror': pickerror,
|
||||
'spe': spe}
|
||||
self.color = color
|
||||
if refreshPlot is False:
|
||||
ax, cbar = self.createPlot(dist, pick, color[colorByVal],
|
||||
label='%s' % colorByVal)
|
||||
region = regions(ax, cbar, self)
|
||||
ax.legend()
|
||||
return (ax, region)
|
||||
if refreshPlot is True:
|
||||
ax, cbar = self.createPlot(dist, pick, color[colorByVal],
|
||||
label='%s' % colorByVal, ax=ax,
|
||||
cbar=cbar)
|
||||
ax.legend()
|
||||
return ax
|
||||
return dist, pick, snrlog, pickerror, spe
|
||||
|
||||
|
||||
def createPlot(self, dist, pick, inkByVal, label, ax=None, cbar=None):
|
||||
'''
|
||||
@ -732,13 +738,14 @@ class Survey(object):
|
||||
else:
|
||||
sc = ax.scatter(dist, pick, cmap=cm, c=inkByVal, s=5,
|
||||
edgecolors='none', label=label)
|
||||
cbar = plt.colorbar(sc, cax=cbar.ax)
|
||||
cbar.set_label(label)
|
||||
if cbar is not None:
|
||||
cbar = plt.colorbar(sc, cax=cbar.ax)
|
||||
cbar.set_label(label)
|
||||
ax.set_xlabel('Distance [m]')
|
||||
ax.set_ylabel('Time [s]')
|
||||
ax.text(0.5, 0.95, 'Plot of all picks', transform=ax.transAxes,
|
||||
horizontalalignment='center')
|
||||
return (ax, cbar)
|
||||
return ax, cbar, sc
|
||||
|
||||
def _update_progress(self, shotname, tend, progress):
|
||||
sys.stdout.write(
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'asp3d_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:26 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:26 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_seisarray_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:26 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_survey_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:26 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:27 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'picking_parameters_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:27 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'postprocessing_layout.ui'
|
||||
#
|
||||
# Created: Tue Aug 9 10:36:58 2016
|
||||
# Created: Tue Aug 9 11:40:27 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -12,7 +12,7 @@ from PySide import QtCore, QtGui
|
||||
class Ui_postprocessing(object):
|
||||
def setupUi(self, postprocessing):
|
||||
postprocessing.setObjectName("postprocessing")
|
||||
postprocessing.resize(640, 479)
|
||||
postprocessing.resize(640, 480)
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout(postprocessing)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.verticalLayout = QtGui.QVBoxLayout()
|
||||
@ -91,19 +91,15 @@ class Ui_postprocessing(object):
|
||||
self.horizontalLayout_3.addWidget(self.pushButton_spe)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_3, 1, 1, 1, 1)
|
||||
self.verticalLayout.addLayout(self.gridLayout)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||
self.verticalLayout_plot = QtGui.QVBoxLayout()
|
||||
self.verticalLayout_plot.setObjectName("verticalLayout_plot")
|
||||
self.horizontalLayout_plot = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_plot.setObjectName("horizontalLayout_plot")
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_plot)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(postprocessing)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.verticalLayout_2.addWidget(self.buttonBox)
|
||||
self.verticalLayout_plot.addLayout(self.horizontalLayout_plot)
|
||||
self.verticalLayout_2.addLayout(self.verticalLayout_plot)
|
||||
|
||||
self.retranslateUi(postprocessing)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), postprocessing.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), postprocessing.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(postprocessing)
|
||||
|
||||
def retranslateUi(self, postprocessing):
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'vtk_tools_layout.ui'
|
||||
#
|
||||
# Created: Thu Aug 4 13:55:47 2016
|
||||
# Created: Tue Aug 9 11:40:27 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
from PySide import QtCore, QtGui
|
||||
from pylot.core.active import surveyUtils, activeSeismoPick, seismicArrayPreparation, fmtomoUtils
|
||||
from generate_survey_layout import Ui_generate_survey
|
||||
@ -8,11 +11,9 @@ from generate_survey_layout_minimal import Ui_generate_survey_minimal
|
||||
from generate_seisarray_layout import Ui_generate_seisarray
|
||||
from picking_parameters_layout import Ui_picking_parameters
|
||||
from fmtomo_parameters_layout import Ui_fmtomo_parameters
|
||||
from pylot.core.active.gui.vtk_tools_layout import Ui_vtk_tools
|
||||
from vtk_tools_layout import Ui_vtk_tools
|
||||
from postprocessing_layout import Ui_postprocessing
|
||||
|
||||
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
matplotlib.use('Qt4Agg')
|
||||
matplotlib.rcParams['backend.qt4']='PySide'
|
||||
|
||||
@ -597,3 +598,60 @@ class Call_VTK_dialog(object):
|
||||
def newFileVTK(self):
|
||||
self.ui.lineEdit_vgout.setText(saveFile())
|
||||
|
||||
class Postprocessing(object):
|
||||
def __init__(self, mainwindow, survey):
|
||||
self.mainwindow = mainwindow
|
||||
self.survey = survey
|
||||
self.init_dialog()
|
||||
self.start_dialog()
|
||||
|
||||
def init_dialog(self):
|
||||
qwidget = QtGui.QWidget()#
|
||||
ui = Ui_postprocessing()
|
||||
ui.setupUi(qwidget)
|
||||
self.ui = ui
|
||||
self.qwidget = qwidget
|
||||
self.initPlot()
|
||||
self.plot()
|
||||
#self.connectButtons()
|
||||
|
||||
def start_dialog(self):
|
||||
self.qwidget.show()
|
||||
# if self.qwidget.exec_():
|
||||
# #self.refresh_selection()
|
||||
# self.executed = True
|
||||
# else:
|
||||
# self.refresh_selection()
|
||||
# self.executed = False
|
||||
|
||||
def initPlot(self):
|
||||
self.figure = Figure()
|
||||
self.canvas = FigureCanvas(self.figure)
|
||||
self.ui.verticalLayout_plot.addWidget(self.canvas)
|
||||
self.toolbar = NavigationToolbar(self.canvas, self.mainwindow)
|
||||
self.ui.verticalLayout_plot.addWidget(self.toolbar)
|
||||
|
||||
def plot(self):
|
||||
survey = self.survey
|
||||
ax = self.figure.add_subplot(111)
|
||||
dist, pick, snrlog, pickerror, spe = survey.preparePlotAllPicks(plotRemoved = False)
|
||||
ax, cbar, sc = survey.createPlot(dist, pick, snrlog, '123', ax = ax, cbar = None)
|
||||
self.cbar = self.figure.colorbar(sc, fraction=0.05)
|
||||
self.ax = ax
|
||||
|
||||
# def refresh_selection(self):
|
||||
# self.obsdir = self.ui.lineEdit_obs.text()
|
||||
# self.fstart = self.ui.fstart.text()
|
||||
# self.fend = self.ui.fend.text()
|
||||
|
||||
def update_survey(self, survey):
|
||||
self.survey = survey
|
||||
|
||||
def get_survey(self):
|
||||
return self.survey
|
||||
|
||||
# def connectButtons(self):
|
||||
# QtCore.QObject.connect(self.ui.pushButton_obs, QtCore.SIGNAL("clicked()"), self.chooseObsdir)
|
||||
|
||||
# def chooseObsdir(self):
|
||||
# self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.'))
|
||||
|
Loading…
Reference in New Issue
Block a user