added method for array plotting to QtPyLoT, to do: button to call array plot

This commit is contained in:
Marcel Paffrath 2017-04-12 16:43:29 +02:00
parent 50f6d7d987
commit 54222b7f11
3 changed files with 22 additions and 11 deletions

View File

@ -58,6 +58,7 @@ from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
WaveformWidget, PropertiesDlg, HelpForm, createAction, PickDlg, \
getDataType, ComparisonDialog
from pylot.core.util.map_projection import map_projection
from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.thread import AutoPickThread
from pylot.core.util.version import get_git_version as _getVersionString
@ -119,6 +120,9 @@ class MainWindow(QMainWindow):
self.picks = {}
self.autopicks = {}
self.loc = False
self._metadata = None
self.array_map = None
# initialize event data
if self.recentfiles:
@ -1034,8 +1038,16 @@ class MainWindow(QMainWindow):
self.get_data().applyEVTData(lt.read_location(locpath), type='event')
self.get_data().applyEVTData(self.calc_magnitude(), type='event')
def calc_magnitude(self, type='ML'):
def show_array_map(self):
if not self.array_map:
self.get_metadata()
if not self.metadata:
return
self.array_map = map_projection(self)
else:
self.array_map.show()
def get_metadata(self):
def set_inv(settings):
fninv, _ = QFileDialog.getOpenFileName(self, self.tr(
"Select inventory..."), self.tr("Select file"))
@ -1070,7 +1082,12 @@ class MainWindow(QMainWindow):
return None
else:
self.metadata = read_metadata(fninv)
def calc_magnitude(self, type='ML'):
self.get_metadata()
if not self.metadata:
return None
wf_copy = self.get_data().getWFData().copy()
corr_wf = restitute_data(wf_copy, *self.metadata)
# if not rest_flag:

View File

@ -1 +1 @@
bb60-dirty
50f6-dirty

View File

@ -7,7 +7,6 @@ from scipy.interpolate import griddata
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
from PySide import QtCore, QtGui
from pylot.core.util.dataprocessing import read_metadata
from pylot.core.util.widgets import PickDlg
plt.interactive(False)
@ -16,7 +15,7 @@ class map_projection(QtGui.QWidget):
def __init__(self, mainwindow):
QtGui.QWidget.__init__(self)
self.pyl_mainwindow = mainwindow
self.parser = self.get_metadata('/data/Geothermie/Insheim/STAT_INFO/MAGS2_net.dless')
self.parser = mainwindow.metadata[1]
self.init_graphics()
self.init_stations()
self.init_lat_lon_dimensions()
@ -57,11 +56,6 @@ class map_projection(QtGui.QWidget):
except Exception as e:
print('Could not generate Plot for station {st}.\n{er}'.format(st=station, er=e))
def get_metadata(self, path):
metadata=read_metadata(path)
parser=metadata[1]
return parser
def connectSignals(self):
self.combobox.currentIndexChanged.connect(self.refresh_drawings)