freq = freq1[::-1] LOfreq = 5150 # MHz freq = LOfreq - freq #get the on board filter normalized attenuation fref = 1400 # MHz fname = 'SXBP-1430-75+___Plus25degC.S2P' data = utils.readminicircuitdata(filterfolder + fname) freqfilt = data[0] gainfilt = data[1] attenatfref = np.interp([fref],freqfilt,gainfilt) print 'attenat ref = ' , attenatfref normedgain = gainfilt - attenatfref #get the cable loss from data meascable = utils.getjacquesmeas(filterfolder+'/scope_46.csv',filterfolder+'/scope_47.csv') #interpolate the gains to add them: newgainlnb = np.interp(freqfilt,freq,gainlnb) newgaincable = np.interp(freqfilt,meascable[0],meascable[1]) totgain = newgainlnb + normedgain + newgaincable gainlin = np.power(10, (totgain)/10) #newgainlin = gainlin[ (freqfilt > 500 ) & (freqfilt <2000)] newgainlin = gainlin sum = np.sum(newgainlin)*(freqfilt[1]- freqfilt[0])*1e6 print 'sum = ' , sum print 'sum dB = ' , 10*np.log10(sum)
data = utils.readminicircuitdata(basefolder + fname) freq = data[0] gain = data[1] attenatfref = np.interp([fref],freq,gain) allgain.append(gain) plt.plot(freq,gain,label=filt) allgainnp = np.ndarray(shape=(len(allgain),len(allgain[0]))) counter = 0 for gain in allgain: allgainnp[counter] = gain counter +=1 meangain = np.mean(allgainnp,axis=0) #print allgain measdata = utils.getjacquesmeas(basefolder+'/scope_42.csv',basefolder+'/scope_43.csv') plt.plot(freq,meangain,'k',lw=2,label='average const.') plt.plot(measdata[0]*1000,measdata[1],'r',lw=2,label='meas. data') ################################################ ### for the board filter (helix) ##### ################################################ if typeoffilter == 'boardhelix': fname = 'CBP-B1230C+_Plus25DegC.s2p' data = utils.readminicircuitdata(basefolder + fname) freq = data[0] gain = data[1] attenatfref = np.interp([fref],freq,gain) plt.plot(freq,gain - attenatfref,label='board filter helix')
lnagain = [] for sn in snarray: fgainname = datafolder2 + 'wenteqS21'+ sn + '.csv' data = utils.readcsv(fgainname) lnagain.append(data) # get the on board filter data (CBP-B1230C+_Plus25DegC.s2p) fref = 1400 #MHz freq to be normalized to (because resistor calibration was done at this frequency) fname = '/CBP-B1230C+_Plus25DegC.s2p' boardfilter = utils.readminicircuitdata(basefolder + fname) # (return [freq,gain]) attenatfref = np.interp([fref],boardfilter[0],boardfilter[1]) boardfilter[1] = boardfilter[1] - attenatfref # normalize the gain to the reference frequency #get the biasT filter from data measbiast = utils.getjacquesmeas(basefolder+'/scope_42.csv',basefolder+'/scope_43.csv') #get the cable loss from data meascable = utils.getjacquesmeas(basefolder+'/scope_43.csv',basefolder+'/scope_44.csv') #we interpolate w.r.t. the constructor data: freq = boardfilter[0] newmeasbiast = np.interp(freq,measbiast[0]*1000,measbiast[1]) newmeascable = np.interp(freq,meascable[0]*1000,meascable[1]) totgains = [] gainbw = np.array([]) for lnag in lnagain: newgain = np.interp(freq,lnag[0],lnag[1]) totgain = newgain + boardfilter[1]+ newmeasbiast + newmeascable # totgain = newgain + boardfilter[1] + newmeasbiast + newmeascable