T.append(T_seg) TUnc.append(np.abs(TUnc_seg)) C.append(Cey) T_InputNames = sigInList T_OutputNames = sigOutList # Compute Gain, Phase, Crit Distance gain_mag = [] gainUnc_mag = [] phase_deg = [] for iSeg in range(0, len(oDataSegs)): gain_mag.append(FreqTrans.Gain(T[iSeg], magUnit='mag')) gainUnc_mag.append(FreqTrans.Gain(TUnc[iSeg], magUnit='mag')) phase_deg.append(FreqTrans.Phase(T[iSeg], phaseUnit='deg', unwrap=False)) #%% Spectrograms if False: iSgnl = 0 freqRate_rps = 50 * hz2rps # freqSpec = np.asarray(freqExc_rps).flatten() freqSpec = freqExc_rps[iSgnl] optSpec = FreqTrans.OptSpect(dftType='czt', freq=freqSpec, freqRate=freqRate_rps, winType=('tukey', 0.2), smooth=('box', 3),
#%% ampPeakFactor = ampList / sigPeakFactor gainDF_mag, phaseDF_deg = FreqTrans.GainPhase(nDF, magUnit = 'mag', unwrap = True) TxyArrayMax = np.nanmax(np.abs(TxyArray).squeeze(), axis=0) TxyArrayNorm = TxyArray.squeeze() / TxyArrayMax gainTxyMean_mag = FreqTrans.Gain(TxyArrayNorm, magUnit = 'mag') gainTxy_mag = FreqTrans.Gain(TxyArray.T.squeeze(), magUnit = 'mag').T gainTxyMax_mag = np.nanmax(gainTxy_mag, axis=0) gainTxyNorm_mag = (gainTxy_mag / gainTxyMax_mag) gainTxyMean_mag = np.nanmean(gainTxyNorm_mag, axis=-1) phaseTxy_deg = FreqTrans.Phase(TxyArray.T.squeeze(), phaseUnit = 'deg', unwrap = True).T phaseTxy_deg[:, phaseTxy_deg[0] > 90] -= 360 phaseTxyMean_deg = np.nanmean(phaseTxy_deg, axis=-1) CxyArrayMin = np.nanmin(np.abs(CxyArray.T.squeeze()), axis=0) CxyArrayMax = np.nanmax(np.abs(CxyArray.T.squeeze()), axis=0) CxyArrayMean = np.nanmean(CxyArray.T.squeeze(), axis=0) fig = None fig = FreqTrans.PlotGainType(ampPeakFactor, gainTxyMean_mag, phaseTxyMean_deg, coher_nd = CxyArrayMean, gainUnc_mag = None, fig = fig, dB = False, color='r', label='Mean Estimate') fig = FreqTrans.PlotGainType(cmd, gainDF_mag, phaseDF_deg, coher_nd = None, gainUnc_mag = None, fig = fig, dB = False, color='k', label='Describing Function') # fig = FreqTrans.PlotGainType(ampPeakFactor, gainTxyNorm_mag, phaseTxy_deg, coher_nd = CxyArray, gainUnc_mag = None, fig = fig, dB = False, color='b', marker = '.', alpha = 0.5, linestyle = '', label='Estimates') ax = fig.get_axes() ax[0].fill_between(ampPeakFactor, np.min(gainTxyNorm_mag, axis = -1), np.max(gainTxyNorm_mag, axis = -1), color='b', alpha = 0.25, label='Estimate Range')