def GenerateAM(fp, fm, t0, tf, vp): times = linspace(t0, tf, 100000) values = [vp*(cos(2*pi*fp*t) + cos(2*pi*(fp-fm)*t)/2 + cos(2*pi*(fp+fm)*t)/2) for t in times] SignalsReadWrite.writeSignal( Senial.Senial(times, values), "Signals/AM_" + str(fp / 1000) + "kHz.xml" )
def GenerateSine(freq, a, b, vp): #print(freq) times = linspace(a, b, 100000) values = [vp*sin(2*pi*freq*t) for t in times] SignalsReadWrite.writeSignal( Senial.Senial(times, values), "Signals/Seno_"+str(freq/1000)+"k.xml" )
def GenerateSquare(start, end, vp): times = linspace(0, 0.005, 100000) values = [vp*square(t, start, end) for t in times] SignalsReadWrite.writeSignal( Senial.Senial(times, values), "Signals/Sqaure_" + str(start / 1000) + "_" + str(end/1000) + "ms.xml" )
def Generate32Sine(freq, a, b, vp): times = linspace(a, b, 100000) T = 2/3/freq values = [vp*Sine32(t, T) for t in times] SignalsReadWrite.writeSignal( Senial.Senial(times, values), "Signals/Sine32_" + str(freq / 1000) + "k.xml" )
def GenerateExp(f, t0, tf, vp): times = linspace(t0, tf, 100000) values = [] for t in times: t = abs(t) T = 1/f if t > T/2: t -= (ceil(t/T)-1)*T if t > T/2: t -= T values.append(vp * exp(-abs(t * (10 * f)))) SignalsReadWrite.writeSignal( Senial.Senial(times, values), "Signals/Exp_" + str(f) + "Hz.xml" )
def saveFile(self): if self.currentSignal: filename = filedialog.asksaveasfile(mode='w', defaultextension=".xls") if filename: SignalsReadWrite.writeSignal(self.currentSignal, filename.name)