added method for array plotting to QtPyLoT, to do: button to call array plot
This commit is contained in:
parent
50f6d7d987
commit
54222b7f11
19
QtPyLoT.py
19
QtPyLoT.py
@ -58,6 +58,7 @@ from pylot.core.io.location import create_creation_info, create_event
|
|||||||
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
||||||
WaveformWidget, PropertiesDlg, HelpForm, createAction, PickDlg, \
|
WaveformWidget, PropertiesDlg, HelpForm, createAction, PickDlg, \
|
||||||
getDataType, ComparisonDialog
|
getDataType, ComparisonDialog
|
||||||
|
from pylot.core.util.map_projection import map_projection
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
from pylot.core.util.thread import AutoPickThread
|
from pylot.core.util.thread import AutoPickThread
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
@ -119,6 +120,9 @@ class MainWindow(QMainWindow):
|
|||||||
self.picks = {}
|
self.picks = {}
|
||||||
self.autopicks = {}
|
self.autopicks = {}
|
||||||
self.loc = False
|
self.loc = False
|
||||||
|
self._metadata = None
|
||||||
|
|
||||||
|
self.array_map = None
|
||||||
|
|
||||||
# initialize event data
|
# initialize event data
|
||||||
if self.recentfiles:
|
if self.recentfiles:
|
||||||
@ -1034,8 +1038,16 @@ class MainWindow(QMainWindow):
|
|||||||
self.get_data().applyEVTData(lt.read_location(locpath), type='event')
|
self.get_data().applyEVTData(lt.read_location(locpath), type='event')
|
||||||
self.get_data().applyEVTData(self.calc_magnitude(), type='event')
|
self.get_data().applyEVTData(self.calc_magnitude(), type='event')
|
||||||
|
|
||||||
|
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 calc_magnitude(self, type='ML'):
|
def get_metadata(self):
|
||||||
def set_inv(settings):
|
def set_inv(settings):
|
||||||
fninv, _ = QFileDialog.getOpenFileName(self, self.tr(
|
fninv, _ = QFileDialog.getOpenFileName(self, self.tr(
|
||||||
"Select inventory..."), self.tr("Select file"))
|
"Select inventory..."), self.tr("Select file"))
|
||||||
@ -1071,6 +1083,11 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.metadata = read_metadata(fninv)
|
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()
|
wf_copy = self.get_data().getWFData().copy()
|
||||||
corr_wf = restitute_data(wf_copy, *self.metadata)
|
corr_wf = restitute_data(wf_copy, *self.metadata)
|
||||||
# if not rest_flag:
|
# if not rest_flag:
|
||||||
|
@ -1 +1 @@
|
|||||||
bb60-dirty
|
50f6-dirty
|
||||||
|
@ -7,7 +7,6 @@ from scipy.interpolate import griddata
|
|||||||
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
|
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
|
||||||
from PySide import QtCore, QtGui
|
from PySide import QtCore, QtGui
|
||||||
|
|
||||||
from pylot.core.util.dataprocessing import read_metadata
|
|
||||||
from pylot.core.util.widgets import PickDlg
|
from pylot.core.util.widgets import PickDlg
|
||||||
|
|
||||||
plt.interactive(False)
|
plt.interactive(False)
|
||||||
@ -16,7 +15,7 @@ class map_projection(QtGui.QWidget):
|
|||||||
def __init__(self, mainwindow):
|
def __init__(self, mainwindow):
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
self.pyl_mainwindow = mainwindow
|
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_graphics()
|
||||||
self.init_stations()
|
self.init_stations()
|
||||||
self.init_lat_lon_dimensions()
|
self.init_lat_lon_dimensions()
|
||||||
@ -57,11 +56,6 @@ class map_projection(QtGui.QWidget):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Could not generate Plot for station {st}.\n{er}'.format(st=station, er=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):
|
def connectSignals(self):
|
||||||
self.combobox.currentIndexChanged.connect(self.refresh_drawings)
|
self.combobox.currentIndexChanged.connect(self.refresh_drawings)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user