[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._shift = False # shift key pressed
|
||||
|
||||
self.drawnPicks = {'auto': {},
|
||||
'manual': {}}
|
||||
|
||||
# default factor for dataplot e.g. enabling/disabling scrollarea
|
||||
self.height_factor = 12
|
||||
self.plot_method = 'normal'
|
||||
@ -2324,14 +2327,12 @@ class MainWindow(QMainWindow):
|
||||
if pickDlg._dirty:
|
||||
self.setDirty(True)
|
||||
self.update_status('picks accepted ({0})'.format(station))
|
||||
replot1 = 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='manual'), type='manual')
|
||||
self.addPicks(station, pickDlg.getPicks(picktype='auto'), type='auto')
|
||||
self.enableSaveEventAction()
|
||||
if replot1 or replot2:
|
||||
self.plotWaveformDataThread()
|
||||
|
||||
self.draw()
|
||||
else:
|
||||
self.comparable = self.checkEvents4comparison()
|
||||
if True in self.comparable.values():
|
||||
self.compare_action.setEnabled(True)
|
||||
self.drawPicks(station)
|
||||
self.draw()
|
||||
if self.nextStation:
|
||||
@ -2652,6 +2653,9 @@ class MainWindow(QMainWindow):
|
||||
self.drawPicks(station, 'auto', stime)
|
||||
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 not station:
|
||||
for station in self.getPicks(type=picktype):
|
||||
@ -2674,6 +2678,11 @@ class MainWindow(QMainWindow):
|
||||
|
||||
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:
|
||||
if phase == 'SPt': continue # wadati SP time
|
||||
picks = stat_picks[phase]
|
||||
@ -2698,15 +2707,14 @@ class MainWindow(QMainWindow):
|
||||
spe = picks['spe']
|
||||
|
||||
if self.pg:
|
||||
if picktype == 'manual' or picktype == 'auto':
|
||||
if spe:
|
||||
if picks['epp'] and picks['lpp']:
|
||||
pen = make_pen(picktype, phaseID, 'epp', quality)
|
||||
pw.plot([epp, epp], ylims,
|
||||
alpha=.25, pen=pen, name='EPP')
|
||||
self.drawnPicks[picktype][station].append(pw.plot([epp, epp], ylims,
|
||||
alpha=.25, pen=pen, name='EPP'))
|
||||
pen = make_pen(picktype, phaseID, 'lpp', quality)
|
||||
pw.plot([lpp, lpp], ylims,
|
||||
alpha=.25, pen=pen, name='LPP')
|
||||
self.drawnPicks[picktype][station].append(pw.plot([lpp, lpp], ylims,
|
||||
alpha=.25, pen=pen, name='LPP'))
|
||||
pen = make_pen(picktype, phaseID, 'spe', quality)
|
||||
spe_l = pg.PlotDataItem([mpp - spe, mpp - spe], ylims, pen=pen,
|
||||
name='{}-SPE'.format(phase))
|
||||
@ -2718,12 +2726,12 @@ class MainWindow(QMainWindow):
|
||||
brush.setColor(color)
|
||||
fill = pg.FillBetweenItem(spe_l, spe_r, brush=brush)
|
||||
fb = pw.addItem(fill)
|
||||
self.drawnPicks[picktype][station].append(fill)
|
||||
except:
|
||||
print('Warning: drawPicks: Could not create fill for symmetric pick error.')
|
||||
pen = make_pen(picktype, phaseID, 'mpp', quality)
|
||||
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase))
|
||||
else:
|
||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||
self.drawnPicks[picktype][station].append(
|
||||
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase)))
|
||||
else:
|
||||
if picktype == 'manual':
|
||||
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||
|
Loading…
Reference in New Issue
Block a user