make MPLWidget able to distinguish scaled and unscaled data; additionally make plotting noise levels more convenient
This commit is contained in:
parent
a46b0db583
commit
d05e9320e5
@ -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)
|
||||||
|
if not scaleddata:
|
||||||
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
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:
|
||||||
|
for level in noiselevel:
|
||||||
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
||||||
[noiselevel[0], noiselevel[0]], '--k')
|
[level, level], '--k')
|
||||||
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
|
||||||
[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)
|
||||||
|
Loading…
Reference in New Issue
Block a user