Partly fixed bug when plotting corrupted trace, formerly killed by ValueError.
This commit is contained in:
parent
e9660eea9c
commit
2628e9d568
@ -1 +1 @@
|
|||||||
50ee3-dirty
|
e966-dirty
|
||||||
|
@ -7,6 +7,7 @@ from scipy.interpolate import splrep, splev
|
|||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
import subprocess
|
import subprocess
|
||||||
from obspy import UTCDateTime, read
|
from obspy import UTCDateTime, read
|
||||||
from pylot.core.io.inputs import AutoPickParameter
|
from pylot.core.io.inputs import AutoPickParameter
|
||||||
@ -381,9 +382,11 @@ def prepTimeAxis(stime, trace):
|
|||||||
print('shorten time axes by one datum')
|
print('shorten time axes by one datum')
|
||||||
time_ax = np.arange(stime, etime - tincr, tincr)
|
time_ax = np.arange(stime, etime - tincr, tincr)
|
||||||
if len(time_ax) != nsamp:
|
if len(time_ax) != nsamp:
|
||||||
raise ValueError('{0} samples of data \n '
|
print('Station {0}, {1} samples of data \n '
|
||||||
'{1} length of time vector \n'
|
'{2} length of time vector \n'
|
||||||
'delta: {2}'.format(nsamp, len(time_ax), tincr))
|
'delta: {3}'.format(trace.stats.station,
|
||||||
|
nsamp, len(time_ax), tincr))
|
||||||
|
time_ax = None
|
||||||
return time_ax
|
return time_ax
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,15 +445,16 @@ class WaveformWidget(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:
|
if time_ax is not None:
|
||||||
trace.detrend('constant')
|
if not scaleddata:
|
||||||
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
trace.detrend('constant')
|
||||||
self.getAxes().plot(time_ax, trace.data + n, 'k')
|
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
||||||
if noiselevel is not None:
|
self.getAxes().plot(time_ax, trace.data + n, 'k')
|
||||||
for level in noiselevel:
|
if noiselevel is not None:
|
||||||
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
for level in noiselevel:
|
||||||
[level, level], '--k')
|
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
||||||
self.setPlotDict(n, (station, channel))
|
[level, level], '--k')
|
||||||
|
self.setPlotDict(n, (station, channel))
|
||||||
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