improved plotting performance especially for large data sets

This commit is contained in:
Sebastian Wehling-Benatelli 2016-05-31 17:27:59 +02:00
parent 7965239a92
commit 73c49d8291

View File

@ -83,6 +83,7 @@ class MainWindow(QMainWindow):
self.recentfiles = settings.value("data/recentEvents", []) self.recentfiles = settings.value("data/recentEvents", [])
self.fname = dict(manual=None, auto=None, loc=None) self.fname = dict(manual=None, auto=None, loc=None)
self.fnames = None self.fnames = None
self._stime = None
structure_setting = settings.value("data/Structure", "PILOT") structure_setting = settings.value("data/Structure", "PILOT")
self.dataStructure = DATASTRUCTURE[structure_setting]() self.dataStructure = DATASTRUCTURE[structure_setting]()
self.seismicPhase = str(settings.value("phase", "P")) self.seismicPhase = str(settings.value("phase", "P"))
@ -429,6 +430,7 @@ class MainWindow(QMainWindow):
if 'loc' not in type: if 'loc' not in type:
self.updatePicks(type=type) self.updatePicks(type=type)
self.drawPicks() self.drawPicks()
self.draw()
def getLastEvent(self): def getLastEvent(self):
return self.recentfiles[0] return self.recentfiles[0]
@ -594,6 +596,9 @@ class MainWindow(QMainWindow):
return wfID return wfID
return None return None
def getStime(self):
return self._stime
def addActions(self, target, actions): def addActions(self, target, actions):
for action in actions: for action in actions:
if action is None: if action is None:
@ -612,6 +617,7 @@ class MainWindow(QMainWindow):
ans = self.data.setWFData(self.fnames) ans = self.data.setWFData(self.fnames)
elif self.fnames is None and self.okToContinue(): elif self.fnames is None and self.okToContinue():
ans = self.data.setWFData(self.getWFFnames()) ans = self.data.setWFData(self.getWFFnames())
self._stime = getGlobalTimes(self.getData().getWFData())[0]
if ans: if ans:
self.plotWaveformData() self.plotWaveformData()
return ans return ans
@ -636,16 +642,19 @@ class MainWindow(QMainWindow):
self.setComponent('Z') self.setComponent('Z')
self.plotWaveformData() self.plotWaveformData()
self.drawPicks() self.drawPicks()
self.draw()
def plotN(self): def plotN(self):
self.setComponent('N') self.setComponent('N')
self.plotWaveformData() self.plotWaveformData()
self.drawPicks() self.drawPicks()
self.draw()
def plotE(self): def plotE(self):
self.setComponent('E') self.setComponent('E')
self.plotWaveformData() self.plotWaveformData()
self.drawPicks() self.drawPicks()
self.draw()
def pushFilterWF(self, param_args): def pushFilterWF(self, param_args):
self.getData().filterWFData(param_args) self.getData().filterWFData(param_args)
@ -661,6 +670,7 @@ class MainWindow(QMainWindow):
self.getData().resetWFData() self.getData().resetWFData()
self.plotWaveformData() self.plotWaveformData()
self.drawPicks() self.drawPicks()
self.draw()
def adjustFilterOptions(self): def adjustFilterOptions(self):
fstring = "Filter Options ({0})".format(self.getSeismicPhase()) fstring = "Filter Options ({0})".format(self.getSeismicPhase())
@ -745,8 +755,10 @@ class MainWindow(QMainWindow):
if replot: if replot:
self.plotWaveformData() self.plotWaveformData()
self.drawPicks() self.drawPicks()
self.draw()
else: else:
self.drawPicks(station) self.drawPicks(station)
self.draw()
else: else:
self.updateStatus('picks discarded ({0})'.format(station)) self.updateStatus('picks discarded ({0})'.format(station))
if not self.getLocflag() and self.check4Loc(): if not self.getLocflag() and self.check4Loc():
@ -782,6 +794,7 @@ class MainWindow(QMainWindow):
def finalizeAutoPick(self): def finalizeAutoPick(self):
self.drawPicks(picktype='auto') self.drawPicks(picktype='auto')
self.draw()
self.thread.quit() self.thread.quit()
def addPicks(self, station, picks, type='manual'): def addPicks(self, station, picks, type='manual'):
@ -836,14 +849,14 @@ class MainWindow(QMainWindow):
stat_picks = self.getPicks(type=picktype)[station] stat_picks = self.getPicks(type=picktype)[station]
stime = self.getStime()
for phase in stat_picks: for phase in stat_picks:
picks = stat_picks[phase] picks = stat_picks[phase]
if type(stat_picks[phase]) is not dict: if type(stat_picks[phase]) is not dict:
return return
colors = phase_col[phase[0].upper()] colors = phase_col[phase[0].upper()]
stime = getGlobalTimes(self.getData().getWFData())[0]
mpp = picks['mpp'] - stime mpp = picks['mpp'] - stime
epp = picks['epp'] - stime epp = picks['epp'] - stime
lpp = picks['lpp'] - stime lpp = picks['lpp'] - stime
@ -860,7 +873,6 @@ class MainWindow(QMainWindow):
mpp, ylims[0], colors[4]) mpp, ylims[0], colors[4])
else: else:
raise TypeError('Unknow picktype {0}'.format(picktype)) raise TypeError('Unknow picktype {0}'.format(picktype))
self.draw()
def locateEvent(self): def locateEvent(self):
settings = QSettings() settings = QSettings()