def state(self): """return state for testing.""" from obspy.core.util import AttribDict out = AttribDict() # path to test files # self.path = # general constants tmax = 6. out.dt = 0.01 npts = int(tmax / out.dt + 1) t = np.linspace(0., tmax, npts) out.fmin = .5 out.fmax = 10 # constants for the signal a1 = 4. t1 = 2. f1 = 2. phi1 = 0. # amplitude and phase error phase_shift = 0.1 amp_fac = 1.2 # generate the signal h1 = (np.sign(t - t1) + 1) / 2 out.st1 = a1 * (t - t1) * np.exp(-2 * (t - t1)) out.st1 *= np.cos(2. * np.pi * f1 * (t - t1) + phi1 * np.pi) * h1 # reference signal out.st2 = out.st1.copy() # generate analytical signal (hilbert transform) and add phase shift out.st1p = hilbert(out.st1) out.st1p = np.real( np.abs(out.st1p) * np.exp( (np.angle(out.st1p) + phase_shift * np.pi) * 1j)) # signal with amplitude error out.st1p /= amp_fac return out