[bugfix] skip unknown channels for everything but comparison option

This commit is contained in:
Marcel Paffrath 2018-01-17 16:38:11 +01:00
parent 60a2863629
commit 819e4d7076
2 changed files with 17 additions and 8 deletions

View File

@ -1 +1 @@
c6cd-dirty 60a2-dirty

View File

@ -904,7 +904,11 @@ class PylotCanvas(FigureCanvas):
plot_positions = {} plot_positions = {}
for trace in wfdata: for trace in wfdata:
comp = trace.stats.channel[-1] comp = trace.stats.channel[-1]
plot_positions[trace.stats.channel] = compclass.getPlotPosition(str(comp)) try:
position = compclass.getPlotPosition(str(comp))
except ValueError as e:
continue
plot_positions[trace.stats.channel] = position
for channel, plot_pos in plot_positions.items(): for channel, plot_pos in plot_positions.items():
while not plot_pos in possible_plot_pos or not plot_pos - 1 in plot_positions.values(): while not plot_pos in possible_plot_pos or not plot_pos - 1 in plot_positions.values():
if plot_pos == 0: if plot_pos == 0:
@ -1259,15 +1263,20 @@ class PickDlg(QDialog):
# fill compare and scale channels # fill compare and scale channels
self.compareChannel.addItem('-', None) self.compareChannel.addItem('-', None)
self.scaleChannel.addItem('normalized', None) self.scaleChannel.addItem('normalized', None)
for trace in self.getWFData(): for trace in self.getWFData():
self.compareChannel.addItem(trace.stats.channel, trace) channel = trace.stats.channel
self.scaleChannel.addItem(trace.stats.channel, trace) self.compareChannel.addItem(channel, trace)
actionP = self.pChannels.addAction(str(trace.stats.channel)) if not channel[-1] in ['Z', 'N', 'E', '1', '2', '3']:
actionS = self.sChannels.addAction(str(trace.stats.channel)) print('Skipping unknown channel for scaling: {}'.format(channel))
continue
self.scaleChannel.addItem(channel, trace)
actionP = self.pChannels.addAction(str(channel))
actionS = self.sChannels.addAction(str(channel))
actionP.setCheckable(True) actionP.setCheckable(True)
actionS.setCheckable(True) actionS.setCheckable(True)
actionP.setChecked(self.getChannelSettingsP(trace.stats.channel)) actionP.setChecked(self.getChannelSettingsP(channel))
actionS.setChecked(self.getChannelSettingsS(trace.stats.channel)) actionS.setChecked(self.getChannelSettingsS(channel))
# plot data # plot data
self.multicompfig.plotWFData(wfdata=self.getWFData(), self.multicompfig.plotWFData(wfdata=self.getWFData(),