[change] possible to select one of all available channels for comparison
This commit is contained in:
		
							parent
							
								
									975bd64266
								
							
						
					
					
						commit
						4835c0ca8a
					
				| @ -1 +1 @@ | |||||||
| f483-dirty | 975b-dirty | ||||||
|  | |||||||
| @ -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) | ||||||
| @ -1211,7 +1224,7 @@ class PickDlg(QDialog): | |||||||
| 
 | 
 | ||||||
|         # plot data |         # plot data | ||||||
|         self.multicompfig.plotWFData(wfdata=self.getWFData(), |         self.multicompfig.plotWFData(wfdata=self.getWFData(), | ||||||
|                                         title=self.getStation()) |                                      title=self.getStation()) | ||||||
| 
 | 
 | ||||||
|         self.multicompfig.setZoomBorders2content() |         self.multicompfig.setZoomBorders2content() | ||||||
| 
 | 
 | ||||||
| @ -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() | ||||||
| @ -1915,14 +1931,15 @@ class PickDlg(QDialog): | |||||||
|         self.setYLims(np.array([-noiselevel * 3.5, noiselevel * 3.5]) + |         self.setYLims(np.array([-noiselevel * 3.5, noiselevel * 3.5]) + | ||||||
|                       trace_number) |                       trace_number) | ||||||
|         self.multicompfig.plotWFData(wfdata=data, |         self.multicompfig.plotWFData(wfdata=data, | ||||||
|                                         title=self.getStation() + |                                      title=self.getStation() + | ||||||
|                                               ' picking mode', |                                               ' picking mode', | ||||||
|                                         zoomx=self.getXLims(), |                                      zoomx=self.getXLims(), | ||||||
|                                         zoomy=self.getYLims(), |                                      zoomy=self.getYLims(), | ||||||
|                                         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): | ||||||
| 
 | 
 | ||||||
| @ -1984,14 +2001,15 @@ class PickDlg(QDialog): | |||||||
|                       [trace - 1 / (2.5 * 2) for trace in traces] |                       [trace - 1 / (2.5 * 2) for trace in traces] | ||||||
| 
 | 
 | ||||||
|         self.multicompfig.plotWFData(wfdata=data, |         self.multicompfig.plotWFData(wfdata=data, | ||||||
|                                         title=self.getStation() + |                                      title=self.getStation() + | ||||||
|                                               ' picking mode', |                                               ' picking mode', | ||||||
|                                         zoomx=self.getXLims(), |                                      zoomx=self.getXLims(), | ||||||
|                                         zoomy=self.getYLims(), |                                      zoomy=self.getYLims(), | ||||||
|                                         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): | ||||||
| 
 | 
 | ||||||
| @ -2346,9 +2364,10 @@ class PickDlg(QDialog): | |||||||
|                 filtops_str = transformFilteroptions2String(filtoptions) |                 filtops_str = transformFilteroptions2String(filtoptions) | ||||||
|                 title += ' | Filteroptions: {}'.format(filtops_str) |                 title += ' | Filteroptions: {}'.format(filtops_str) | ||||||
|         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() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user