def make_sweep(self, pre=None, span=0.5, post=0.1, magnitude=1e-2, start=20, stop=10000): smpl = lambda tm: int(round(tm*self.FS)) if pre is None: pre = span/2 s, d = dk_lib.genlogsweep( start, stop, self.FS, smpl(pre), smpl(span), smpl(post)) s *= magnitude n = dk_lib.pow2roundup(len(s)) #d /= np.mean(abs(np.fft.fft(dk_lib.fft_convolve(d, s), n))[n*start/self.FS:n*stop/self.FS]) #return s, d return s
def make_sweep(self, pre=None, span=0.5, post=0.1, magnitude=1e-2, start=20, stop=10000): smpl = lambda tm: int(round(tm * self.FS)) if pre is None: pre = span / 2 s, d = dk_lib.genlogsweep(start, stop, self.FS, smpl(pre), smpl(span), smpl(post)) s *= magnitude n = dk_lib.pow2roundup(len(s)) #d /= np.mean(abs(np.fft.fft(dk_lib.fft_convolve(d, s), n))[n*start/self.FS:n*stop/self.FS]) #return s, d return s
def _sweep(self, t, start, stop, pre, post, fs): self.generate_spectrum = True self.generate_harmonics = True self.make_spectrum = self._sweep_make_spectrum self.make_harmonics_responses = self._sweep_harmonics_responses post = int(round(post * fs)) if pre < 0: pre = int(round((len(t) - post) * 0.1)) if pre < 0: pre = 0 else: pre = int(round(pre * fs)) if post >= len(t) - pre: post = int((len(t) - pre) * 0.1) span = len(t) - (pre + post) self.pre = pre self.post = post self.fs = fs sig, self.sweep_inverse_signal, self.start, self.stop, self.sweep_rate = \ dk_lib.genlogsweep(start, stop, fs, pre, span, post) return sig
def _sweep(self, t, start, stop, pre, post, fs): self.generate_spectrum = True self.generate_harmonics = True self.make_spectrum = self._sweep_make_spectrum self.make_harmonics_responses = self._sweep_harmonics_responses post = int(round(post * fs)) if pre < 0: pre = int(round((len(t) - post) * 0.1)) if pre < 0: pre = 0 else: pre = int(round(pre * fs)) if post >= len(t) - pre: post = int((len(t) - pre) * 0.1) span = len(t) - (pre + post) self.pre = pre self.post = post self.fs = fs sig, self.sweep_inverse_signal, self.start, self.stop, self.sweep_rate = dk_lib.genlogsweep( start, stop, fs, pre, span, post ) return sig