[minor] corrected time axes to correct endtime (was increased by one sample using npts*dt instead of npts-1*dt)

This commit is contained in:
Marcel Paffrath 2019-06-05 14:12:16 +02:00
parent 291db16e2b
commit 508250f03f
2 changed files with 7 additions and 7 deletions

View File

@ -589,7 +589,7 @@ class AutopickStation(object):
plt_flag = 0 plt_flag = 0
fig._tight = True fig._tight = True
ax1 = fig.add_subplot(311) ax1 = fig.add_subplot(311)
tdata = np.linspace(start=0, stop=self.ztrace.stats.npts*self.ztrace.stats.delta, num=self.ztrace.stats.npts) tdata = np.linspace(start=0, stop=self.ztrace.stats.endtime-self.ztrace.stats.starttime, num=self.ztrace.stats.npts)
# plot tapered trace filtered with bpz2 filter settings # plot tapered trace filtered with bpz2 filter settings
ax1.plot(tdata, self.tr_filt_z_bpz2.data/max(self.tr_filt_z_bpz2.data), color=linecolor, linewidth=0.7, label='Data') ax1.plot(tdata, self.tr_filt_z_bpz2.data/max(self.tr_filt_z_bpz2.data), color=linecolor, linewidth=0.7, label='Data')
if self.p_results.weight < 4: if self.p_results.weight < 4:
@ -632,7 +632,7 @@ class AutopickStation(object):
if self.horizontal_traces_exist() and self.s_data.Sflag == 1: if self.horizontal_traces_exist() and self.s_data.Sflag == 1:
# plot E trace # plot E trace
ax2 = fig.add_subplot(3, 1, 2, sharex=ax1) ax2 = fig.add_subplot(3, 1, 2, sharex=ax1)
th1data = np.linspace(0, self.etrace.stats.npts*self.etrace.stats.delta, self.etrace.stats.npts) th1data = np.linspace(0, self.etrace.stats.endtime-self.etrace.stats.starttime, self.etrace.stats.npts)
# plot filtered and tapered waveform # plot filtered and tapered waveform
ax2.plot(th1data, self.etrace.data / max(self.etrace.data), color=linecolor, linewidth=0.7, label='Data') ax2.plot(th1data, self.etrace.data / max(self.etrace.data), color=linecolor, linewidth=0.7, label='Data')
if self.p_results.weight < 4: if self.p_results.weight < 4:
@ -668,7 +668,7 @@ class AutopickStation(object):
# plot N trace # plot N trace
ax3 = fig.add_subplot(3, 1, 3, sharex=ax1) ax3 = fig.add_subplot(3, 1, 3, sharex=ax1)
th2data= np.linspace(0, self.ntrace.stats.npts*self.ntrace.stats.delta, self.ntrace.stats.npts) th2data= np.linspace(0, self.ntrace.stats.endtime-self.ntrace.stats.starttime, self.ntrace.stats.npts)
# plot trace # plot trace
ax3.plot(th2data, self.ntrace.data / max(self.ntrace.data), color=linecolor, linewidth=0.7, label='Data') ax3.plot(th2data, self.ntrace.data / max(self.ntrace.data), color=linecolor, linewidth=0.7, label='Data')
if self.p_results.weight < 4: if self.p_results.weight < 4:

View File

@ -72,7 +72,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol
' relative to most likely pick ...') ' relative to most likely pick ...')
x = X[0].data x = X[0].data
t = np.linspace(0, X[0].stats.npts / X[0].stats.sampling_rate, t = np.linspace(0, X[0].stats.endtime - X[0].stats.starttime,
X[0].stats.npts) X[0].stats.npts)
inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1]) inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1])
@ -218,7 +218,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
xraw = Xraw[0].data xraw = Xraw[0].data
xfilt = Xfilt[0].data xfilt = Xfilt[0].data
t = np.linspace(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate, t = np.linspace(0, Xraw[0].stats.endtime - Xraw[0].stats.starttime,
Xraw[0].stats.npts) Xraw[0].stats.npts)
# get pick window # get pick window
ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick)) ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick))
@ -824,7 +824,7 @@ def checksignallength(X, pick, minsiglength, pickparams, iplot=0, fig=None, line
ilen = len(x1) ilen = len(x1)
rms = abs(x1) rms = abs(x1)
t = np.linspace(0, X[0].stats.delta * ilen, ilen) t = np.linspace(0, X[0].stats.endtime - X[0].stats.starttime, ilen)
if pick >= t[np.size(t)-1]: # it might happen, that for individual stations cut times if pick >= t[np.size(t)-1]: # it might happen, that for individual stations cut times
# are set to zero because of too small time series # are set to zero because of too small time series
# => pick time has to be reduced for pstart # => pick time has to be reduced for pstart
@ -1196,7 +1196,7 @@ def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'):
for i, key in enumerate(['Z', 'N', 'E']): for i, key in enumerate(['Z', 'N', 'E']):
rms = rms_dict[key] rms = rms_dict[key]
trace = traces_dict[key] trace = traces_dict[key]
t = np.linspace(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key], t = np.linspace(diff_dict[key], trace.stats.endtime - trace.stats.starttime + diff_dict[key],
trace.stats.npts) trace.stats.npts)
if i == 0: if i == 0:
if real_None(fig) is None: if real_None(fig) is None: