[update] no more replotting of whole data when pick is changed
This commit is contained in:
parent
5b48b744fd
commit
64885db214
38
PyLoT.py
38
PyLoT.py
@ -134,6 +134,9 @@ class MainWindow(QMainWindow):
|
|||||||
self._ctrl = False # control key pressed
|
self._ctrl = False # control key pressed
|
||||||
self._shift = False # shift key pressed
|
self._shift = False # shift key pressed
|
||||||
|
|
||||||
|
self.drawnPicks = {'auto': {},
|
||||||
|
'manual': {}}
|
||||||
|
|
||||||
# default factor for dataplot e.g. enabling/disabling scrollarea
|
# default factor for dataplot e.g. enabling/disabling scrollarea
|
||||||
self.height_factor = 12
|
self.height_factor = 12
|
||||||
self.plot_method = 'normal'
|
self.plot_method = 'normal'
|
||||||
@ -2324,14 +2327,12 @@ class MainWindow(QMainWindow):
|
|||||||
if pickDlg._dirty:
|
if pickDlg._dirty:
|
||||||
self.setDirty(True)
|
self.setDirty(True)
|
||||||
self.update_status('picks accepted ({0})'.format(station))
|
self.update_status('picks accepted ({0})'.format(station))
|
||||||
replot1 = self.addPicks(station, pickDlg.getPicks(picktype='manual'), type='manual')
|
self.addPicks(station, pickDlg.getPicks(picktype='manual'), type='manual')
|
||||||
replot2 = self.addPicks(station, pickDlg.getPicks(picktype='auto'), type='auto')
|
self.addPicks(station, pickDlg.getPicks(picktype='auto'), type='auto')
|
||||||
self.enableSaveEventAction()
|
self.enableSaveEventAction()
|
||||||
if replot1 or replot2:
|
self.comparable = self.checkEvents4comparison()
|
||||||
self.plotWaveformDataThread()
|
if True in self.comparable.values():
|
||||||
|
self.compare_action.setEnabled(True)
|
||||||
self.draw()
|
|
||||||
else:
|
|
||||||
self.drawPicks(station)
|
self.drawPicks(station)
|
||||||
self.draw()
|
self.draw()
|
||||||
if self.nextStation:
|
if self.nextStation:
|
||||||
@ -2652,6 +2653,9 @@ class MainWindow(QMainWindow):
|
|||||||
self.drawPicks(station, 'auto', stime)
|
self.drawPicks(station, 'auto', stime)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not picktype in ['manual', 'auto']:
|
||||||
|
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||||
|
|
||||||
# if picks to draw not specified, draw all picks available
|
# if picks to draw not specified, draw all picks available
|
||||||
if not station:
|
if not station:
|
||||||
for station in self.getPicks(type=picktype):
|
for station in self.getPicks(type=picktype):
|
||||||
@ -2674,6 +2678,11 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
stat_picks = self.getPicks(type=picktype)[station]
|
stat_picks = self.getPicks(type=picktype)[station]
|
||||||
|
|
||||||
|
if station in self.drawnPicks[picktype].keys():
|
||||||
|
for item in self.drawnPicks[picktype][station]:
|
||||||
|
pw.removeItem(item)
|
||||||
|
self.drawnPicks[picktype][station] = []
|
||||||
|
|
||||||
for phase in stat_picks:
|
for phase in stat_picks:
|
||||||
if phase == 'SPt': continue # wadati SP time
|
if phase == 'SPt': continue # wadati SP time
|
||||||
picks = stat_picks[phase]
|
picks = stat_picks[phase]
|
||||||
@ -2698,15 +2707,14 @@ class MainWindow(QMainWindow):
|
|||||||
spe = picks['spe']
|
spe = picks['spe']
|
||||||
|
|
||||||
if self.pg:
|
if self.pg:
|
||||||
if picktype == 'manual' or picktype == 'auto':
|
|
||||||
if spe:
|
if spe:
|
||||||
if picks['epp'] and picks['lpp']:
|
if picks['epp'] and picks['lpp']:
|
||||||
pen = make_pen(picktype, phaseID, 'epp', quality)
|
pen = make_pen(picktype, phaseID, 'epp', quality)
|
||||||
pw.plot([epp, epp], ylims,
|
self.drawnPicks[picktype][station].append(pw.plot([epp, epp], ylims,
|
||||||
alpha=.25, pen=pen, name='EPP')
|
alpha=.25, pen=pen, name='EPP'))
|
||||||
pen = make_pen(picktype, phaseID, 'lpp', quality)
|
pen = make_pen(picktype, phaseID, 'lpp', quality)
|
||||||
pw.plot([lpp, lpp], ylims,
|
self.drawnPicks[picktype][station].append(pw.plot([lpp, lpp], ylims,
|
||||||
alpha=.25, pen=pen, name='LPP')
|
alpha=.25, pen=pen, name='LPP'))
|
||||||
pen = make_pen(picktype, phaseID, 'spe', quality)
|
pen = make_pen(picktype, phaseID, 'spe', quality)
|
||||||
spe_l = pg.PlotDataItem([mpp - spe, mpp - spe], ylims, pen=pen,
|
spe_l = pg.PlotDataItem([mpp - spe, mpp - spe], ylims, pen=pen,
|
||||||
name='{}-SPE'.format(phase))
|
name='{}-SPE'.format(phase))
|
||||||
@ -2718,12 +2726,12 @@ class MainWindow(QMainWindow):
|
|||||||
brush.setColor(color)
|
brush.setColor(color)
|
||||||
fill = pg.FillBetweenItem(spe_l, spe_r, brush=brush)
|
fill = pg.FillBetweenItem(spe_l, spe_r, brush=brush)
|
||||||
fb = pw.addItem(fill)
|
fb = pw.addItem(fill)
|
||||||
|
self.drawnPicks[picktype][station].append(fill)
|
||||||
except:
|
except:
|
||||||
print('Warning: drawPicks: Could not create fill for symmetric pick error.')
|
print('Warning: drawPicks: Could not create fill for symmetric pick error.')
|
||||||
pen = make_pen(picktype, phaseID, 'mpp', quality)
|
pen = make_pen(picktype, phaseID, 'mpp', quality)
|
||||||
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase))
|
self.drawnPicks[picktype][station].append(
|
||||||
else:
|
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase)))
|
||||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
|
||||||
else:
|
else:
|
||||||
if picktype == 'manual':
|
if picktype == 'manual':
|
||||||
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
|
Loading…
Reference in New Issue
Block a user