#colormesh(absolute(a.MagcomFilt[300*2, :, :, a.pwr2_ind]))#.show() #colormesh(absolute(a.MagcomFilt[350*2, :, :, a.pwr2_ind]))#.show() #colormesh(absolute(a.MagcomFilt[400*2, :, :, a.pwr2_ind]))#.show() #colormesh(absolute(a.MagcomFilt[450*2, :, :, a.pwr2_ind]))#.show() # #colormesh(absolute(a.MagcomFilt[235, :, :]))#.show() # #colormesh(a.frq2, a.yoko, absolute(a.MagcomFilt[289, :, :]))#.show() # #colormesh(absolute(a.MagcomFilt[:, :, 50]))#.show() from taref.core.api import process_kwargs from taref.physics.filtering import Filter from numpy import amax, array, swapaxes, angle, log10 filt = Filter(center=5, halfwidth=15) #a.pwr2_ind=1 a.frq2_ind = 0 if 0: def ifft_plot(self, **kwargs): process_kwargs(self, kwargs, pl="hannifft_{0}_{1}_{2}".format( self.filter_type, self.bgsub_type, self.name)) on_res = absolute(filt.window_ifft(self.MagcomData[50, :, 91])) #strt=absolute(self.filt.window_ifft(self.Magcom[:,self.start_ind])) #stop=absolute(self.filt.window_ifft(self.Magcom[:,self.stop_ind])) pl = line(filt.fftshift(on_res),
scatter(data[:, 0], data[:, 1]) #nps.data_buffer=pl1.savedata() pl1.show(nps, npr) if __name__ == "__main2__": pl.set_xlim(-6, 6) pl.set_ylim(3.5, 7.5) pl.savefig( r"/Users/thomasaref/Dropbox (Clan Aref)/Current stuff/Logbook/TA210715A88_cooldown210216/tex_source_files/TA88_processed/", "fit_fluxmap") pl1.show() if __name__ == "__main2__": from taref.physics.filtering import Filter from numpy import absolute b = Filter(center=0, halfwidth=40, reflect=False, N=len(a.yoko)) #Magcom=a.Magcom.transpose() Magfilt = array([ b.fft_filter(a.Magcom[m, :]) for m in range(len(a.frequency[a.indices])) ]) #.transpose() pl = line(b.fftshift(absolute(b.window_ifft(a.Magcom[261, :]))), color="red") line(b.fftshift(absolute(b.window_ifft(a.Magcom[240, :]))), pl=pl) pl = colormesh(a.MagAbs) colormesh(absolute(Magfilt)[:, 10:-10]).show() colormesh((absolute(Magfilt).transpose() - absolute(Magfilt[:, 20])).transpose()[:, 10:-10]).show() a.bgsub_type = "Complex" pl, pf = line(a.MagAbs[:, 517]) line(a.MagAbs[:, 519], color="red", pl=pl)
#data=hilbert(a.MagcomData, axis=1) #colormesh(absolute(data)).show() #data2d=a.MagcomData*exp(-2.0j*pi*f*t[10:-10]) #data2d1=decimate(data2d, q=q, ftype="fir") #T = 1.0 / 800.0 #x = np.linspace(0.0, N*T, N) #y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x) #>>> yf = fft(y) #>>> xf = np.linspace(0.0, 1.0/(2.0*T), N/2) # N=len(fs) # df=1.0/(fs[1]-fs[0])/2.0 # return linspace(-df/2.0, df/2.0, N) b=Filter(center=4465, halfwidth=85, reflect=False) t=a.frequency f=4.468e9 wi=b.window_ifft(a.Magcom[:, 25]) data=b.fft_filter(a.Magcom[:, 25]) #, 4380, 4550) #fd=fir_filter(data, 4380, 4550, numtaps=1000) data=data[10:-10]*exp(-2.0j*pi*f*t[10:-10]) q=200 #data=decimate(data, q=q, ftype="fir") #wi=window_ifft(data, shift=True) #xd=ifft_x(t, shift=True)[::q]/q pl=line(absolute(wi)) line(b.fftshift(b.freqz*max(absolute(wi))), pl=pl, color="green")
data=npr.read() scatter(data[:, 0], data[:, 1]) #nps.data_buffer=pl1.savedata() pl1.show(nps, npr) if __name__=="__main2__": pl.set_xlim(-6,6) pl.set_ylim(3.5, 7.5) pl.savefig(r"/Users/thomasaref/Dropbox (Clan Aref)/Current stuff/Logbook/TA210715A88_cooldown210216/tex_source_files/TA88_processed/", "fit_fluxmap") pl1.show() if __name__=="__main2__": from taref.physics.filtering import Filter from numpy import absolute b=Filter(center=0, halfwidth=40, reflect=False, N=len(a.yoko)) #Magcom=a.Magcom.transpose() Magfilt=array([b.fft_filter(a.Magcom[m,:]) for m in range(len(a.frequency[a.indices]))])#.transpose() pl=line(b.fftshift(absolute(b.window_ifft(a.Magcom[261, :]))), color="red") line(b.fftshift(absolute(b.window_ifft(a.Magcom[240, :]))), pl=pl) pl=colormesh(a.MagAbs) colormesh(absolute(Magfilt)[:, 10:-10]).show() colormesh((absolute(Magfilt).transpose()-absolute(Magfilt[:,20])).transpose()[:, 10:-10]).show() a.bgsub_type="Complex" pl, pf=line(a.MagAbs[:, 517]) line(a.MagAbs[:, 519], color="red", pl=pl) line(a.MagAbs[:, 521], color="green", pl=pl) pl, pf=line(a.freq_axis, a.qdt._get_VfFWHM(f=a.frequency)[0], color="blue") line(a.freq_axis, a.qdt._get_VfFWHM(f=a.frequency)[1], color="green", pl=pl)
data=npr.read() scatter(data[:, 0], data[:, 1]) #nps.data_buffer=pl1.savedata() pl1.show(nps, npr) if __name__=="__main__": pl.set_xlim(-6,6) pl.set_ylim(3.5, 7.5) pl.savefig(r"/Users/thomasaref/Dropbox (Clan Aref)/Current stuff/Logbook/TA210715A88_cooldown210216/tex_source_files/TA88_processed/", "fit_fluxmap") pl1.show() if __name__=="__main__": from taref.physics.filtering import Filter from numpy import absolute b=Filter(center=0, halfwidth=40, reflect=False, N=len(a.yoko)) #Magcom=a.Magcom.transpose() Magfilt=array([b.fft_filter(a.Magcom[m,:]) for m in range(len(a.frequency[a.indices]))])#.transpose() pl=line(b.fftshift(absolute(b.window_ifft(a.Magcom[261, :]))), color="red") line(b.fftshift(absolute(b.window_ifft(a.Magcom[240, :]))), pl=pl) pl=colormesh(a.MagAbs) colormesh(absolute(Magfilt)[:, 10:-10]).show() colormesh((absolute(Magfilt).transpose()-absolute(Magfilt[:,20])).transpose()[:, 10:-10]).show() a.bgsub_type="Complex" pl, pf=line(a.MagAbs[:, 517]) line(a.MagAbs[:, 519], color="red", pl=pl) line(a.MagAbs[:, 521], color="green", pl=pl) pl, pf=line(a.freq_axis, a.qdt._get_VfFWHM(f=a.frequency)[0], color="blue") line(a.freq_axis, a.qdt._get_VfFWHM(f=a.frequency)[1], color="green", pl=pl)
plot_name="stop {}".format(self.stop_ind), label="{:.4g}".format(self.stop_ind)) self.filt.N=len(on_res) filt=self.filt.freqz #filt=filt_prep(len(on_res), self.filt_start_ind, self.filt_end_ind) top=max([amax(on_res), amax(strt), amax(stop)]) line(self.time_axis, filt*top, plotter=pl, color="green", label="wdw") pl.xlabel=kwargs.pop("xlabel", self.time_axis_label) pl.ylabel=kwargs.pop("ylabel", "Mag abs") return pl pl2=ifft_plot(a)#.show() tstart=time() double_filt= array([a.filt.fft_filter(a.MagcomData[:,n]) for n in range(len(a.frq2))])#.transpose() filt=Filter(center=0, halfwidth=30) line(absolute(filt.fftshift(filt.window_ifft(double_filt[:, 69])))) filt.N=len(a.frq2) df=array([filt.fft_filter(double_filt[:, n]) for n in range(len(a.frequency))]) print time()-tstart print double_filt.shape #double_filt=swapaxes(double_filt, 0, 2) print double_filt.shape fi=69 print a.frequency[fi] colormesh(a.frq2, a.frequency, absolute(df)) colormesh(10*log10(absolute(double_filt[:, 10:-10]))).show() pl3=colormesh(a.yoko, a.frq2/1e9, absolute(double_filt[fi, :, :]).transpose(), xlabel="yoko (V)", ylabel="Freq 2 (GHz)", auto_xlim=False, x_min=2, x_max=2.9, auto_ylim=False, y_min=4, y_max=8, auto_zlim=False, vmax=0.02, vmin=0.006)#.show() #.show() #a.frq2, a.yoko, pl4=colormesh(a.yoko, a.frq2/1e9, absolute(double_filt[fi, :, :]).transpose()-absolute(double_filt[fi, :, 200]), xlabel="yoko (V)", ylabel="Freq 2 (GHz)",
line(self.time_axis, filt * top, plotter=pl, color="green", label="wdw") pl.xlabel = kwargs.pop("xlabel", self.time_axis_label) pl.ylabel = kwargs.pop("ylabel", "Mag abs") return pl pl2 = ifft_plot(a) #.show() tstart = time() double_filt = array([ a.filt.fft_filter(a.MagcomData[:, n]) for n in range(len(a.frq2)) ]) #.transpose() filt = Filter(center=0, halfwidth=30) line(absolute(filt.fftshift(filt.window_ifft(double_filt[:, 69])))) filt.N = len(a.frq2) df = array( [filt.fft_filter(double_filt[:, n]) for n in range(len(a.frequency))]) print time() - tstart print double_filt.shape #double_filt=swapaxes(double_filt, 0, 2) print double_filt.shape fi = 69 print a.frequency[fi] colormesh(a.frq2, a.frequency, absolute(df)) colormesh(10 * log10(absolute(double_filt[:, 10:-10]))).show() pl3 = colormesh(a.yoko, a.frq2 / 1e9,
print fstart, fstep print shape(Magvec), shape(self.yoko) sm=shape(Magvec)[0] sy=shape(data) #print sy s=(sm, sy[0], 1)#sy[2]) Magcom=Magvec[:,0, :]#+1j*Magvec[:,1, :] Magcom=reshape(Magcom, s, order="F") self.frequency=linspace(fstart, fstart+fstep*(sm-1), sm) self.MagcomData=squeeze(Magcom) print shape(self.MagcomData) self.stop_ind=len(self.yoko)-1 a=TA88_Lyzer(name="d0629", on_res_ind=240, filt=Filter(center=2, halfwidth=10, reflect=False),#read_data=read_data, # VNA_name="RS VNA", rd_hdf=TA88_Read(main_file="Data_0629/S4A4_just_gate_FFT_high_frq_n20dBm.hdf5"), fit_indices=[range(48,154+1), range(276, 578+1)], desc="Gate high frequency", ) #a.filt.center=0 #a.filt.halfwidth=50 #a.filt.reflect=True #, window_ifft, fir_filt_prep, fir_filter, fir_freqz, fft_filt_prep, fft_filter, ifft_x from scipy.signal import decimate, resample from numpy import exp, log10 from time import time #a.filt.center=26