diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 755013bb..00000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
Specifiy simple input velocity file from which linear gradients will be evaluated.
\n" -"\n" -"For example:
\n" -"\n" -"First gradient: Surface velocity: 0.5 km/s rising to 1.0 km/s at a depth of 5 m below the surface.
\n" -"Second gradient: Continuous change to another gradient from 1.0 km/s to 4.0 km/s at 60 m depth below the surface.
\n" -"\n" -"0 0.5
\n" -"-5 1.0
\n" -"-5 1.0
\n" -"-60 4.0
\n" -"", None, QtGui.QApplication.UnicodeUTF8)) - self.label_15.setText(QtGui.QApplication.translate("fmtomo_parameters", "Custom velocity\n" -"grid (earthmodel) [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.browse_customgrid.setText(QtGui.QApplication.translate("fmtomo_parameters", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_16.setToolTip(QtGui.QApplication.translate("fmtomo_parameters", "Specifiy directory for FMTOMO simulation.", None, QtGui.QApplication.UnicodeUTF8)) - self.label_16.setText(QtGui.QApplication.translate("fmtomo_parameters", "Simulation\n" -"Directory [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.browse_simuldir.setText(QtGui.QApplication.translate("fmtomo_parameters", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/generate_seisarray_layout.py b/pylot/core/active/gui/generate_seisarray_layout.py deleted file mode 100644 index e22b7488..00000000 --- a/pylot/core/active/gui/generate_seisarray_layout.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'generate_seisarray_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_generate_seisarray(object): - def setupUi(self, generate_seisarray): - generate_seisarray.setObjectName("generate_seisarray") - generate_seisarray.resize(403, 221) - generate_seisarray.setMinimumSize(QtCore.QSize(400, 220)) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - generate_seisarray.setWindowIcon(icon) - self.verticalLayout_5 = QtGui.QVBoxLayout(generate_seisarray) - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label_rec = QtGui.QLabel(generate_seisarray) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_rec.sizePolicy().hasHeightForWidth()) - self.label_rec.setSizePolicy(sizePolicy) - self.label_rec.setToolTip("") - self.label_rec.setObjectName("label_rec") - self.horizontalLayout.addWidget(self.label_rec) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.radioButton_normal = QtGui.QRadioButton(generate_seisarray) - self.radioButton_normal.setChecked(True) - self.radioButton_normal.setObjectName("radioButton_normal") - self.horizontalLayout.addWidget(self.radioButton_normal) - self.radioButton_interpolatable = QtGui.QRadioButton(generate_seisarray) - self.radioButton_interpolatable.setObjectName("radioButton_interpolatable") - self.horizontalLayout.addWidget(self.radioButton_interpolatable) - self.verticalLayout_4.addLayout(self.horizontalLayout) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.lineEdit_rec = QtGui.QLineEdit(generate_seisarray) - self.lineEdit_rec.setObjectName("lineEdit_rec") - self.horizontalLayout_4.addWidget(self.lineEdit_rec) - self.pushButton_rec = QtGui.QPushButton(generate_seisarray) - self.pushButton_rec.setObjectName("pushButton_rec") - self.horizontalLayout_4.addWidget(self.pushButton_rec) - self.verticalLayout_4.addLayout(self.horizontalLayout_4) - self.verticalLayout.addLayout(self.verticalLayout_4) - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_src = QtGui.QLabel(generate_seisarray) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_src.sizePolicy().hasHeightForWidth()) - self.label_src.setSizePolicy(sizePolicy) - self.label_src.setObjectName("label_src") - self.verticalLayout_2.addWidget(self.label_src) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.lineEdit_src = QtGui.QLineEdit(generate_seisarray) - self.lineEdit_src.setObjectName("lineEdit_src") - self.horizontalLayout_5.addWidget(self.lineEdit_src) - self.pushButton_src = QtGui.QPushButton(generate_seisarray) - self.pushButton_src.setObjectName("pushButton_src") - self.horizontalLayout_5.addWidget(self.pushButton_src) - self.verticalLayout_2.addLayout(self.horizontalLayout_5) - self.verticalLayout.addLayout(self.verticalLayout_2) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.label_obs = QtGui.QLabel(generate_seisarray) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_obs.sizePolicy().hasHeightForWidth()) - self.label_obs.setSizePolicy(sizePolicy) - self.label_obs.setObjectName("label_obs") - self.verticalLayout_3.addWidget(self.label_obs) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.lineEdit_pts = QtGui.QLineEdit(generate_seisarray) - self.lineEdit_pts.setObjectName("lineEdit_pts") - self.horizontalLayout_6.addWidget(self.lineEdit_pts) - self.pushButton_obs = QtGui.QPushButton(generate_seisarray) - self.pushButton_obs.setObjectName("pushButton_obs") - self.horizontalLayout_6.addWidget(self.pushButton_obs) - self.verticalLayout_3.addLayout(self.horizontalLayout_6) - self.verticalLayout.addLayout(self.verticalLayout_3) - self.verticalLayout_5.addLayout(self.verticalLayout) - self.buttonBox = QtGui.QDialogButtonBox(generate_seisarray) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.verticalLayout_5.addWidget(self.buttonBox) - - self.retranslateUi(generate_seisarray) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), generate_seisarray.reject) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), generate_seisarray.accept) - QtCore.QMetaObject.connectSlotsByName(generate_seisarray) - - def retranslateUi(self, generate_seisarray): - generate_seisarray.setWindowTitle(QtGui.QApplication.translate("generate_seisarray", "Generate new Seismic Array", None, QtGui.QApplication.UnicodeUTF8)) - self.label_rec.setText(QtGui.QApplication.translate("generate_seisarray", "Measured Receivers", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_normal.setToolTip(QtGui.QApplication.translate("generate_seisarray", "\n" -"\n" -"Load normal measured receiver input file. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).
\n" -"\n" -"50 10.5 20.4 30.3
", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_normal.setText(QtGui.QApplication.translate("generate_seisarray", "normal [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_interpolatable.setToolTip(QtGui.QApplication.translate("generate_seisarray", "\n" -"\n" -"Load measured receiver input file that can be interpolated. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [receiver line ID (int)] [number of the geophone on receiver line (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).
\n" -"\n" -"50 2 3 10.5 20.4 30.3
", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_interpolatable.setText(QtGui.QApplication.translate("generate_seisarray", "interpolation [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_rec.setText(QtGui.QApplication.translate("generate_seisarray", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_src.setToolTip(QtGui.QApplication.translate("generate_seisarray", "\n" -"\n" -"Load measured sources input file to improve interpolation precision. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[source ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Shot 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("generate_seisarray", "Measured Sources (optional) [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_src.setText(QtGui.QApplication.translate("generate_seisarray", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_obs.setToolTip(QtGui.QApplication.translate("generate_seisarray", "\n" -"\n" -"Load measured points input file to improve interpolation precision. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[point ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Point 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_obs.setText(QtGui.QApplication.translate("generate_seisarray", "Additional measured points (optional) [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_obs.setText(QtGui.QApplication.translate("generate_seisarray", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/generate_survey_layout.py b/pylot/core/active/gui/generate_survey_layout.py deleted file mode 100644 index 8afada23..00000000 --- a/pylot/core/active/gui/generate_survey_layout.py +++ /dev/null @@ -1,151 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'generate_survey_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_generate_survey(object): - def setupUi(self, generate_survey): - generate_survey.setObjectName("generate_survey") - generate_survey.resize(382, 220) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap("../asp3d_icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - generate_survey.setWindowIcon(icon) - 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) - self.lineEdit_rec.setObjectName("lineEdit_rec") - self.gridLayout.addWidget(self.lineEdit_rec, 0, 1, 1, 1) - 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(generate_survey) - self.label_rec.setObjectName("label_rec") - self.gridLayout.addWidget(self.label_rec, 0, 0, 1, 1) - 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(generate_survey) - self.label_obs.setObjectName("label_obs") - self.gridLayout.addWidget(self.label_obs, 2, 0, 1, 1) - 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(generate_survey) - self.label_src.setObjectName("label_src") - self.gridLayout.addWidget(self.label_src, 1, 0, 1, 1) - 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(generate_survey) - self.pushButton_src.setObjectName("pushButton_src") - self.gridLayout.addWidget(self.pushButton_src, 1, 2, 1, 1) - self.verticalLayout_2.addLayout(self.gridLayout) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.line_2 = QtGui.QFrame(generate_survey) - self.line_2.setFrameShape(QtGui.QFrame.HLine) - self.line_2.setFrameShadow(QtGui.QFrame.Sunken) - self.line_2.setObjectName("line_2") - self.verticalLayout.addWidget(self.line_2) - 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_2.addWidget(self.buttonBox) - - 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, 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" -"Load receiver input file. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"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("generate_survey", "Receiver\n" -"File [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.label_obs.setToolTip(QtGui.QApplication.translate("generate_survey", "\n" -"\n" -"Specifiy directory containing seismograms for each shot.
\n" -"Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.
\n" -"\n" -"For example:
\n" -"\n" -"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("generate_survey", "Seismogram\n" -"Directory [?]", None, QtGui.QApplication.UnicodeUTF8)) - 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" -"Load sources input file. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"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("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", "\n" -"\n" -"Specifiy directory containing seismograms for each shot.
\n" -"Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.
\n" -"\n" -"For example:
\n" -"\n" -"Shot number 100 containing seismograms for all traces with the name:
\n" -"\n" -"100_pickle.dat
", 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)) - diff --git a/pylot/core/active/gui/generate_survey_layout_minimal.py b/pylot/core/active/gui/generate_survey_layout_minimal.py deleted file mode 100644 index c33302be..00000000 --- a/pylot/core/active/gui/generate_survey_layout_minimal.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'generate_survey_layout_minimal.ui' -# -# Created: Mon Aug 29 10:26:23 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_generate_survey_minimal(object): - def setupUi(self, generate_survey_minimal): - generate_survey_minimal.setObjectName("generate_survey_minimal") - 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_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) - self.lineEdit_obs.setObjectName("lineEdit_obs") - self.gridLayout.addWidget(self.lineEdit_obs, 0, 1, 1, 1) - self.label_obs = QtGui.QLabel(generate_survey_minimal) - self.label_obs.setObjectName("label_obs") - self.gridLayout.addWidget(self.label_obs, 0, 0, 1, 1) - 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_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_2.addWidget(self.buttonBox) - - self.retranslateUi(generate_survey_minimal) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), generate_survey_minimal.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), generate_survey_minimal.reject) - QtCore.QMetaObject.connectSlotsByName(generate_survey_minimal) - - def retranslateUi(self, generate_survey_minimal): - generate_survey_minimal.setWindowTitle(QtGui.QApplication.translate("generate_survey_minimal", "Generate new Survey", None, QtGui.QApplication.UnicodeUTF8)) - self.label_obs.setToolTip(QtGui.QApplication.translate("generate_survey_minimal", "\n" -"\n" -"Specifiy directory containing seismograms for each shot.
\n" -"Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.
\n" -"\n" -"For example:
\n" -"\n" -"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("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", "\n" -"\n" -"Specifiy directory containing seismograms for each shot.
\n" -"Currently in the format SEGY with each file named \'shotnumber*_pickle.dat\'.
\n" -"\n" -"For example:
\n" -"\n" -"Shot number 100 containing seismograms for all traces with the name:
\n" -"\n" -"100_pickle.dat
", 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)) - diff --git a/pylot/core/active/gui/picking_parameters_layout.py b/pylot/core/active/gui/picking_parameters_layout.py deleted file mode 100644 index a6b2c3f2..00000000 --- a/pylot/core/active/gui/picking_parameters_layout.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'picking_parameters_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_picking_parameters(object): - def setupUi(self, picking_parameters): - picking_parameters.setObjectName("picking_parameters") - picking_parameters.resize(422, 798) - picking_parameters.setMinimumSize(QtCore.QSize(0, 700)) - self.verticalLayout_4 = QtGui.QVBoxLayout(picking_parameters) - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.label_7 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) - self.label_7.setSizePolicy(sizePolicy) - font = QtGui.QFont() - font.setFamily("Sans Serif") - font.setWeight(75) - font.setBold(True) - self.label_7.setFont(font) - self.label_7.setObjectName("label_7") - self.verticalLayout_4.addWidget(self.label_7) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) - self.label.setSizePolicy(sizePolicy) - self.label.setObjectName("label") - self.horizontalLayout.addWidget(self.label) - self.ncores = QtGui.QSpinBox(picking_parameters) - self.ncores.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.ncores.setMinimum(1) - self.ncores.setMaximum(10000) - self.ncores.setObjectName("ncores") - self.horizontalLayout.addWidget(self.ncores) - self.verticalLayout_4.addLayout(self.horizontalLayout) - self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) - self.label_2.setSizePolicy(sizePolicy) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.lineEdit_vmin = QtGui.QLineEdit(picking_parameters) - self.lineEdit_vmin.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.lineEdit_vmin.setObjectName("lineEdit_vmin") - self.verticalLayout_2.addWidget(self.lineEdit_vmin) - self.horizontalLayout_3.addLayout(self.verticalLayout_2) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.label_3 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) - self.label_3.setSizePolicy(sizePolicy) - self.label_3.setObjectName("label_3") - self.verticalLayout.addWidget(self.label_3) - self.lineEdit_vmax = QtGui.QLineEdit(picking_parameters) - self.lineEdit_vmax.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.lineEdit_vmax.setObjectName("lineEdit_vmax") - self.verticalLayout.addWidget(self.lineEdit_vmax) - self.horizontalLayout_3.addLayout(self.verticalLayout) - self.verticalLayout_4.addLayout(self.horizontalLayout_3) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.label_4 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) - self.label_4.setSizePolicy(sizePolicy) - self.label_4.setObjectName("label_4") - self.horizontalLayout_4.addWidget(self.label_4) - 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_4.addLayout(self.horizontalLayout_4) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.label_5 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) - self.label_5.setSizePolicy(sizePolicy) - self.label_5.setObjectName("label_5") - self.horizontalLayout_5.addWidget(self.label_5) - self.checkBox_AIC = QtGui.QCheckBox(picking_parameters) - self.checkBox_AIC.setText("") - self.checkBox_AIC.setChecked(True) - self.checkBox_AIC.setObjectName("checkBox_AIC") - self.horizontalLayout_5.addWidget(self.checkBox_AIC) - self.verticalLayout_4.addLayout(self.horizontalLayout_5) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.label_6 = QtGui.QLabel(picking_parameters) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth()) - self.label_6.setSizePolicy(sizePolicy) - self.label_6.setObjectName("label_6") - self.horizontalLayout_6.addWidget(self.label_6) - self.horizontalLayout_7 = QtGui.QHBoxLayout() - self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.lineEdit_aicleft = QtGui.QLineEdit(picking_parameters) - self.lineEdit_aicleft.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.lineEdit_aicleft.setObjectName("lineEdit_aicleft") - self.horizontalLayout_7.addWidget(self.lineEdit_aicleft) - self.lineEdit_aicright = QtGui.QLineEdit(picking_parameters) - self.lineEdit_aicright.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.lineEdit_aicright.setObjectName("lineEdit_aicright") - self.horizontalLayout_7.addWidget(self.lineEdit_aicright) - self.horizontalLayout_6.addLayout(self.horizontalLayout_7) - self.verticalLayout_4.addLayout(self.horizontalLayout_6) - self.verticalLayout_snr = QtGui.QVBoxLayout() - self.verticalLayout_snr.setObjectName("verticalLayout_snr") - self.line = QtGui.QFrame(picking_parameters) - self.line.setFrameShape(QtGui.QFrame.HLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) - self.line.setObjectName("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.setObjectName("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.setObjectName("gridLayout_2") - self.label_9 = QtGui.QLabel(picking_parameters) - self.label_9.setObjectName("label_9") - self.gridLayout_2.addWidget(self.label_9, 1, 0, 1, 1) - self.label_10 = QtGui.QLabel(picking_parameters) - self.label_10.setObjectName("label_10") - self.gridLayout_2.addWidget(self.label_10, 2, 0, 1, 1) - self.p1 = QtGui.QDoubleSpinBox(picking_parameters) - self.p1.setDecimals(6) - self.p1.setMinimum(-100.0) - self.p1.setMaximum(100.0) - self.p1.setSingleStep(0.0001) - self.p1.setProperty("value", 0.004) - self.p1.setObjectName("p1") - self.gridLayout_2.addWidget(self.p1, 2, 1, 1, 1) - self.label_11 = QtGui.QLabel(picking_parameters) - self.label_11.setObjectName("label_11") - self.gridLayout_2.addWidget(self.label_11, 1, 2, 1, 1) - self.label_12 = QtGui.QLabel(picking_parameters) - self.label_12.setObjectName("label_12") - self.gridLayout_2.addWidget(self.label_12, 2, 2, 1, 1) - self.p2 = QtGui.QDoubleSpinBox(picking_parameters) - self.p2.setDecimals(6) - self.p2.setMinimum(-100.0) - self.p2.setMaximum(100.0) - self.p2.setSingleStep(0.001) - self.p2.setProperty("value", -0.0007) - self.p2.setObjectName("p2") - self.gridLayout_2.addWidget(self.p2, 2, 3, 1, 1) - self.shift_dist = QtGui.QSpinBox(picking_parameters) - self.shift_dist.setMinimum(-10000) - self.shift_dist.setMaximum(10000) - self.shift_dist.setProperty("value", 30) - self.shift_dist.setObjectName("shift_dist") - self.gridLayout_2.addWidget(self.shift_dist, 1, 1, 1, 1) - self.shift_snr = QtGui.QSpinBox(picking_parameters) - self.shift_snr.setMinimum(-10000) - self.shift_snr.setMaximum(10000) - self.shift_snr.setProperty("value", 100) - self.shift_snr.setObjectName("shift_snr") - self.gridLayout_2.addWidget(self.shift_snr, 1, 3, 1, 1) - self.verticalLayout_snr.addLayout(self.gridLayout_2) - 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.setObjectName("vlayout_plot") - self.verticalLayout_4.addLayout(self.vlayout_plot) - 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.verticalLayout_4.addWidget(self.buttonBox) - - self.retranslateUi(picking_parameters) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), picking_parameters.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), picking_parameters.reject) - QtCore.QMetaObject.connectSlotsByName(picking_parameters) - - def retranslateUi(self, picking_parameters): - picking_parameters.setWindowTitle(QtGui.QApplication.translate("picking_parameters", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) - self.label_7.setText(QtGui.QApplication.translate("picking_parameters", "Choose parameters for FMTOMO simulation", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setToolTip(QtGui.QApplication.translate("picking_parameters", "Amount of CPU kernels used.", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("picking_parameters", "nproc [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setToolTip(QtGui.QApplication.translate("picking_parameters", "Minimum permitted direct velocity (apparent velocity!).", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("picking_parameters", "vmin [m/s] [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.lineEdit_vmin.setText(QtGui.QApplication.translate("picking_parameters", "100", None, QtGui.QApplication.UnicodeUTF8)) - 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 1 and 100 % 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.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)) - self.label_6.setText(QtGui.QApplication.translate("picking_parameters", "AIC window samples\n" -"(only if AIC checked)", 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.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_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_12.setText(QtGui.QApplication.translate("picking_parameters", "p2", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/postprocessing_layout.py b/pylot/core/active/gui/postprocessing_layout.py deleted file mode 100644 index 0cb3d539..00000000 --- a/pylot/core/active/gui/postprocessing_layout.py +++ /dev/null @@ -1,178 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'postprocessing_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_postprocessing(object): - def setupUi(self, postprocessing): - postprocessing.setObjectName("postprocessing") - postprocessing.resize(825, 617) - self.verticalLayout = QtGui.QVBoxLayout(postprocessing) - self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.label = QtGui.QLabel(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) - self.label.setSizePolicy(sizePolicy) - self.label.setMinimumSize(QtCore.QSize(0, 20)) - self.label.setMaximumSize(QtCore.QSize(16777215, 30)) - self.label.setObjectName("label") - self.verticalLayout_3.addWidget(self.label) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.pushButton_rect = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_rect.sizePolicy().hasHeightForWidth()) - self.pushButton_rect.setSizePolicy(sizePolicy) - self.pushButton_rect.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_rect.setCheckable(False) - self.pushButton_rect.setObjectName("pushButton_rect") - self.buttonGroup = QtGui.QButtonGroup(postprocessing) - self.buttonGroup.setObjectName("buttonGroup") - self.buttonGroup.addButton(self.pushButton_rect) - self.horizontalLayout_4.addWidget(self.pushButton_rect) - self.pushButton_poly = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_poly.sizePolicy().hasHeightForWidth()) - self.pushButton_poly.setSizePolicy(sizePolicy) - self.pushButton_poly.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_poly.setCheckable(False) - self.pushButton_poly.setObjectName("pushButton_poly") - self.buttonGroup.addButton(self.pushButton_poly) - self.horizontalLayout_4.addWidget(self.pushButton_poly) - self.pushButton_undo = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_undo.sizePolicy().hasHeightForWidth()) - self.pushButton_undo.setSizePolicy(sizePolicy) - self.pushButton_undo.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_undo.setCheckable(False) - self.pushButton_undo.setObjectName("pushButton_undo") - self.horizontalLayout_4.addWidget(self.pushButton_undo) - self.verticalLayout_3.addLayout(self.horizontalLayout_4) - self.horizontalLayout_2.addLayout(self.verticalLayout_3) - self.line = QtGui.QFrame(postprocessing) - self.line.setFrameShape(QtGui.QFrame.VLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) - self.line.setObjectName("line") - self.horizontalLayout_2.addWidget(self.line) - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.label_3 = QtGui.QLabel(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) - self.label_3.setSizePolicy(sizePolicy) - self.label_3.setMinimumSize(QtCore.QSize(0, 20)) - self.label_3.setMaximumSize(QtCore.QSize(16777215, 30)) - self.label_3.setObjectName("label_3") - self.verticalLayout_4.addWidget(self.label_3) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.pushButton_plot = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_plot.sizePolicy().hasHeightForWidth()) - self.pushButton_plot.setSizePolicy(sizePolicy) - self.pushButton_plot.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_plot.setCheckable(False) - self.pushButton_plot.setDefault(False) - self.pushButton_plot.setFlat(False) - self.pushButton_plot.setObjectName("pushButton_plot") - self.horizontalLayout_6.addWidget(self.pushButton_plot) - self.pushButton_delete = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_delete.sizePolicy().hasHeightForWidth()) - self.pushButton_delete.setSizePolicy(sizePolicy) - self.pushButton_delete.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_delete.setObjectName("pushButton_delete") - self.horizontalLayout_6.addWidget(self.pushButton_delete) - self.verticalLayout_4.addLayout(self.horizontalLayout_6) - self.horizontalLayout_2.addLayout(self.verticalLayout_4) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtGui.QLabel(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) - self.label_2.setSizePolicy(sizePolicy) - self.label_2.setMinimumSize(QtCore.QSize(0, 20)) - self.label_2.setMaximumSize(QtCore.QSize(16777215, 30)) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.pushButton_snr = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_snr.sizePolicy().hasHeightForWidth()) - self.pushButton_snr.setSizePolicy(sizePolicy) - self.pushButton_snr.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_snr.setObjectName("pushButton_snr") - self.horizontalLayout_5.addWidget(self.pushButton_snr) - self.pushButton_pe = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_pe.sizePolicy().hasHeightForWidth()) - self.pushButton_pe.setSizePolicy(sizePolicy) - self.pushButton_pe.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_pe.setObjectName("pushButton_pe") - self.horizontalLayout_5.addWidget(self.pushButton_pe) - self.pushButton_spe = QtGui.QPushButton(postprocessing) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButton_spe.sizePolicy().hasHeightForWidth()) - self.pushButton_spe.setSizePolicy(sizePolicy) - self.pushButton_spe.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_spe.setObjectName("pushButton_spe") - self.horizontalLayout_5.addWidget(self.pushButton_spe) - self.verticalLayout_2.addLayout(self.horizontalLayout_5) - self.horizontalLayout_2.addLayout(self.verticalLayout_2) - self.verticalLayout.addLayout(self.horizontalLayout_2) - self.verticalLayout_plot = QtGui.QVBoxLayout() - self.verticalLayout_plot.setObjectName("verticalLayout_plot") - self.verticalLayout.addLayout(self.verticalLayout_plot) - - self.retranslateUi(postprocessing) - QtCore.QMetaObject.connectSlotsByName(postprocessing) - - def retranslateUi(self, postprocessing): - postprocessing.setWindowTitle(QtGui.QApplication.translate("postprocessing", "Postprocessing", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("postprocessing", "Selection", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_rect.setText(QtGui.QApplication.translate("postprocessing", "Rectangle", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_poly.setText(QtGui.QApplication.translate("postprocessing", "Polygon", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_undo.setText(QtGui.QApplication.translate("postprocessing", "Unselect", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("postprocessing", "Action", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_plot.setText(QtGui.QApplication.translate("postprocessing", "Plot", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_delete.setText(QtGui.QApplication.translate("postprocessing", "Delete", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("postprocessing", "Color by (refreshes plot)", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_snr.setText(QtGui.QApplication.translate("postprocessing", "SNR", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_pe.setText(QtGui.QApplication.translate("postprocessing", "PE", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_spe.setText(QtGui.QApplication.translate("postprocessing", "SPE", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/repicking_layout.py b/pylot/core/active/gui/repicking_layout.py deleted file mode 100644 index 717cc7d1..00000000 --- a/pylot/core/active/gui/repicking_layout.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'repicking_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_repicking(object): - def setupUi(self, repicking): - repicking.setObjectName("repicking") - repicking.resize(640, 480) - self.verticalLayout = QtGui.QVBoxLayout(repicking) - self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.pushButton_repick = QtGui.QPushButton(repicking) - self.pushButton_repick.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_repick.setObjectName("pushButton_repick") - self.horizontalLayout.addWidget(self.pushButton_repick) - self.pushButton_delete = QtGui.QPushButton(repicking) - self.pushButton_delete.setMaximumSize(QtCore.QSize(16777215, 30)) - self.pushButton_delete.setObjectName("pushButton_delete") - self.horizontalLayout.addWidget(self.pushButton_delete) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.verticalLayout.addLayout(self.horizontalLayout) - self.verticalLayout_plot = QtGui.QVBoxLayout() - self.verticalLayout_plot.setObjectName("verticalLayout_plot") - self.verticalLayout.addLayout(self.verticalLayout_plot) - self.buttonBox = QtGui.QDialogButtonBox(repicking) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) - self.buttonBox.setObjectName("buttonBox") - self.verticalLayout.addWidget(self.buttonBox) - - self.retranslateUi(repicking) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), repicking.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), repicking.reject) - QtCore.QMetaObject.connectSlotsByName(repicking) - - def retranslateUi(self, repicking): - repicking.setWindowTitle(QtGui.QApplication.translate("repicking", "Repicking", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_repick.setText(QtGui.QApplication.translate("repicking", "Repick", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_delete.setText(QtGui.QApplication.translate("repicking", "Delete", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/vtk_tools_layout.py b/pylot/core/active/gui/vtk_tools_layout.py deleted file mode 100644 index 53d05106..00000000 --- a/pylot/core/active/gui/vtk_tools_layout.py +++ /dev/null @@ -1,224 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'vtk_tools_layout.ui' -# -# Created: Mon Aug 29 10:26:23 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_vtk_tools(object): - def setupUi(self, vtk_tools): - vtk_tools.setObjectName("vtk_tools") - vtk_tools.resize(422, 471) - self.verticalLayout_9 = QtGui.QVBoxLayout(vtk_tools) - self.verticalLayout_9.setObjectName("verticalLayout_9") - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label_rec = QtGui.QLabel(vtk_tools) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_rec.sizePolicy().hasHeightForWidth()) - self.label_rec.setSizePolicy(sizePolicy) - font = QtGui.QFont() - font.setWeight(75) - font.setBold(True) - self.label_rec.setFont(font) - self.label_rec.setToolTip("") - self.label_rec.setObjectName("label_rec") - self.horizontalLayout.addWidget(self.label_rec) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.radioButton_abs = QtGui.QRadioButton(vtk_tools) - self.radioButton_abs.setChecked(True) - self.radioButton_abs.setObjectName("radioButton_abs") - self.horizontalLayout.addWidget(self.radioButton_abs) - self.radioButton_rel = QtGui.QRadioButton(vtk_tools) - self.radioButton_rel.setObjectName("radioButton_rel") - self.horizontalLayout.addWidget(self.radioButton_rel) - self.verticalLayout_4.addLayout(self.horizontalLayout) - self.verticalLayout_6 = QtGui.QVBoxLayout() - self.verticalLayout_6.setObjectName("verticalLayout_6") - self.label_3 = QtGui.QLabel(vtk_tools) - self.label_3.setObjectName("label_3") - self.verticalLayout_6.addWidget(self.label_3) - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.lineEdit_vg = QtGui.QLineEdit(vtk_tools) - self.lineEdit_vg.setObjectName("lineEdit_vg") - self.horizontalLayout_2.addWidget(self.lineEdit_vg) - self.pushButton_vg = QtGui.QPushButton(vtk_tools) - self.pushButton_vg.setObjectName("pushButton_vg") - self.horizontalLayout_2.addWidget(self.pushButton_vg) - self.verticalLayout_6.addLayout(self.horizontalLayout_2) - self.verticalLayout_4.addLayout(self.verticalLayout_6) - self.verticalLayout_7 = QtGui.QVBoxLayout() - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.label_4 = QtGui.QLabel(vtk_tools) - self.label_4.setObjectName("label_4") - self.verticalLayout_7.addWidget(self.label_4) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.lineEdit_vgref = QtGui.QLineEdit(vtk_tools) - self.lineEdit_vgref.setEnabled(False) - self.lineEdit_vgref.setObjectName("lineEdit_vgref") - self.horizontalLayout_4.addWidget(self.lineEdit_vgref) - self.pushButton_vgref = QtGui.QPushButton(vtk_tools) - self.pushButton_vgref.setEnabled(False) - self.pushButton_vgref.setObjectName("pushButton_vgref") - self.horizontalLayout_4.addWidget(self.pushButton_vgref) - self.verticalLayout_7.addLayout(self.horizontalLayout_4) - self.verticalLayout_8 = QtGui.QVBoxLayout() - self.verticalLayout_8.setObjectName("verticalLayout_8") - self.verticalLayout_7.addLayout(self.verticalLayout_8) - self.label_5 = QtGui.QLabel(vtk_tools) - self.label_5.setObjectName("label_5") - self.verticalLayout_7.addWidget(self.label_5) - self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.lineEdit_vgout = QtGui.QLineEdit(vtk_tools) - self.lineEdit_vgout.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.lineEdit_vgout.setObjectName("lineEdit_vgout") - self.horizontalLayout_3.addWidget(self.lineEdit_vgout) - self.pushButton_vtkout = QtGui.QPushButton(vtk_tools) - self.pushButton_vtkout.setObjectName("pushButton_vtkout") - self.horizontalLayout_3.addWidget(self.pushButton_vtkout) - self.pushButton_parav = QtGui.QPushButton(vtk_tools) - self.pushButton_parav.setObjectName("pushButton_parav") - self.horizontalLayout_3.addWidget(self.pushButton_parav) - self.verticalLayout_7.addLayout(self.horizontalLayout_3) - self.start_vg = QtGui.QPushButton(vtk_tools) - self.start_vg.setEnabled(False) - self.start_vg.setObjectName("start_vg") - self.verticalLayout_7.addWidget(self.start_vg) - self.verticalLayout_4.addLayout(self.verticalLayout_7) - self.verticalLayout.addLayout(self.verticalLayout_4) - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.line = QtGui.QFrame(vtk_tools) - self.line.setFrameShape(QtGui.QFrame.HLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) - self.line.setObjectName("line") - self.verticalLayout_2.addWidget(self.line) - self.label_src = QtGui.QLabel(vtk_tools) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_src.sizePolicy().hasHeightForWidth()) - self.label_src.setSizePolicy(sizePolicy) - font = QtGui.QFont() - font.setWeight(75) - font.setBold(True) - self.label_src.setFont(font) - self.label_src.setObjectName("label_src") - self.verticalLayout_2.addWidget(self.label_src) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.label = QtGui.QLabel(vtk_tools) - self.label.setObjectName("label") - self.verticalLayout_3.addWidget(self.label) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.lineEdit_rays = QtGui.QLineEdit(vtk_tools) - self.lineEdit_rays.setObjectName("lineEdit_rays") - self.horizontalLayout_6.addWidget(self.lineEdit_rays) - self.pushButton_rays = QtGui.QPushButton(vtk_tools) - self.pushButton_rays.setObjectName("pushButton_rays") - self.horizontalLayout_6.addWidget(self.pushButton_rays) - self.verticalLayout_3.addLayout(self.horizontalLayout_6) - self.verticalLayout_2.addLayout(self.verticalLayout_3) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.label_2 = QtGui.QLabel(vtk_tools) - self.label_2.setObjectName("label_2") - self.verticalLayout_5.addWidget(self.label_2) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.lineEdit_raysout = QtGui.QLineEdit(vtk_tools) - self.lineEdit_raysout.setObjectName("lineEdit_raysout") - self.horizontalLayout_5.addWidget(self.lineEdit_raysout) - self.pushButton_raysout = QtGui.QPushButton(vtk_tools) - self.pushButton_raysout.setObjectName("pushButton_raysout") - self.horizontalLayout_5.addWidget(self.pushButton_raysout) - self.verticalLayout_5.addLayout(self.horizontalLayout_5) - self.start_rays = QtGui.QPushButton(vtk_tools) - self.start_rays.setEnabled(False) - self.start_rays.setObjectName("start_rays") - self.verticalLayout_5.addWidget(self.start_rays) - self.verticalLayout_2.addLayout(self.verticalLayout_5) - self.verticalLayout.addLayout(self.verticalLayout_2) - self.verticalLayout_9.addLayout(self.verticalLayout) - self.buttonBox = QtGui.QDialogButtonBox(vtk_tools) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.verticalLayout_9.addWidget(self.buttonBox) - - self.retranslateUi(vtk_tools) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), vtk_tools.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), vtk_tools.reject) - QtCore.QMetaObject.connectSlotsByName(vtk_tools) - - def retranslateUi(self, vtk_tools): - vtk_tools.setWindowTitle(QtGui.QApplication.translate("vtk_tools", "VTK tools", None, QtGui.QApplication.UnicodeUTF8)) - self.label_rec.setText(QtGui.QApplication.translate("vtk_tools", "Velocity grid to VTK", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_abs.setToolTip(QtGui.QApplication.translate("vtk_tools", "\n" -"\n" -"Load normal measured receiver input file. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Geophone with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).
\n" -"\n" -"50 10.5 20.4 30.3
", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_abs.setText(QtGui.QApplication.translate("vtk_tools", "absolute [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_rel.setToolTip(QtGui.QApplication.translate("vtk_tools", "\n" -"\n" -"Load measured receiver input file that can be interpolated. The input file must be in the following format:
\n" -"\n" -"Containing in each line, separated by spaces:
\n" -"\n" -"[trace ID (int)] [receiver line ID (int)] [number of the geophone on receiver line (int)] [X (float)] [Y (float)] [Z (float)]
\n" -"\n" -"For example:
\n" -"Third geophone on the second receiver line with the trace ID 50 and the coordinates (10.5 [m], 20.4 [m], 30.3 [m]).
\n" -"\n" -"50 2 3 10.5 20.4 30.3
", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_rel.setText(QtGui.QApplication.translate("vtk_tools", "relative [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("vtk_tools", "Browse for velocity grid file (\'vgrids.in\'):", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_vg.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_4.setText(QtGui.QApplication.translate("vtk_tools", "Browse for reference velocity grid file (\'vgridsref.in\'):", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_vgref.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setText(QtGui.QApplication.translate("vtk_tools", "Output Filename:", None, QtGui.QApplication.UnicodeUTF8)) - self.lineEdit_vgout.setText(QtGui.QApplication.translate("vtk_tools", "vgrids.vtk", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_vtkout.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_parav.setToolTip(QtGui.QApplication.translate("vtk_tools", "\n" -"\n" -"Call Paraview (Shell command: paraview) for the specified output filename in the current directory.
", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_parav.setText(QtGui.QApplication.translate("vtk_tools", "<- Paraview", None, QtGui.QApplication.UnicodeUTF8)) - self.start_vg.setText(QtGui.QApplication.translate("vtk_tools", "Start", None, QtGui.QApplication.UnicodeUTF8)) - self.label_src.setToolTip(QtGui.QApplication.translate("vtk_tools", "Create VTK files from the FMTOMO output file \'rays.dat\'.\n" -"This will generate one file of ray paths for each individual source.", None, QtGui.QApplication.UnicodeUTF8)) - self.label_src.setText(QtGui.QApplication.translate("vtk_tools", "Rays to VTK [?]", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("vtk_tools", "Browse for input file (\'rays.dat\'):", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_rays.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("vtk_tools", "Specify output directory:", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_raysout.setText(QtGui.QApplication.translate("vtk_tools", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - self.start_rays.setText(QtGui.QApplication.translate("vtk_tools", "Start", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/pylot/core/active/gui/windows.py b/pylot/core/active/gui/windows.py deleted file mode 100644 index 00bb7119..00000000 --- a/pylot/core/active/gui/windows.py +++ /dev/null @@ -1,773 +0,0 @@ -#!/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 -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 vtk_tools_layout import Ui_vtk_tools -from postprocessing_layout import Ui_postprocessing -from repicking_layout import Ui_repicking - -from pylot.core.active.surveyPlotTools import regions - -matplotlib.use('Qt4Agg') -matplotlib.rcParams['backend.qt4']='PySide' - -from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas -from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar -from matplotlib.figure import Figure - -def openFile(name = 'Open'): - dialog = QtGui.QFileDialog() - dialog.setWindowTitle(name) #not working yet - filename = dialog.getOpenFileName() - if len(filename[0]) > 0: - return filename[0] - -def saveFile(name = 'Save'): - dialog = QtGui.QFileDialog() - dialog.setWindowTitle(name) - filename = dialog.getSaveFileName() - if len(filename[0]) > 0: - return filename[0] - -def browseDir(name = 'Open Directory'): - dialog = QtGui.QFileDialog() - dialog.setWindowTitle(name) - directory = dialog.getExistingDirectory() - if len(directory) > 0: - return directory - -def getMaxCPU(): - import multiprocessing - return multiprocessing.cpu_count() - -def printDialogMessage(message): - qmb = QtGui.QMessageBox() - qmb.setText(message) - qmb.setStandardButtons(QtGui.QMessageBox.Ok) - qmb.setIcon(QtGui.QMessageBox.Warning) - qmb.exec_() - -def continueDialogExists(name): - qmb = QtGui.QMessageBox() - qmb.setText('%s object already exists. Overwrite?'%name) - qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - qmb.setIcon(QtGui.QMessageBox.Warning) - answer = qmb.exec_() - if answer == 1024: - return True - else: - return False - -def continueDialogMessage(message): - qmb = QtGui.QMessageBox() - qmb.setText(message) - qmb.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) - qmb.setIcon(QtGui.QMessageBox.Warning) - answer = qmb.exec_() - if answer == 1024: - return True - else: - return False - - -class Gen_SeisArray(object): - def __init__(self, mainwindow): - self.mainwindow = mainwindow - self.seisarray = None - self.srcfile = None - self.recfile = None - self.ptsfile = None - self.init_dialog() - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_generate_seisarray() - ui.setupUi(qdialog) - self.ui = ui - self.qdialog = qdialog - self.connectButtons() - - def start_dialog(self): - if self.qdialog.exec_(): - self.refresh_selection() - if self.ui.radioButton_interpolatable.isChecked(): - self.seisarray = seismicArrayPreparation.SeisArray(self.recfile, True) - elif self.ui.radioButton_normal.isChecked(): - self.seisarray = seismicArrayPreparation.SeisArray(self.recfile, False) - if len(self.srcfile) > 0: - self.seisarray.addSourceLocations(self.srcfile) - if len(self.ptsfile) > 0: - self.seisarray.addMeasuredTopographyPoints(self.ptsfile) - self.executed = True - else: - self.refresh_selection() - self.executed = False - - def refresh_selection(self): - self.srcfile = self.ui.lineEdit_src.text() - self.recfile = self.ui.lineEdit_rec.text() - self.ptsfile = self.ui.lineEdit_pts.text() - - def get_seisarray(self): - if self.seisarray is not None: - return self.seisarray - - def connectButtons(self): - QtCore.QObject.connect(self.ui.pushButton_rec, QtCore.SIGNAL("clicked()"), self.chooseMeasuredRec) - QtCore.QObject.connect(self.ui.pushButton_src, QtCore.SIGNAL("clicked()"), self.chooseMeasuredSrc) - QtCore.QObject.connect(self.ui.pushButton_obs, QtCore.SIGNAL("clicked()"), self.chooseMeasuredPts) - - def chooseMeasuredSrc(self): - self.ui.lineEdit_src.setText(openFile('Open measured sources file.')) - - def chooseMeasuredRec(self): - self.ui.lineEdit_rec.setText(openFile('Open measured receivers file.')) - - def chooseMeasuredPts(self): - self.ui.lineEdit_pts.setText(openFile('Open measured points file.')) - - -class Gen_Survey_from_SA(object): - def __init__(self, mainwindow, seisarray): - self.mainwindow = mainwindow - self.seisarray = seisarray - self.survey = None - self.obsdir = None - self.fstart = 'shot' - self.fend = '.dat' - self.init_dialog() - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_generate_survey_minimal() - ui.setupUi(qdialog) - self.ui = ui - self.qdialog = qdialog - self.connectButtons() - - def start_dialog(self): - if self.qdialog.exec_(): - self.refresh_selection() - self.survey = activeSeismoPick.Survey(self.obsdir, seisArray = self.seisarray, - useDefaultParas = True, fstart = self.fstart, - fend = self.fend) - self.executed = True - else: - self.refresh_selection() - self.executed = False - - def update_seisarray(self, seisarray): - self.seisarray = seisarray - - def refresh_selection(self): - self.obsdir = self.ui.lineEdit_obs.text() - self.fstart = self.ui.fstart.text() - self.fend = self.ui.fend.text() - - 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.')) - - -class Gen_Survey_from_SR(object): - def __init__(self, mainwindow): - self.mainwindow = mainwindow - self.survey = None - self.obsdir = None - self.srcfile = None - self.recfile = None - self.fstart = 'shot' - self.fend = '.dat' - self.init_dialog() - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_generate_survey() - ui.setupUi(qdialog) - self.ui = ui - self.qdialog = qdialog - self.connectButtons() - - def start_dialog(self): - if self.qdialog.exec_(): - self.refresh_selection() - self.survey = activeSeismoPick.Survey(self.obsdir, self.srcfile, self.recfile, - useDefaultParas = True, - fstart = self.fstart, fend = self.fend) - self.executed = True - else: - self.refresh_selection() - self.executed = False - - def refresh_selection(self): - self.obsdir = self.ui.lineEdit_obs.text() - self.srcfile = self.ui.lineEdit_src.text() - self.recfile = self.ui.lineEdit_rec.text() - self.fstart = self.ui.fstart.text() - self.fend = self.ui.fend.text() - - def get_survey(self): - return self.survey - - def connectButtons(self): - QtCore.QObject.connect(self.ui.pushButton_obs, QtCore.SIGNAL("clicked()"), self.chooseObsdir) - QtCore.QObject.connect(self.ui.pushButton_src, QtCore.SIGNAL("clicked()"), self.chooseSourcefile) - QtCore.QObject.connect(self.ui.pushButton_rec, QtCore.SIGNAL("clicked()"), self.chooseRecfile) - - def chooseObsdir(self): - self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.')) - - def chooseSourcefile(self): - self.ui.lineEdit_src.setText(openFile('Open sourcefile.')) - - def chooseRecfile(self): - self.ui.lineEdit_rec.setText(openFile('Open receiverfile.')) - - -class Call_autopicker(object): - def __init__(self, mainwindow, survey): - self.mainwindow = mainwindow - self.survey = survey - self.maxSRdist = None - self.dists_p = [] - self.snr_p = [] - self.lines = [] - self.init_dialog() - self.refresh_selection() - self.enableDynSNR(False) - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_picking_parameters() - ui.setupUi(qdialog) - ui.ncores.setMaximum(getMaxCPU()) - self.ui = ui - self.qdialog = qdialog - self.initSNRplot() - self.connectButtons() - - def getMaxSRdist(self): - if self.maxSRdist is not None: - return self.maxSRdist - else: - SRdists = [] - for shot in self.survey.data.values(): - for traceID in shot.getTraceIDlist(): - SRdists.append(shot.getDistance(traceID)) - self.maxSRdist = max(SRdists) - return self.maxSRdist - - def update_survey(self, survey): - self.survey = survey - - def initSNRplot(self): - self.snrFig = Figure() - self.snrCanvas = FigureCanvas(self.snrFig) - self.ui.vlayout_plot.addWidget(self.snrCanvas) - self.snrToolbar = NavigationToolbar(self.snrCanvas, self.mainwindow) - self.ui.vlayout_plot.addWidget(self.snrToolbar) - - def prepFigure(self, refresh = True): - fig = self.snrFig - if fig.axes == []: - ax = fig.add_subplot(111) - xlim = None - ylim = None - else: - ax = fig.axes[0] - xlim = ax.get_xlim() - ylim = ax.get_ylim() - #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 = [] - shiftSNR = float(self.ui.shift_snr.value()) - shiftDist = float(self.ui.shift_dist.value()) - p1 = float(self.ui.p1.value()) - p2 = float(self.ui.p2.value()) - dists = np.arange(0, self.getMaxSRdist() + 1, 1) - - for dist in dists: - dist += shiftDist - snrthresholds.append(surveyUtils.snr_fit_func(surveyUtils.get_fit_fn(p1, p2), dist, shiftSNR)) - self.lines = ax.plot(dists, snrthresholds, 'b') - - if refresh == False: - xlim, ylim = self.finishNewFigure(ax) - - if self.survey.picked: - self.finishFigure(ax, xlim, ylim) - - 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): - self.plotSNR(refresh = False) - if self.qdialog.exec_(): - self.refresh_selection() - - if self.AIC == True: - HosAic = 'aic' - else: - HosAic = 'hos' - - surveyUtils.setDynamicFittedSNR(self.survey.getShotDict(), shiftdist = self.shiftDist, - shiftSNR = self.shiftSNR, p1 = self.p1, p2 = self.p2) - - self.survey.pickAllShots(vmin = self.vmin, vmax = self.vmax, - folm = self.folm/100., HosAic = HosAic, - aicwindow = self.aicwindow, cores = self.ncores) - - #QtGui.qApp.processEvents() # test - self.executed = True - self.clear_lines() - else: - self.refresh_selection() - self.executed = False - self.clear_lines() - - def refreshFolm(self): - self.ui.label_folm.setText('%s %%'%self.ui.slider_folm.value()) - - def refresh_selection(self): - self.ncores = int(self.ui.ncores.value()) - self.vmin = float(self.ui.lineEdit_vmin.text()) - self.vmax = float(self.ui.lineEdit_vmax.text()) - self.folm = float(self.ui.slider_folm.value()) - self.AIC = self.ui.checkBox_AIC.isChecked() - self.aicwindow = (int(self.ui.lineEdit_aicleft.text()), int(self.ui.lineEdit_aicright.text())) - self.shiftSNR = float(self.ui.shift_snr.value()) - self.shiftDist = float(self.ui.shift_dist.value()) - self.p1 = float(self.ui.p1.value()) - self.p2 = float(self.ui.p2.value()) - - def connectButtons(self): - 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.plotSNR) - QtCore.QObject.connect(self.ui.shift_dist, QtCore.SIGNAL("valueChanged(int)"), self.plotSNR) - QtCore.QObject.connect(self.ui.p1, QtCore.SIGNAL("valueChanged(double)"), self.plotSNR) - 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): - self.ui.lineEdit_obs.setText(browseDir('Choose observation directory.')) - - def chooseSourcefile(self): - self.ui.lineEdit_src.setText(openFile('Open sourcefile.')) - - def chooseRecfile(self): - self.ui.lineEdit_rec.setText(openFile('Open receiverfile.')) - - -class Call_FMTOMO(object): - def __init__(self, mainwindow, survey): - self.mainwindow = mainwindow - self.survey = survey - self.init_dialog() - self.refresh_selection() - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_fmtomo_parameters() - ui.setupUi(qdialog) - ui.nproc.setMaximum(getMaxCPU()) - self.ui = ui - self.qdialog = qdialog - self.connectButtons() - - def start_dialog(self): - if self.qdialog.exec_(): - self.refresh_selection() - - if not os.path.isdir(self.picks_dir): - err = os.mkdir(self.picks_dir) # error not handled yet - - self.survey.exportFMTOMO(self.picks_dir) - - cwd = os.getcwd() - interpolationMethod = 'linear' - os.chdir(self.simuldir) - if self.survey.seisarray.twoDim: - interpolationMethod = 'nearest' - self.survey.seisarray.generateFMTOMOinputFromArray(self.propgrid, self.vgrid, (self.bbot, self.btop), - self.cushionfactor/100., interpolationMethod, - customgrid = self.customgrid, writeVTK = True) - os.chdir(cwd) - - tomo = fmtomoUtils.Tomo3d(self.fmtomo_dir, self.simuldir) - tomo.runTOMO3D(self.nproc, self.nIter) - - self.executed = True - else: - self.refresh_selection() - self.executed = False - - def update_survey(self, survey): - self.survey = survey - - def refresh_selection(self): - self.fmtomo_dir = self.ui.fmtomo_dir.text() - self.nIter = int(self.ui.nIter.value()) - self.nproc = int(self.ui.nproc.value()) - self.btop = float(self.ui.btop.text()) - self.bbot = float(self.ui.bbot.text()) - self.propgrid = (int(self.ui.pgrid_x.value()), int(self.ui.pgrid_y.value()), int(self.ui.pgrid_z.value())) - self.vgrid = (int(self.ui.invgrid_x.value()), int(self.ui.invgrid_y.value()), int(self.ui.invgrid_z.value())) - self.cushionfactor = float(self.ui.cushion.value()) - self.customgrid = self.ui.customgrid.text() - self.simuldir = self.ui.simuldir.text() - self.picks_dir = os.path.join(self.simuldir, 'picks') - - def connectButtons(self): - 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_simuldir, QtCore.SIGNAL("clicked()"), self.chooseSimuldir) - - def chooseFMTOMOdir(self): - self.ui.fmtomo_dir.setText(browseDir()) - - def chooseCustomgrid(self): - self.ui.customgrid.setText(openFile()) - - def chooseSimuldir(self): - 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()) - -class Postprocessing(object): - def __init__(self, mainwindow, survey): - self.mainwindow = mainwindow - self.survey = survey - self.init_widget() - self.start_widget() - self.inkByVal = 'snrlog' - - def init_widget(self): - qwidget = QtGui.QWidget()# - ui = Ui_postprocessing() - ui.setupUi(qwidget) - self.ui = ui - self.qwidget = qwidget - self.initPlot() - self.newPlot() - self.connectButtons() - self.region = regions(self.ax, self.cbar, self.survey, qt_interface = True) - - def start_widget(self): - self.qwidget.show() - - 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 newPlot(self): - ax = self.figure.add_subplot(111) - dists, picks, snrlog, pe, spe = self.survey.preparePlotAllPicks(plotRemoved = False) - self.dists = dists - self.picks = picks - self.inkDict = {'snrlog': snrlog, - 'pe': pe, - 'spe': spe} - - ax, cbar, sc = self.survey.createPlot(dists, picks, snrlog, 'log10(SNR)', ax = ax, cbar = None) - self.cbar = self.figure.colorbar(sc, ax = ax, fraction=0.05) - self.ax = ax - self.draw() - - def refreshPlot(self): - self.ax.clear() - ax = self.ax - ax, cbar, sc = self.survey.createPlot(self.dists, self.picks, self.inkDict[self.inkByVal], - self.inkByVal, ax = ax, cbar = self.cbar) - #self.cbar = self.figure.colorbar(sc, fraction=0.05) - self.draw() - - def update_survey(self, survey): - self.survey = survey - - def get_survey(self): - return self.survey - - def draw(self): - self.canvas.draw() - - def connectButtons(self): - QtCore.QObject.connect(self.ui.pushButton_rect, QtCore.SIGNAL("clicked()"), self.chooseRect) - QtCore.QObject.connect(self.ui.pushButton_poly, QtCore.SIGNAL("clicked()"), self.choosePoly) - QtCore.QObject.connect(self.ui.pushButton_plot, QtCore.SIGNAL("clicked()"), self.plotPicks) - QtCore.QObject.connect(self.ui.pushButton_delete, QtCore.SIGNAL("clicked()"), self.deleteSelected) - QtCore.QObject.connect(self.ui.pushButton_undo, QtCore.SIGNAL("clicked()"), self.undoSelection) - QtCore.QObject.connect(self.ui.pushButton_snr, QtCore.SIGNAL("clicked()"), self.refrSNR) - QtCore.QObject.connect(self.ui.pushButton_pe, QtCore.SIGNAL("clicked()"), self.refrPE) - QtCore.QObject.connect(self.ui.pushButton_spe, QtCore.SIGNAL("clicked()"), self.refrSPE) - - def chooseRect(self): - self.region.chooseRectangles() - - def choosePoly(self): - self.region.choosePolygon() - - def disconnectRect(self): - self.region.disconnectRect() - - def disconnectPoly(self): - self.region.disconnectPoly() - - def plotPicks(self): - self.region.plotTracesInActiveRegions() - - def deleteSelected(self): - self.region.setAllActiveRegionsForDeletion() - message = 'Are you sure you want to delete all marked picks?' - if continueDialogMessage(message): - self.region.deleteAllMarkedPicks() - else: - self.region.refreshFigure() - - def undoSelection(self): - self.region.deselectLastSelection() - - def refrSNR(self): - self.region.refreshLog10SNR() - - def refrPE(self): - self.region.refreshPickerror() - - def refrSPE(self): - self.region.refreshSPE() - - -class Repicking(object): - def __init__(self, mainwindow, region, shot, traceID): - self.mainwindow = mainwindow - self.region = region - self.shot = shot - self.traceID = traceID - self.init_dialog() - self.start_dialog() - - def init_dialog(self): - qdialog = QtGui.QDialog(self.mainwindow) - ui = Ui_repicking() - ui.setupUi(qdialog) - self.ui = ui - self.qdialog = qdialog - self.connectButtons() - - def start_dialog(self): - self.qdialog.exec_() - - def connectButtons(self): - QtCore.QObject.connect(self.ui.pushButton_repick, QtCore.SIGNAL("clicked()"), self.repick) - QtCore.QObject.connect(self.ui.pushButton_delete, QtCore.SIGNAL("clicked()"), self.delete) - - 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): - self.shot.plot_traces(self.traceID, figure = self.figure, buttons = False) - self.ax = ax - self.draw() diff --git a/pylot/core/active/run_asp3d.py b/pylot/core/active/run_asp3d.py deleted file mode 100755 index 0b7202e1..00000000 --- a/pylot/core/active/run_asp3d.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import sys -import os -from obspy import read -from obspy import Stream -from obspy import Trace -from datetime import datetime -import numpy as np - -from pylot.core.active import surveyUtils -from pylot.core.active import seismicshot -from pylot.core.active import activeSeismoPick -from pylot.core.active import fmtomoUtils -from pylot.core.active import seismicArrayPreparation -# reload(seismicshot) -# reload(surveyUtils) -# reload(activeSeismoPick) - -##################################################################################### -# parameter definitions:############################################################# -cutwindow = (0, 0.15) # cut out a part of the trace [seconds] -tmovwind = 0.1 # size of the moving window -windowsize = (30, 0) # windowsize for AIC picker (indices around HOS picks [time/sampling rate] !!!) -folm = 0.6 # fraction of local maximum for threshold picker -tsignal = 0.03 -tgap = 0.0007 - -nproc = 1 - -vmin = 333 -vmax = 5500 - -HosAic = 'aic' # can be 'hos' or 'aic' - -rockeskyll = False -GZB = True -bb1 = False - -# Simulation parameters ############################################################# -simulation = True - -niter = 4 - -bottomBoundary = -50.0 -topBoundary = 5.0 -nPointsPropgrid = (100, 100, 100) -nPointsVgrid = (30, 30, 30) -cushionfactor = 0.1 -interpolationMethod = 'linear' -mygrid = '../mygrid.in' - -cwd = os.getcwd() -simuldir = 'fmtomo_simulation' -pickdir = 'picks' -fmtomopath = '/rscratch/minos22/marcel/flachseismik/fmtomo/GZB_clean/' -###################################################################################### -###################################################################################### -if rockeskyll == True: - receiverfile = "Geophone_interpoliert_rockes" - sourcefile = "Schusspunkte_rockes" - obsdir = "/rscratch/minos22/marcel/flachseismik/rockeskyll_200615_270615/" - filename = 'survey_rockes.pickle' -elif GZB == True: - receiverfile = "Geophone_interpoliert_GZB" - sourcefile = "Schusspunkte_GZB" - #sourcefile = "Schusspunkte_GZB_1shot" - obsdir = "/rscratch/minos22/marcel/flachseismik/GZB_26_06_15_01/" - filename = 'survey_GZB.pickle' -elif bb1 == True: - receiverfile = "Geophone_Marcel" - sourcefile = "Schusspunkte_Marcel" - obsdir = "/rscratch/minos22/marcel/flachseismik/bachelor_bausenberg/" - filename = 'survey_bb1.pickle' -###################################################################################### - -starttime = datetime.now() - -print('\n--------------------Starting Script at %s -------------------\n' %starttime.time()) -print('directory: %s\nsourcefile: %s\nreceiverfile: %s\nsurvey output filename: %s\n' %(obsdir, sourcefile, receiverfile, filename)) -if HosAic == 'aic': print('picking with AIC\n') -if HosAic == 'hos': print('picking with HOS\n') - -survey = activeSeismoPick.Survey(obsdir, os.path.join(obsdir, sourcefile), - os.path.join(obsdir, receiverfile), useDefaultParas = False) -survey.setParametersForAllShots(cutwindow, tmovwind, tsignal, tgap) -surveyUtils.setDynamicFittedSNR(survey.getShotDict()) -#surveyUtils.setConstantSNR(survey.getShotDict(), 0) -survey.setArtificialPick(0, 0) # artificial pick at source origin -print('\nDone after %s seconds!\n------------------------------------------------------------------------------\n' % (datetime.now() - starttime).seconds) -survey.pickAllShots(vmin, vmax, folm, HosAic, windowsize, cores = nproc) -survey.cleanBySPE(maxSPE = 0.0075) -survey.saveSurvey(filename) -print('\n--- Finished picking ---') -print'Elapsed time:', datetime.now()-starttime - - -###################################################################################### -if simulation == False: - sys.exit() - -survey = activeSeismoPick.Survey.from_pickle(filename) - -if not os.path.isdir(os.path.join(cwd, simuldir)): - err = os.mkdir(os.path.join(cwd, simuldir)) - -picks = os.path.join(simuldir, pickdir) - -if not os.path.isdir(os.path.join(cwd, picks)): - err2 = os.mkdir(os.path.join(cwd, picks)) - -survey.exportFMTOMO(picks) - -####### hard coded -os.chdir(simuldir) -survey.loadArray(obsdir, 'Geophone_eingemessen_GZB', 'Schusspunkte_GZB') -survey.seisArray.generateFMTOMOinputFromArray(nPointsPropgrid, nPointsVgrid, - (bottomBoundary, topBoundary), cushionfactor, - interpolationMethod, customgrid = mygrid, - writeVTK = False) - -os.chdir(cwd) -####### test - -tomo = fmtomoUtils.Tomo3d(fmtomopath, simuldir) -tomo.runTOMO3D(nproc, niter) - -print('\n--- Finished script ---') -print'Elapsed time:', datetime.now()-starttime diff --git a/pylot/core/active/seismicArrayPreparation.py b/pylot/core/active/seismicArrayPreparation.py deleted file mode 100644 index 907e9161..00000000 --- a/pylot/core/active/seismicArrayPreparation.py +++ /dev/null @@ -1,1122 +0,0 @@ -# -*- coding: utf-8 -*- -import sys -import numpy as np -from scipy.interpolate import griddata - -def readMygridNlayers(filename): - infile = open(filename, 'r') - nlayers = len(infile.readlines()) / 2 - infile.close() - - return nlayers - -def readMygrid(filename): - ztop = []; - zbot = []; - vtop = []; - vbot = [] - infile = open(filename, 'r') - nlayers = readMygridNlayers(filename) - - print('\nreadMygrid: Reading file %s.' % filename) - for index in range(nlayers): - line1 = infile.readline() - line2 = infile.readline() - ztop.append(float(line1.split()[0])) - vtop.append(float(line1.split()[1])) - zbot.append(float(line2.split()[0])) - vbot.append(float(line2.split()[1])) - print('Layer %s:\n[Top: v = %s [km/s], z = %s [m]]' - '\n[Bot: v = %s [km/s], z = %s [m]]' - % (index + 1, vtop[index], ztop[index], - vbot[index], zbot[index])) - - if not ztop[0] == 0: - print('ERROR: there must be a velocity set for z = 0 in the file %s' % filename) - print('e.g.:\n0 0.33\n-5 1.0\netc.') - - infile.close() - return ztop, zbot, vtop, vbot - - -class SeisArray(object): - ''' - Can be used to interpolate missing values of a receiver grid, if only support points were measured. - Input file should contain in each line: ('traceID' 'receiverLineID' 'number of the geophone on recLine' 'X' 'Y' 'Z') - - Can be used to generate a velocity grid file (vgrids.in) for FMTOMO with a topography adapting gradient. - - Can be used to generate an interface file for FMTOMO (right now only interface.z used by grid3dg) for the topography. - - Supports vtk output for sources and receivers. - Note: Source and Receiver files for FMTOMO will be generated by the Survey object (because traveltimes will be added directly). - ''' - - def __init__(self, recfile, interpolatable = False): - self.recfile = recfile - self._receiverCoords = {} - self._measuredReceivers = {} - self._measuredTopo = {} - self._sourceCoords = {} - self._receiverlist = open(self.recfile, 'r').readlines() - if interpolatable == True: - self._init_interpolatable() - elif interpolatable == False: - self._init_normal() - self.set2D() - - def _init_normal(self): - self.interpolatable = False - self._setReceiverCoords_normal() - - def _init_interpolatable(self): - self.interpolatable = True - self._receiverlines = {} - self._geophoneNumbers = {} - self._setReceiverCoords_interp() - self._setGeophoneNumbers() - self._generateReceiverlines() - - def _generateReceiverlines(self): - ''' - Connects the traceIDs to the lineIDs - for each receiverline in a dictionary. - ''' - for receiver in self._receiverlist: - traceID = int(receiver.split()[0]) - lineID = int(receiver.split()[1]) - if not lineID in self._receiverlines.keys(): - self._receiverlines[lineID] = [] - self._receiverlines[lineID].append(traceID) - - def _setReceiverCoords_interp(self): - ''' - Fills the three x, y, z dictionaries with measured coordinates - in case of interpolatable measured input data. - ''' - for line in self._getReceiverlist(): - traceID = int(line.split()[0]) - x = float(line.split()[3]) - y = float(line.split()[4]) - z = float(line.split()[5]) - self._receiverCoords[traceID] = (x, y, z) - self._measuredReceivers[traceID] = (x, y, z) - - def _setReceiverCoords_normal(self): - ''' - Fills the three x, y, z dictionaries with measured coordinates - ''' - for line in self._getReceiverlist(): - traceID = int(line.split()[0]) - x = float(line.split()[1]) - y = float(line.split()[2]) - z = float(line.split()[3]) - self._receiverCoords[traceID] = (x, y, z) - self._measuredReceivers[traceID] = (x, y, z) - - def _setGeophoneNumbers(self): - for line in self._getReceiverlist(): - traceID = int(line.split()[0]) - 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 - - def _getReceiverlist(self): - return self._receiverlist - - def getReceiverCoordinates(self): - return self._receiverCoords - - def _getXreceiver(self, traceID): - return self._receiverCoords[traceID][0] - - def _getYreceiver(self, traceID): - return self._receiverCoords[traceID][1] - - def _getZreceiver(self, traceID): - return self._receiverCoords[traceID][2] - - def _getXshot(self, shotnumber): - return self._sourceCoords[shotnumber][0] - - def _getYshot(self, shotnumber): - return self._sourceCoords[shotnumber][1] - - def _getZshot(self, shotnumber): - return self._sourceCoords[shotnumber][2] - - def _getReceiverValue(self, traceID, coordinate): - setCoordinate = {'X': self._getXreceiver, - 'Y': self._getYreceiver, - 'Z': self._getZreceiver} - return setCoordinate[coordinate](traceID) - - def _getGeophoneNumber(self, traceID): - return self._geophoneNumbers[traceID] - - def getMeasuredReceivers(self): - return self._measuredReceivers - - def getMeasuredTopo(self): - return self._measuredTopo - - def getSourceCoordinates(self): - return self._sourceCoords - - def _setXvalue(self, traceID, value): - self._checkKey(traceID) - self._receiverCoords[traceID][0] = value - - def _setYvalue(self, traceID, value): - self._checkKey(traceID) - self._receiverCoords[traceID][1] = value - - def _setZvalue(self, traceID, value): - self._checkKey(traceID) - self._receiverCoords[traceID][2] = value - - def _setValue(self, traceID, coordinate, value): - setCoordinate = {'X': self._setXvalue, - 'Y': self._setYvalue, - 'Z': self._setZvalue} - setCoordinate[coordinate](traceID, value) - - def _checkKey(self, traceID): - if not traceID in self._receiverCoords.keys(): - self._receiverCoords[traceID] = [None, None, None] - - def _checkTraceIDdirection(self, traceID1, traceID2): - if traceID2 > traceID1: - direction = +1 - return direction - if traceID2 < traceID1: - direction = -1 - return direction - err_msg = "Same Value for traceID1 = %s and traceID2 = %s" % (traceID1, traceID2) - raise RuntimeError(err_msg) - - def _checkCoordDirection(self, traceID1, traceID2, coordinate): - ''' - Checks whether the interpolation direction is positive or negative - ''' - if self._getReceiverValue(traceID1, coordinate) < self._getReceiverValue(traceID2, coordinate): - direction = +1 - return direction - if self._getReceiverValue(traceID1, coordinate) > self._getReceiverValue(traceID2, coordinate): - direction = -1 - return direction - err_msg = "Same Value for traceID1 = %s and traceID2 = %s" % (traceID1, traceID2) - raise RuntimeError(err_msg) - - def _interpolateMeanDistances(self, traceID1, traceID2, coordinate): - ''' - Returns the mean distance between two traceID's depending on the number of geophones in between - ''' - num_spaces = abs(self._getGeophoneNumber(traceID1) - self._getGeophoneNumber(traceID2)) - mean_distance = abs( - self._getReceiverValue(traceID1, coordinate) - self._getReceiverValue(traceID2, coordinate)) / num_spaces - return mean_distance - - def checkInterpolatable(self): - if self.interpolatable == False: - print('Not interpolatable.') - return self.interpolatable - - def interpolateValues(self, coordinate): - ''' - Interpolates and sets all values (linear) for coordinate = 'X', 'Y' or 'Z' - ''' - if not self.checkInterpolatable(): - return - for lineID in self._getReceiverlines().keys(): - number_measured = len(self._getReceiverlines()[lineID]) - for index, traceID1 in enumerate(self._getReceiverlines()[lineID]): - if index + 1 < number_measured: - traceID2 = self._getReceiverlines()[lineID][index + 1] - - traceID_dir = self._checkTraceIDdirection(traceID1, traceID2) - traceID_interp = traceID1 + traceID_dir - - coord_dir = self._checkCoordDirection(traceID1, traceID2, coordinate) - mean_distance = self._interpolateMeanDistances(traceID1, traceID2, coordinate) - - while (traceID_dir * traceID_interp) < (traceID_dir * traceID2): - self._setValue(traceID_interp, coordinate, - (self._getReceiverValue(traceID_interp - traceID_dir, coordinate) - + coord_dir * (mean_distance))) - traceID_interp += traceID_dir - - def addMeasuredTopographyPoints(self, filename): - ''' - Use more measured points for a higher precision of height interpolation. - Input file should contain in each line: ('point ID' 'X' 'Y' 'Z') - ''' - topolist = open(filename, 'r').readlines() - for line in topolist: - line = line.split() - pointID = int(line[0]) - x = float(line[1]) - y = float(line[2]) - z = float(line[3]) - self._measuredTopo[pointID] = (x, y, z) - - def addSourceLocations(self, filename): - ''' - Use source locations for a higher precision of height interpolation. - Input file should contain in each line: ('point ID' 'X' 'Y' 'Z') - - Source locations must be added before they can be written to vtk files. - ''' - topolist = open(filename, 'r').readlines() - for line in topolist: - line = line.split() - pointID = int(line[0]) - x = float(line[1]) - y = float(line[2]) - z = float(line[3]) - self._sourceCoords[pointID] = (x, y, z) - - def interpZcoords4rec(self, method='linear'): - ''' - Interpolates z values for all receivers. - ''' - measured_x, measured_y, measured_z = self.getAllMeasuredPointsLists() - - for traceID in self.getReceiverCoordinates().keys(): - if type(self.getReceiverCoordinates()[traceID]) is not tuple: - z = griddata((measured_x, measured_y), measured_z, - (self._getXreceiver(traceID), self._getYreceiver(traceID)), method=method) - self._setZvalue(traceID, float(z)) - - def _getAngle(self, distance): - ''' - Function returns the angle on a Sphere of the radius R = 6371 [km] for a distance [km]. - ''' - PI = np.pi - R = 6371. - angle = distance * 180. / (PI * R) - return angle - - def _getDistance(self, angle): - ''' - Function returns the distance [km] on a Sphere of the radius R = 6371 [km] for an angle. - ''' - PI = np.pi - R = 6371. - distance = angle / 180. * (PI * R) - return distance - - def getMeasuredReceiverLists(self): - ''' - Returns a list of all measured receivers known to SeisArray. - ''' - x = []; - y = []; - z = [] - for traceID in self.getMeasuredReceivers().keys(): - x.append(self.getMeasuredReceivers()[traceID][0]) - y.append(self.getMeasuredReceivers()[traceID][1]) - z.append(self.getMeasuredReceivers()[traceID][2]) - return x, y, z - - def getMeasuredTopoLists(self): - ''' - Returns a list of all measured topography points known to the SeisArray. - ''' - x = []; - y = []; - z = [] - for pointID in self.getMeasuredTopo().keys(): - x.append(self.getMeasuredTopo()[pointID][0]) - y.append(self.getMeasuredTopo()[pointID][1]) - z.append(self.getMeasuredTopo()[pointID][2]) - return x, y, z - - def getSourceLocsLists(self): - ''' - Returns a list of all measured source locations known to SeisArray. - ''' - x = []; - y = []; - z = [] - for pointID in self.getSourceCoordinates().keys(): - x.append(self.getSourceCoordinates()[pointID][0]) - y.append(self.getSourceCoordinates()[pointID][1]) - z.append(self.getSourceCoordinates()[pointID][2]) - return x, y, z - - def getAllMeasuredPointsLists(self): - ''' - Returns a list of all measured points known to SeisArray. - ''' - mtopo_x, mtopo_y, mtopo_z = self.getMeasuredTopoLists() - msource_x, msource_y, msource_z = self.getSourceLocsLists() - mrec_x, mrec_y, mrec_z = self.getMeasuredReceiverLists() - - x = mtopo_x + mrec_x + msource_x - y = mtopo_y + mrec_y + msource_y - z = mtopo_z + mrec_z + msource_z - return x, y, z - - def getReceiverLists(self): - ''' - Returns a list of all receivers (measured and interpolated). - ''' - x = []; - y = []; - z = [] - for traceID in self.getReceiverCoordinates().keys(): - x.append(self.getReceiverCoordinates()[traceID][0]) - y.append(self.getReceiverCoordinates()[traceID][1]) - z.append(self.getReceiverCoordinates()[traceID][2]) - return x, y, z - - def _interpolateXY4rec(self): - ''' - Interpolates the X and Y coordinates for all receivers. - ''' - for coordinate in ('X', 'Y'): - self.interpolateValues(coordinate) - - def interpolateAll(self): - if not self.checkInterpolatable(): - return - self._interpolateXY4rec() - self.interpZcoords4rec() - print('Interpolated receiver locations.') - - def interpolateTopography(self, nTheta, nPhi, thetaSN, phiWE, elevation=0.25, method='linear'): - ''' - Interpolate Z values on a regular grid with cushion nodes e.g. to use it as FMTOMO topography interface. - Returns a surface in form of a list of points [[x1, y1, z1], [x2, y2, y2], ...] (cartesian). - - :param: nTheta, number of points in theta (NS) - type: integer - - :param: nPhi, number of points in phi (WE) - type: integer - - :param: thetaSN (S, N) extensions of the model in degree - type: tuple - - :param: phiWE (W, E) extensions of the model in degree - type: tuple - - :param: elevation, default: 0.25 (elevate topography so that no source lies above the surface) - type: float - ''' - return self.interpolateOnRegularGrid(nTheta, nPhi, thetaSN, phiWE, elevation, method) - - def interpolateOnRegularGrid(self, nTheta, nPhi, thetaSN, phiWE, elevation, method='linear'): - ''' - Interpolate Z values on a regular grid with cushion nodes e.g. to use it as FMTOMO topography interface. - Returns a surface in form of a list of points [[x1, y1, z1], [x2, y2, y2], ...] (cartesian). - - :param: nTheta, number of points in theta (NS) - type: integer - - :param: nPhi, number of points in phi (WE) - type: integer - - :param: thetaSN (S, N) extensions of the model in degree - type: tuple - - :param: phiWE (W, E) extensions of the model in degree - type: tuple - - :param: elevation, default: 0.25 (elevate topography so that no source lies above the surface) - type: float - ''' - - surface = [] - - print "Interpolating interface on regular grid with the dimensions:" - print "nTheta = %s, nPhi = %s, thetaSN = %s, phiWE = %s" % (nTheta, nPhi, thetaSN, phiWE) - print "method = %s, elevation = %s" % (method, elevation) - - thetaS, thetaN = thetaSN - phiW, phiE = phiWE - - measured_x, measured_y, measured_z = self.getAllMeasuredPointsLists() - - # need to determine the delta to add two cushion nodes around the min/max values - deltaTheta = (thetaN - thetaS) / (nTheta - 1) - deltaPhi = (phiE - phiW) / (nPhi - 1) - - thetaGrid = np.linspace(thetaS - deltaTheta, thetaN + deltaTheta, num=nTheta + 2) # +2 cushion nodes - phiGrid = np.linspace(phiW - deltaPhi, phiE + deltaPhi, num=nPhi + 2) # +2 cushion nodes - - nTotal = len(thetaGrid) * len(phiGrid); - count = 0 - for theta in thetaGrid: - for phi in phiGrid: - xval = self._getDistance(phi) - yval = self._getDistance(theta) - - z = griddata((measured_x, measured_y), measured_z, (xval, yval), method=method) - # in case the point lies outside, nan will be returned. Find nearest: - if np.isnan(z) == True: - z = griddata((measured_x, measured_y), measured_z, (xval, yval), method='nearest') - z = float(z) + elevation - surface.append((xval, yval, z)) - count += 1 - progress = float(count) / float(nTotal) * 100 - self._update_progress(progress) - - return surface - - def generateFMTOMOinputFromArray(self, nPointsPropgrid, nPointsInvgrid, - zBotTop, cushionfactor, interpolationMethod='linear', - customgrid='mygrid.in', writeVTK=True): - ''' - Generate FMTOMO input files from the SeisArray dimensions. - Generates: vgridsref.in, interfacesref.in, propgrid.in - - :param: nPointsPropgrid, number of points in each direction of the propagation grid (x, y, z) - :type: tuple - - :param: nPointsInvgrid, number of points in each direction of the inversion grid (x, y, z) - :type: tuple - - :param: zBotTop, (bottom, top) dimensions of the model - :type: tuple - - :param: cushionfactor, adds cushioning around the model (0.1 = 10%) - :type: float - ''' - - nPhiP, nThetaP, nRP = nPointsPropgrid - nPhiI, nThetaI, nRI = nPointsInvgrid - - print('\n------------------------------------------------------------') - print('Automatically generating input for FMTOMO from array size.') - print('Propgrid: nR = %s, nTheta = %s, nPhi = %s' % (nRP, nThetaP, nPhiP)) - print('Interpolation Grid and Interfaces Grid: nR = %s, nTheta = %s, nPhi = %s' % (nRI, nThetaI, nPhiI)) - print('Bottom and Top of model: (%s, %s)' % (zBotTop[0], zBotTop[1])) - print('Method: %s, customgrid = %s' % (interpolationMethod, customgrid)) - print('------------------------------------------------------------') - - def getZmin(surface): - z = [] - for point in surface: - z.append(point[2]) - return min(z) - - self.generatePropgrid(nThetaP, nPhiP, nRP, zBotTop, cushionfactor=cushionfactor, - cushionpropgrid=0.05) - surface = self.generateVgrid(nThetaI, nPhiI, nRI, zBotTop, method=interpolationMethod, - cushionfactor=cushionfactor, infilename=customgrid, - returnTopo=True) - - depthmax = abs(zBotTop[0] - getZmin(surface)) - 1.0 # cushioning for the bottom interface - - interf1, interf2 = self.generateInterfaces(nThetaI, nPhiI, depthmax, cushionfactor=cushionfactor, - returnInterfaces=True, method=interpolationMethod) - - if writeVTK == True: - from pylot.core.active import fmtomoUtils - self.surface2VTK(interf1, filename='interface1.vtk') - self.surface2VTK(interf2, filename='interface2.vtk') - self.receivers2VTK() - self.sources2VTK() - #fmtomoUtils.vgrids2VTK() - - def generateReceiversIn(self, outfilename='receivers.in'): - outfile = open(outfilename, 'w') - - recx, recy, recz = self.getReceiverLists() - nsrc = len(self.getSourceCoordinates()) - outfile.write('%s\n' % (len(zip(recx, recy, recz)) * nsrc)) - - for index in range(nsrc): - for point in zip(recx, recy, recz): - rx, ry, rz = point - rad = - rz - lat = self._getAngle(ry) - lon = self._getAngle(rx) - outfile.write('%15s %15s %15s\n' % (rad, lat, lon)) - outfile.write('%15s\n' % (1)) - outfile.write('%15s\n' % (index + 1)) - outfile.write('%15s\n' % (1)) - - outfile.close() - - def generateInterfaces(self, nTheta, nPhi, depthmax, cushionfactor=0.1, - outfilename='interfacesref.in', method='linear', - returnInterfaces=False): - ''' - Create an interfacesref.in file for FMTOMO from the SeisArray boundaries. - :param: nTheta, number of points in Theta - type: int - - :param: nPhi, number of points in Phi - type: int - - :param: depthmax, maximum depth of the model (below topography) - type: float - - :param: cushionfactor, add some extra space to the model (default: 0.1 = 10%) - type: float - ''' - - print('\n------------------------------------------------------------') - print('Generating interfaces...') - nInterfaces = 2 - - # generate dimensions of the grid from array - thetaSN, phiWE = self.getThetaPhiFromArray(cushionfactor) - - thetaS, thetaN = thetaSN - phiW, phiE = phiWE - R = 6371. - - outfile = open(outfilename, 'w') - - # determine the deltas - deltaTheta = abs(thetaN - thetaS) / float((nTheta - 1)) - deltaPhi = abs(phiE - phiW) / float((nPhi - 1)) - - # write header for interfaces grid file (in RADIANS) - outfile.write('%10s\n' % (nInterfaces)) - outfile.write('%10s %10s\n' % (nTheta + 2, nPhi + 2)) # +2 cushion nodes - outfile.write('%10s %10s\n' % (np.deg2rad(deltaTheta), np.deg2rad(deltaPhi))) - outfile.write('%10s %10s\n' % (np.deg2rad(thetaS - deltaTheta), np.deg2rad(phiW - deltaPhi))) - - interface1 = self.interpolateTopography(nTheta, nPhi, thetaSN, phiWE, method=method) - interface2 = self.interpolateOnRegularGrid(nTheta, nPhi, thetaSN, phiWE, -depthmax, method=method) - - for point in interface1: - z = point[2] - outfile.write('%10s\n' % (z + R)) - - outfile.write('\n') - for point in interface2: - z = point[2] - outfile.write('%10s\n' % (z + R)) - - outfile.close() - - if returnInterfaces == True: - return interface1, interface2 - - print('Finished generating interfaces.') - print('------------------------------------------------------------') - - def getThetaPhiFromArray(self, cushionfactor=0.1): - ''' - Determine and returns PhiWE (tuple: (West, East)) and thetaSN (tuple (South, North)) from the SeisArray boundaries. - - :param: cushionfactor, add some extra space to the model (default: 0.1 = 10%) - type: float - ''' - x, y, _ = self.getAllMeasuredPointsLists() - phi_min, phi_max = (self._getAngle(min(x)), self._getAngle(max(x))) - theta_min, theta_max = (self._getAngle(min(y)), self._getAngle(max(y))) - cushionPhi = abs(phi_max - phi_min) * cushionfactor - cushionTheta = abs(theta_max - theta_min) * cushionfactor - # 2D Case only: - if cushionPhi == 0.: - cushionPhi = 0.1 - if cushionTheta == 0.: - cushionTheta = 0.1 - phiWE = (phi_min - cushionPhi, phi_max + cushionPhi) - thetaSN = (theta_min - cushionTheta, theta_max + cushionTheta) - return thetaSN, phiWE - - def generatePropgrid(self, nTheta, nPhi, nR, Rbt, cushionfactor, cushionpropgrid=0.05, - refinement=(5, 5), outfilename='propgrid.in'): - ''' - Create a propergation grid file for FMTOMO using SeisArray boundaries - - :param: nTheta, number of points in Theta - type: int - - :param: nPhi, number of points in Phi - type: int - - :param: nR, number of points in R - type: int - - :param: Rbt (bot, top) extensions of the model in m - type: tuple - - :param: cushionfactor, add some extra space to the model (default: 0.1 = 10%) - type: float - - :param: cushionpropogrid, cushionfactor for the propagationgrid (cushion direction - opposing to vgrids cushionfactor) - type: float - - :param: refinement, (refinement factor, number of local cells for refinement) used by FMTOMO - type: tuple - ''' - outfile = open(outfilename, 'w') - - print('\n------------------------------------------------------------') - print('Generating Propagation Grid for nTheta = %s, nPhi' - ' = %s, nR = %s and a cushioning of %s' - % (nTheta, nPhi, nR, cushionpropgrid)) - print('Bottom of the grid: %s, top of the grid %s' - % (Rbt[0], Rbt[1])) - - thetaSN, phiWE = self.getThetaPhiFromArray(cushionfactor) - - # +2 cushion nodes - nTheta += 2 - nPhi += 2 - nR += 2 - - thetaS = thetaSN[0] + cushionpropgrid - thetaN = thetaSN[1] - cushionpropgrid - phiW = phiWE[0] + cushionpropgrid - phiE = phiWE[1] - cushionpropgrid - rbot = Rbt[0] - rtop = Rbt[1] - - deltaTheta = abs(thetaN - thetaS) / float(nTheta - 1) - deltaPhi = abs(phiE - phiW) / float(nPhi - 1) - deltaR = abs(rbot - rtop) / float(nR - 1) - - outfile.write('%10s %10s %10s\n' % (nR, nTheta, nPhi)) - outfile.write('%10s %10s %10s\n' % (deltaR, deltaTheta, deltaPhi)) - outfile.write('%10s %10s %10s\n' % (rtop, thetaS, phiW)) - outfile.write('%10s %10s\n' % refinement) - - outfile.close() - - print('Created Propagation Grid and saved it to %s' % outfilename) - print('------------------------------------------------------------') - - def generateVgrid(self, nTheta, nPhi, nR, Rbt, thetaSN=None, - phiWE=None, cushionfactor=0.1, - outfilename='vgridsref.in', method='linear', - infilename='mygrid.in', returnTopo=False): - ''' - Generate a velocity grid for fmtomo regarding topography with a linear gradient starting at the topography with 0.34 [km/s]. - - :param: nTheta, number of points in theta (NS) - type: integer - - :param: nPhi, number of points in phi (WE) - type: integer - - :param: nR, number of points in depth - type: integer - - :param: thetaSN (S, N) extensions of the model in degree - type: tuple - - :param: phiWE (W, E) extensions of the model in degree - type: tuple - - :param: Rbt (bot, top) extensions of the model in m - type: tuple - - :param: vbot, velocity at the bottom of the model - type: real - - :param: method, interpolation method for topography - type: str - ''' - print('\n------------------------------------------------------------') - print('generateVgrid: Starting...') - - # def getRad(angle): - # PI = np.pi - # rad = angle / 180 * PI - # return rad - - R = 6371. - vmin = 0.34 - decm = 0.3 # diagonal elements of the covariance matrix (grid3dg's default value is 0.3) - outfile = open(outfilename, 'w') - - # generate dimensions of the grid from array - if thetaSN is None and phiWE is None: - thetaSN, phiWE = self.getThetaPhiFromArray(cushionfactor) - - thetaS, thetaN = thetaSN - phiW, phiE = phiWE - rbot = Rbt[0] + R - rtop = Rbt[1] + R - - # need to determine the delta to add two cushion nodes around the min/max values - deltaTheta = abs(thetaN - thetaS) / float((nTheta - 1)) - deltaPhi = abs(phiE - phiW) / float((nPhi - 1)) - deltaR = abs(rbot - rtop) / float((nR - 1)) - - # create a regular grid including +2 cushion nodes in every direction - thetaGrid = np.linspace(thetaS - deltaTheta, thetaN + deltaTheta, num=nTheta + 2) # +2 cushion nodes - phiGrid = np.linspace(phiW - deltaPhi, phiE + deltaPhi, num=nPhi + 2) # +2 cushion nodes - rGrid = np.linspace(rbot - deltaR, rtop + deltaR, num=nR + 2) # +2 cushion nodes - - nTotal = len(rGrid) * len(thetaGrid) * len(phiGrid) - print("Total number of grid nodes: %s" % nTotal) - - # write header for velocity grid file (in RADIANS) - outfile.write('%10s %10s \n' % (1, 1)) - outfile.write('%10s %10s %10s\n' % (nR + 2, nTheta + 2, nPhi + 2)) - outfile.write('%10s %10s %10s\n' % (deltaR, np.deg2rad(deltaTheta), np.deg2rad(deltaPhi))) - outfile.write( - '%10s %10s %10s\n' % (rbot - deltaR, np.deg2rad(thetaS - deltaTheta), np.deg2rad(phiW - deltaPhi))) - - surface = self.interpolateTopography(nTheta, nPhi, thetaSN, phiWE, method=method) - - nlayers = readMygridNlayers(infilename) - ztop, zbot, vtop, vbot = readMygrid(infilename) - - print("\nGenerating velocity grid for FMTOMO. " - "Output filename = %s, interpolation method = %s" % (outfilename, method)) - print("nTheta = %s, nPhi = %s, nR = %s, " - "thetaSN = %s, phiWE = %s, Rbt = %s" % (nTheta, nPhi, nR, thetaSN, phiWE, Rbt)) - count = 0 - - for radius in rGrid: - for theta in thetaGrid: - for phi in phiGrid: - xval = self._getDistance(phi) - yval = self._getDistance(theta) - for point in surface: - if point[0] == xval and point[1] == yval: - topo = point[2] - break - depth = -(R + topo - radius) - if depth > 1: - vel = 0.0 - elif 1 >= depth > 0: # cushioning around topography - vel = vtop[0] - else: - for index in range(nlayers): - if (ztop[index]) >= depth > (zbot[index]): - vel = (depth - ztop[index]) / (zbot[index] - ztop[index]) * ( - vbot[index] - vtop[index]) + vtop[index] - break - if not (ztop[index]) >= depth > (zbot[index]): - err_msg = 'ERROR in grid inputfile, could not find velocity' - 'for a z-value of %s in the inputfile' % (depth - topo) - raise ValueError(err_msg) - count += 1 - if not vel >= 0: - err_msg = 'vel < 0; z, topo, zbot, vbot, vtop:', - depth, topo, zbot[index], vbot[index], vtop[index] - raise ValueError(err_msg) - - outfile.write('%10s %10s\n' % (vel, decm)) - - progress = float(count) / float(nTotal) * 100 - self._update_progress(progress) - - print('\nWrote %d points to file %s for %d layers' % (count, outfilename, nlayers)) - print('------------------------------------------------------------') - outfile.close() - - if returnTopo == True: - return surface - - def exportAll(self, filename='interpolated_receivers.out'): - ''' - Exports all receivers to an input file for ActiveSeismoPick3D. - ''' - recfile_out = open(filename, 'w') - count = 0 - for traceID in self.getReceiverCoordinates().keys(): - count += 1 - x, y, z = self.getReceiverCoordinates()[traceID] - recfile_out.write('%5s %15s %15s %15s\n' % (traceID, x, y, z)) - 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, twoDim = False): - import matplotlib.pyplot as plt - if ax == None: - plt.interactive(True) - fig = plt.figure() - ax = plt.axes() - xmt, ymt, zmt = self.getMeasuredTopoLists() - xsc, ysc, zsc = self.getSourceLocsLists() - xmr, ymr, zmr = self.getMeasuredReceiverLists() - xrc, yrc, zrc = self.getReceiverLists() - - if len(xrc) > 0: - ax.plot(xrc, yrc, 'k.', markersize=pointsize, label='all receivers') - if len(xsc) > 0: - ax.plot(xsc, ysc, 'b*', markersize=pointsize, label='shot locations') - - if plot_topo == True: - ax.plot(xmt, ymt, 'b.', markersize=pointsize, label='measured topo points') - if highlight_measured == True: - ax.plot(xmr, ymr, 'r.', markersize=pointsize, label='measured receivers') - - ax.figure.text(0.5, 0.95,'2D plot of seismic array\n %s'%self.recfile, - horizontalalignment='center', verticalalignment='center', - transform = ax.figure.transFigure) - - ax.set_xlabel('X [m]') - ax.set_ylabel('Y [m]') - if twoDim == False: - ax.set_aspect('equal') - ax.legend(prop={'size':7}) - if annotations == True: - for traceID in self.getReceiverCoordinates().keys(): - ax.annotate((' ' + str(traceID)), xy=(self._getXreceiver(traceID), self._getYreceiver(traceID)), - fontsize='x-small', color='k') - for shotnumber in self.getSourceCoordinates().keys(): - ax.annotate((' ' + str(shotnumber)), xy=(self._getXshot(shotnumber), self._getYshot(shotnumber)), - fontsize='x-small', color='b') - - def plotArray3D(self, ax=None, legend = True, markersize = 10): - import matplotlib.pyplot as plt - from mpl_toolkits.mplot3d import Axes3D - - if ax == None: - plt.interactive(True) - fig = plt.figure() - ax = plt.axes(projection='3d') - - xmt, ymt, zmt = self.getMeasuredTopoLists() - xmr, ymr, zmr = self.getMeasuredReceiverLists() - xrc, yrc, zrc = self.getReceiverLists() - xsc, ysc, zsc = self.getSourceLocsLists() - - ax.figure.text(0.5, 0.95,'3D plot of seismic array\n %s'%self.recfile, - horizontalalignment='center', verticalalignment='center', - transform = ax.figure.transFigure) - - if len(xmt) > 0: - ax.plot(xmt, ymt, zmt, 'b.', markersize=markersize, label='measured topo points') - if len(xrc) > 0: - ax.plot(xrc, yrc, zrc, 'k.', markersize=markersize, label='all receivers') - if len(xmr) > 0: - ax.plot(xmr, ymr, zmr, 'ro', markersize=markersize, label='measured receivers') - if len(xsc) > 0: - ax.plot(xsc, ysc, zsc, 'b*', markersize=markersize, label='shot locations') - ax.set_xlabel('X [m]'); - ax.set_ylabel('Y [m]'); - ax.set_zlabel('Z [m]') - if legend == True: - ax.legend() - - return ax - - 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 - - if ax == None: - plt.interactive(True) - fig = plt.figure() - ax = plt.axes(projection='3d') - - xmt, ymt, zmt = self.getMeasuredTopoLists() - xmr, ymr, zmr = self.getMeasuredReceiverLists() - - x = xmt + xmr - y = ymt + ymr - z = zmt + zmr - - xaxis = np.arange(min(x) + 1, max(x), step) - yaxis = np.arange(min(y) + 1, max(y), step) - - xgrid, ygrid = np.meshgrid(xaxis, yaxis) - - zgrid = griddata((x, y), z, (xgrid, ygrid), method=method) - - surf = ax.plot_surface(xgrid, ygrid, zgrid, linewidth=0, cmap=cm.jet, vmin=min(z), vmax=max(z)) - cbar = ax.figure.colorbar(surf) - cbar.set_label('Elevation [m]') - - if exag == False: - ax.set_zlim(-(max(x) - min(x) / 2), (max(x) - min(x) / 2)) - if twoDim == False: - ax.set_aspect('equal') - - ax.set_xlabel('X [m]'); - ax.set_ylabel('Y [m]'); - ax.set_zlabel('Z [m]') - ax.legend() - - return ax - - def _update_progress(self, progress): - sys.stdout.write("%d%% done \r" % (progress)) - sys.stdout.flush() - - def surface2VTK(self, surface, filename='surface.vtk'): - ''' - Generates a vtk file from all points of a surface as generated by interpolateTopography. - ''' - outfile = open(filename, 'w') - - nPoints = len(surface) - - # write header - print("Writing header for VTK file...") - outfile.write('# vtk DataFile Version 3.1\n') - outfile.write('Surface Points\n') - outfile.write('ASCII\n') - outfile.write('DATASET POLYDATA\n') - outfile.write('POINTS %15d float\n' % (nPoints)) - - # write coordinates - print("Writing coordinates to VTK file...") - for point in surface: - x = point[0] - y = point[1] - z = point[2] - - outfile.write('%10f %10f %10f \n' % (x, y, z)) - - outfile.write('VERTICES %15d %15d\n' % (nPoints, 2 * nPoints)) - - # write indices - print("Writing indices to VTK file...") - for index in range(nPoints): - outfile.write('%10d %10d\n' % (1, index)) - - # outfile.write('POINT_DATA %15d\n' %(nPoints)) - # outfile.write('SCALARS traceIDs int %d\n' %(1)) - # outfile.write('LOOKUP_TABLE default\n') - - # # write traceIDs - # print("Writing traceIDs to VTK file...") - # for traceID in traceIDs: - # outfile.write('%10d\n' %traceID) - - outfile.close() - print("Wrote %d points to file: %s" % (nPoints, filename)) - return - - def receivers2VTK(self, filename='receivers.vtk'): - ''' - Generates a vtk file from all receivers of the SeisArray object. - ''' - outfile = open(filename, 'w') - traceIDs = [] - - for traceID in self.getReceiverCoordinates(): - traceIDs.append(traceID) - - nPoints = len(traceIDs) - - # write header - print("Writing header for VTK file...") - outfile.write('# vtk DataFile Version 3.1\n') - outfile.write('Receivers with traceIDs\n') - outfile.write('ASCII\n') - outfile.write('DATASET POLYDATA\n') - outfile.write('POINTS %15d float\n' % (nPoints)) - - # write coordinates - print("Writing coordinates to VTK file...") - for traceID in traceIDs: - x = self._getXreceiver(traceID) - y = self._getYreceiver(traceID) - z = self._getZreceiver(traceID) - - outfile.write('%10f %10f %10f \n' % (x, y, z)) - - outfile.write('VERTICES %15d %15d\n' % (nPoints, 2 * nPoints)) - - # write indices - print("Writing indices to VTK file...") - for index in range(nPoints): - outfile.write('%10d %10d\n' % (1, index)) - - outfile.write('POINT_DATA %15d\n' % (nPoints)) - outfile.write('SCALARS traceIDs int %d\n' % (1)) - outfile.write('LOOKUP_TABLE default\n') - - # write traceIDs - print("Writing traceIDs to VTK file...") - for traceID in traceIDs: - outfile.write('%10d\n' % traceID) - - outfile.close() - print("Wrote %d receiver for to file: %s" % (nPoints, filename)) - return - - def sources2VTK(self, filename='sources.vtk'): - ''' - Generates a vtk-file for all source locations in the SeisArray object. - ''' - outfile = open(filename, 'w') - shotnumbers = [] - - for shotnumber in self.getSourceCoordinates(): - shotnumbers.append(shotnumber) - - nPoints = len(shotnumbers) - - # write header - print("Writing header for VTK file...") - outfile.write('# vtk DataFile Version 3.1\n') - outfile.write('Shots with shotnumbers\n') - outfile.write('ASCII\n') - outfile.write('DATASET POLYDATA\n') - outfile.write('POINTS %15d float\n' % (nPoints)) - - # write coordinates - print("Writing coordinates to VTK file...") - for shotnumber in shotnumbers: - x = self._getXshot(shotnumber) - y = self._getYshot(shotnumber) - z = self._getZshot(shotnumber) - - outfile.write('%10f %10f %10f \n' % (x, y, z)) - - outfile.write('VERTICES %15d %15d\n' % (nPoints, 2 * nPoints)) - - # write indices - print("Writing indices to VTK file...") - for index in range(nPoints): - outfile.write('%10d %10d\n' % (1, index)) - - outfile.write('POINT_DATA %15d\n' % (nPoints)) - outfile.write('SCALARS shotnumbers int %d\n' % (1)) - outfile.write('LOOKUP_TABLE default\n') - - # write shotnumber - print("Writing shotnumbers to VTK file...") - for shotnumber in shotnumbers: - outfile.write('%10d\n' % shotnumber) - - outfile.close() - print("Wrote %d sources to file: %s" % (nPoints, filename)) - return - - def saveSeisArray(self, filename='seisArray.pickle'): - import cPickle - outfile = open(filename, 'wb') - - cPickle.dump(self, outfile, -1) - print('saved SeisArray to file %s' % (filename)) - - @staticmethod - def from_pickle(filename): - import cPickle - infile = open(filename, 'rb') - return cPickle.load(infile) diff --git a/pylot/core/active/seismicshot.py b/pylot/core/active/seismicshot.py deleted file mode 100644 index e74ecaed..00000000 --- a/pylot/core/active/seismicshot.py +++ /dev/null @@ -1,957 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import os -import numpy as np -from obspy.core import read -from obspy import Stream -from obspy import Trace -from pylot.core.pick.charfuns import HOScf -from pylot.core.pick.charfuns import AICcf -from pylot.core.pick.utils import getSNR -from pylot.core.pick.utils import earllatepicker -import matplotlib.pyplot as plt -import warnings -import copy_reg -import types -from pylot.core.util.utils import worker, _pickle_method - -copy_reg.pickle(types.MethodType, _pickle_method) - -plt.interactive('True') - -class SeismicShot(object): - ''' - SuperClass for a seismic shot object. - ''' - def __init__(self, obsfile): - ''' - Initialize seismic shot object giving an inputfile. - - :param: obsfile, ((!SEG2/SEGY!)) file readable by obspy - :type: string - ''' - self.traces = read(obsfile) - self.renameChannelIDs() - # self.recCoordlist = None - # self.srcCoordlist = None - self.traceIDs = None - self.picks = {} - self.pwindow = {} - self.manualpicks = {} - self.snr = {} - self.snrthreshold = {} - self.timeArray = {} - self.traces4plot = {} - self.paras = {} - 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 = [] - removed = [] - traceIDs = self.getReceiverCoords().keys() - - for trace in self.traces: - try: - traceIDs.index(int(trace.stats.channel)) - except: - self.traces.remove(trace) - removed.append(int(trace.stats.channel)) - - if len(removed) > 0: - return removed - - def removeTrace(self, traceID): - for trace in self.traces: - if traceID == trace.stats.channel: - self.traces.remove(trace) - - def updateTraceList(self): - ''' - Looks for empty traces, returns a list of deleted traceIDs. - ''' - traceIDs = [] - for traceID in self.getTraceIDlist(): - if traceID not in self.getStreamTraceIDs(): - self.traceIDs.remove(traceID) - traceIDs.append(traceID) - return traceIDs - - def setParameters(self, name, value): - self.paras[name] = value - - def setVmin(self, vmin): - self.setParameters('vmin', vmin) - - def setVmax(self, vmax): - self.setParameters('vmax', vmax) - - def setCut(self, cut): - self.setParameters('cut', cut) - - def setTmovwind(self, tmovwind): - self.setParameters('tmovwind', tmovwind) - - def setOrder(self, order): - self.setParameters('order', order) - - def setTsignal(self, tsignal): - self.setParameters('tsignal', tsignal) - - def setTgap(self, tgap): - self.setParameters('tgap', tgap) - - def setShotnumber(self, shotnumber): - self.setParameters('shotnumber', shotnumber) - - def setReceiverCoords(self, receiver): - self.setParameters('receiverLoc', receiver) - - def setSourceCoords(self, source): - self.setParameters('sourceLoc', source) - - def setMethod(self, method): - self.setParameters('method', method) - - def setAicwindow(self, aicwindow): - self.setParameters('aicwindow', aicwindow) - - def setFolm(self, folm): - self.setParameters('folm', folm) - - def setDynPickwindow(self, traceID, cutdist = 5.): - distance = self.getDistance(traceID) # receive distance - - vmin = self.getVmin() - vmax = self.getVmax() - - pickwin_used = self.getCut() - cutwindow = self.getCut() - - # for higher distances use a linear vmin/vmax to cut out late/early regions with high noise - if distance > cutdist: - pwleft = distance / vmax - pwright = distance / vmin - if pwright > cutwindow[1]: - pwright = cutwindow[1] - pickwin_used = (pwleft, pwright) - - self.setPickwindow(traceID, pickwin_used) - - def getMethod(self): - return self.paras['method'] - - def getAicwindow(self): - return self.paras['aicwindow'] - - def getFolm(self): - return self.paras['folm'] - - def getParas(self): - return self.paras - - def getShotnumber(self): - return self.paras['shotnumber'] - - def getSourceCoords(self): - return self.paras['sourceLoc'] - - def getReceiverCoords(self): - return self.paras['receiverLoc'] - - def getCut(self): - return self.paras['cut'] - - def getTmovwind(self): - return self.paras['tmovwind'] - - def getOrder(self): - return self.paras['order'] - - def getTsignal(self): - return self.paras['tsignal'] - - def getTgap(self): - return self.paras['tgap'] - - def getShotnumber(self): - return self.paras['shotnumber'] - - def getVmin(self): - return self.paras['vmin'] - - def getVmax(self): - return self.paras['vmax'] - - def getManualPick(self, traceID): - if not self.getManualPickFlag(traceID) == 0: - return self.manualpicks[traceID]['mpp'] - - def getManualEarliest(self, traceID): - return self.manualpicks[traceID]['epp'] - - def getManualLatest(self, traceID): - return self.manualpicks[traceID]['lpp'] - - def getPick(self, traceID, returnRemoved=False): - if not self.getPickFlag(traceID) == 0: - return self.picks[traceID]['mpp'] - if returnRemoved == True: - return self.picks[traceID]['mpp'] - - def getPickIncludeRemoved(self, traceID): - return self.getPick(traceID, returnRemoved=True) - - def getEarliest(self, traceID): - return self.picks[traceID]['epp'] - - def getLatest(self, traceID): - return self.picks[traceID]['lpp'] - - def getSymmetricPickError(self, traceID): - pickerror = self.picks[traceID]['spe'] - if np.isnan(pickerror) == True: - print "SPE is NaN for shot %s, traceID %s" % (self.getShotnumber(), traceID) - return pickerror - - def getPickError(self, traceID): - pickerror = abs(self.getEarliest(traceID) - self.getLatest(traceID)) / 2 - if np.isnan(pickerror) == True: - print("PE is NaN for shot %s, traceID %s" % (self.getShotnumber(), traceID)) - return pickerror - - def getStreamTraceIDs(self): - traceIDs = [] - for trace in self.traces: - traceIDs.append(int(trace.stats.channel)) - return traceIDs - - def getTraceIDlist(self): - ''' - Returns a list containing the traceIDs. - ''' - traceIDs = [] - if self.traceIDs == None: - traceIDs = self.getReceiverCoords().keys() - self.traceIDs = traceIDs - return self.traceIDs - - def getPickwindow(self, traceID): - try: - self.pwindow[traceID] - except KeyError as e: - print('no pickwindow for trace %s, set to %s' % (traceID, self.getCut())) - self.setPickwindow(traceID, self.getCut()) - return self.pwindow[traceID] - - def getSNR(self, traceID): - return self.snr[traceID] - - def getSNRthreshold(self, traceID): - return self.snrthreshold[traceID] - - # def getRecCoordlist(self): - # if self.recCoordlist is None: - # coordlist = open(self.getRecfile(), 'r').readlines() - # # print 'Reading receiver coordinates from %s' %(self.getRecfile()) - # self.recCoordlist = coordlist - # return self.recCoordlist - - # def getSrcCoordlist(self): - # if self.srcCoordlist is None: - # coordlist = open(self.getSourcefile(), 'r').readlines() - # # print 'Reading shot coordinates from %s' %(self.getSourcefile()) - # self.srcCoordlist = coordlist - # return self.srcCoordlist - - def getTimeArray(self, traceID): - return self.timeArray[traceID] - - def getHOScf(self, traceID): - ''' - Returns the higher order statistics characteristic function for a trace using pylot. - - :param: traceID - :type: int - - :param: cut, cut out a part of the trace (t_start, t_end) [s] - :type: tuple - - :param: t2, size of the moving window [s] - :type: float - - :param: order, order of the characteristic function - :type: int - ''' - return HOScf(self.getSingleStream(traceID), self.getCut(), - self.getTmovwind(), self.getOrder(), stealthMode=True) - - def getAICcf(self, traceID): - ''' - Returns the Akaike criterion for a trace using pylot and the higher order statistics characteristic function. - - :param: traceID - :type: int - - :param: cut, cut out a part of the trace (t_start, t_end) [s] - :type: tuple - - :param: t2, size of the moving window [s] - :type: float - - :param: order, order of the characteristic function - :type: int - ''' - - st_cf = Stream() - tr_cf = Trace() - tr_cf.data = self.getHOScf(traceID).getCF() - st_cf += tr_cf - return AICcf(st_cf, self.getCut(), self.getTmovwind(), stealthMode=True) - - def getSingleStream(self, traceID): ########## SEG2 / SEGY ? ########## - ''' - Returns a Stream with only one trace (instead of just one trace) because it is needed for pylot. - - :param: traceID - :type: int - ''' - # traces = [trace for trace in self.traces if int(trace.stats.seg2['CHANNEL_NUMBER']) == traceID] - traces = [trace for trace in self.traces if int(trace.stats.channel) == traceID] - if len(traces) == 1: - return Stream(traces) - self.setPick(traceID, None) - warnings.warn('ambigious or empty traceID: %s' % traceID) - - def setPickParameters(self, folm, method = 'hos', aicwindow = (10, 0)): - self.setFolm(folm) - self.setMethod(method) - self.setAicwindow(aicwindow) - - # def pickParallel(self): - # traceIDs = self.getTraceIDlist() - # picks = [] - # #picks = worker(self.pickTrace, traceIDs) - - # # for traceID, pick in picks: - # # self.setPick(traceID, pick) - - # for traceID in traceIDs: - # trID, pick = self.pickTrace(traceID) - # picks.append([trID, pick]) - # #self.setPick(traceID, pick) - # return picks - - def pickTrace(self, traceID): - ''' - Intitiate picking for a trace. - - :param: traceID - :type: int - - :param: cutwindow (equals HOScf 'cut' variable) - :type: tuple - - :param: t2 (equals HOScf t2 variable) - :type: float - - :param: order (equals HOScf 'order' variable) - :type: int - - :param: windowsize, window around the returned HOS picktime, to search for the AIC minumum - :type: 'tuple' - - :param: folm, fraction of local maximumm - :type: 'real' - - :param: HosAic, get hos or aic pick (can be 'hos'(default) or 'aic') - :type: 'string' - ''' - self.setDynPickwindow(traceID) - - hoscf = self.getHOScf(traceID) ### determination of both, HOS and AIC (need to change threshold-picker) ### - aiccf = self.getAICcf(traceID) - - self.timeArray[traceID] = hoscf.getTimeArray() - aiccftime, hoscftime = self.threshold(hoscf, aiccf, self.getAicwindow(), self.getPickwindow(traceID), self.getFolm()) - setHosAic = {'hos': hoscftime, - 'aic': aiccftime} - - if aiccftime < self.getPickwindow(traceID)[0] and 'aic' in self.getMethod(): - return 0 - - return setHosAic[self.getMethod()] - - def setEarllatepick(self, traceID, nfac=1.5): - tgap = self.getTgap() - tsignal = self.getTsignal() - tnoise = self.getPickIncludeRemoved(traceID) - tgap - - (self.picks[traceID]['epp'], - self.picks[traceID]['lpp'], - self.picks[traceID]['spe']) = earllatepicker(self.getSingleStream(traceID), - nfac, (tnoise, tgap, tsignal), - self.getPickIncludeRemoved(traceID), - stealth_mode=True) - - def threshold(self, hoscf, aiccf, windowsize, pickwindow, folm): - ''' - Threshold picker, using the local maximum in a pickwindow to find the time at - which a fraction of the local maximum is reached for the first time. - - :param: hoscf, Higher Order Statistics Characteristic Function - :type: 'Characteristic Function' - - :param: aiccf, Characteristic Function after Akaike - :type: 'Characteristic Function' - - :param: windowsize, window around the returned HOS picktime, to search for the AIC minumum - :type: 'tuple' - - :param: pickwindow [seconds] - :type: 'tuple' - - :param: cutwindow [seconds], cut a part of the trace as in Characteristic Function - :type: 'tuple' - - :param: folm, fraction of local maximum - :type: 'real' - ''' - hoscflist = list(hoscf.getCF()) - leftb = int(pickwindow[0] / self.getCut()[1] * len(hoscflist)) - rightb = int(pickwindow[1] / self.getCut()[1] * len(hoscflist)) - - threshold = folm * (max(hoscflist[leftb: rightb]) - min(hoscflist[leftb: rightb])) + min( - hoscflist[leftb: rightb]) # combination of local maximum and threshold - - m = leftb - - while hoscflist[m] < threshold: - m += 1 - - hoscftime = list(hoscf.getTimeArray())[m] - - lb = max(0, m - windowsize[0]) # if window exceeds t = 0 - aiccfcut = list(aiccf.getCF())[lb: m + windowsize[1]] - if len(aiccfcut) > 0: - n = aiccfcut.index(min(aiccfcut)) - else: - n = 0 - - m = lb + n - - aiccftime = list(hoscf.getTimeArray())[m] - - return aiccftime, hoscftime - - def getDistance(self, traceID): - ''' - Returns the distance of the receiver with the ID == traceID to the source location (shot location). - Uses getSrcLoc and getRecLoc. - - :param: traceID - :type: int - ''' - shotX, shotY, shotZ = self.getSrcLoc() - recX, recY, recZ = self.getRecLoc(traceID) - dist = np.sqrt((shotX - recX) ** 2 + (shotY - recY) ** 2 + (shotZ - recZ) ** 2) - - if np.isnan(dist) == True: - raise ValueError("Distance is NaN for traceID %s" % traceID) - - return dist - - def getRecLoc(self, traceID): ########## input FILENAME ########## - ''' - Returns the location (x, y, z) of the receiver with the ID == traceID. - RECEIVEIVER FILE MUST BE SET FIRST, TO BE IMPROVED. - - :param: traceID - :type: int - ''' - if traceID == 0: # artificial traceID 0 with pick at t = 0 - return self.getSrcLoc() - - return self.getReceiverCoords()[traceID] - - raise ValueError("traceID %s not found" % traceID) - - def getSrcLoc(self): ########## input FILENAME ########## - ''' - Returns the location (x, y, z) of the shot. - SOURCE FILE MUST BE SET FIRST, TO BE IMPROVED. - ''' - return self.getSourceCoords() - - def getTraceIDs4Dist(self, distance=0, - distancebin=(0, 0)): ########## nur fuer 2D benutzt, 'distance bins' ########## - ''' - Returns the traceID(s) for a certain distance between source and receiver. - Used for 2D Tomography. TO BE IMPROVED. - - :param: distance - :type: real - - :param: distancebin - :type: tuple - ''' - - traceID_list = [] - for trace in self.traces: - # traceID = int(trace.stats.seg2['CHANNEL_NUMBER']) - traceID = int(trace.stats.channel) - if distance != 0: - if self.getDistance(traceID) == distance: - traceID_list.append(traceID) - if distancebin[0] >= 0 and distancebin[1] > 0: - if distancebin[0] < self.getDistance(traceID) < distancebin[1]: - traceID_list.append(traceID) - - if len(traceID_list) > 0: - return traceID_list - - def setManualPicksFromFile(self, directory='picks'): - ''' - Read manual picks from *.pck file. - The * must be identical with the shotnumber. - ''' - if directory[-1] == '/': - filename = directory + str(self.getShotnumber()) + '.pck' - else: - filename = directory + '/' + str(self.getShotnumber()) + '.pck' - infile = open(filename, 'r') - mpicks = infile.readlines() - for line in mpicks: - if line.split()[0] == []: - continue - traceID, mpp, epp, lpp = line.split() - traceID = int(traceID) - if traceID in self.picks.keys(): - self.manualpicks[traceID] = {'mpp': float(mpp), - 'epp': float(epp), - 'lpp': float(lpp)} - if float(mpp) <= 0: - self.setManualPickFlag(traceID, 0) - else: - self.setManualPickFlag(traceID, 1) - - def setPick(self, traceID, pick): ########## siehe Kommentar ########## - if not traceID in self.picks.keys(): - self.picks[traceID] = {} - self.picks[traceID]['mpp'] = pick - self.picks[traceID]['flag'] = 1 - # ++++++++++++++ Block raus genommen, da Error beim 2ten Mal picken! (Ueberschreiben von erstem Pick!) - # if not self.picks.has_key(traceID): - # self.getPick(traceID) = picks - # else: - # raise KeyError('pick to be set more than once for traceID %s' % traceID) - - # def readParameter(self, parfile): - # parlist = open(parfile,'r').readlines() - - def removePick(self, traceID): - self.setPickFlag(traceID, 0) - - def setPickFlag(self, traceID, flag): - 'Set flag = 0 if pick is invalid, else flag = 1' - self.picks[traceID]['flag'] = flag - - def getPickFlag(self, traceID): - return self.picks[traceID]['flag'] - - def setManualPickFlag(self, traceID, flag): - 'Set flag = 0 if pick is invalid, else flag = 1' - self.manualpicks[traceID]['flag'] = flag - - def getManualPickFlag(self, traceID): - return self.manualpicks[traceID]['flag'] - - def setPickwindow(self, traceID, pickwindow): - self.pwindow[traceID] = pickwindow - - def setSNR(self, traceID): ########## FORCED HOS PICK ########## - ''' - Gets the SNR using pylot and then sets the SNR for the traceID. - - :param: traceID - :type: int - - :param: (tnoise, tgap, tsignal), as used in pylot SNR - ''' - from pylot.core.pick.utils import getSNR - - tgap = self.getTgap() - tsignal = self.getTsignal() - tnoise = self.getPick(traceID) - tgap - - self.snr[traceID] = getSNR(self.getSingleStream(traceID), (tnoise, tgap, tsignal), self.getPick(traceID)) - - def setSNRthreshold(self, traceID, snrthreshold): - self.snrthreshold[traceID] = snrthreshold - - def getDistArray4ttcPlot(self): ########## nur fuer 2D benoetigt ########## - ''' - Function to create a distance array for the plots. 2D only! X DIRECTION!! - ''' - distancearray = [] - - for traceID in self.picks.keys(): - if self.getRecLoc(traceID)[0] > self.getSrcLoc()[0]: - distancearray.append(self.getDistance(traceID)) - elif self.getRecLoc(traceID)[0] <= self.getSrcLoc()[0]: - distancearray.append((-1) * self.getDistance(traceID)) - - return distancearray - - def plot2dttc(self, ax=None): - ''' - Function to plot the traveltime curve for automated picks of a shot. 2d only! ATM: X DIRECTION!! - ''' - import matplotlib.pyplot as plt - plt.interactive('True') - picks = [] - - for traceID in self.picks.keys(): - picks.append(self.getPick(traceID)) - - if ax is None: - fig = plt.figure() - ax = fig.add_subplot(111) - - # shotnumbers = [shotnumbers for (shotnumbers, shotnames) in sorted(zip(shotnumbers, shotnames))] - plotarray = sorted(zip(self.getDistArray4ttcPlot(), picks)) - x = []; - y = [] - for point in plotarray: - x.append(point[0]) - y.append(point[1]) - ax.plot(x, y, 'r', label="Automatic Picks") - ax.text(0.5, 0.9, 'shot: %s' % self.getShotnumber(), transform=ax.transAxes - , horizontalalignment='center') - - def plotmanual2dttc(self, ax=None): - ''' - Function to plot the traveltime curve for manual picks of a shot. 2D only! - ''' - import matplotlib.pyplot as plt - plt.interactive('True') - manualpicktimesarray = [] - - for traceID in self.picks.keys(): - if not traceID in self.manualpicks.keys() or self.getManualPickFlag(traceID) == 0: - manualpicktimesarray.append(None) - else: - manualpicktimesarray.append(self.getManualPick(traceID)) - - if ax is None: - fig = plt.figure() - ax = fig.add_subplot(111) - - plotarray = sorted(zip(self.getDistArray4ttcPlot(), manualpicktimesarray)) - x = []; - y = [] - for point in plotarray: - x.append(point[0]) - y.append(point[1]) - ax.plot(x, y, 'b', label="Manual Picks") - - def plotTrace(self, traceID, plotSNR=True, lw=1): - fig = plt.figure() - ax = fig.add_subplot(111) - ax = self._drawStream(traceID, ax=ax) - - tgap = self.getTgap() - tsignal = self.getTsignal() - pick = self.getPick(traceID) - tnoise = pick - tgap - snr, snrdb, noiselevel = self.getSNR(traceID) - - ax.plot([0, tnoise], [noiselevel, noiselevel], 'm', linewidth=lw, label='noise level') - ax.plot([tnoise, pick], [noiselevel, noiselevel], 'g:', linewidth=lw, label='gap') - ax.plot([tnoise + tgap, pick + tsignal], [noiselevel * snr, noiselevel * snr], 'b', linewidth=lw, - label='signal level') - ax.legend() - ax.text(0.05, 0.9, 'SNR: %s' % snr, transform=ax.transAxes) - - def plot_traces(self, traceID, figure = None, buttons = True): - from matplotlib.widgets import Button - - def onclick(event): - self.setPick(traceID, event.xdata) - if self.getSNR(traceID)[0] > 1: - self.setEarllatepick(traceID) - self._drawStream(traceID, refresh=True) - self._drawCFs(traceID, folm, refresh=True) - fig.canvas.mpl_disconnect(self.traces4plot[traceID]['cid']) - plt.draw() - - def rmPick(event=None): - self.removePick(traceID) - self._drawStream(traceID, refresh=True) - self._drawCFs(traceID, folm, refresh=True) - plt.draw() - - def connectButton(event=None): - cid = fig.canvas.mpl_connect('button_press_event', onclick) - self.traces4plot[traceID]['cid'] = cid - - def cleanup(event): - self.traces4plot[traceID] = {} - - def addButtons(fig): - axb1 = fig.add_axes([0.15, 0.91, 0.05, 0.03]) - axb2 = fig.add_axes([0.22, 0.91, 0.05, 0.03]) - button1 = Button(axb1, 'repick', color='red', hovercolor='grey') - button1.on_clicked(connectButton) - button2 = Button(axb2, 'delete', color='green', hovercolor='grey') - button2.on_clicked(rmPick) - return axb1, axb2, button1, button2 - - folm = self.folm - - if figure == None: - fig = plt.figure() - else: - fig = figure - - ax1 = fig.add_subplot(2, 1, 1) - ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) - - if buttons: - axb1, axb2, button1, button2 = addButtons(fig) - else: - axb1 = None - axb2 = None - button1 = None - button2 = None - - fig.canvas.mpl_connect('close_event', cleanup) - - self.traces4plot[traceID] = dict(fig=fig, ax1=ax1, ax2=ax2, axb1=axb1, axb2=axb2, button1=button1, - button2=button2, cid=None) - - self._drawStream(traceID) - self._drawCFs(traceID, folm) - - def _drawStream(self, traceID, refresh=False, ax=None): - from pylot.core.util.utils import full_range - from pylot.core.util.utils import prepTimeAxis - - stream = self.getSingleStream(traceID) - stime = full_range(stream)[0] - timeaxis = prepTimeAxis(stime, stream[0]) - timeaxis -= stime - - if ax is None: - ax = self.traces4plot[traceID]['ax1'] - - if refresh == True: - xlim, ylim = ax.get_xlim(), ax.get_ylim() - ax.clear() - if refresh == True: - ax.set_xlim(xlim) - ax.set_ylim(ylim) - - ax.set_title('Shot: %s, traceID: %s, pick: %s' - % (self.getShotnumber(), traceID, self.getPick(traceID))) - ax.plot(timeaxis, stream[0].data, 'k', label='trace') - ax.plot([self.getPick(traceID), self.getPick(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'r', label='most likely') - if self.getEarliest(traceID) is not None: - ax.plot([self.getEarliest(traceID), self.getEarliest(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'g:', label='earliest') - if self.getLatest(traceID) is not None: - ax.plot([self.getLatest(traceID), self.getLatest(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'b:', label='latest') - - ax.legend() - return ax - - def _drawCFs(self, traceID, folm=None, refresh=False): - hoscf = self.getHOScf(traceID) - aiccf = self.getAICcf(traceID) - ax = self.traces4plot[traceID]['ax2'] - - if refresh == True: - xlim, ylim = ax.get_xlim(), ax.get_ylim() - ax.clear() - if refresh == True: - ax.set_xlim(xlim) - ax.set_ylim(ylim) - - ax.plot(hoscf.getTimeArray(), hoscf.getCF(), 'b', label='HOS') - ax.plot(hoscf.getTimeArray(), aiccf.getCF(), 'g', label='AIC') - ax.plot([self.getPick(traceID), self.getPick(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'r', label='most likely') - if self.getEarliest(traceID) is not None: - ax.plot([self.getEarliest(traceID), self.getEarliest(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'g:', label='earliest') - if self.getLatest(traceID) is not None: - ax.plot([self.getLatest(traceID), self.getLatest(traceID)], - [ax.get_ylim()[0], - ax.get_ylim()[1]], - 'b:', label='latest') - if folm is not None: - ax.plot([0, self.getPick(traceID)], - [folm * max(hoscf.getCF()), folm * max(hoscf.getCF())], - 'm:', label='folm = %s' % folm) - ax.set_xlabel('Time [s]') - ax.legend() - - def plot3dttc(self, step=0.5, contour=False, plotpicks=False, method='linear', ax=None): - ''' - Plots a 3D 'traveltime cone' as surface plot by interpolating on a regular grid over the traveltimes, not yet regarding the vertical offset of the receivers. - - :param: step (optional), gives the stepsize for the interpolated grid. Default is 0.5 - :type: 'float' - - :param: contour (optional), plot contour plot instead of surface plot - :type: 'logical' - - :param: plotpicks (optional), plot the data points onto the interpolated grid - :type: 'logical' - - :param: method (optional), interpolation method; can be 'linear' (default) or 'cubic' - :type: 'string' - ''' - from scipy.interpolate import griddata - from matplotlib import cm - from mpl_toolkits.mplot3d import Axes3D - - x = [] - y = [] - z = [] - for traceID in self.picks.keys(): - if self.getPickFlag(traceID) != 0: - x.append(self.getRecLoc(traceID)[0]) - y.append(self.getRecLoc(traceID)[1]) - z.append(self.getPick(traceID)) - - xaxis = np.arange(min(x) + step, max(x), step) - yaxis = np.arange(min(y) + step, max(y), step) - xgrid, ygrid = np.meshgrid(xaxis, yaxis) - zgrid = griddata((x, y), z, (xgrid, ygrid), method=method) - - if ax == None: - fig = plt.figure() - ax = plt.axes(projection='3d') - - xsrc, ysrc, zsrc = self.getSrcLoc() - - if contour == True: - ax.contour3D(xgrid, ygrid, zgrid, 20) - else: - ax.plot_surface(xgrid, ygrid, zgrid, linewidth=0, cmap=cm.jet, vmin=min(z), vmax=max(z)) - ax.plot([xsrc], [ysrc], [self.getPick(0)], 'k*', markersize=20) # plot source location - ax.plot([xsrc], [ysrc], [self.getPick(0)], 'r*', markersize=15) # plot source location - - if plotpicks == True: - ax.plot(x, y, z, 'k.') - - def plotttc(self, method, *args): - plotmethod = {'2d': self.plot2dttc, '3d': self.plot3dttc} - - plotmethod[method](*args) - - def matshow(self, ax=None, step=0.5, method='linear', plotRec=True, annotations=True, colorbar=True, legend=True): - ''' - Plots a 2D matrix of the interpolated traveltimes. This needs less performance than plot3dttc - - :param: step (optional), gives the stepsize for the interpolated grid. Default is 0.5 - :type: 'float' - - :param: method (optional), interpolation method; can be 'linear' (default) or 'cubic' - :type: 'string' - - :param: plotRec (optional), plot the receiver positions (colored scatter plot, should not be - deactivated because there might be receivers that are not inside the interpolated area) - :type: 'logical' - - :param: annotations (optional), displays traceIDs as annotations - :type: 'logical' - ''' - from scipy.interpolate import griddata - from matplotlib import cm - cmap = cm.jet - - x = []; - xcut = [] - y = []; - ycut = [] - z = []; - zcut = [] - - for traceID in self.picks.keys(): - if self.getPickFlag(traceID) != 0: - x.append(self.getRecLoc(traceID)[0]) - y.append(self.getRecLoc(traceID)[1]) - z.append(self.getPick(traceID)) - if self.getPickFlag(traceID) == 0 and self.getPickIncludeRemoved(traceID) is not None: - xcut.append(self.getRecLoc(traceID)[0]) - ycut.append(self.getRecLoc(traceID)[1]) - zcut.append(self.getPickIncludeRemoved(traceID)) - - tmin = 0.8 * min(z) # 20% cushion for colorbar - tmax = 1.2 * max(z) - - xaxis = np.arange(min(x), max(x), step) - yaxis = np.arange(min(y), max(y), step) - xgrid, ygrid = np.meshgrid(xaxis, yaxis) - zgrid = griddata((x, y), z, (xgrid, ygrid), method='linear') - - if ax == None: - fig = plt.figure() - ax = plt.axes() - - count = 0 - ax.imshow(zgrid, extent=[min(x), max(x), min(y), max(y)], vmin=tmin, vmax=tmax, cmap=cmap, origin='lower', - alpha=0.85) - ax.text(0.5, 0.95, 'shot: %s' % self.getShotnumber(), transform=ax.transAxes - , horizontalalignment='center') - sc = ax.scatter(x, y, c=z, s=30, label='active traces', vmin=tmin, vmax=tmax, cmap=cmap, linewidths=1.5) - for xyz in zip(xcut, ycut, zcut): - x, y, z = xyz - count += 1 - if z > tmax: - z = 'w' - if count == 1: - label = 'inactive traces' - else: - label = None - ax.scatter(x, y, c=z, s=30, edgecolor='m', label=label, vmin=tmin, vmax=tmax, cmap=cmap, linewidths=1.5) - if colorbar == True: - cbar = plt.colorbar(sc) - cbar.set_label('Time [s]') - - if legend == True: - ax.legend() - ax.set_xlabel('X') - ax.set_ylabel('Y') - ax.plot(self.getSrcLoc()[0], self.getSrcLoc()[1], '*k', markersize=15) # plot source location - - if annotations == True: - for traceID in self.getTraceIDlist(): - if self.getPickFlag(traceID) is not 0: - ax.annotate(' %s' % traceID, xy=(self.getRecLoc(traceID)[0], self.getRecLoc(traceID)[1]), - fontsize='x-small', color='k') - else: - ax.annotate(' %s' % traceID, xy=(self.getRecLoc(traceID)[0], self.getRecLoc(traceID)[1]), - fontsize='x-small', color='r') - - plt.show() diff --git a/pylot/core/active/surveyPlotTools.py b/pylot/core/active/surveyPlotTools.py deleted file mode 100644 index d6303d79..00000000 --- a/pylot/core/active/surveyPlotTools.py +++ /dev/null @@ -1,537 +0,0 @@ -# -*- coding: utf-8 -*- -import matplotlib.pyplot as plt -import math -import numpy as np - -plt.interactive(True) - - -class regions(object): - ''' - A class used for manual inspection and processing of all picks for the user. - - Examples: - - regions.chooseRectangles(): - - lets the user choose several rectangular regions in the plot - - regions.plotTracesInActiveRegions(): - - creates plots (shot.plot_traces) for all traces in the active regions (i.e. chosen by e.g. chooseRectangles) - - regions.setAllActiveRegionsForDeletion(): - - highlights all shots in a the active regions for deletion - - regions.deleteAllMarkedPicks(): - - deletes the picks (pick flag set to 0) for all shots set for deletion - - regions.deselectSelection(number): - - deselects the region of number = number - - ''' - - def __init__(self, ax, cbar, survey, qt_interface = False): - self.ax = ax - self.cbar = cbar - self.cbv = 'log10SNR' - self._xlim0 = self.ax.get_xlim() - self._ylim0 = self.ax.get_ylim() - self._xlim = self.ax.get_xlim() - self._ylim = self.ax.get_ylim() - self.survey = survey - self.shot_dict = self.survey.getShotDict() - self._x0 = [] - self._y0 = [] - self._x1 = [] - self._y1 = [] - self._polyx = [] - self._polyy = [] - self._allpicks = None - self.shots_found = {} - self.shots_for_deletion = {} - self._generateList() - if not qt_interface: - self.buttons = {} - self._addButtons() - self.addTextfield() - self.drawFigure() - - def _generateList(self): - allpicks = [] - for shot in self.shot_dict.values(): - for traceID in shot.getTraceIDlist(): - allpicks.append((shot.getDistance(traceID), - shot.getPickIncludeRemoved(traceID), - shot.getShotnumber(), - traceID, - shot.getPickFlag(traceID))) - - allpicks.sort() - self._allpicks = allpicks - - def getShotDict(self): - return self.shot_dict - - def getShotsForDeletion(self): - return self.shots_for_deletion - - def _onselect_clicks(self, eclick, erelease): - '''eclick and erelease are matplotlib events at press and release''' - print 'region selected x0, y0 = (%3s, %3s), x1, y1 = (%3s, %3s)' % (eclick.xdata, - eclick.ydata, - erelease.xdata, - erelease.ydata) - x0 = min(eclick.xdata, erelease.xdata) - x1 = max(eclick.xdata, erelease.xdata) - y0 = min(eclick.ydata, erelease.ydata) - y1 = max(eclick.ydata, erelease.ydata) - - shots, numtraces = self.findTracesInShotDict((x0, x1), (y0, y1)) - self.printOutput('Found %d traces in rectangle: %s' % (numtraces, shots)) - key = self.getKey() - self.shots_found[key] = {'shots': shots, - 'selection': 'rect', - 'xvalues': (x0, x1), - 'yvalues': (y0, y1)} - self.markRectangle((x0, x1), (y0, y1), key) - self.disconnectRect() - - def _onselect_verts(self, verts): - x = verts[0][0] - y = verts[0][1] - self._polyx.append(x) - self._polyy.append(y) - - self.drawPolyLine() - - def _onpress(self, event): - if event.button == 3: - self.disconnectPoly() - self.printOutput('Disconnected polygon selection') - - def addTextfield(self, xpos=0, ypos=0.95, width=1, height=0.03): - ''' - Adds an ax for text output to the plot. - ''' - self.axtext = self.ax.figure.add_axes([xpos, - ypos, - width, - height]) - self.axtext.xaxis.set_visible(False) - self.axtext.yaxis.set_visible(False) - - def writeInTextfield(self, text=None): - self.setXYlim(self.ax.get_xlim(), self.ax.get_ylim()) - self.axtext.clear() - self.axtext.text(0.01, 0.5, text, verticalalignment='center', horizontalalignment='left') - self.drawFigure() - - def _addButtons(self): - xpos1 = 0.13 - xpos2 = 0.6 - dx = 0.06 - self.addButton('Rect', self.chooseRectangles, xpos=xpos1, color='white') - self.addButton('Poly', self.choosePolygon, xpos=xpos1 + dx, color='white') - self.addButton('Plot', self.plotTracesInActiveRegions, xpos=xpos1 + 2 * dx, color='yellow') - self.addButton('SNR', self.refreshLog10SNR, xpos=xpos1 + 3 * dx, color='cyan') - self.addButton('PE', self.refreshPickerror, xpos=xpos1 + 4 * dx, color='cyan') - self.addButton('SPE', self.refreshSPE, xpos=xpos1 + 5 * dx, color='cyan') - self.addButton('DesLst', self.deselectLastSelection, xpos=xpos2 + dx, color='green') - self.addButton('SelAll', self.setAllActiveRegionsForDeletion, xpos=xpos2 + 2 * dx) - self.addButton('DelAll', self.deleteAllMarkedPicks, xpos=xpos2 + 3 * dx, color='red') - - def addButton(self, name, action, xpos, ypos=0.91, color=None): - from matplotlib.widgets import Button - self.buttons[name] = {'ax': None, - 'button': None, - 'action': action, - 'xpos': xpos} - ax = self.ax.figure.add_axes([xpos, - ypos, - 0.05, - 0.03]) - button = Button(ax, name, color=color, hovercolor='grey') - button.on_clicked(action) - self.buttons[name]['ax'] = ax - self.buttons[name]['button'] = button - self.buttons[name]['xpos'] = xpos - - def getKey(self): - if self.shots_found.keys() == []: - key = 1 - else: - key = max(self.shots_found.keys()) + 1 - return key - - def drawPolyLine(self): - self.setXYlim(self.ax.get_xlim(), self.ax.get_ylim()) - x = self._polyx - y = self._polyy - if len(x) >= 2 and len(y) >= 2: - self.ax.plot(x[-2:], y[-2:], 'k', alpha=0.1) - self.drawFigure() - - def drawLastPolyLine(self): - self.setXYlim(self.ax.get_xlim(), self.ax.get_ylim()) - x = self._polyx - y = self._polyy - if len(x) >= 2 and len(y) >= 2: - self.ax.plot((x[-1], x[0]), (y[-1], y[0]), 'k', alpha=0.1) - self.drawFigure() - - def finishPolygon(self): - self.drawLastPolyLine() - x = self._polyx - y = self._polyy - self._polyx = []; - self._polyy = [] - - key = self.getKey() - self.markPolygon(x, y, key=key) - - shots, numtraces = self.findTracesInPoly(x, y) - self.shots_found[key] = {'shots': shots, - 'selection': 'poly', - 'xvalues': x, - 'yvalues': y} - self.printOutput('Found %d traces in polygon: %s' % (numtraces, shots)) - - def printOutput(self, text): - print text - self.writeInTextfield(text) - - def chooseRectangles(self, event=None): - ''' - Activates matplotlib widget RectangleSelector. - ''' - from matplotlib.widgets import RectangleSelector - if hasattr(self, '_cidPoly'): - self.disconnectPoly() - self.printOutput('Select rectangle is active. Press and hold left mousebutton.') - self._cidRect = None - self._cidRect = self.ax.figure.canvas.mpl_connect('button_press_event', self._onpress) - self._rectangle = RectangleSelector(self.ax, self._onselect_clicks) - return self._rectangle - - def choosePolygon(self, event=None): - ''' - Activates matplotlib widget LassoSelector. - ''' - from matplotlib.widgets import LassoSelector - if hasattr(self, '_cidRect'): - self.disconnectRect() - self.printOutput('Select polygon is active. Add points with leftclick. Finish with rightclick.') - self._cidPoly = None - self._cidPoly = self.ax.figure.canvas.mpl_connect('button_press_event', self._onpress) - self._lasso = LassoSelector(self.ax, self._onselect_verts) - return self._lasso - - def disconnectPoly(self, event=None): - if not hasattr(self, '_cidPoly'): - self.printOutput('no poly selection found') - return - self.ax.figure.canvas.mpl_disconnect(self._cidPoly) - del self._cidPoly - self.finishPolygon() - self._lasso.disconnect_events() - print 'disconnected poly selection\n' - - def disconnectRect(self, event=None): - if not hasattr(self, '_cidRect'): - self.printOutput('no rectangle selection found') - return - self.ax.figure.canvas.mpl_disconnect(self._cidRect) - del self._cidRect - self._rectangle.disconnect_events() - print 'disconnected rectangle selection\n' - - def deselectLastSelection(self, event=None): - if self.shots_found.keys() == []: - self.printOutput('No selection found.') - return - key = max(self.shots_found.keys()) - self.deselectSelection(key) - self.refreshFigure() - - def deselectSelection(self, key, color='green', alpha=0.1): - if key not in self.shots_found.keys(): - self.printOutput('No selection found.') - return - if color is not None: - if self.shots_found[key]['selection'] == 'rect': - self.markRectangle(self.shots_found[key]['xvalues'], - self.shots_found[key]['yvalues'], - key=key, color=color, alpha=alpha, - linewidth=1) - elif self.shots_found[key]['selection'] == 'poly': - self.markPolygon(self.shots_found[key]['xvalues'], - self.shots_found[key]['yvalues'], - key=key, color=color, alpha=alpha, - linewidth=1) - value = self.shots_found.pop(key) - self.printOutput('Deselected selection number %d' % key) - - def findTracesInPoly(self, x, y, picks='normal', highlight=True): - def dotproduct(v1, v2): - return sum((a * b for a, b in zip(v1, v2))) - - def getlength(v): - return math.sqrt(dotproduct(v, v)) - - def getangle(v1, v2): - return np.rad2deg(math.acos(dotproduct(v1, v2) / (getlength(v1) * getlength(v2)))) - - def insidePoly(x, y, pickX, pickY): - angle = 0 - epsilon = 1e-07 - for index in range(len(x)): - xval1 = x[index - 1]; - yval1 = y[index - 1] - xval2 = x[index]; - yval2 = y[index] - angle += getangle([xval1 - pickX, yval1 - pickY], [xval2 - pickX, yval2 - pickY]) - if 360 - epsilon <= angle <= 360 + epsilon: ### IMPROVE THAT?? - return True - - if len(x) == 0 or len(y) == 0: - self.printOutput('No polygon defined.') - return - - shots_found = {}; - numtraces = 0 - x0 = min(x); - x1 = max(x) - y0 = min(y); - y1 = max(y) - - shots, numtracesrect = self.findTracesInShotDict((x0, x1), (y0, y1), highlight=False) - for shotnumber in shots.keys(): - shot = self.shot_dict[shotnumber] - for traceID in shots[shotnumber]: - if shot.getPickFlag(traceID) is not 0: - pickX = shot.getDistance(traceID) - pickY = shot.getPick(traceID) - if insidePoly(x, y, pickX, pickY): - if shotnumber not in shots_found.keys(): - shots_found[shotnumber] = [] - shots_found[shotnumber].append(traceID) - if highlight == True: - self.highlightPick(shot, traceID) - numtraces += 1 - - self.drawFigure() - return shots_found, numtraces - - def findTracesInShotDict(self, (x0, x1), (y0, y1), picks='normal', highlight=True): - ''' - Returns traces corresponding to a certain area in the plot with all picks over the distances. - ''' - shots_found = {}; - numtraces = 0 - if picks == 'normal': - pickflag = 0 - elif picks == 'includeCutOut': - pickflag = None - - for line in self._allpicks: - dist, pick, shotnumber, traceID, flag = line - if flag == pickflag: continue ### IMPROVE THAT - if (x0 <= dist <= x1 and y0 <= pick <= y1): - if shotnumber not in shots_found.keys(): - shots_found[shotnumber] = [] - shots_found[shotnumber].append(traceID) - if highlight == True: - self.highlightPick(self.shot_dict[shotnumber], traceID) - numtraces += 1 - - self.drawFigure() - return shots_found, numtraces - - def highlightPick(self, shot, traceID, annotations=True): - ''' - Highlights a single pick for a shot(object)/shotnumber and traceID. - If annotations == True: Displays shotnumber and traceID in the plot. - ''' - if type(shot) == int: - shot = self.survey.getShotDict()[shot] - - if shot.getPickFlag(traceID) is 0: - return - - self.ax.scatter(shot.getDistance(traceID), shot.getPick(traceID), s=50, marker='o', facecolors='none', - edgecolors='m', alpha=1) - if annotations == True: - self.ax.annotate(s='s%s|t%s' % (shot.getShotnumber(), traceID), - xy=(shot.getDistance(traceID), shot.getPick(traceID)), fontsize='xx-small') - - def highlightAllActiveRegions(self): - ''' - Highlights all picks in all active regions. - ''' - for key in self.shots_found.keys(): - for shotnumber in self.shots_found[key]['shots'].keys(): - for traceID in self.shots_found[key]['shots'][shotnumber]: - self.highlightPick(self.shot_dict[shotnumber], traceID) - self.drawFigure() - - def plotTracesInActiveRegions(self, event=None, keys='all', maxfigures=20, qt = False): - ''' - Plots all traces in the active region or for all specified keys. - - :param: keys - :type: int or list - - :param: maxfigures, maximum value of figures opened - :type: int - ''' - if qt: - from pylot.core.active.gui import Repicking - - count = 0 - if keys == 'all': - keys = self.shots_found.keys() - elif type(keys) == int: - keys = [keys] - - if len(self.shots_found) > 0: - for shot in self.shot_dict.values(): - for key in keys: - for shotnumber in self.shots_found[key]['shots']: - if shot.getShotnumber() == shotnumber: - for traceID in self.shots_found[key]['shots'][shotnumber]: - count += 1 - if count > maxfigures: - print 'Maximum number of figures (%s) reached. %sth figure was not opened.' % ( - maxfigures, count) - break - shot.plot_traces(traceID) - else: - self.printOutput('No picks defined in that region(s)') - - def setAllActiveRegionsForDeletion(self, event=None): - keys = [] - for key in self.shots_found.keys(): - keys.append(key) - self.setRegionForDeletion(keys) - - def setRegionForDeletion(self, keys): - if type(keys) == int: - keys = [keys] - - for key in keys: - for shotnumber in self.shots_found[key]['shots'].keys(): - if shotnumber not in self.shots_for_deletion: - self.shots_for_deletion[shotnumber] = [] - for traceID in self.shots_found[key]['shots'][shotnumber]: - if traceID not in self.shots_for_deletion[shotnumber]: - self.shots_for_deletion[shotnumber].append(traceID) - self.deselectSelection(key, color='red', alpha=0.2) - - self.deselectSelection(key, color='red', alpha=0.2) - - self.printOutput('Set region(s) %s for deletion' % keys) - - def markAllActiveRegions(self): - for key in self.shots_found.keys(): - if self.shots_found[key]['selection'] == 'rect': - self.markRectangle(self.shots_found[key]['xvalues'], - self.shots_found[key]['yvalues'], key=key) - if self.shots_found[key]['selection'] == 'poly': - self.markPolygon(self.shots_found[key]['xvalues'], - self.shots_found[key]['yvalues'], key=key) - - def markRectangle(self, (x0, x1), (y0, y1), key=None, color='grey', alpha=0.1, linewidth=1): - ''' - Mark a rectangular region on the axes. - ''' - from matplotlib.patches import Rectangle - self.ax.add_patch(Rectangle((x0, y0), x1 - x0, y1 - y0, alpha=alpha, facecolor=color, linewidth=linewidth)) - if key is not None: - self.ax.text(x0 + (x1 - x0) / 2, y0 + (y1 - y0) / 2, str(key)) - self.drawFigure() - - def markPolygon(self, x, y, key=None, color='grey', alpha=0.1, linewidth=1): - from matplotlib.patches import Polygon - poly = Polygon(np.array(zip(x, y)), color=color, alpha=alpha, lw=linewidth) - self.ax.add_patch(poly) - if key is not None: - self.ax.text(min(x) + (max(x) - min(x)) / 2, min(y) + (max(y) - min(y)) / 2, str(key)) - self.drawFigure() - - def clearShotsForDeletion(self): - ''' - Clears the list of shots marked for deletion. - ''' - self.shots_for_deletion = {} - print('Cleared all shots that were set for deletion.') - - def getShotsForDeletion(self): - return self.shots_for_deletion - - def deleteAllMarkedPicks(self, event=None): - ''' - Deletes all shots set for deletion. - ''' - if len(self.getShotsForDeletion()) is 0: - self.printOutput('No shots set for deletion.') - return - - for shot in self.getShotDict().values(): - for shotnumber in self.getShotsForDeletion(): - if shot.getShotnumber() == shotnumber: - for traceID in self.getShotsForDeletion()[shotnumber]: - shot.removePick(traceID) - print "Deleted the pick for traceID %s on shot number %s" % (traceID, shotnumber) - self.clearShotsForDeletion() - self.refreshFigure() - - def highlightPicksForShot(self, shot, annotations=False): - ''' - Highlight all picks for a given shot. - ''' - if type(shot) is int: - shot = self.survey.getShotDict()[shotnumber] - - for traceID in shot.getTraceIDlist(): - if shot.getPickFlag(traceID) is not 0: - self.highlightPick(shot, traceID, annotations) - - self.drawFigure() - - def setXYlim(self, xlim, ylim): - self._xlim, self._ylim = xlim, ylim - - def refreshLog10SNR(self, event=None): - cbv = 'log10SNR' - self.cbv = cbv - self.refreshFigure(self, colorByVal=cbv) - - def refreshPickerror(self, event=None): - cbv = 'pickerror' - self.cbv = cbv - self.refreshFigure(self, colorByVal=cbv) - - def refreshSPE(self, event=None): - cbv = 'spe' - self.cbv = cbv - self.refreshFigure(self, colorByVal=cbv) - - def refreshFigure(self, event=None, colorByVal=None): - if colorByVal == None: - colorByVal = self.cbv - else: - self.cbv = colorByVal - self.printOutput('Refreshing figure...') - self.ax.clear() - self.ax = self.survey.plotAllPicks(ax=self.ax, cbar=self.cbar, refreshPlot=True, colorByVal=colorByVal) - self.setXYlim(self.ax.get_xlim(), self.ax.get_ylim()) - self.markAllActiveRegions() - self.highlightAllActiveRegions() - self.drawFigure() - self.printOutput('Done!') - - def drawFigure(self, resetAxes=True): - if resetAxes == True: - self.ax.set_xlim(self._xlim) - self.ax.set_ylim(self._ylim) - self.ax.figure.canvas.draw() - diff --git a/pylot/core/active/surveyUtils.py b/pylot/core/active/surveyUtils.py deleted file mode 100644 index 3d19650c..00000000 --- a/pylot/core/active/surveyUtils.py +++ /dev/null @@ -1,293 +0,0 @@ -from __future__ import print_function -import numpy as np - -def readParameters(parfile, parameter): - """ - - :param parfile: - :param parameter: - :return: - """ - from ConfigParser import ConfigParser - parameterConfig = ConfigParser() - parameterConfig.read('parfile') - - value = parameterConfig.get('vars', parameter).split('\t')[0] - - return value - - -def fitSNR4dist(shot_dict, shiftdist=30, shiftSNR=100): - """ - Approach to fit the decreasing SNR with wave travel distance. - - :param shot_dict: dictionary containing Seismicshot objects (e.g. survey.getShotDict()) - :param shiftdist: shift compensating curve by a certain distance to the left - :param shiftSNR: shift compensating curve by a certain SNR value to the bottom - :return: - """ - import numpy as np - dists = [] - picks = [] - snrs = [] - snr_sqrt_inv = [] - snrthresholds = [] - snrBestFit = [] - for shot in shot_dict.values(): - for traceID in shot.getTraceIDlist(): - if shot.getSNR(traceID)[0] >= 1: - dists.append(shot.getDistance(traceID)) - picks.append(shot.getPickIncludeRemoved(traceID)) - snrs.append(shot.getSNR(traceID)[0]) - snr_sqrt_inv.append(1 / np.sqrt(shot.getSNR(traceID)[0])) - fit = np.polyfit(dists, snr_sqrt_inv, 1) - fit_fn = np.poly1d(fit) - for dist in dists: - snrBestFit.append((1 / (fit_fn(dist) ** 2))) - dist += shiftdist - snrthresholds.append((1 / (fit_fn(dist) ** 2)) - shiftSNR * np.exp(-0.05 * dist)) - plotFittedSNR(dists, snrthresholds, snrs, snrBestFit) - return fit_fn #### ZU VERBESSERN, sollte fertige funktion wiedergeben - - -def plotFittedSNR(dists, snrthresholds, snrs, snrBestFit): - """ - - :param dists: - :param snrthresholds: - :param snrs: - :param snrBestFit: - :return: - """ - import matplotlib.pyplot as plt - plt.interactive(True) - fig = plt.figure() - plt.plot(dists, snrs, 'b.', markersize=2.0, label='SNR values') - dists.sort() - snrthresholds.sort(reverse=True) - snrBestFit.sort(reverse=True) - plt.plot(dists, snrthresholds, 'r', markersize=1, label='Fitted threshold') - plt.plot(dists, snrBestFit, 'k', markersize=1, label='Best fitted curve') - plt.xlabel('Distance[m]') - plt.ylabel('SNR') - plt.legend() - - -def setDynamicFittedSNR(shot_dict, shiftdist=30, shiftSNR=100, p1=0.004, p2=-0.0007): - """ - Set SNR values for a dictionary containing Seismicshots (e.g. survey.getShotDict()) - by parameters calulated from fitSNR4dist. - - :param shot_dict: - :type shot_dict: dict - :param shiftdist: - :type shiftdist: int - :param shiftSNR: - :type shiftSNR: int - :param p1: - :type p1: float - :param p2: - :type p2: float - :return: - """ - minSNR = 2.5 - # fit_fn = fitSNR4dist(shot_dict) - fit_fn = get_fit_fn(p1, p2) - for shot in shot_dict.values(): - for traceID in shot.getTraceIDlist(): ### IMPROVE - dist = shot.getDistance(traceID) + shiftdist - snrthreshold = snr_fit_func(fit_fn, dist, shiftSNR) - if snrthreshold < minSNR: - print('WARNING: SNR threshold %s lower %s. Set SNR threshold to %s.' - % (snrthreshold, minSNR, minSNR)) - shot.setSNRthreshold(traceID, minSNR) - else: - shot.setSNRthreshold(traceID, snrthreshold) - print("setDynamicFittedSNR: Finished setting of fitted SNR-threshold.\n" - "Parameters: ShiftDist = %s, ShiftSNR = %s, p1 = %s, p2 = %s" - %(shiftdist, shiftSNR, p1, p2)) - -def snr_fit_func(fit_fn, dist, shiftSNR): - snrthreshold = (1 / (fit_fn(dist) ** 2)) - shiftSNR * np.exp(-0.05 * dist) - return snrthreshold - -def get_fit_fn(p1, p2): - return np.poly1d([p1, p2]) - -def setConstantSNR(shot_dict, snrthreshold=2.5): - """ - Set a constant SNR value to all Seismicshots in a dictionary (e.g. survey.getShotDict()). - - :param shot_dict: - :param snrthreshold: - :return: - """ - for shot in shot_dict.values(): - for traceID in shot.getTraceIDlist(): - shot.setSNRthreshold(traceID, snrthreshold) - print("setConstantSNR: Finished setting of SNR threshold to a constant value of %s" % snrthreshold) - - -def findTracesInRanges(shot_dict, distancebin, pickbin): - ''' - Returns traces corresponding to a certain area in a plot with all picks over the distances. - - :param: shot_dict, dictionary containing all shots that are used - :type: dictionary - - :param: distancebin - :type: tuple, (dist1[m], dist2[m]) - - :param: pickbin - :type: tuple, (t1[s], t2[s]) - - ''' - shots_found = {} - for shot in shot_dict.values(): - if shot.getTraceIDs4Dist(distancebin=distancebin) is not None: - for traceID in shot.getTraceIDs4Dist(distancebin=distancebin): - if pickbin[0] < shot.getPick(traceID) < pickbin[1]: - if shot.getShotnumber() not in shots_found.keys(): - shots_found[shot.getShotnumber()] = [] - shots_found[shot.getShotnumber()].append(traceID) - - return shots_found - - -def cleanUp(survey): - """ - Cleans up a Survey object by removing frontend information - which can not be saved in the pickle format. - """ - for shot in survey.data.values(): - shot.traces4plot = {} - -def plotScatterStats4Shots(survey, variable, ax = None, twoDim = False): - """ - Statistics, scatter plot. - - :param survey: - :param variable: can be 'mean SNR', 'median SNR', 'mean SPE', 'median SPE', or 'picked traces' - :return: - """ - import matplotlib.pyplot as plt - import numpy as np - statsShot = {} - x = [] - y = [] - value = [] - for shot in survey.data.values(): - for traceID in shot.getTraceIDlist(): - if not shot in statsShot.keys(): - statsShot[shot] = {'x': shot.getSrcLoc()[0], - 'y': shot.getSrcLoc()[1], - 'SNR': [], - 'SPE': [], - 'picked traces': 0} - - SNR = shot.getSNR(traceID)[0] - if not SNR == np.inf: - statsShot[shot]['SNR'].append(SNR) - if shot.getPickFlag(traceID) == 1: - statsShot[shot]['picked traces'] += 1 - statsShot[shot]['SPE'].append(shot.getSymmetricPickError(traceID)) - - for shot in statsShot.keys(): - statsShot[shot]['mean SNR'] = np.mean(statsShot[shot]['SNR']) - statsShot[shot]['median SNR'] = np.median(statsShot[shot]['SNR']) - statsShot[shot]['mean SPE'] = np.mean(statsShot[shot]['SPE']) - statsShot[shot]['median SPE'] = np.median(statsShot[shot]['SPE']) - - for shot in statsShot.keys(): - x.append(statsShot[shot]['x']) - y.append(statsShot[shot]['y']) - value.append(statsShot[shot][variable]) - - if ax is None: - fig = plt.figure() - ax = fig.add_subplot(111) - - size = [] - for val in value: - size.append(100 * val / max(value)) - - sc = ax.scatter(x, y, s=size, c=value) - ax.text(0.5, 1.05,'Plot of all shots', - horizontalalignment='center', verticalalignment='center', - transform=ax.transAxes) - ax.set_xlabel('X [m]') - ax.set_ylabel('Y [m]') - if not twoDim: - ax.set_aspect('equal') - cbar = ax.figure.colorbar(sc) - cbar.set_label(variable) - - for shot in statsShot.keys(): - ax.annotate(' %s' % shot.getShotnumber(), xy=(shot.getSrcLoc()[0], shot.getSrcLoc()[1]), - fontsize='x-small', color='k') - - -def plotScatterStats4Receivers(survey, variable, ax = None, twoDim = False): - """ - Statistics, scatter plot. - - :param survey: - :param variable: can be 'mean SNR', 'median SNR', 'mean SPE', 'median SPE', or 'picked traces' - :return: - """ - import matplotlib.pyplot as plt - import numpy as np - statsRec = {} - x = [] - y = [] - value = [] - for shot in survey.data.values(): - for traceID in shot.getTraceIDlist(): - if not traceID in statsRec.keys(): - statsRec[traceID] = {'x': shot.getRecLoc(traceID)[0], - 'y': shot.getRecLoc(traceID)[1], - 'SNR': [], - 'SPE': [], - 'picked traces': 0} - - SNR = shot.getSNR(traceID)[0] - if not SNR == np.inf: - statsRec[traceID]['SNR'].append(SNR) - if shot.getPickFlag(traceID) == 1: - statsRec[traceID]['picked traces'] += 1 - statsRec[traceID]['SPE'].append(shot.getSymmetricPickError(traceID)) - - for traceID in statsRec.keys(): - statsRec[traceID]['mean SNR'] = np.mean(statsRec[traceID]['SNR']) - statsRec[traceID]['median SNR'] = np.median(statsRec[traceID]['SNR']) - statsRec[traceID]['mean SPE'] = np.mean(statsRec[traceID]['SPE']) - statsRec[traceID]['median SPE'] = np.median(statsRec[traceID]['SPE']) - - for traceID in statsRec.keys(): - x.append(statsRec[traceID]['x']) - y.append(statsRec[traceID]['y']) - value.append(statsRec[traceID][variable]) - - if ax is None: - fig = plt.figure() - ax = fig.add_subplot(111) - - size = [] - for val in value: - size.append(100 * val / max(value)) - - sc = ax.scatter(x, y, s=size, c=value) - ax.text(0.5, 1.05,'Plot of all receivers', - horizontalalignment='center', verticalalignment='center', - transform=ax.transAxes) - ax.set_xlabel('X [m]') - ax.set_ylabel('Y [m]') - if not twoDim: - ax.set_aspect('equal') - cbar = ax.figure.colorbar(sc) - cbar.set_label(variable) - - shot = survey.data.values()[0] - for traceID in shot.getTraceIDlist(): - ax.annotate(' %s' % traceID, xy=(shot.getRecLoc(traceID)[0], shot.getRecLoc(traceID)[1]), - fontsize='x-small', color='k') diff --git a/pylot/core/analysis/coinctimes.py b/pylot/core/analysis/coinctimes.py deleted file mode 100644 index 9b41b0c3..00000000 --- a/pylot/core/analysis/coinctimes.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from obspy.core import read -from obspy.signal.trigger import coincidenceTrigger - - -class CoincidenceTimes(object): - def __init__(self, st, comp='Z', coinum=4, sta=1., lta=10., on=5., off=1.): - _type = 'recstalta' - self.coinclist = self.createCoincTriggerlist(data=st, trigcomp=comp, - coinum=coinum, sta=sta, - lta=lta, trigon=on, - trigoff=off, type=_type) - - def __str__(self): - n = 1 - out = '' - for time in self.getCoincTimes(): - out += 'event no. {0}: starttime is {1}\n'.format(n, time) - n += 1 - return out - - def getCoincTimes(self): - timelist = [] - for info in self.getCoincList(): - timelist.append(info['time']) - - return timelist - - def getCoincList(self): - return self.coinclist - - def createCoincTriggerlist(self, data, trigcomp, coinum, sta, lta, - trigon, trigoff, type): - ''' - uses a coincidence trigger to detect all events in the given - dataset - ''' - - triggerlist = coincidenceTrigger(type, trigon, trigoff, - data.select(component=trigcomp), - coinum, sta=sta, lta=lta) - return triggerlist - - -def main(): - data = read('/data/SDS/2014/1A/ZV??/?H?.D/*.365') - data.filter(type='bandpass', freqmin=5., freqmax=30.) - coincs = CoincidenceTimes(data) - print(coincs) - - -if __name__ == '__main__': - main() diff --git a/pylot/core/analysis/correlation.py b/pylot/core/analysis/correlation.py deleted file mode 100644 index 2cf97231..00000000 --- a/pylot/core/analysis/correlation.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import numpy as np - - -def crosscorrsingle(wf1, wf2, taumax): - ''' - Calculates the crosscorrelation between two waveforms with a defined maximum timedifference. - :param wf1: first waveformdata - :type wf1: list - :param wf2: second waveformdata - :type wf2: list - :param taumax: maximum time difference between waveforms - :type taumax: positive integer - :return: returns the crosscorrelation funktion 'c' and the lagvector 'l' - :rtype: c and l are lists - ''' - N = len(wf1) - c = np.zeros(2 * taumax - 1) - l = np.zeros(2 * taumax - 1) - for tau in range(taumax): - Cxyplus = 0 - Cxyminus = 0 - for n in range(N - tau): - Cxy1plus = wf1[n] * wf2[n + tau] - Cxy1minus = wf1[n + tau] * wf2[n] - Cxyplus = Cxyplus + Cxy1plus - Cxyminus = Cxyminus + Cxy1minus - - c[(taumax - 1) - tau] = Cxyminus - c[(taumax - 1) + tau] = Cxyplus - l[(taumax - 1) - tau] = -tau - l[(taumax - 1) + tau] = tau - return c, l - - -def crosscorrnormcalc(weights, wfs): - ''' - crosscorrnormcalc - function that calculates the normalization for the - cross correlation carried out by 'wfscrosscorr' - :param weights: weighting factors for the single components - :type weights: tuple - :param wfs: tuple of `~numpy.array` object containing waveform data - :type wfs: tuple - :return: a floating point number yielding the by 'weights' weighted energy - of the waveforms in 'wfs' - :rtype: float - ''' - - # check if the parameters are of the right type - if not isinstance(weights, tuple): - raise TypeError("type of 'weight' should be 'tuple', but is {0}".format( - type(weights))) - if not isinstance(wfs, tuple): - raise TypeError( - "type of parameter 'wfs' should be 'tuple', but is {0}".format( - type(wfs))) - sqrsumwfs = 0. - for n, wf in enumerate(wfs): - sqrsumwf = np.sum(weights[n] ** 2. * wf ** 2.) - sqrsumwfs += sqrsumwf - return np.sqrt(sqrsumwfs) - - -def wfscrosscorr(weights, wfs, taumax): - ''' - wfscrosscorr - function that calculates successive cross-correlations from a set of waveforms stored in a matrix - - base formula is: - C(i)=SUM[p=1:nComponent](eP(p)*(SUM[n=1:N]APp(x,n)*APp(y,n+i)))/(SQRT(SUM[p=1:nComponent]eP(p)^2*(SUM[n=1:N](APp(x,n)^2)))*SQRT(SUM[p=1:nComponent]eP(p)^2*(SUM[n=1:N]APp(y,n)^2))) - whereas - nComponent is the number of components - N is the number of samples - i is the lag-index - - input: - APp rowvectors containing the waveforms of each component p for which the cross-correlation is calculated - tPp rowvectros containing times - eP vector containing the weighting factors for the components (maxsize = [1x3]) - - output: - C cross-correlation function - L lag-vector - - author(s): - - SWB 26.01.2010 as arranged with Thomas Meier and Monika Bischoff - - :param weights: weighting factors for the single components - :type weights: tuple - :param wfs: tuple of `~numpy.array` object containing waveform data - :type wfs: tuple - :param taumax: maximum time difference - :type taumax: positive integer - :return: returns cross correlation function normalized by the waveform energy - ''' - - ccnorm = 0. - ccnorm = crosscorrnormcalc(weights, wfs[0]) - ccnorm *= crosscorrnormcalc(weights, wfs[1]) - - c = 0. - for n in range(len(wfs)): - cc, l = crosscorrsingle(wfs[0][n], wfs[1][n], taumax) - c += cc - return c / ccnorm, l diff --git a/pylot/core/analysis/trigger.py b/pylot/core/analysis/trigger.py deleted file mode 100644 index a1e61b36..00000000 --- a/pylot/core/analysis/trigger.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from obspy.signal.trigger import recursive_sta_lta, trigger_onset - - -def createSingleTriggerlist(st, station='ZV01', trigcomp='Z', stalta=(1, 10), - trigonoff=(6, 1)): - ''' - uses a single-station trigger to create a triggerlist for this station - :param st: obspy stream - :type st: - :param station: station name to get triggers for (optional, default = ZV01) - :type station: str - :param trigcomp: (optional, default = Z) - :type trigcomp: str - :param stalta: (optional, default = (1,10)) - :type stalta: tuple - :param trigonoff: (optional, default = (6,1)) - :type trigonoff: tuple - :return: list of triggtimes - :rtype: list - ''' - tr = st.copy().select(component=trigcomp, station=station)[0] - df = tr.stats.sampling_rate - - cft = recursive_sta_lta(tr.data, int(stalta[0] * df), int(stalta[1] * df)) - triggers = trigger_onset(cft, trigonoff[0], trigonoff[1]) - trigg = [] - for time in triggers: - trigg.append(tr.stats.starttime + time[0] / df) - return trigg - - -def createSubCoincTriggerlist(trig, station='ZV01'): - ''' - makes a triggerlist with the events, that are triggered by the - coincidence trigger and are seen at the demanded station - :param trig: list containing triggers from coincidence trigger - :type trig: list - :param station: station name to get triggers for (optional, default = ZV01) - :type station: str - :return: list of triggertimes - :rtype: list - ''' - trigg = [] - for tri in trig: - if station in tri['stations']: - trigg.append(tri['time']) - return trigg diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index f1a186cb..35111071 100755 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -17,7 +17,6 @@ from pylot.core.pick.charfuns import CharacteristicFunction from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \ getSNR, fmpicker, checkPonsets, wadaticheck -from pylot.core.util.dataprocessing import restitute_data from pylot.core.util.utils import getPatternLine from pylot.core.io.data import Data