rps2hz = 1/hz2rps rad2deg = 180/pi deg2rad = 1/rad2deg mag2db = control.mag2db db2mag = control.db2mag #%% Define the frequency selection and distribution of the frequencies into the signals # W_dB = -20.0 # W = db2mag(W_dB) # binSel = FreqTrans.LeakageGoal(W, winType = 'rect')[0] binSel = 1 W = FreqTrans.DirichletApprox(np.asarray([binSel])) numChan = 1 freqRate_hz = 50 numCycles = 1 freqMaxDes_rps = 15 * hz2rps * np.ones(numChan) freqStepDes_rps = (20 / 50) * hz2rps tBinWidth = FreqTrans.FreqStep2TimeBin(freqStepDes_rps) timeDur_s = binSel * tBinWidth freqMinDes_rps = (1/timeDur_s) * hz2rps * np.ones(numChan) methodSW = 'zip' # "zippered" component distribution ## Generate MultiSine Frequencies freqExc_rps, sigIndx, time_s = GenExcite.MultiSineComponents(freqMinDes_rps, freqMaxDes_rps, freqRate_hz, numCycles, freqStepDes_rps, methodSW)
# Excited Frequencies per input channel freqChan_rps = freqExc_rps[sigIndx] freqChan_hz = freqChan_rps * rps2hz #%% N = 2**8 fBin = np.linspace(0, 10, num=N) D = FreqTrans.Dirichlet(fBin, N) Dmag = np.abs(D) Dmax = np.nanmax(Dmag) Dnorm_mag = Dmag / Dmax Dnorm_dB = mag2db(Dnorm_mag) Dapprox_mag = FreqTrans.DirichletApprox(fBin) Dapprox_dB = mag2db(Dapprox_mag) B = FreqTrans.Bartlett(fBin, N) Bmag = np.abs(B) Bmax = np.nanmax(Bmag) Bnorm_mag = Bmag / Bmax Bnorm_dB = mag2db(Bnorm_mag) Bapprox_mag = FreqTrans.BartlettApprox(fBin) Bapprox_dB = mag2db(Bapprox_mag) H = FreqTrans.Hann(fBin, N) Hmag = np.abs(H) Hmax = np.nanmax(Hmag) Hnorm_mag = Hmag / Hmax