make MPLWidget able to distinguish scaled and unscaled data; additionally make plotting noise levels more convenient

This commit is contained in:
Sebastian Wehling-Benatelli 2015-07-02 10:35:36 +02:00
parent a46b0db583
commit d05e9320e5

View File

@ -88,7 +88,7 @@ class MPLWidget(FigureCanvas):
self._parent = parent self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None): noiselevel=None, scaleddata=False):
self.getAxes().cla() self.getAxes().cla()
self.clearPlotDict() self.clearPlotDict()
wfstart, wfend = getGlobalTimes(wfdata) wfstart, wfend = getGlobalTimes(wfdata)
@ -99,13 +99,13 @@ class MPLWidget(FigureCanvas):
print(msg) print(msg)
stime = trace.stats.starttime - wfstart stime = trace.stats.starttime - wfstart
time_ax = prepTimeAxis(stime, trace) time_ax = prepTimeAxis(stime, trace)
trace.normalize(np.max(np.abs(trace.data)) * 2) if not scaleddata:
trace.normalize(np.max(np.abs(trace.data)) * 2)
self.getAxes().plot(time_ax, trace.data + n, 'k') self.getAxes().plot(time_ax, trace.data + n, 'k')
if noiselevel is not None: if noiselevel is not None:
self.getAxes().plot([time_ax[0], time_ax[-1]], for level in noiselevel:
[noiselevel[0], noiselevel[0]], '--k') self.getAxes().plot([time_ax[0], time_ax[-1]],
self.getAxes().plot([time_ax[0], time_ax[-1]], [level, level], '--k')
[noiselevel[1], noiselevel[1]], '--k')
xlabel = 'seconds since {0}'.format(wfstart) xlabel = 'seconds since {0}'.format(wfstart)
ylabel = '' ylabel = ''
self.updateWidget(xlabel, ylabel, title) self.updateWidget(xlabel, ylabel, title)