From 508250f03f14db0af023878eeac72c6f320cd2df Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 5 Jun 2019 14:12:16 +0200 Subject: [PATCH] [minor] corrected time axes to correct endtime (was increased by one sample using npts*dt instead of npts-1*dt) --- pylot/core/pick/autopick.py | 6 +++--- pylot/core/pick/utils.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 138cb772..08cc2397 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -589,7 +589,7 @@ class AutopickStation(object): plt_flag = 0 fig._tight = True 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 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: @@ -632,7 +632,7 @@ class AutopickStation(object): if self.horizontal_traces_exist() and self.s_data.Sflag == 1: # plot E trace 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 ax2.plot(th1data, self.etrace.data / max(self.etrace.data), color=linecolor, linewidth=0.7, label='Data') if self.p_results.weight < 4: @@ -668,7 +668,7 @@ class AutopickStation(object): # plot N trace 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 ax3.plot(th2data, self.ntrace.data / max(self.ntrace.data), color=linecolor, linewidth=0.7, label='Data') if self.p_results.weight < 4: diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 0fa49afa..ed67a8b7 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -72,7 +72,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol ' relative to most likely pick ...') 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) 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 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) # get pick window 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) 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 # are set to zero because of too small time series # => 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']): rms = rms_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) if i == 0: if real_None(fig) is None: