def callback(): if not os.path.isfile(e.get()): textabc = tkinter.Text(top, height=1, font="font, 20", width=20) textabc.insert(tkinter.INSERT, "File does not exist!") textabc.config(state=tkinter.DISABLED, bg="#f0f0f0", bd=0) textabc.pack() else: stsdatacheck = e.get() if ".stsdata" not in stsdatacheck: filemanager.wpitch(s.get() + 1) filemanager.wlength(l.get()) filemanager.wpath(e.get()) top.withdraw() import curve # next part in script, to keep it readable if qdebug.get() == 1: curve.write() sys.exit() else: importdata.data(e.get(), l.get())
def plotPair(number): dataset = data() subplot = 210 plt.figure(figsize=(5, 8), dpi=160) for key in dataset: subplot += 1 plt.subplot(subplot) plt.plot(dataset[key][number]) plt.ylim(0, 27) plt.title('{} raw signal'.format(key)) plt.ylabel('acceleration') plt.xlabel('samples') plt.subplots_adjust(hspace=0.53) plt.savefig('presentation/figures/rawplot.png')
#!python from numpy import cos, sin, pi, absolute, arange from scipy.signal import kaiserord, lfilter, firwin, freqz from pylab_test import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show from importdata import data #------------------------------------------------ # Create a signal for demonstration. #------------------------------------------------ dataset = data() sample_rate = 100.0 nsamples = len(dataset['walk'][1]) t = arange(nsamples) / sample_rate x = dataset['walk'][1] #------------------------------------------------ # Create a FIR filter and apply it to x. #------------------------------------------------ # The Nyquist rate of the signal. nyq_rate = sample_rate / 2.0 # The desired width of the transition from pass to stop, # relative to the Nyquist rate. We'll design the filter # with a 5 Hz transition width. width = 1.0 / nyq_rate # The desired attenuation in the stop band, in dB.
shape = 410 fir.plot_impulse_response(subplot=shape + count) count += 1 fir.plot_step_responce(subplot=shape + count) count += 1 # fir.plot_magnitude(shape + count) # count += 1 fir.plot_frequesy_response(shape + count) count += 1 fir.plot_phase_response(shape + count) plt.subplots_adjust(hspace=0.3) plt.savefig("presentation/figures/{}".format(savefig)) if __name__ == '__main__': data = data() plt.rc('text', usetex=True) higpa_cutoff_hz = 2.0 # --------- Lopass filterd signals------------ fig = plt.figure(figsize=(8, 13), tight_layout=False) fig.suptitle("LOW pass filterd signal") plot_filter_results(data, savefig="plot_lti_lopasl.png") # --------- Highpass filterd signals------------ fig = plt.figure(figsize=(8, 13), tight_layout=False) fig.suptitle("HIGH pass filterd signal", fontsize=18) plot_filter_results(data, savefig='plot_lti_higpas.png', cutoff_hz=higpa_cutoff_hz, hp=True) # # --------- Lopass filter plot ------------