added station list to TuneAutopicker

This commit is contained in:
Marcel Paffrath 2017-05-15 12:03:53 +02:00
parent 4d9c7b02cf
commit a2ab98c202
3 changed files with 47 additions and 25 deletions

View File

@ -556,19 +556,6 @@ class MainWindow(QMainWindow):
self.drawPicks(picktype=type)
self.draw()
def getCurrentEvent(self, eventlist=None):
if not eventlist:
eventlist = self.project.eventlist
for event in eventlist:
if event.path == self.getCurrentEventPath(eventlist):
return event
def getCurrentEventPath(self, eventlist=None):
return str(self.eventBox.currentText().split('|')[0]).strip()
def getLastEvent(self):
return self.recentfiles[0]
def add_recentfile(self, event):
self.recentfiles.insert(0, event)
@ -606,16 +593,28 @@ class MainWindow(QMainWindow):
else:
return
def getWFFnames_from_eventlist(self, eventlist=None):
def getWFFnames_from_eventbox(self, eventlist=None, eventbox=None):
if self.dataStructure:
searchPath = self.dataStructure.expandDataPath()
directory = self.getCurrentEventPath(eventlist)
self.fnames = [os.path.join(directory, f) for f in os.listdir(directory)]
directory = self.getCurrentEventPath(eventbox)
fnames = [os.path.join(directory, f) for f in os.listdir(directory)]
else:
raise DatastructureError('not specified')
if not self.fnames:
return None
return self.fnames
return fnames
def getCurrentEvent(self, eventlist=None, eventbox=None):
if not eventlist:
eventlist = self.project.eventlist
for event in eventlist:
if event.path == self.getCurrentEventPath(eventbox):
return event
def getCurrentEventPath(self, eventbox=None):
if not eventbox:
eventbox = self.eventBox
return str(eventbox.currentText().split('|')[0]).strip()
def getLastEvent(self):
return self.recentfiles[0]
def add_events(self):
if not self.project:
@ -942,7 +941,8 @@ class MainWindow(QMainWindow):
# ans = self.data.setWFData(self.getWFFnames())
# else:
# ans = False
self.data.setWFData(self.getWFFnames_from_eventlist(self.project.eventlist))
self.fnames = self.getWFFnames_from_eventbox(self.project.eventlist)
self.data.setWFData(self.fnames)
self._stime = full_range(self.get_data().getWFData())[0]
def connectWFplotEvents(self):

View File

@ -1 +1 @@
77b07-dirty
4d9c-dirty

View File

@ -30,6 +30,7 @@ from PySide.QtGui import QAction, QApplication, QCheckBox, QComboBox, \
from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
from PySide.QtWebKit import QWebView
from obspy import Stream, UTCDateTime
from pylot.core.io.data import Data
from pylot.core.io.inputs import FilterOptions, AutoPickParameter
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
getResolutionWindow
@ -1272,14 +1273,21 @@ class PickDlg(QDialog):
class TuneAutopicker(QWidget):
update = QtCore.Signal(str)
'''
QWidget used to modifiy and test picking parameters for autopicking algorithm.
:param: parent
:type: QtPyLoT Mainwindow
'''
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent, 1)
self.parent = parent
self.ap = parent._inputs
self.fig_dict = parent.fig_dict
self.data = Data()
self.init_main_layouts()
self.init_eventlist()
self.init_stationlist()
self.init_figure_tabs()
self.add_parameter()
self.add_buttons()
@ -1302,10 +1310,24 @@ class TuneAutopicker(QWidget):
self.eventBox = self.parent.createEventBox()
self.fill_eventbox()
self.trace_layout.addWidget(self.eventBox)
self.eventBox.activated.connect(self.fill_stationbox)
def init_stationlist(self):
pass
self.stationBox = QtGui.QComboBox()
self.trace_layout.addWidget(self.stationBox)
def fill_stationbox(self):
fnames = self.parent.getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames)
self.stationBox.clear()
stations = []
for trace in self.data.getWFData():
station = trace.stats.station
if not station in stations:
stations.append(str(station))
for station in stations:
self.stationBox.addItem(str(station))
def init_figure_tabs(self):
self.main_tabs = QtGui.QTabWidget()
self.p_tabs = QtGui.QTabWidget()