[change] possible to select one of all available channels for comparison

This commit is contained in:
Marcel Paffrath 2018-01-15 15:29:46 +01:00
parent 975bd64266
commit 4835c0ca8a
2 changed files with 49 additions and 30 deletions

View File

@ -1 +1 @@
f483-dirty 975b-dirty

View File

@ -902,7 +902,7 @@ class PylotCanvas(FigureCanvas):
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True, noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None, verbosity=0, component='*', nth_sample=1, iniPick=None, verbosity=0,
plot_additional=False): plot_additional=False, additional_channel=None):
ax = self.axes[0] ax = self.axes[0]
ax.cla() ax.cla()
@ -966,13 +966,19 @@ class PylotCanvas(FigureCanvas):
color = linecolor, color = linecolor,
linestyle = 'dashed') linestyle = 'dashed')
self.setPlotDict(n, (station, channel, network)) self.setPlotDict(n, (station, channel, network))
if plot_additional: if plot_additional and additional_channel:
pressure = wfdata.select(channel='MDO') compare_stream = wfdata.select(channel=additional_channel)
if pressure: if compare_stream:
p_data = pressure[0].data trace = compare_stream[0]
#normalize if not scaleddata:
p_max = max(abs(p_data)) trace.detrend('constant')
p_data /= p_max trace.normalize(np.max(np.abs(trace.data)) * 2)
time_ax = prepTimeAxis(stime, trace)
times = [time for index, time in enumerate(time_ax) if not index % nth_sample]
p_data = compare_stream[0].data
# #normalize
# p_max = max(abs(p_data))
# p_data /= p_max
for index in range(3): for index in range(3):
ax.plot(times, p_data, color='red', alpha=0.5, linewidth=0.7) ax.plot(times, p_data, color='red', alpha=0.5, linewidth=0.7)
p_data += 1 p_data += 1
@ -1180,8 +1186,10 @@ class PickDlg(QDialog):
self.filteroptions = FILTERDEFAULTS self.filteroptions = FILTERDEFAULTS
self.pick_block = False self.pick_block = False
self.nextStation = QtGui.QCheckBox('Continue with next station ') self.nextStation = QtGui.QCheckBox('Continue with next station ')
self.additionalChannel = QtGui.QCheckBox('Additional Channel')
self.additionalChannel.stateChanged.connect(self.resetPlot) # comparison channel
self.compareChannel = QtGui.QComboBox()
self.compareChannel.activated.connect(self.resetPlot)
# initialize panning attributes # initialize panning attributes
self.press = None self.press = None
@ -1204,6 +1212,11 @@ class PickDlg(QDialog):
self.stime, self.etime = full_range(self.getWFData()) self.stime, self.etime = full_range(self.getWFData())
# fill compare channels
self.compareChannel.addItem('', None)
for trace in self.getWFData():
self.compareChannel.addItem(trace.stats.channel, trace)
# initialize plotting widget # initialize plotting widget
self.multicompfig = PylotCanvas(parent=self, multicursor=True) self.multicompfig = PylotCanvas(parent=self, multicursor=True)
self.phaseplot = PhasePlotWidget(self) self.phaseplot = PhasePlotWidget(self)
@ -1351,6 +1364,7 @@ class PickDlg(QDialog):
# layout the outermost appearance of the Pick Dialog # layout the outermost appearance of the Pick Dialog
_outerlayout = QVBoxLayout() _outerlayout = QVBoxLayout()
_dialtoolbar = QToolBar() _dialtoolbar = QToolBar()
_dialtoolbar.setStyleSheet('QToolBar{spacing:5px;}')
# fill toolbar with content # fill toolbar with content
_dialtoolbar.addAction(self.filterActionP) _dialtoolbar.addAction(self.filterActionP)
@ -1382,7 +1396,9 @@ class PickDlg(QDialog):
'padding-left:5px}') 'padding-left:5px}')
_dialtoolbar.addWidget(est_label) _dialtoolbar.addWidget(est_label)
_dialtoolbar.addWidget(self.plot_arrivals_button) _dialtoolbar.addWidget(self.plot_arrivals_button)
_dialtoolbar.addWidget(self.additionalChannel) _dialtoolbar.addSeparator()
_dialtoolbar.addWidget(QtGui.QLabel('Compare to channel: '))
_dialtoolbar.addWidget(self.compareChannel)
# layout the innermost widget # layout the innermost widget
_innerlayout = QVBoxLayout() _innerlayout = QVBoxLayout()
@ -1922,7 +1938,8 @@ class PickDlg(QDialog):
noiselevel=(trace_number + noiselevel, noiselevel=(trace_number + noiselevel,
trace_number - noiselevel), trace_number - noiselevel),
iniPick=ini_pick, iniPick=ini_pick,
plot_additional=self.additionalChannel.isChecked()) plot_additional=bool(self.compareChannel.currentText()),
additional_channel=self.compareChannel.currentText())
def setIniPickS(self, gui_event, wfdata): def setIniPickS(self, gui_event, wfdata):
@ -1991,7 +2008,8 @@ class PickDlg(QDialog):
noiselevel=noiselevels, noiselevel=noiselevels,
scaleddata=True, scaleddata=True,
iniPick=ini_pick, iniPick=ini_pick,
plot_additional=self.additionalChannel.isChecked()) plot_additional=bool(self.compareChannel.currentText()),
additional_channel=self.compareChannel.currentText())
def setPick(self, gui_event): def setPick(self, gui_event):
@ -2348,7 +2366,8 @@ class PickDlg(QDialog):
self.multicompfig.plotWFData(wfdata=data, title=title, self.multicompfig.plotWFData(wfdata=data, title=title,
zoomx=self.getXLims(), zoomx=self.getXLims(),
zoomy=self.getYLims(), zoomy=self.getYLims(),
plot_additional=self.additionalChannel.isChecked()) plot_additional=bool(self.compareChannel.currentText()),
additional_channel=self.compareChannel.currentText())
self.setPlotLabels() self.setPlotLabels()
self.drawAllPicks() self.drawAllPicks()
self.draw() self.draw()