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=10*log10(absolute(self.filt.window_ifft(self.MagcomData[:,0]))) pl=line(self.time_axis-0.05863, self.filt.fftshift(on_res), color="purple", plot_name="onres_{}".format(self.on_res_ind), alpha=0.8, label="IFFT", **kwargs) 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=36.0#amax(on_res) line(self.time_axis-0.05863, filt*top-70, plotter=pl, color="green", linestyle="dotted", label="Filter window") pl.xlabel=kwargs.pop("xlabel", self.time_axis_label) pl.ylabel=kwargs.pop("ylabel", "Mag abs") scatter(array([0.05863, 0.2, 0.337, 0.48, 0.761, 1.395, 1.455])-0.05863, array([0.0, 500.0, 1000.0, 1500.0, 2500.0, 4500, 200+2500+2500-300])/100.0-60, marker_size=4.0, pl=pl, label="IFFT peak") t=linspace(0,2,1001) #self.time_axis-0.05863 line(t, 3488.0*t/100.0-60, pl=pl, color="black", linestyle="dashed", auto_xlim=False, x_min=-0.2, x_max=1.0, auto_ylim=False, y_min=-65, y_max=-15, label="$d=v_ft$") t=array([8.7e-8, 2.64e-7, 3.79e-7, 4.35e-7, 6.6e-7])-8.7e-8 scatter(t*1e6, array([0.0, 600.0, 1000.0, 1200.0, 2000.0])/100.0-60, pl=pl, facecolor="red", edgecolor="red", label="100 ns pulse", marker_size=4.0) pl.legend() #b.line_plot("spd_fit", t*1e6, (t*qdt.vf)*1e6, label="(3488 m/s)t") return pl
def flux_plots(): data=npr.read() frequency=linspace(3.5e9, 7.5e9, 1000) freq=append(frequency/1e9, frequency/1e9) freq=append(freq, freq) V=qdt._get_Vfq0_many(f=frequency)[1] pl1=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="fitVvsf") line(freq, V, pl=pl1, ylabel="Yoko (V)", xlabel="Frequency (GHz)") pl1.add_label("a)") V2=ideal_qdt._get_Vfq0_many(f=frequency)[1] pl2=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="idealVvsf") line(freq, V2, pl=pl2, ylabel="Yoko (V)", xlabel="Frequency (GHz)") pl2.add_label("b)") pl3=scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="fitfvsV") line(V, freq, pl=pl3, xlabel="Yoko (V)", ylabel="Frequency (GHz)") pl3.add_label("c)") pl4=scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="idealfvsV") line(V2, freq, pl=pl4, xlabel="Yoko (V)", ylabel="Frequency (GHz)") pl4.add_label("d)") #pls=[pl1, pl2, pl3, pl4] #for pl in pls: return [pl1, pl2, pl3, pl4]
def plot_widths(self, plotter=None): print "first fit" tstart = time() #fit_p=self.fano_fit(440) #print self.p_guess, fit_p #fit=lorentzian(self.yoko, fit_p[1:]) #pl, pf=line(self.yoko, self.MagAbsFilt_sq[440, :]) #line(self.yoko, fit, plotter=pl, color="red") fit_params = self.full_fano_fit() pl, pf = scatter(self.frequency, absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, self.qdt._get_coupling(self.frequency) + 18e6, plotter=pl) pl, pf = scatter(self.frequency, fit_params[2, :], color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, flux_par3(self), plotter=pl) print "fit second", tstart - time() tstart = time() fq_vec = array([ sqrt(f * (f - 2 * self.qdt._get_Lamb_shift(f=f))) for f in self.frequency ]) pl, pf = scatter(fit_params[2, :], fq_vec, color="red") #flux_d_flux0=self.qdt._get_flux_over_flux0(voltage=self.yoko, offset=0.0) fq = self.qdt._get_flux_parabola(voltage=self.yoko, offset=0.0) line(self.yoko, fq, plotter=pl) #fit_params=self.full_fano_fit2() #def rpt_fit2(self): # MagAbsFilt_sq=self.MagAbsFilt**2 # return rpt_fit(lorentzian2, self.p_guess, MagAbsFilt_sq[440, :], self.yoko) #fit2_p=rpt_fit2(self) #print fit2_p #fit2=lorentzian2(self.yoko, *fit2_p) #line(self.yoko, fit2, plotter=pl, color="green") #scatter(absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) print "fit third", tstart - time() tstart = time() #fit_params=self.full_fano_fit3() #scatter(absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) print "fit done", tstart - time()
def flux_plots(): data = npr.read() frequency = linspace(3.5e9, 7.5e9, 1000) freq = append(frequency / 1e9, frequency / 1e9) freq = append(freq, freq) V = qdt._get_Vfq0_many(f=frequency)[1] pl1 = scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="fitVvsf") line(freq, V, pl=pl1, ylabel="Yoko (V)", xlabel="Frequency (GHz)") pl1.add_label("a)") V2 = ideal_qdt._get_Vfq0_many(f=frequency)[1] pl2 = scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="idealVvsf") line(freq, V2, pl=pl2, ylabel="Yoko (V)", xlabel="Frequency (GHz)") pl2.add_label("b)") pl3 = scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="fitfvsV") line(V, freq, pl=pl3, xlabel="Yoko (V)", ylabel="Frequency (GHz)") pl3.add_label("c)") pl4 = scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="idealfvsV") line(V2, freq, pl=pl4, xlabel="Yoko (V)", ylabel="Frequency (GHz)") pl4.add_label("d)") #pls=[pl1, pl2, pl3, pl4] #for pl in pls: return [pl1, pl2, pl3, pl4]
def lgf_test_plot(self, pl="lgf_test", **kwargs): """test plot of legendre functions to legendre polynomials using Legendre class""" nu_max = 30 v_arr = linspace(-1.0, nu_max, 1000) print "start plot" pl = line(v_arr, self.Pv(v_arr, 0.0), pl=pl, color="blue", linewidth=0.5, label=r"$P_{\nu}(0)$") line(v_arr, self.Pv(v_arr, 0.25), pl=pl, color="red", linewidth=0.5, label=r"$P_{\nu}(0.25)$") line(v_arr, self.Pv(v_arr, 0.5), pl=pl, color="green", linewidth=0.5, label=r"$P_{\nu}(0.5)$") line(v_arr, self.Pv(v_arr, 0.75), pl=pl, color="purple", linewidth=0.5, label=r"$P_{\nu}(0.75)$") print "stop plot" if 1: for nu in range(nu_max): scatter(array([nu]), array([legendre(nu)(0.0)]), pl=pl, color="blue", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.25)]), pl=pl, color="red", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.5)]), pl=pl, color="green", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.75)]), pl=pl, color="purple", marker_size=3.0) pl.xlabel = r"$\nu$" pl.ylabel = r"$P_{\nu}(x)$" pl.legend() pl.set_ylim(-0.75, 1.5) return pl
def plot_widths(self, plotter=None): print "first fit" #tstart=time() #fq_vec=array([sqrt(f*(f-2*self.qdt._get_Lamb_shift(f=f))) for f in self.frequency]) #fit_p=self.fano_fit(263, fq_vec) #print self.p_guess, fit_p #fit=lorentzian(fq_vec, fit_p[1:]) #pl, pf=line(fq_vec, self.MagAbsFilt_sq[263, :]) #line(fq_vec, fit, plotter=pl, color="red") #pl.show() print self.ls_f.shape, self.yoko.shape fit_params = self.full_fano_fit(self.fq) print(fit_params[1, :]).shape pl, pf = scatter(self.frequency[self.indices], absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, self.qdt._get_coupling(self.frequency) + 0 * 1.8e6, plotter=pl) return pl
def flux_plots(): data = npr.read() frequency = linspace(3.5e9, 7.5e9, 1000) freq = append(frequency / 1e9, frequency / 1e9) freq = append(freq, freq) qdt.gate_type = "constant" #"capacitive" V = qdt._get_Vfq0_many(f=frequency)[1] #pl1=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="fitVvsf") #line(freq, V, pl=pl1, ylabel="Yoko (V)", xlabel="Frequency (GHz)") #pl1.add_label("a)") #V2=ideal_qdt._get_Vfq0_many(f=frequency)[1] #pl2=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="idealVvsf") #line(freq, V2, pl=pl2, ylabel="Yoko (V)", xlabel="Frequency (GHz)") #pl2.add_label("b)") flux = qdt._get_flux_over_flux0(voltage=data[:, 1], offset=a.offset, flux_factor=a.flux_factor) pl3 = scatter( flux, data[:, 0], color="red", pl=pl, ) # auto_xlim=False, x_min=-3, x_max=3) flux = qdt._get_flux_over_flux0(V, offset=a.offset, flux_factor=a.flux_factor) line(flux, freq, pl=pl3, xlabel="$\Phi/\Phi_0$ ", ylabel="Frequency (GHz) ", color="red") voltage = linspace(-6, 6, 1001) flux = qdt._get_flux_over_flux0(voltage=voltage, offset=a.offset, flux_factor=a.flux_factor) line(flux, qdt._get_flux_parabola(voltage=voltage, ng=0.0) / 1e9, pl=pl, color="green") #.show() #pl3.add_label("c)") #pl4=scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="idealfvsV") #line(V2, freq, pl=pl4, xlabel="Yoko (V)", ylabel="Frequency (GHz)") #pl4.add_label("d)") #pls=[pl1, pl2, pl3, pl4] #for pl in pls: return pl3 #[pl1, pl2, pl3, pl4]
def center_plot(self, **kwargs): process_kwargs(self, kwargs, pl="center2_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) pl = scatter(array(self.flat_indices), array([fp[1] for fp in self.fit_params]), **kwargs) return pl
def widths_plot(self, **kwargs): process_kwargs(self, kwargs, pl="widths2_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) pl = scatter(array(self.flat_indices), absolute([fp[0] for fp in self.fit_params]), **kwargs) return pl
def plot_widths(self, plotter=None): print "first fit" tstart=time() fq_vec=array([sqrt(f*(f-2*self.qdt._get_Lamb_shift(f=f))) for f in self.frequency]) #fit_p=self.fano_fit(263, fq_vec) #print self.p_guess, fit_p #fit=lorentzian(fq_vec, fit_p[1:]) #pl, pf=line(fq_vec, self.MagAbsFilt_sq[263, :]) #line(fq_vec, fit, plotter=pl, color="red") #pl.show() fit_params=self.full_fano_fit(fq_vec) pl, pf=scatter(self.frequency, absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, self.qdt._get_coupling(self.frequency)+18e6, plotter=pl) pl, pf=scatter(self.frequency, fit_params[2, :], color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, fq_vec, #flux_par3(self), plotter=pl) print "fit second", tstart-time() tstart=time() fq_vec=array([sqrt(f*(f-2*self.qdt._get_Lamb_shift(f=f))) for f in self.frequency]) pl, pf = scatter(fit_params[2, :], fq_vec, color="red") #flux_d_flux0=self.qdt._get_flux_over_flux0(voltage=self.yoko, offset=0.0) fq=self.qdt._get_flux_parabola(voltage=self.yoko, offset=0.0) line(self.yoko, fq, plotter=pl) #fit_params=self.full_fano_fit2() #def rpt_fit2(self): # MagAbsFilt_sq=self.MagAbsFilt**2 # return rpt_fit(lorentzian2, self.p_guess, MagAbsFilt_sq[440, :], self.yoko) #fit2_p=rpt_fit2(self) #print fit2_p #fit2=lorentzian2(self.yoko, *fit2_p) #line(self.yoko, fit2, plotter=pl, color="green") #scatter(absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) print "fit third", tstart-time() tstart=time() #fit_params=self.full_fano_fit3() #scatter(absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) print "fit done", tstart-time()
def center_plot(self, **kwargs): process_kwargs(self, kwargs, pl="center_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) pl=scatter(self.freq_axis[self.flat_indices], array([fp[1] for fp in self.fit_params]), **kwargs) if self.show_quick_fit: if self.flux_axis_type=="fq": line(self.freq_axis[self.indices], self.ls_f[self.indices]/1e9, plotter=pl, color="red", linewidth=1.0) elif self.flux_axis_type=="yoko": line(self.freq_axis[self.indices], self.qdt._get_Vfq0(f=self.frequency[self.indices]), plotter=pl, color="red", linewidth=1.0) else: line(self.freq_axis, self.qdt._get_fluxfq0(f=self.frequency), plotter=pl, color="red", linewidth=1.0) if self.fitter.p_guess is not None: line(self.freq_axis[self.indices], array([pg[1] for pg in self.fitter.p_guess]), pl=pl, color="green", linewidth=1.0) #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") return pl
def widths_plot(self, **kwargs): process_kwargs(self, kwargs, pl="widths_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) pl=scatter(self.freq_axis[self.flat_indices], absolute([fp[0] for fp in self.fit_params]), **kwargs) if self.show_quick_fit: if self.flux_axis_type=="fq": #line(self.freq_axis[self.indices], self.qdt._get_coupling(f=self.frequency[self.indices])/1e9, plotter=pl, color="red") line(self.freq_axis[self.indices], self.qdt._get_fFWHM(f=self.frequency[self.indices])[2]/2.0/1e9, plotter=pl, color="red") elif self.flux_axis_type=="yoko": line(self.freq_axis[self.indices], self.qdt._get_VfFWHM(f=self.frequency[self.indices])[2]/2.0, pl=pl, color="red") #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") else: line(self.freq_axis[self.indices], self.qdt._get_fluxfFWHM(f=self.frequency[self.indices])[2]/2.0, pl=pl, color="red") #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") if self.fitter.p_guess is not None: line(self.freq_axis[self.flat_indices], array([pg[0] for pg in self.fitter.p_guess]), pl=pl, color="green") #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") return pl
def lgf_plot(pl="legendre", **kwargs): """test plot of legendre functions compared to legendre polynomials""" nu_max = 30 v_arr = linspace(-1.0, nu_max, 1000) print "start plot" pl = line(v_arr, lgf_arr(v_arr, 0.0), pl=pl, color="blue", linewidth=0.5, label=r"$P_{\nu}(0)$")[0] line(v_arr, lgf_arr(v_arr, 0.25, nu_max), pl=pl, color="red", linewidth=0.5, label=r"$P_{\nu}(0.25)$") line(v_arr, lgf_arr(v_arr, 0.5, nu_max), pl=pl, color="green", linewidth=0.5, label=r"$P_{\nu}(0.5)$") line(v_arr, lgf_arr(v_arr, 0.75, nu_max), pl=pl, color="purple", linewidth=0.5, label=r"$P_{\nu}(0.75)$") print "stop plot" for nu in range(nu_max): scatter(array([nu]), array([legendre(nu)(0.0)]), pl=pl, color="blue") scatter(array([nu]), array([legendre(nu)(0.25)]), pl=pl, color="red") scatter(array([nu]), array([legendre(nu)(0.5)]), pl=pl, color="green") scatter(array([nu]), array([legendre(nu)(0.75)]), pl=pl, color="purple") pl.xlabel = r"$\nu$" pl.ylabel = r"$P_{\nu}(x)$" pl.legend() pl.set_ylim(-0.75, 1.5) return pl
def flux_plots(): data=npr.read() frequency=linspace(3.5e9, 7.5e9, 1000) freq=append(frequency/1e9, frequency/1e9) freq=append(freq, freq) qdt.gate_type="constant" #"capacitive" V=qdt._get_Vfq0_many(f=frequency)[1] #pl1=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="fitVvsf") #line(freq, V, pl=pl1, ylabel="Yoko (V)", xlabel="Frequency (GHz)") #pl1.add_label("a)") #V2=ideal_qdt._get_Vfq0_many(f=frequency)[1] #pl2=scatter(data[:, 0], data[:, 1], fig_width=6.0, fig_height=4.0, color="red", pl="idealVvsf") #line(freq, V2, pl=pl2, ylabel="Yoko (V)", xlabel="Frequency (GHz)") #pl2.add_label("b)") flux=qdt._get_flux_over_flux0(voltage=data[:,1], offset=a.offset, flux_factor=a.flux_factor) pl3=scatter(flux, data[:, 0], color="red", pl=pl,) # auto_xlim=False, x_min=-3, x_max=3) flux=qdt._get_flux_over_flux0(V, offset=a.offset, flux_factor=a.flux_factor) line(flux, freq, pl=pl3, xlabel="$\Phi/\Phi_0$ ", ylabel="Frequency (GHz) ", color ="red") voltage=linspace(-6,6, 1001) flux=qdt._get_flux_over_flux0(voltage=voltage, offset=a.offset, flux_factor=a.flux_factor) line(flux, qdt._get_flux_parabola(voltage=voltage, ng=0.0)/1e9, pl=pl, color="green")#.show() #pl3.add_label("c)") #pl4=scatter(data[:, 1], data[:, 0], fig_width=6.0, fig_height=4.0, color="red", pl="idealfvsV") #line(V2, freq, pl=pl4, xlabel="Yoko (V)", ylabel="Frequency (GHz)") #pl4.add_label("d)") #pls=[pl1, pl2, pl3, pl4] #for pl in pls: pl.axes.set_xticks(linspace(-1, 1, 3)) pl.axes.set_yticks(linspace(4, 7, 4)) return pl3 #[pl1, pl2, pl3, pl4]
def lgf_test_plot(self, pl="lgf_test", **kwargs): """test plot of legendre functions to legendre polynomials using Legendre class""" nu_max=30 v_arr=linspace(-1.0, nu_max, 1000) print "start plot" pl=line(v_arr, self.Pv(v_arr, 0.0), pl=pl, color="blue", linewidth=0.5, label=r"$P_{\nu}(0)$") line(v_arr, self.Pv(v_arr, 0.25), pl=pl, color="red", linewidth=0.5, label=r"$P_{\nu}(0.25)$") line(v_arr, self.Pv(v_arr, 0.5), pl=pl, color="green", linewidth=0.5, label=r"$P_{\nu}(0.5)$") line(v_arr, self.Pv(v_arr, 0.75), pl=pl, color="purple", linewidth=0.5, label=r"$P_{\nu}(0.75)$") print "stop plot" if 1: for nu in range(nu_max): scatter(array([nu]), array([legendre(nu)(0.0)]), pl=pl, color="blue", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.25)]), pl=pl, color="red", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.5)]), pl=pl, color="green", marker_size=3.0) scatter(array([nu]), array([legendre(nu)(0.75)]), pl=pl, color="purple", marker_size=3.0) pl.xlabel=r"$\nu$" pl.ylabel=r"$P_{\nu}(x)$" pl.legend() pl.set_ylim(-0.75, 1.5) return pl
def lgf_plot(pl="legendre", **kwargs): """test plot of legendre functions compared to legendre polynomials""" nu_max=30 v_arr=linspace(-1.0, nu_max, 1000) print "start plot" pl=line(v_arr, lgf_arr(v_arr, 0.0), pl=pl, color="blue", linewidth=0.5, label=r"$P_{\nu}(0)$")[0] line(v_arr, lgf_arr(v_arr, 0.25, nu_max), pl=pl, color="red", linewidth=0.5, label=r"$P_{\nu}(0.25)$") line(v_arr, lgf_arr(v_arr, 0.5, nu_max), pl=pl, color="green", linewidth=0.5, label=r"$P_{\nu}(0.5)$") line(v_arr, lgf_arr(v_arr, 0.75, nu_max), pl=pl, color="purple", linewidth=0.5, label=r"$P_{\nu}(0.75)$") print "stop plot" for nu in range(nu_max): scatter(array([nu]), array([legendre(nu)(0.0)]), pl=pl, color="blue") scatter(array([nu]), array([legendre(nu)(0.25)]), pl=pl, color="red") scatter(array([nu]), array([legendre(nu)(0.5)]), pl=pl, color="green") scatter(array([nu]), array([legendre(nu)(0.75)]), pl=pl, color="purple") pl.xlabel=r"$\nu$" pl.ylabel=r"$P_{\nu}(x)$" pl.legend() pl.set_ylim(-0.75, 1.5) return pl
def plot_widths(self, plotter=None): print "first fit" #tstart=time() #fq_vec=array([sqrt(f*(f-2*self.qdt._get_Lamb_shift(f=f))) for f in self.frequency]) #fit_p=self.fano_fit(263, fq_vec) #print self.p_guess, fit_p #fit=lorentzian(fq_vec, fit_p[1:]) #pl, pf=line(fq_vec, self.MagAbsFilt_sq[263, :]) #line(fq_vec, fit, plotter=pl, color="red") #pl.show() print self.ls_f.shape, self.yoko.shape fit_params=self.full_fano_fit(self.fq) print (fit_params[1, :]).shape pl, pf=scatter(self.frequency[self.indices], absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name)) line(self.frequency, self.qdt._get_coupling(self.frequency)+0*1.8e6, plotter=pl) return pl
def widths_plot(self, **kwargs): process_kwargs(self, kwargs, pl="widths_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) pl = scatter(self.freq_axis[self.flat_indices], absolute([fp[0] for fp in self.fit_params]), **kwargs) if self.show_quick_fit: if self.flux_axis_type == "fq": #line(self.freq_axis[self.indices], self.qdt._get_coupling(f=self.frequency[self.indices])/1e9, plotter=pl, color="red") line(self.freq_axis[self.indices], self.qdt._get_fFWHM(f=self.frequency[self.indices])[2] / 2.0 / 1e9, plotter=pl, color="red") elif self.flux_axis_type == "yoko": line( self.freq_axis[self.indices], self.qdt._get_VfFWHM(f=self.frequency[self.indices])[2] / 2.0, pl=pl, color="red" ) #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") else: line( self.freq_axis[self.indices], self.qdt._get_fluxfFWHM(f=self.frequency[self.indices])[2] / 2.0, pl=pl, color="red" ) #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") if self.fitter.p_guess is not None: line( self.freq_axis[self.flat_indices], array([pg[0] for pg in self.fitter.p_guess]), pl=pl, color="green" ) #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") return pl
def center_plot(self, **kwargs): process_kwargs(self, kwargs, pl="center_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) # line(frequency/1e9, frequency/1e9-qdt._get_Lamb_shift(f=frequency)/1.0/1e9, plotter=pl, color="blue") #pl=scatter(self.freq_axis[self.flat_indices], array([fp[1] for fp in self.fit_params])-self.freq_axis[self.flat_indices], **kwargs) pl = scatter(array([fp[1] for fp in self.fit_params]), self.freq_axis[self.flat_indices], **kwargs) # if self.show_quick_fit: # if self.flux_axis_type=="fq": # line(self.freq_axis[self.indices], self.ls_f[self.indices]/1e9, plotter=pl, color="red", linewidth=1.0) # elif self.flux_axis_type=="yoko": # line(self.freq_axis[self.indices], self.qdt._get_Vfq0(f=self.frequency[self.indices]), plotter=pl, color="red", linewidth=1.0) # else: # line(self.freq_axis, self.qdt._get_fluxfq0(f=self.frequency), plotter=pl, color="red", linewidth=1.0) # if self.fitter.p_guess is not None: # line(self.freq_axis[self.indices], array([pg[1] for pg in self.fitter.p_guess]), pl=pl, color="green", linewidth=1.0) #self.voltage_from_frequency(self.qdt._get_coupling(self.frequency)), plotter=pl, color="red") return pl
return data #print argers(gamma/2.0) gamma_frac=linspace(0.5, 20.0, 1001) gd=gamma/gamma_frac #print array([argers(g)[-1] for g in gd]) pl1=line(gd*Np/f0*2*pi, array([argers(g)[-1] for g in gd])/f0, pl=pl, auto_xlim=False, x_min=0.0, x_max=20.0, auto_ylim=False, y_min=0.8, y_max=1.2, xlabel="$N_p\Gamma_0/f_0$", ylabel="Frequency ($f_0$)", color="red") pl1=line(gd*Np/f0*2*pi, array([argers(g)[-2] for g in gd])/f0, pl=pl, color="red") #pl1=line(gd*Np/f0*2*pi, array([argers(g)[0] for g in gd])/f0, pl=pl) line(array([0.0, 20.0]), array([1.0, 1.0]), color="green", pl=pl) scatter(array([1.0, 1.0])*gamma*Np/f0*2*pi, array([4.85, 5.75])/f0, pl=pl, marker_size=3.0) #scatter(array([1.0, 1.0, 1.0])*gamma*Np/f0*2*pi, array([5.694, 5.414, 4.784])/f0, pl=pl, marker_size=3.0) scatter(array([2.9,]), array([1.0]), pl=pl, marker_size=3.0, facecolor="black", edgecolor="black") pl.axes.set_xticks(linspace(0, 20, 5)) pl.axes.set_yticks(linspace(0.8, 1.2, 5)) # def coup(G): # inner=(1.0/3.0-5.0/(2*pi*9*G))*15 # if inner<0: # return 0.0 # return sqrt(inner) # # from numpy import sin # f0=qdt.f0/1e9
rd_hdf=TA88_Read(main_file="Data_0222/S4A1_TA88_powswp.hdf5"), desc="looking", swp_type="yoko_first", ) b.filt.center=18 b.filt.halfwidth=10 b.fitter.fit_type="lorentzian" b.fitter.gamma=0.05 #0.01 b.flux_axis_type="fq" #"flux" b.end_skip=10 b.save_folder.main_dir=b.name if __name__=="__main__": if 0: b.read_data() scatter(absolute(b.MagcomFilt[50, 370, :])) colormesh(absolute(b.MagcomFilt[50, :, :]))#.show() b.magabs_colormesh() b.ifft_plot() b.filter_type="FFT" #b.ifft_plot() b.pwr_ind=0 b.magabs_colormesh() b.pwr_ind=3 b.magabs_colormesh() b.pwr_ind=6 b.magabs_colormesh() b.pwr_ind=9 b.magabs_colormesh().show()
name="magabs_{}".format(self.name)) pl, pf = colormesh(self.yoko, fq_vec / 1e9, (absolute(Magfilt.transpose() - 0.0 * Magfilt[:, 0])).transpose(), plotter=pl) if __name__ == "__main2__": pl = magabs_colormesh3(s3a4_wg) #flux_par3(s3a4_wg, pl=pl) magfilt_cmesh(s3a4_wg) ifft_plot(s3a4_wg) print "start" fit_params = s3a4_wg.full_fano_fit2() print "done" scatter(absolute(fit_params[1, :])) s3a4_wg.plot_widths() pl.show() #new_flux(s3a4_wg, pl=pl).show() #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_colormap.png") #flux_par3(s3a4_wg, pl=pl)#.show()#, f0=5.45e9, alpha=1.0) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_colormap_bothpar.png") #pl=line_cs2(s3a4_wg, ind=156) #pl=line_cs(s3a4_wg, 190) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_cs_5p4.pdf") #pl=line_cs(s3a4_wg, 210) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/",
class Coil_Lyzer(TA88_Lyzer): current = Array().tag(unit="V", plot=True, label="Current", sub=True) a = Coil_Lyzer( read_data=read_data, rd_hdf=TA88_Read(main_file="Data_1011/test_coil_setup_overnight.hdf5")) a.read_data() #print a.yoko #print a.current pf = polyfit(a.yoko, a.current, 3) print pf p = poly1d(pf) pl = scatter(a.yoko, a.current) line(a.yoko, p(a.yoko), pl=pl) #.show() #pl=scatter(a.yoko, a.current) endskip = 0 mean_yoko = (a.yoko[1500 - endskip:500 + endskip:-1] + a.yoko[1500 + endskip:2500 - endskip] + a.yoko[3500 - endskip:2500 + endskip:-1] + a.yoko[3500 + endskip:4500 - endskip]) / 4.0 mean_current = (a.current[1500 - endskip:500 + endskip:-1] + a.current[1500 + endskip:2500 - endskip] + a.current[3500 - endskip:2500 + endskip:-1] + a.current[3500 + endskip:4500 - endskip]) / 4.0 #mean_current=(a.current[1499:501:-1]+a.current[1501:2499]+a.current[3499:2501:-1]+a.current[3501:4499])/4.0 line(a.yoko, a.current - p(a.yoko)) #.show() line(a.yoko)
fig_width=7.2 fig_height=2.5 if __name__=="__main__": pl="fig2" nskip=50 magfilt=MagcomFilt(d1122) magabs=absolute(magfilt) pl=scatter(d1122.frequency[::nskip]/1e9, 20.0*log10(magabs[::nskip])-bg_A4(d1122.frequency[::nskip]), facecolor="blue", edgecolor="blue", pl=pl, nrows=1, ncols=3, nplot=1, fig_width=fig_width, fig_height=fig_height, marker_size=10) #idt.Np=56 #idt.f0=4.46e9 #4.452 #idt.K2=0.032 #idt.Np=36.5 #idt.f0=4.452e9 (S11, S12, S13, S21, S22, S23, S31, S32, S33)=idt._get_simple_S(f=d1122.frequency)
def phase_ed(self): return a.frequency[a.indices]/1e9, angle(a.Magcom[:,1]*exp(1j*a.frequency[a.indices]*self.ed))#+a.frequency[0]*self.ed a.filter_type="FFT" b=ElectricalDelay() b.plotter pl=colormesh(angle(a.Magcom[a.flat_indices].transpose()*exp(1j*a.frequency[a.flat_indices]*b.ed))) a.MagAbsFit print a.fitter.fit_params #colormesh(-0.5+1.5/6.0*angle([1.0-1.0/(1.0+1.0j*(a.yoko-absolute(fp[1]))/absolute(fp[0])) for n, fp in enumerate(a.fitter.fit_params)]).transpose(), pl=pl)#a.fitter.fit_params[0])) #b.show() #print diff(a.Phase[0, :]) from numpy import unwrap scatter(unwrap(a.Phase[:,0], discont=3)).show() line(diff(a.Phase[:,0])).show() #pl=a.magabs_colormesh()#magabs_colormesh3(s3a4_wg) #pl=a.hann_ifft_plot() #pl=a.ifft_plot() #a.filt_compare(a.on_res_ind) #filt=filt_prep(601, s3a4_wg.filt_start_ind, s3a4_wg.filt_end_ind) #line(filt*0.001, plotter=pl) #colormesh(s3a4_wg.MagAbsFilt)#, plotter="magabsfilt_{}".format(self.name)) pl=a.magabs_colormesh() #a.phase_colormesh()#.show() a.filter_type="FFT" #a.filt.filter_type="FFT" pl=a.magabs_colormesh()
Magfilt=array([fft_filter(Magcom[:,n], self.filt_start_ind, self.filt_end_ind) for n in range(len(self.yoko))]).transpose() Magfilt2=array([fft_filter(Magcom[:,n], 0, 34) for n in range(len(self.yoko))]).transpose() pl=Plotter(fig_width=9.0, fig_height=6.0, name="magabs_{}".format(self.name)) pl, pf=colormesh(self.yoko, fq_vec/1e9, (absolute(Magfilt.transpose()-0.0*Magfilt[:,0])).transpose(), plotter=pl) if __name__=="__main__": pl=magabs_colormesh3(s3a4_wg) #flux_par3(s3a4_wg, pl=pl) magfilt_cmesh(s3a4_wg) ifft_plot(s3a4_wg) print "start" fit_params=s3a4_wg.full_fano_fit2() print "done" scatter(absolute(fit_params[1, :])) s3a4_wg.plot_widths() pl.show() #new_flux(s3a4_wg, pl=pl).show() #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_colormap.png") #flux_par3(s3a4_wg, pl=pl)#.show()#, f0=5.45e9, alpha=1.0) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_colormap_bothpar.png") #pl=line_cs2(s3a4_wg, ind=156) #pl=line_cs(s3a4_wg, 190) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/", # fig_name="wide_gate_cs_5p4.pdf") #pl=line_cs(s3a4_wg, 210) #pl.savefig(dir_path="/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/Graphs_0425/",
a.fitter.gamma = 0.05 #0.01 a.flux_axis_type = "fq" #"flux" a.end_skip = 10 a.save_folder.main_dir = a.name b.filt.center = 18 b.filt.halfwidth = 10 b.fitter.fit_type = "lorentzian" b.fitter.gamma = 0.05 #0.01 b.flux_axis_type = "fq" #"flux" b.end_skip = 10 b.save_folder.main_dir = b.name if __name__ == "__main__": b.read_data() scatter(absolute(b.MagcomFilt[280, 62, :])) colormesh(absolute(b.MagcomFilt[280, :, :])).show() b.magabs_colormesh() b.ifft_plot() b.filter_type = "FFT" #b.ifft_plot() b.pwr_ind = 0 b.magabs_colormesh() b.pwr_ind = 3 b.magabs_colormesh() b.pwr_ind = 6 b.magabs_colormesh() b.pwr_ind = 9 b.magabs_colormesh().show()
#a.bgsub_type="Complex" #"Abs" #"dB" a.end_skip=10 #a.flux_indices=[range(479, 712)] #range(0,41), range(43, 479), range(482, len(a.yoko))] #a.bgsub_type="dB" #"Abs" a.save_folder.main_dir=a.name a.read_data() a.pwr_ind=39 print a.yoko.shape a.filter_type="None" a.magabs_colormesh(fig_width=6.0, fig_height=4.0)#.show() probe_ind=271 #448 #343 #100 #187 pl1=scatter(a.pwr, absolute(a.MagcomFilt[probe_ind, 192, :])) #535 scatter(a.yoko, absolute(a.MagcomFilt[probe_ind, :, 7])) pl2=colormesh(a.yoko, a.pwr, absolute(a.MagcomFilt[probe_ind, :, :]).transpose(), cmap="nipy_spectral")#.show() a.ifft_plot(fig_width=6.0, fig_height=4.0)#.show() #, time_axis_type="time", a.filter_type="FFT" #a.pwr_ind=10 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=9 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=8 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) a.pwr_ind=21 pl3=a.magabs_colormesh(pl="dB"+str(a.pwr[a.pwr_ind])+"dB.jpg", cmap="nipy_spectral")
a.filter_type = "None" print a.MagAbs.shape pl = line(a.frequency, 10 * log10(absolute(a.MagcomData[:, 0])), color="cyan") #.show() #pl=line(a.frequency, 10*log10(absolute(a.MagcomData[:, 1])))#.show() #pl=line(a.frequency, a.MagdB)#.show() magfilt = MagcomFilt(a) magabs = absolute(magfilt) line(a.frequency, magabs) nskip = 50 pl = scatter(a.frequency[::nskip], 10.0 * log10(magabs[::nskip]), facecolor="red", edgecolor="red", pl=pl) #idt.Np=56 #idt.f0=4.46e9 #4.452 #idt.K2=0.032 idt.Np = 36.5 #idt.f0=4.452e9 (S11, S12, S13, S21, S22, S23, S31, S32, S33) = idt._get_simple_S(f=a.frequency) print idt.Np, idt.K2 print idt.f0 print a.comment print -a.fridge_atten + a.fridge_gain - a.rt_atten + a.rt_gain - 10
a.end_skip=10 #a.flux_indices=[range(479, 712)] #range(0,41), range(43, 479), range(482, len(a.yoko))] a.bgsub_type="Complex" #"Abs" #"dB" #"Abs" a.save_folder.main_dir=a.name a.frq2_ind=0 a.pwr2_ind=1 a.read_data() #a.pwr_ind=39 print a.yoko.shape a.filter_type="None" #a.magabs_colormesh(fig_width=6.0, fig_height=4.0)#.show() scatter(absolute(a.MagcomFilt[170, 192, :])) scatter(absolute(a.MagcomFilt[170, :, 0])) colormesh(absolute(a.MagcomFilt[260, :, :]))#.show() a.ifft_plot(fig_width=6.0, fig_height=4.0).show() #, time_axis_type="time", a.filter_type="FFT" a.pwr_ind=0 a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind]))#.show() a.pwr_ind=1 a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) a.pwr_ind=2 a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #offset=0 a.pwr_ind=3
[347, 4.107, 2.645, 2.542], [426, 4.186, 2.657, 2.528], [507, 4.267, 2.659, 2.522]]) print pts.shape def fq(self, volts): flux_d_flux0=self.qdt._get_flux_over_flux0(voltage=volts, offset=self.offset, flux_factor=self.flux_factor) Ej=self.qdt._get_Ej(Ejmax=self.qdt.Ejmax, flux_over_flux0=flux_d_flux0) return self.qdt._get_fq(Ej=Ej, Ec=self.qdt.Ec) def ls_f(self, freqs): return array([sqrt(f*(f-2*self.qdt._get_Lamb_shift(f=f))) for f in freqs]) pl=scatter(pts[:, 1], fq(a, pts[:, 2])/1e9) scatter(pts[:, 1], fq(a, pts[:, 3])/1e9, pl=pl, color="red") line(a.frequency/1e9, a.ls_f/1e9, pl=pl) ff=ls_f(a, a.frequency-1.3*a.qdt.Ec/h)+1.3*a.qdt.Ec/h line(a.frequency/1e9, ls_f(a, a.frequency)/1e9, pl=pl) line(a.frequency/1e9, ff/1e9, pl=pl, color="black") def ls_f2(self, volts): flux_d_flux0=self.qdt._get_flux_over_flux0(voltage=volts, offset=self.offset, flux_factor=self.flux_factor) Ej=self.qdt._get_Ej(Ejmax=self.qdt.Ejmax, flux_over_flux0=flux_d_flux0) E0p, E1p, E2p=a.qdt._get_lamb_shifted_transmon_energy_levels(Ej=Ej, n_energy=3)
a.fitter.gamma = 0.1 #0.035 a.flux_axis_type = "yoko" #"flux" #"fq" # #a.bgsub_type="Complex" #"Abs" #"dB" a.end_skip = 10 #a.flux_indices=[range(479, 712)] #range(0,41), range(43, 479), range(482, len(a.yoko))] #a.bgsub_type="dB" #"Abs" a.save_folder.main_dir = a.name a.read_data() a.pwr_ind = 39 print a.yoko.shape a.filter_type = "None" a.magabs_colormesh(fig_width=6.0, fig_height=4.0) #.show() scatter(absolute(a.MagcomFilt[170, 192, :])) scatter(absolute(a.MagcomFilt[170, :, 7])) colormesh(absolute(a.MagcomFilt[170, :, :])) #.show() a.ifft_plot(fig_width=6.0, fig_height=4.0) #.show() #, time_axis_type="time", a.filter_type = "FFT" #a.pwr_ind=10 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=9 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=8 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) offset = 0 a.pwr_ind = 15 + offset
qdt.S_type = "simple" #qdt.couple_type="sinc^2" #qdt.Lamb_shift_type="formula" qdt.Np = 9.5 #9.5 #qdt.Ec=1e-25 #f=Fitter(plot_name="centers") qdt.gate_type = "capacitive" qdt.Cc = 30e-15 qdt.magabs_type = "S33" #qdt.fixed_freq_min=3e9 #qdt.fixed_freq_max=8e9 #qdt.fixed_fq_min=1e9 #qdt.fixed_fq_max=10e9 qdt.fitter.gamma = 0.05 pl1 = qdt.plotter scatter(data[:, 0], data[:, 1], fig_width=9, fig_height=6, pl=pl1, color="red").show() class Fitter(LineFitter): Ejmax = FloatRange(0.001, 100.0, qdt.Ejmax / h / 1e9).tag(tracking=True) offset = FloatRange(-5.0, 5.0, qdt.offset).tag(tracking=True) flux_factor = FloatRange(0.1, 5.0, qdt.flux_factor).tag(tracking=True) f0 = FloatRange(4.0, 6.0, qdt.f0 / 1e9).tag(tracking=True) alpha = FloatRange(0.0, 2.0, 0.0 * qdt.couple_mult).tag(tracking=True) Ct = FloatRange(0.1, 10.0, qdt.Ct / 1e-13).tag(tracking=True) @tag_property(private=True) def frequency(self): return linspace(3.5e9, 7.5e9, 1000)
#a.bgsub_type="Complex" #"Abs" #"dB" a.end_skip = 10 #a.flux_indices=[range(479, 712)] #range(0,41), range(43, 479), range(482, len(a.yoko))] #a.bgsub_type="dB" #"Abs" a.save_folder.main_dir = a.name a.read_data() a.pwr_ind = 39 print a.yoko.shape a.filter_type = "None" a.magabs_colormesh(fig_width=6.0, fig_height=4.0) #.show() probe_ind = 271 #448 #343 #100 #187 pl1 = scatter(a.pwr, absolute(a.MagcomFilt[probe_ind, 192, :])) #535 scatter(a.yoko, absolute(a.MagcomFilt[probe_ind, :, 7])) pl2 = colormesh(a.yoko, a.pwr, absolute(a.MagcomFilt[probe_ind, :, :]).transpose(), cmap="nipy_spectral") #.show() a.ifft_plot(fig_width=6.0, fig_height=4.0) #.show() #, time_axis_type="time", a.filter_type = "FFT" #a.pwr_ind=10 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=9 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=8
# -*- coding: utf-8 -*- """ Created on Sun Apr 24 18:55:33 2016 @author: thomasaref """ from TA88_fundamental import qdt, TA88_VNA_Lyzer, TA88_Read, TA88_VNA_Pwr_Lyzer, bg_A1, TA88_Read_NP, TA88_Save_NP from taref.plotter.api import colormesh, line, scatter from numpy import absolute, log10, linspace file_path=r"/Users/thomasaref/Dropbox (Clan Aref)/Current stuff/test_data/Lamb_shift/extract_data/TA88_pwr_sat.txt" npr=TA88_Read_NP(file_path=file_path, show_data_str=True) data=npr.read() pl=scatter(data[:, 0], data[:, 1]) file_path=r"/Users/thomasaref/Dropbox (Clan Aref)/Current stuff/test_data/Lamb_shift/extract_data/TA53_pwr_sat.txt" npr=TA88_Read_NP(file_path=file_path, show_data_str=True) data=npr.read() pl=scatter(data[:, 0], data[:, 1], pl=pl)#.show() a=TA88_VNA_Lyzer(name="testing", on_res_ind=182, VNA_name="RS VNA", rd_hdf=TA88_Read(main_file="Data_0222/S4A1_TA88_swp_5Vtn5V.hdf5"), desc="looking", #offset=-0.09, #fit_indices=[range(19, 259+1),range(300, 566+1)], ) #33, 70 a.filt.center=14 a.filt.halfwidth=5 a.fitter.fit_type="lorentzian"
fig_width=7.2 fig_height=5.0 c.save_folder.main_dir="sup_fig2_for_TA88" if __name__=="__main__": nskip=50 d0527.read_data() magfilt88=MagcomFilt88(d0527) magabs88=absolute(magfilt88) #line(d0527.frequency/1e9, magabs88) pl88=scatter(d0527.frequency[::nskip]/1e9, 20.0*log10(magabs88[::nskip])-bg_A4(d0527.frequency[::nskip]), facecolor="blue", edgecolor="blue", pl=pl88, nrows=2, ncols=3, nplot=1, fig_width=fig_width, fig_height=fig_height, marker_size=10) (S11, S12, S13, S21, S22, S23, S31, S32, S33)=idt88._get_simple_S(f=d0527.frequency) S13xS31=S13*S31 print idt88.Np, idt88.K2 print idt88.f0 print d0527.comment print -d0527.fridge_atten+d0527.fridge_gain-d0527.rt_atten+d0527.rt_gain-10 line(d0527.frequency/1e9, 20*log10(absolute(S13xS31))-4, color="red", pl=pl88, auto_ylim=False, y_min=-40, y_max=0, auto_xlim=False, x_min=4.2, x_max=4.7, xlabel="Frequency (GHz)", ylabel="Transmission (dB)", linewidth=1.0,
d0527.filter_type="None" d0527.read_data() plbg="fig2_sup" plbg=line(d0527.frequency/1e9, 20*log10(absolute(d0527.MagcomData[:, 0]))-bg_A4(d0527.frequency), color="cyan", alpha=0.5, nrows=2, ncols=2, nplot=1, pl=plbg, fig_width=3.5, fig_height=3.5)#.show() #pl=line(a.frequency, 10*log10(absolute(a.MagcomData[:, 1])))#.show() #pl=line(a.frequency, a.MagdB)#.show() magfilt=MagcomFilt(d0527) magabs=absolute(magfilt) line(d0527.frequency/1e9, magabs) nskip=50 pl=scatter(d0527.frequency[::nskip]/1e9, 20.0*log10(magabs[::nskip])-bg_A4(d0527.frequency[::nskip]), facecolor="red", edgecolor="red", pl=pl, nrows=2, ncols=2, nplot=1, fig_width=3.5, fig_height=3.5) plbg=scatter(d0527.frequency[::nskip]/1e9, 20.0*log10(magabs[::nskip])-bg_A4(d0527.frequency[::nskip]), facecolor="red", edgecolor="red", pl=plbg) #idt.Np=56 #idt.f0=4.46e9 #4.452 #idt.K2=0.032 #idt.Np=36.5 #idt.f0=4.452e9 (S11, S12, S13, S21, S22, S23, S31, S32, S33)=idt._get_simple_S(f=d0527.frequency)
pl2 = a.magabs_colormesh() a.filter_type = "Fit" a.magabs_colormesh(pl=pl2) a.magdB_colormesh(pl=pl1) a.center_plot(pl=cp, color="red") a.widths_plot(pl=wp, color="red").show() #pl1=colormesh(a.yoko, a.pwr, absolute(a.MagcomData[69, :, :]).transpose(), ylabel="Power (dBm)", xlabel=r"Yoko (V)")#.show() pl3 = colormesh(a.pwr, a.freq_axis[a.end_skip:-a.end_skip], absolute(a.MagcomFilt[a.end_skip:-a.end_skip, 335, :]), ylabel="Frequency (GHz)", xlabel=r"Power (dBm") #.show() pl1 = colormesh(a.yoko, a.pwr, absolute(a.MagcomFilt[69, :, :]).transpose(), ylabel="Power (dBm)", xlabel=r"Yoko (V)") #.show() pl2 = scatter(a.pwr, absolute( absolute(a.MagcomFilt[69, 335, :]) - absolute(a.MagcomFilt[69, 0, :])), xlabel="Power (dBm)", ylabel=r"$|\Delta S_{21}|$") #.show() pls = [pl_raw, pl_ifft, pl_fft, pl1, pl2, pl3] #a.save_plots(pls) pls[0].show()
qdt.S_type="simple" #qdt.couple_type="sinc^2" #qdt.Lamb_shift_type="formula" qdt.Np=9.5#9.5 #qdt.Ec=1e-25 #f=Fitter(plot_name="centers") qdt.gate_type="capacitive" qdt.Cc=30e-15 qdt.magabs_type="S33" #qdt.fixed_freq_min=3e9 #qdt.fixed_freq_max=8e9 #qdt.fixed_fq_min=1e9 #qdt.fixed_fq_max=10e9 qdt.fitter.gamma=0.05 pl1=qdt.plotter scatter(data[:, 0], data[:, 1], fig_width=9, fig_height=6, pl=pl1, color="red").show() class Fitter(LineFitter): Ejmax=FloatRange(0.001, 100.0, qdt.Ejmax/h/1e9).tag(tracking=True) offset=FloatRange(-5.0, 5.0, qdt.offset).tag(tracking=True) flux_factor=FloatRange(0.1, 5.0, qdt.flux_factor).tag(tracking=True) f0=FloatRange(4.0, 6.0, qdt.f0/1e9).tag(tracking=True) alpha=FloatRange(0.0, 2.0, 0.0*qdt.couple_mult).tag(tracking=True) Ct=FloatRange(0.1, 10.0, qdt.Ct/1e-13).tag(tracking=True) @tag_property(private=True) def frequency(self): return linspace(3.5e9, 7.5e9, 1000) # def _default_plotter(self): # if self.plot_name=="":
fig_height = 2.5 if __name__ == "__main__": pl = "fig2" nskip = 50 magfilt = MagcomFilt(d1122) magabs = absolute(magfilt) pl = scatter(d1122.frequency[::nskip] / 1e9, 20.0 * log10(magabs[::nskip]) - bg_A4(d1122.frequency[::nskip]), facecolor="blue", edgecolor="blue", pl=pl, nrows=1, ncols=3, nplot=1, fig_width=fig_width, fig_height=fig_height, marker_size=10) #idt.Np=56 #idt.f0=4.46e9 #4.452 #idt.K2=0.032 #idt.Np=36.5 #idt.f0=4.452e9 (S11, S12, S13, S21, S22, S23, S31, S32, S33) = idt._get_simple_S(f=d1122.frequency)
pl=line(a.frequency, 20*log10(absolute(a.MagcomData[:, 0]))-bg(a.frequency), color="cyan")#.show() bg_pl=line(b.frequency, 20*log10(absolute(b.MagcomData[:, 0])), color="cyan")#.show() line(b.frequency, 20*log10(absolute(b.MagcomData[:, 1])), color="red", pl=bg_pl)#.show() line(b.frequency, bg(a.frequency), color="green", pl=bg_pl)#.show() line(b.frequency, 20*log10(absolute(MagcomFilt(b))), pl=bg_pl, color="purple") print b.comment #pl=line(a.frequency, 10*log10(absolute(a.MagcomData[:, 1])))#.show() #pl=line(a.frequency, a.MagdB)#.show() magfilt=MagcomFilt(a) magabs=absolute(magfilt) line(a.frequency, magabs) nskip=50 pl=scatter(a.frequency[::nskip], 20.0*log10(magabs[::nskip])-bg(a.frequency[::nskip]), facecolor="red", edgecolor="red", pl=pl) #idt.Np=56 #idt.f0=4.46e9 #4.452 #idt.K2=0.032 idt.Np=36.5 #idt.f0=4.452e9 (S11, S12, S13, S21, S22, S23, S31, S32, S33)=idt._get_simple_S(f=a.frequency) print idt.Np, idt.K2 print idt.f0 print a.comment print -a.fridge_atten+a.fridge_gain-a.rt_atten+a.rt_gain-10
b.filter_type="FFT" pl_fft=b.magabs_colormesh()#.show() pl_pwr_frq=colormesh(b.pwr, b.freq_axis[b.end_skip:-b.end_skip], absolute(b.MagcomFilt[b.end_skip:-b.end_skip, 635, :]), ylabel="Frequency (GHz)", xlabel=r"Power (dBm")#.show() pl_pwr_color=colormesh(b.flux_axis, b.pwr, absolute(b.MagcomFilt[69, :, :]).transpose(), ylabel="Power (dBm)", xlabel=b.flux_axis_label, #pl=pl, auto_ylim=False, y_min=-30, y_max=10, auto_xlim=False, x_min=1.0, x_max=2.5, auto_zlim=True) pl.nplot=4 print b.comment pl_pwr_sat=scatter(b.pwr-30-60, 100*absolute(absolute(b.MagcomFilt[69, 635, :])-absolute(b.MagcomFilt[69,0, :])), xlabel="Power (dBm)", ylabel=r"$|\Delta S_{21}| \times 100$", pl=pl, auto_ylim=False, y_min=100*0.0, y_max=100*0.015, marker_size=3.0, auto_xlim=False, x_min=-30-90, x_max=10-90)#.show() ax=pl.figure.add_subplot(pl.nrows, pl.ncols, 4) ax.set_xticks(linspace(-30.0-90, 10.0-90, 5)) ax.set_yticks(linspace(0.0, 1.5, 4)) pl.nplot=3 if 1: c.read_data() c.filter_type="FFT" pl, pf=c.magabs_colormesh(pl=pl, pf_too=True, auto_zlim=False, auto_xlim=False, x_min=0.65, x_max=1.5, auto_ylim=True, vmin=0.0, vmax=0.02) cbr=colorbar(pf.clt, ax=pl.axes) cbr.set_label("$|S_{21}|$", size=8, labelpad=-10) cbr.set_ticks(linspace(0.0, 0.02, 2))
filt=fil.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( 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 ifft_plot(a)#.show() df=array([fil.fft_filter(a.MagAbs[n, :]) for n in range(stop_ind)])#.transpose() #df_bgsub=bgsub2D(10.0*log10(absolute(df)), 0, 1, 0) df_bgsub=absolute(df) pl3=colormesh(a.flux_axis[a.end_skip:-a.end_skip], a.frequency[a.end_skip:-a.end_skip]/1e9, df_bgsub[:,a.end_skip:-a.end_skip], vmin=0.987, vmax=1.00, cmap="afmhot", auto_zlim=False, xlabel="Yoko (V)", ylabel="Frequency (Ghz)") scatter(df_bgsub[210, :]) scatter(df_bgsub[:, 210]) #a.save_plots([pl1,pl2, pl3]) pl1.show() if __name__=="__main2__": class Fitter(LineFitter): Ejmax=FloatRange(0.001, 100.0, qdt.Ejmax/h/1e9).tag(tracking=True) offset=FloatRange(-5.0, 5.0, 0.0).tag(tracking=True) flux_factor=FloatRange(0.1, 5.0, 0.3).tag(tracking=True) f0=FloatRange(4.0, 6.0, qdt.f0/1e9).tag(tracking=True) alpha=FloatRange(0.0, 2.0, 0.0*qdt.couple_mult).tag(tracking=True) Ct=FloatRange(0.1, 10.0, 1.3).tag(tracking=True) def _default_plotter2(self): if self.plot_name=="":
#self.filt.N=len(self.frequency) class Coil_Lyzer(TA88_Lyzer): current=Array().tag(unit="V", plot=True, label="Current", sub=True) a=Coil_Lyzer(read_data=read_data, rd_hdf=TA88_Read(main_file="Data_1011/test_coil_setup_overnight.hdf5")) a.read_data() #print a.yoko #print a.current pf=polyfit(a.yoko, a.current, 3) print pf p=poly1d(pf) pl=scatter(a.yoko, a.current) line(a.yoko, p(a.yoko), pl=pl)#.show() #pl=scatter(a.yoko, a.current) endskip=0 mean_yoko=(a.yoko[1500-endskip:500+endskip:-1]+a.yoko[1500+endskip:2500-endskip]+a.yoko[3500-endskip:2500+endskip:-1]+a.yoko[3500+endskip:4500-endskip])/4.0 mean_current=(a.current[1500-endskip:500+endskip:-1]+a.current[1500+endskip:2500-endskip]+a.current[3500-endskip:2500+endskip:-1]+a.current[3500+endskip:4500-endskip])/4.0 #mean_current=(a.current[1499:501:-1]+a.current[1501:2499]+a.current[3499:2501:-1]+a.current[3501:4499])/4.0 line(a.yoko, a.current-p(a.yoko))#.show() line(a.yoko) line(a.yoko[a.yoko<5.9], a.current[a.yoko<5.9]-interp(a.yoko[a.yoko<5.9], mean_yoko, mean_current)).show() line(a.yoko, a.current-interp(a.yoko, a.yoko[1500:500:-1], a.current[1500:500:-1])).show() line(a.yoko[a.yoko<5.9], a.current-interp(a.yoko, a.yoko[1500:2500], a.current[1500:2500])).show()
a.filter_type="Fit" a.magabs_colormesh(pl=pl, vmin=0.995, vmax=1.005, cmap="nipy_spectral", auto_zlim=False)#.show() centers=a.qdt._get_fluxfq0(f=a.frequency[a.indices]) print [a.indices[n] for n, fp in enumerate(a.fit_params) if absolute(fp[1]-centers[n])>0.3] pl1=a.center_plot(pl=pl1) if __name__=="__main__2": nps=TA88_Save_NP(file_path=r"/Users/thomasaref/Dropbox/Current stuff/Logbook/TA210715A88_cooldown210216/tex_source_files/TA88_processed/discard/S2016_07_28_171620/meas.txt") nps.save(pl1.savedata()) npr=TA88_Read_NP(file_path=nps.file_path, show_data_str=True) 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()
pf_too=True, fig_width=fig_width, fig_height=fig_height) ax = pl.axes ax.set_yticks(linspace(-30.0 - 90, 10.0 - 90, 3)) ax.set_xticks(linspace(0.38, 0.48, 3)) #b.pwr, b.freq_axis[a.end_skip:-b.end_skip], 10**(onres/20.0), #absolute(a.MagcomFilt[a.end_skip:-a.end_skip, 635, :]), # ylabel="Frequency (GHz)", xlabel=r"Power (dBm")#.show() pl.nplot = 2 onres = 20 * log10(absolute(b.MagcomFilt[69, 635, :])) - bg_A4( b.frequency[69]) offres = 20 * log10(absolute(b.MagcomFilt[69, 0, :])) - bg_A4( b.frequency[69]) scatter(b.pwr - 30 - 60, absolute(onres - offres)) #scatter(b.pwr-30-60, 10**(absolute(onres-offres)/20.0)) scatter(b.pwr - 30 - 60, absolute(10**(onres / 20.0) - 10**(offres / 20.0))) #scatter(b.pwr-30-60, absolute(10**(onres/20.0))) pl_pwr_sat = scatter(b.pwr - 30 - 60, absolute(10**(onres / 20.0) - 10**(offres / 20.0)), xlabel="Power (dBm)", ylabel=r"$|\Delta S_{21}|$", pl=pl, auto_ylim=False, y_min=0.0, y_max=0.12, marker_size=10.0, auto_xlim=False,
def widths_plot(self, pl=None): scatter(self.frequency[self.indices]/1e9, absolute([fp[0] for fp in self.fit_params]), plotter=pl) line(self.frequency/1e9, self.qdt._get_coupling(self.frequency), plotter=pl, color="red") return pl
desc="looking", swp_type="yoko_first", ) b.filt.center = 18 b.filt.halfwidth = 10 b.fitter.fit_type = "lorentzian" b.fitter.gamma = 0.05 #0.01 b.flux_axis_type = "fq" #"flux" b.end_skip = 10 b.save_folder.main_dir = b.name if __name__ == "__main__": if 0: b.read_data() scatter(absolute(b.MagcomFilt[50, 370, :])) colormesh(absolute(b.MagcomFilt[50, :, :])) #.show() b.magabs_colormesh() b.ifft_plot() b.filter_type = "FFT" #b.ifft_plot() b.pwr_ind = 0 b.magabs_colormesh() b.pwr_ind = 3 b.magabs_colormesh() b.pwr_ind = 6 b.magabs_colormesh() b.pwr_ind = 9 b.magabs_colormesh().show()
def plot_widths(self, plotter=None): fit_params=self.full_fano_fit() scatter(fit_params[0, :], absolute(fit_params[1, :]), color="red", label=self.name, plot_name="widths_{}".format(self.name), plotter=plotter)
a.fitter.gamma=0.1 #0.035 a.flux_axis_type="flux" #"fq" # #a.bgsub_type="Complex" #"Abs" #"dB" a.end_skip=10 #a.flux_indices=[range(479, 712)] #range(0,41), range(43, 479), range(482, len(a.yoko))] #a.bgsub_type="Abs" a.save_folder.main_dir=a.name a.read_data() a.pwr_ind=10 print a.yoko.shape a.filter_type="None" a.magabs_colormesh(fig_width=6.0, fig_height=4.0)#.show() scatter(absolute(a.MagcomFilt[535, 316, :])) scatter(absolute(a.MagcomFilt[535, :, 7])) colormesh(absolute(a.MagcomFilt[535, :, :]))#.show() a.ifft_plot(fig_width=6.0, fig_height=4.0)#.show() #, time_axis_type="time", a.filter_type="FFT" #a.pwr_ind=10 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=9 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) #a.pwr_ind=8 #a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) a.pwr_ind=7 a.magabs_colormesh(pl=str(a.pwr[a.pwr_ind])) a.pwr_ind=6
c.save_folder.main_dir = "sup_fig2_for_TA88" if __name__ == "__main__": nskip = 50 d0527.read_data() magfilt88 = MagcomFilt88(d0527) magabs88 = absolute(magfilt88) #line(d0527.frequency/1e9, magabs88) pl88 = scatter(d0527.frequency[::nskip] / 1e9, 20.0 * log10(magabs88[::nskip]) - bg_A4(d0527.frequency[::nskip]), facecolor="blue", edgecolor="blue", pl=pl88, nrows=2, ncols=3, nplot=1, fig_width=fig_width, fig_height=fig_height, marker_size=10) (S11, S12, S13, S21, S22, S23, S31, S32, S33) = idt88._get_simple_S(f=d0527.frequency) S13xS31 = S13 * S31 print idt88.Np, idt88.K2 print idt88.f0 print d0527.comment print -d0527.fridge_atten + d0527.fridge_gain - d0527.rt_atten + d0527.rt_gain - 10 line(
x_min=0.0, x_max=20.0, auto_ylim=False, y_min=0.8, y_max=1.2, xlabel="$N_p\Gamma_0/f_0$", ylabel="Frequency ($f_0$)", color="red") pl1 = line(gd * Np / f0 * 2 * pi, array([argers(g)[-2] for g in gd]) / f0, pl=pl, color="red") #pl1=line(gd*Np/f0*2*pi, array([argers(g)[0] for g in gd])/f0, pl=pl) line(array([0.0, 20.0]), array([1.0, 1.0]), color="green", pl=pl) scatter(array([1.0, 1.0]) * gamma * Np / f0 * 2 * pi, array([4.85, 5.75]) / f0, pl=pl, marker_size=3.0) #scatter(array([1.0, 1.0, 1.0])*gamma*Np/f0*2*pi, array([5.694, 5.414, 4.784])/f0, pl=pl, marker_size=3.0) scatter(array([ 2.9, ]), array([1.0]), pl=pl, marker_size=3.0, facecolor="black", edgecolor="black") # def coup(G): # inner=(1.0/3.0-5.0/(2*pi*9*G))*15 # if inner<0:
pl2=a.magabs_colormesh() a.filter_type="Fit" a.magabs_colormesh(pl=pl2) a.magdB_colormesh(pl=pl1) cp=a.center_plot() wp=a.widths_plot().show() a.pwr_ind=1 a.filter_type="FFT" pl_fft=a.magabs_colormesh()#.show() a.bgsub_type="None" pl1=a.magdB_colormesh() pl2=a.magabs_colormesh() a.filter_type="Fit" a.magabs_colormesh(pl=pl2) a.magdB_colormesh(pl=pl1) a.center_plot(pl=cp, color="red") a.widths_plot(pl=wp, color="red").show() #pl1=colormesh(a.yoko, a.pwr, absolute(a.MagcomData[69, :, :]).transpose(), ylabel="Power (dBm)", xlabel=r"Yoko (V)")#.show() pl3=colormesh(a.pwr, a.freq_axis[a.end_skip:-a.end_skip], absolute(a.MagcomFilt[a.end_skip:-a.end_skip, 335, :]), ylabel="Frequency (GHz)", xlabel=r"Power (dBm")#.show() pl1=colormesh(a.yoko, a.pwr, absolute(a.MagcomFilt[69, :, :]).transpose(), ylabel="Power (dBm)", xlabel=r"Yoko (V)")#.show() pl2=scatter(a.pwr, absolute(absolute(a.MagcomFilt[69, 335, :])-absolute(a.MagcomFilt[69,0, :])), xlabel="Power (dBm)", ylabel=r"$|\Delta S_{21}|$")#.show() pls=[pl_raw, pl_ifft, pl_fft, pl1, pl2, pl3] #a.save_plots(pls) pls[0].show()
rd_hdf=TA88_Read(main_file="Data_0222/S4A1_TA88_powswp.hdf5"), desc="looking", swp_type="yoko_first", ) b.filt.center=14 b.filt.halfwidth=5 b.fitter.fit_type="lorentzian" b.fitter.gamma=0.05 #0.01 b.flux_axis_type="fq" #"flux" b.end_skip=10 b.save_folder.main_dir=b.name if __name__=="__main__": if 1: b.read_data() scatter(absolute(b.MagcomFilt[50, 370, :])) colormesh(absolute(b.MagcomFilt[50, :, :]))#.show() onres=20*log10(absolute(b.MagcomFilt[50, 362, :]))-bg_A1(b.frequency[50]) offres=20*log10(absolute(a.MagcomFilt[50, 0, :]))-bg_A1(b.frequency[50]) scatter(b.pwr-30-60, absolute(onres-offres)) scatter(b.pwr-30-60, absolute(10**(onres/20.0)-10**(offres/20.0))) b.magabs_colormesh() b.ifft_plot() b.filter_type="FFT" #b.ifft_plot() b.pwr_ind=0 b.magabs_colormesh() b.pwr_ind=3
ifft_plot(a) #.show() df = array([fil.fft_filter(a.MagAbs[n, :]) for n in range(stop_ind)]) #.transpose() #df_bgsub=bgsub2D(10.0*log10(absolute(df)), 0, 1, 0) df_bgsub = absolute(df) pl3 = colormesh(a.flux_axis[a.end_skip:-a.end_skip], a.frequency[a.end_skip:-a.end_skip] / 1e9, df_bgsub[:, a.end_skip:-a.end_skip], vmin=0.987, vmax=1.00, cmap="afmhot", auto_zlim=False, xlabel="Yoko (V)", ylabel="Frequency (Ghz)") scatter(df_bgsub[210, :]) scatter(df_bgsub[:, 210]) #a.save_plots([pl1,pl2, pl3]) pl1.show() if __name__ == "__main2__": class Fitter(LineFitter): Ejmax = FloatRange(0.001, 100.0, qdt.Ejmax / h / 1e9).tag(tracking=True) offset = FloatRange(-5.0, 5.0, 0.0).tag(tracking=True) flux_factor = FloatRange(0.1, 5.0, 0.3).tag(tracking=True) f0 = FloatRange(4.0, 6.0, qdt.f0 / 1e9).tag(tracking=True) alpha = FloatRange(0.0, 2.0, 0.0 * qdt.couple_mult).tag(tracking=True) Ct = FloatRange(0.1, 10.0, 1.3).tag(tracking=True) def _default_plotter2(self):