def szum_jedn(A, t1, d, N, filename): fs = d / N szum = np.random.uniform(-A, A, N) x = calc.calc_signal(A, 0, t1, d, fs, 0, szum) params = np.array([t1, fs, A, 0, d, 0]) np.savez(filename, params, szum) return params, szum
def unit_impulse(A, t1, d, fs, filename): ns = int(GUI.values['_ns_']) t2 = t1 + d N = int(d * fs) n = np.linspace(t1, t2, N) impuls = A * sig.unit_impulse(N, ns) x = calc.calc_signal(A, 0, t1, d, fs, 0, impuls) params = np.array([t1, fs, A, 0, d, 0]) np.savez(filename, params, impuls) return params, impuls
def syg_trojkatny(A, T, t1, d, fs, kw, filename): f = 1 / T t2 = t1 + d N = int(d * fs) n = np.linspace(t1, t2, N) trojkat = (A / 2) * sig.sawtooth(2 * np.pi * f * n, kw) + (A / 2) x = calc.calc_signal(A, T, t1, d, fs, kw, trojkat) params = np.array([t1, fs, A, T, d, kw]) np.savez(filename, params, trojkat) return params, trojkat
def syg_prostokatny_sym(A, T, t1, d, fs, kw, filename): f = 1 / T t2 = t1 + d N = int(d * fs) n = np.linspace(t1, t2, N) prostokat = A * sig.square(2 * np.pi * f * n, duty=kw) x = calc.calc_signal(A, T, t1, d, fs, kw, prostokat) params = np.array([t1, fs, A, T, d, kw]) np.savez(filename, params, prostokat) return params, prostokat
def syg_sin_dwupolowkowo(A, T, t1, d, fs, filename): f = 1 / T if ((fs / 2) < f): np.savez(filename, 0, 0) return (0, 0) t2 = t1 + d N = int(d * fs) n = np.linspace(t1, t2, N) sinus = A * np.fabs(np.sin(2 * np.pi * f * n)) x = calc.calc_signal(A, T, t1, d, fs, 0, sinus) params = np.array([t1, fs, A, T, d, 0]) np.savez(filename, params, sinus) return params, sinus
def syg_sin(A, T, t1, d, fs, filename): f = 1 / T # TODO:Może jakoś lepiej zabezpieczyć się przed nie spełnieniem twierdzenia o próbkowaniu if ((fs / 2) < f): np.savez(filename, 0, 0) return (0, 0) t2 = t1 + d N = int(d * fs) n = np.linspace(t1, t2, N) sinus = A * np.sin(2 * np.pi * f * n) x = calc.calc_signal(A, T, t1, d, fs, 0, sinus) params = np.array([t1, fs, A, T, d, 0]) np.savez(filename, params, sinus) return params, sinus