From 8714616d1baf79f2479147b26c699302d0a25e3b Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Mon, 27 Jun 2016 15:20:17 +0200 Subject: [PATCH] Working on input file format (SEG2/SEGY) etc. --- pylot/core/active/activeSeismoPick.py | 6 +- pylot/core/active/asp3d_layout.py | 2 +- pylot/core/active/fmtomo_parameters_layout.py | 2 +- .../core/active/generate_seisarray_layout.py | 2 +- pylot/core/active/generate_survey_layout.py | 64 +++++++++---------- .../core/active/picking_parameters_layout.py | 2 +- pylot/core/active/seismicshot.py | 8 ++- 7 files changed, 47 insertions(+), 39 deletions(-) diff --git a/pylot/core/active/activeSeismoPick.py b/pylot/core/active/activeSeismoPick.py index 3f91c898..b2815192 100644 --- a/pylot/core/active/activeSeismoPick.py +++ b/pylot/core/active/activeSeismoPick.py @@ -49,7 +49,9 @@ class Survey(object): shotlist = self.getShotlist() for shotnumber in shotlist: # loop over data files # generate filenames and read manual picks to a list - obsfile = os.path.join(self._obsdir, str(shotnumber)) + '_pickle.dat' + #fileending = '_pickle.dat' + fileending = '.sg2' + obsfile = os.path.join(self._obsdir, str(shotnumber)) + fileending if obsfile not in shot_dict.keys(): shot_dict[shotnumber] = [] shot_dict[shotnumber] = seismicshot.SeismicShot(obsfile) @@ -375,7 +377,7 @@ class Survey(object): shotlist = [] for line in srcfile.readlines(): line = line.split() - shotlist.append(int(line[0])) + shotlist.append(line[0]) return shotlist diff --git a/pylot/core/active/asp3d_layout.py b/pylot/core/active/asp3d_layout.py index 461fb2fd..fe85b039 100644 --- a/pylot/core/active/asp3d_layout.py +++ b/pylot/core/active/asp3d_layout.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'asp3d_layout.ui' # -# Created: Mon Jun 27 13:23:32 2016 +# Created: Mon Jun 27 15:18:25 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! diff --git a/pylot/core/active/fmtomo_parameters_layout.py b/pylot/core/active/fmtomo_parameters_layout.py index aa6edd3e..9ba8f5ec 100644 --- a/pylot/core/active/fmtomo_parameters_layout.py +++ b/pylot/core/active/fmtomo_parameters_layout.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'fmtomo_parameters_layout.ui' # -# Created: Mon Jun 27 13:23:32 2016 +# Created: Mon Jun 27 15:18:25 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! diff --git a/pylot/core/active/generate_seisarray_layout.py b/pylot/core/active/generate_seisarray_layout.py index 4caeb2a9..be785a97 100644 --- a/pylot/core/active/generate_seisarray_layout.py +++ b/pylot/core/active/generate_seisarray_layout.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'generate_seisarray_layout.ui' # -# Created: Mon Jun 27 13:23:32 2016 +# Created: Mon Jun 27 15:18:25 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! diff --git a/pylot/core/active/generate_survey_layout.py b/pylot/core/active/generate_survey_layout.py index 6e0bc92a..f2c8c992 100644 --- a/pylot/core/active/generate_survey_layout.py +++ b/pylot/core/active/generate_survey_layout.py @@ -2,67 +2,67 @@ # Form implementation generated from reading ui file 'generate_survey_layout.ui' # -# Created: Mon Jun 27 13:23:33 2016 +# Created: Mon Jun 27 15:18:25 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(380, 160) +class Ui_generate_survey(object): + def setupUi(self, generate_survey): + generate_survey.setObjectName("generate_survey") + generate_survey.resize(380, 160) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - Dialog.setWindowIcon(icon) - self.verticalLayout = QtGui.QVBoxLayout(Dialog) + generate_survey.setWindowIcon(icon) + self.verticalLayout = QtGui.QVBoxLayout(generate_survey) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") - self.lineEdit_rec = QtGui.QLineEdit(Dialog) + self.lineEdit_rec = QtGui.QLineEdit(generate_survey) self.lineEdit_rec.setObjectName("lineEdit_rec") self.gridLayout.addWidget(self.lineEdit_rec, 0, 1, 1, 1) - self.pushButton_rec = QtGui.QPushButton(Dialog) + self.pushButton_rec = QtGui.QPushButton(generate_survey) self.pushButton_rec.setObjectName("pushButton_rec") self.gridLayout.addWidget(self.pushButton_rec, 0, 2, 1, 1) - self.label_rec = QtGui.QLabel(Dialog) + self.label_rec = QtGui.QLabel(generate_survey) self.label_rec.setObjectName("label_rec") self.gridLayout.addWidget(self.label_rec, 0, 0, 1, 1) - self.lineEdit_obs = QtGui.QLineEdit(Dialog) + self.lineEdit_obs = QtGui.QLineEdit(generate_survey) self.lineEdit_obs.setObjectName("lineEdit_obs") self.gridLayout.addWidget(self.lineEdit_obs, 2, 1, 1, 1) - self.label_obs = QtGui.QLabel(Dialog) + self.label_obs = QtGui.QLabel(generate_survey) self.label_obs.setObjectName("label_obs") self.gridLayout.addWidget(self.label_obs, 2, 0, 1, 1) - self.pushButton_obs = QtGui.QPushButton(Dialog) + self.pushButton_obs = QtGui.QPushButton(generate_survey) self.pushButton_obs.setObjectName("pushButton_obs") self.gridLayout.addWidget(self.pushButton_obs, 2, 2, 1, 1) - self.label_src = QtGui.QLabel(Dialog) + self.label_src = QtGui.QLabel(generate_survey) self.label_src.setObjectName("label_src") self.gridLayout.addWidget(self.label_src, 1, 0, 1, 1) - self.lineEdit_src = QtGui.QLineEdit(Dialog) + self.lineEdit_src = QtGui.QLineEdit(generate_survey) self.lineEdit_src.setObjectName("lineEdit_src") self.gridLayout.addWidget(self.lineEdit_src, 1, 1, 1, 1) - self.pushButton_src = QtGui.QPushButton(Dialog) + 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.buttonBox = QtGui.QDialogButtonBox(Dialog) + 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.retranslateUi(Dialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) + self.retranslateUi(generate_survey) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), generate_survey.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), generate_survey.reject) + QtCore.QMetaObject.connectSlotsByName(generate_survey) - def retranslateUi(self, Dialog): - Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Generate new Survey", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_rec.setText(QtGui.QApplication.translate("Dialog", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_rec.setToolTip(QtGui.QApplication.translate("Dialog", "\n" + def retranslateUi(self, generate_survey): + generate_survey.setWindowTitle(QtGui.QApplication.translate("generate_survey", "Generate new Survey", None, QtGui.QApplication.UnicodeUTF8)) + self.pushButton_rec.setText(QtGui.QApplication.translate("generate_survey", "Browse", None, QtGui.QApplication.UnicodeUTF8)) + self.label_rec.setToolTip(QtGui.QApplication.translate("generate_survey", "\n" "\n" @@ -76,9 +76,9 @@ class Ui_Dialog(object): "

Trace ID 100 with the coordinates (12.3 [m], 100.5 [m], 20.3 [m]).

\n" "

\n" "

100 12.3 100.5 20.3

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_rec.setText(QtGui.QApplication.translate("Dialog", "Receiver\n" + self.label_rec.setText(QtGui.QApplication.translate("generate_survey", "Receiver\n" "File [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.label_obs.setToolTip(QtGui.QApplication.translate("Dialog", "\n" + self.label_obs.setToolTip(QtGui.QApplication.translate("generate_survey", "\n" "\n" @@ -90,10 +90,10 @@ class Ui_Dialog(object): "

Shot number 100 containing seismograms for all traces with the name:

\n" "

\n" "

100_pickle.dat

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_obs.setText(QtGui.QApplication.translate("Dialog", "Seismogram\n" + self.label_obs.setText(QtGui.QApplication.translate("generate_survey", "Seismogram\n" "Directory [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_obs.setText(QtGui.QApplication.translate("Dialog", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_src.setToolTip(QtGui.QApplication.translate("Dialog", "\n" + self.pushButton_obs.setText(QtGui.QApplication.translate("generate_survey", "Browse", None, QtGui.QApplication.UnicodeUTF8)) + self.label_src.setToolTip(QtGui.QApplication.translate("generate_survey", "\n" "\n" @@ -107,7 +107,7 @@ class Ui_Dialog(object): "

Source number 100 with the coordinates (12.3 [m], 100.5 [m], 20.3 [m]).

\n" "

\n" "

100 12.3 100.5 20.3

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_src.setText(QtGui.QApplication.translate("Dialog", "Source\n" + self.label_src.setText(QtGui.QApplication.translate("generate_survey", "Source\n" "File [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_src.setText(QtGui.QApplication.translate("Dialog", "Browse", None, QtGui.QApplication.UnicodeUTF8)) + self.pushButton_src.setText(QtGui.QApplication.translate("generate_survey", "Browse", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/pylot/core/active/picking_parameters_layout.py b/pylot/core/active/picking_parameters_layout.py index fdecdea1..eb6c87eb 100644 --- a/pylot/core/active/picking_parameters_layout.py +++ b/pylot/core/active/picking_parameters_layout.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'picking_parameters_layout.ui' # -# Created: Mon Jun 27 13:23:33 2016 +# Created: Mon Jun 27 15:18:25 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! diff --git a/pylot/core/active/seismicshot.py b/pylot/core/active/seismicshot.py index a93acd7f..bc51b4b4 100644 --- a/pylot/core/active/seismicshot.py +++ b/pylot/core/active/seismicshot.py @@ -33,6 +33,7 @@ class SeismicShot(object): :type: string ''' self.traces = read(obsfile) + self.renameChannelIDs() self.recCoordlist = None self.srcCoordlist = None self.traceIDs = None @@ -47,6 +48,11 @@ class SeismicShot(object): self.paras['shotname'] = obsfile self.folm = None + def renameChannelIDs(self): + for trace in self.traces: + if trace.stats._format == 'SEG2': + trace.stats.channel = int(trace.stats.seg2['CHANNEL_NUMBER']) + def removeEmptyTraces(self): traceIDs = [] coordlist = self.getRecCoordlist() @@ -495,7 +501,7 @@ class SeismicShot(object): ''' coordlist = self.getSrcCoordlist() for i in range(0, len(coordlist)): - if int(coordlist[i].split()[0]) == self.paras['shotnumber']: + if coordlist[i].split()[0] == self.paras['shotnumber']: x = coordlist[i].split()[1] y = coordlist[i].split()[2] z = coordlist[i].split()[3]