def element_factor_plot(pl="element_factor", **kwargs): rho = Rho.process_kwargs(kwargs) rho.ft = "single" f = linspace(0.0, 500e9, 10000) print "start plot" pl = line(f / rho.f0, rho._get_alpha(f=f), plotter=pl, plot_name="single", color="blue", label="single finger", **kwargs) print "finish plot" rho.ft = "double" pl = line(f / rho.f0, rho._get_alpha(f=f), plotter=pl, plot_name="double", color="red", label="double finger", linestyle="dashed") pl.xlabel = "frequency/center frequency" pl.ylabel = "element factor" pl.set_ylim(-1.0, 2.0) pl.set_xlim(0.0, 20.0) pl.legend() return pl
def background_plot(self, pl=None): pl=line(self.freq_axis[self.flat_indices], array([fp[2]+fp[3] for fp in self.fit_params]), pl=pl) line(self.freq_axis[self.indices], self.MagAbsFilt_sq[self.indices,0], plotter=pl, color="red", linewidth=1.0, alpha=0.5) if self.show_quick_fit: if self.fitter.p_guess is not None: line(self.freq_axis[self.flat_indices], array([pg[2]+pg[3] for pg in self.fitter.p_guess]), pl=pl, color="green", linewidth=0.5) return pl
def new_flux(self, offset=-0.07, flux_factor=0.16, Ejmax=h * 43.0e9, C=qdt.Ct, pl=None): flx_d_flx0 = qdt.call_func("flux_over_flux0", voltage=self.yoko, offset=offset, flux_factor=flux_factor) Ec = qdt.call_func("Ec", Cq=C) qEj = qdt.call_func("Ej", Ejmax=Ejmax, flux_over_flux0=flx_d_flx0) E0, E1, E2 = qdt.call_func("transmon_energy_levels", EjdivEc=qEj / Ec, Ec=Ec, n_energy=3) fq = (E1 - E0) / h pl, pf = line(self.yoko, fq / 1e9, plotter=pl, linewidth=1.0) qdt.couple_mult = 0.55 * 3 EjdivEc = linspace(0.1, 300, 3000) E0p, E1p, E2p = qdt.call_func("lamb_shifted_transmon_energy_levels", EjdivEc=EjdivEc, n_energy=3) ls_fq = (E1p - E0p) / h ls_fq2 = (E2p - E1p) / h ls_fq20 = (E2p - E0p) / h anharm = ls_fq2 - ls_fq anh = interp(fq, ls_fq, ls_fq20) pl, pf = line(self.yoko, anh / 1e9 / 2, plotter=pl, linewidth=1.0) return pl
def metallization_plot(pl="metalization", **kwargs): rho = Rho.process_kwargs(kwargs) rho.eta = 0.5 rho.ft = "single" pl = line(rho.fixed_freq / rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.5", color="blue", label="0.5", **kwargs) rho.eta = 0.75 rho.fixed_reset() line(rho.fixed_freq / rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.6", color="red", label="0.6", **kwargs) rho.eta = 0.25 rho.fixed_reset() line(rho.fixed_freq / rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.4", color="green", label="0.4", **kwargs) pl.set_xlim(0.0, 20.0) pl.set_ylim(-2.0, 2.0) pl.xlabel = "frequency/center frequency" pl.ylabel = "element factor" pl.legend() return pl
def anharm_plot(): """reproduces anharm plot in Anton's paper""" set_tag(qdt, "EjdivEc", log=False) set_tag(qdt, "Ej", log=False) #qdt.epsinf=qdt.epsinf/3.72 #qdt.Np=10 #qdt.Ec=qdt.fq*0.1*h print qdt.max_coupling, qdt.coupling_approx anharm=qdt.call_func("anharm", EjdivEc=EjdivEc) anharmp=qdt.call_func("lamb_shifted_anharm", EjdivEc=EjdivEc) fq=qdt.call_func("fq", Ej=EjdivEc*qdt.Ec) ls_fq=qdt.call_func("lamb_shifted_fq", EjdivEc=EjdivEc) ls_fq2=qdt.call_func("lamb_shifted_fq2", EjdivEc=EjdivEc) pl, pf=line(fq/qdt.f0, (anharmp/h-anharm/h)/(2.0*qdt.max_coupling), linewidth=0.5, color="black", label=r"$\Delta_{2,1}-\Delta_{1,0}$") line(fq/qdt.f0, (ls_fq-fq)/(2.0*qdt.max_coupling), plotter=pl, color="blue", linewidth=0.5, label=r"$\Delta_{1,0}$") E0, E1, E2=qdt.call_func("transmon_energy_levels", EjdivEc=EjdivEc, n_energy=3) fq2=(E2-E1)/h line(fq/qdt.f0, (ls_fq2-fq2)/(2.0*qdt.max_coupling), plotter=pl, color="red", linewidth=0.5, label=r"$\Delta_{2,1}$") pl.set_ylim(-1.0, 0.6) pl.set_xlim(0.7, 1.3) pl.xlabel=r"$f_{10}/f_{IDT}$" pl.ylabel=r"$\Delta/\Gamma_{10}^{MAX}$" pl.legend(loc='lower left') #fq=qdt.call_func("lamb_shifted_fq", EjdivEc=EjdivEc) #line(EjdivEc, fq, plotter=pl, color="green", linewidth=0.5) #line(EjdivEc, E1p, plotter=pl, color="green", linewidth=0.5) #line(EjdivEc, E2p, plotter=pl, color="purple", linewidth=0.5) return pl
def capacitor(x=0, y=0, w=5, h=22, g=2, label="$C_C$", lx=5, ly=7, color=color, fontsize=fontsize, linewidth=linewidth, **kwargs): pl = line([x, x, x - w, x + w], [y + h + g, y + g, y + g, y + g], color=color, linewidth=linewidth, **kwargs) line([x, x, x - w, x + w], [y - h - g, y - g, y - g, y - g], color=color, linewidth=linewidth, pl=pl) pl.axes.text(x + lx, y + ly, label, fontsize=fontsize, color=color, ha="center", va="center") return pl
def arc_arrow(x=0, y=0, angle=13 * pi / 8.0, sangle=0.0, r=1, Nsteps=101, xa=0.01, ya=0.007, color=color, linewidth=linewidth, **kwargs): theta = linspace(sangle, angle, Nsteps) x_arr = x + r * cos(theta) y_arr = y + r * sin(theta) line(x_arr, y_arr, color=color, linewidth=linewidth, **kwargs) pl.axes.arrow(x_arr[-1], y_arr[-1], xa, ya, shape='full', lw=linewidth, length_includes_head=False, edgecolor="black", facecolor="black", head_width=10)
def filt_compare(self, ind, **kwargs): process_kwargs(self, kwargs, pl="filtcomp_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) self.filter_type="None" pl=line(self.frequency, self.MagdB[:, ind], label="MagAbs (unfiltered)", **kwargs) self.filter_type="FFT" line(self.frequency, self.MagdB[:, ind], label="MagAbs (filtered)", plotter=pl) 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 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_line(self, pl=None, xlabel="$\Phi/\Phi_0$", ylabel="Frequency (GHz)"): xmin, xmax, ymin, ymax=pl.x_min, pl.x_max, pl.y_min, pl.y_max line(self.flux_over_flux0[10:-10], self.fq[10:-10]/1e9, plotter=pl, xlabel=xlabel, ylabel=ylabel) pl.x_min, pl.x_max, pl.y_min, pl.y_max=xmin, xmax, ymin, ymax pl.xlabel="$\Phi/\Phi_0$" pl.ylabel="Frequency (GHz)" return pl
def Pmatrix(Np=5, frqs=frqs, f0=4.5e9, vf=3488.0, rs=-1j * 0.03, Cs=4.07e-10, W=25.0e-6): ts = sqrt(1 + rs**2) lbda0 = vf / f0 p = lbda0 / 4.0 #N=4*Np-3 #Np=int((N+3)/4.0) C = sqrt(2.0) * Np * W * Cs Pmat = array([P_one_freq(Np=Np, f=f, p=p, ts=ts, rs=rs) for f in frqs]) #, dtype=complex) #print shape(Pmat) (P11, P12, P13, P21, P22, P23, P31, P32, Ga) = (Pmat[:, 0], Pmat[:, 1], Pmat[:, 2], Pmat[:, 3], Pmat[:, 4], Pmat[:, 5], Pmat[:, 6], Pmat[:, 7], absolute(Pmat[:, 8])) Ba = -imag(hilbert(Ga)) w = 2 * pi * frqs P33 = Ga + 1j * Ba + 1j * w * C if 0: line(frqs, Ga, pl=pl) line(frqs, Ba, pl=pl) return (P11, P12, P13, P21, P22, P23, P31, P32, P33)
def Pmatrix(Np=5, frqs=frqs, f0=4.5e9, vf=3488.0, rs=-1j*0.03, Cs=4.07e-10, W=25.0e-6): ts=sqrt(1+rs**2) lbda0=vf/f0 p=lbda0/4.0 #N=4*Np-3 #Np=int((N+3)/4.0) C=sqrt(2.0)*Np*W*Cs Pmat=array([P_one_freq(Np=Np, f=f, p=p, ts=ts, rs=rs) for f in frqs])#, dtype=complex) #print shape(Pmat) (P11, P12, P13, P21, P22, P23, P31, P32, Ga)=(Pmat[:,0], Pmat[:,1], Pmat[:,2], Pmat[:,3], Pmat[:,4], Pmat[:,5], Pmat[:,6], Pmat[:,7], absolute(Pmat[:,8])) Ba=-imag(hilbert(Ga)) w=2*pi*frqs P33=Ga+1j*Ba+1j*w*C if 0: line(frqs, Ga, pl=pl) line(frqs, Ba, pl=pl) return (P11, P12, P13, P21, P22, P23, P31, P32, P33)
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.MagcomFilt[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), color="red", plot_name="onres_{}".format(self.on_res_ind), label="{:.4g}".format(self.flux_axis[self.on_res_ind]), **kwargs) #line(self.time_axis, self.filt.fftshift(strt), pl=pl, linewidth=1.0, color="purple", # plot_name="strt {}".format(self.start_ind), label="{:.4g}".format(self.flux_axis[self.start_ind])) #line(self.time_axis, self.filt.fftshift(stop), pl=pl, linewidth=1.0, color="blue", # plot_name="stop {}".format(self.stop_ind), label="{:.4g}".format(self.flux_axis[self.stop_ind])) filt.N = len(on_res) filt_frq = filt.freqz #filt=filt_prep(len(on_res), self.filt_start_ind, self.filt_end_ind) top = amax(on_res) #, amax(strt), amax(stop)]) line(filt_frq * top, plotter=pl, color="green", label="wdw") pl.xlabel = kwargs.pop("xlabel", self.time_axis_label) pl.ylabel = kwargs.pop("ylabel", "Mag abs") if 1: double_filt = array([[ filt.fft_filter(a.MagcomFilt[m, :, n]) for n in range(len(a.frq2)) ] for m in a.flat_indices]) #.transpose() print double_filt.shape double_filt = swapaxes(double_filt, 1, 2) endskip = 2 colormesh(absolute(a.MagcomData[50, :, :]).transpose()) pl = colormesh( absolute(a.MagcomFilt[50, endskip:-endskip, :]).transpose()) colormesh(absolute(double_filt[50, endskip:-endskip, :]).transpose(), pl=pl) #-absolute(double_filt[50, 10:-10, 134])) #colormesh(absolute(double_filt[250, endskip:-endskip, :]).transpose())#-absolute(double_filt[250, 10:-10, 134])) #colormesh(absolute(double_filt[450, endskip:-endskip, :]).transpose())#-absolute(double_filt[450, 10:-10, 134])) colormesh( absolute(double_filt[50, endskip:-endskip, :]).transpose() / absolute(double_filt[50, endskip:-endskip, 134])) #colormesh(absolute(double_filt[250, endskip:-endskip, :]).transpose()/absolute(double_filt[250, endskip:-endskip, 134])) #colormesh(absolute(double_filt[450, endskip:-endskip, :]).transpose()/absolute(double_filt[450, endskip:-endskip, 134])) colormesh(angle(double_filt[ 50, 10:-10, :]).transpose()) #-absolute(double_filt[50, 10:-10, 134])) #colormesh(angle(double_filt[250, 10:-10, :]).transpose())#-absolute(double_filt[250, 10:-10, 134])) #colormesh(angle(double_filt[450, 10:-10, :]).transpose())#-absolute(double_filt[450, 10:-10, 134])) #colormesh(absolute(double_filt[:, :, 75])) #colormesh(absolute(double_filt[:, :, 50])) #colormesh(absolute(double_filt[:, :, 25])) return pl
def ifft_plot(self): Magcom=(self.Magcom.transpose()-self.Magcom[:, 0]).transpose() p, pf=line(absolute(fft.ifft(Magcom[:,self.on_res_ind])), plotter="ifft_{}".format(self.name), plot_name="onres_{}".format(self.on_res_ind),label="i {}".format(self.on_res_ind)) line(absolute(fft.ifft(Magcom[:,self.start_ind])), plotter=p, plot_name="strt {}".format(self.start_ind), label="i {}".format(self.start_ind)) line(absolute(fft.ifft(Magcom[:,self.stop_ind])), plotter=p, plot_name="stop {}".format(self.stop_ind), label="i {}".format(self.stop_ind))
def arc_arrow(x=0, y=0, angle=13*pi/8.0, sangle=0.0, r=1, Nsteps=101, xa=0.01, ya=0.007, color=color, linewidth=linewidth, **kwargs): theta=linspace(sangle, angle, Nsteps) x_arr=x+r*cos(theta) y_arr=y+r*sin(theta) line(x_arr, y_arr, color=color, linewidth=linewidth, **kwargs) pl.axes.arrow(x_arr[-1], y_arr[-1], xa, ya, shape='full', lw=linewidth, length_includes_head=False, edgecolor="black", facecolor="black", head_width=10)
def ifft_plot(self): p, pf=line(absolute(fft.ifft(self.Magcom[:,self.on_res_ind])), plotter="ifft_{}".format(self.name), plot_name="onres_{}".format(self.on_res_ind),label="i {}".format(self.on_res_ind), color="red") line(absolute(fft.ifft(self.Magcom[:,self.start_ind])), plotter=p, linewidth=1.0, plot_name="strt {}".format(self.start_ind), label="i {}".format(self.start_ind)) line(absolute(fft.ifft(self.Magcom[:,self.stop_ind])), plotter=p, linewidth=1.0, plot_name="stop {}".format(self.stop_ind), label="i {}".format(self.stop_ind)) return p
def _default_plotter(self): line(*self.data, plot_name=self.plot_name, plotter=pl, color="green", linewidth=0.3, alpha=0.6) return pl
def ifft_plot(self): Magcom=(self.Magcom.transpose()-self.Magcom[:, 0]).transpose() p, pf=line(absolute(fft.ifft(Magcom[:,self.on_res_ind])), plotter="ifft_{}".format(self.name), plot_name="onres_{}".format(self.on_res_ind),label="i {}".format(self.on_res_ind)) line(absolute(fft.ifft(Magcom[:,self.start_ind])), plotter=p, plot_name="strt {}".format(self.start_ind), label="i {}".format(self.start_ind)) line(absolute(fft.ifft(Magcom[:,self.stop_ind])), plotter=p, plot_name="stop {}".format(self.stop_ind), label="i {}".format(self.stop_ind))
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 JJ(x=0, y=0, jjx=2.0, jjy=2.0, color=color, linewidth=linewidth, **kwargs): line([x - jjx, x + jjx], [y - jjy, y + jjy], color=color, linewidth=linewidth, **kwargs) line([x - jjx, x + jjx], [y + jjy, y - jjy], color=color, linewidth=linewidth, **kwargs)
def magabsfilt2_colormesh(self): p, pf=colormesh(self.frequency[10:-10]/1e9, self.yoko[10:-10], self.MagAbsFilt.transpose()[10:-10, 10:-10], plotter="magabsfilt2_{}".format(self.name)) print self.voltage_from_flux_par2[0].shape,self.voltage_from_flux_par2[1].shape line(self.voltage_from_flux_par2[0]/1e9, self.voltage_from_flux_par2[1], plotter=p) #print max(self.voltage_from_flux_par), min(self.voltage_from_flux_par) p.xlabel="Yoko (V)" p.ylabel="Frequency (GHz)" return p
def flux_par4(self, offset=-0.08, flux_factor=0.16, Ejmax=h*44.0e9, f0=5.35e9, alpha=0.7, pl=None): set_all_tags(qdt, log=False) flux_o_flux0=flux_over_flux0(self.yoko, offset, flux_factor) qEj=Ej(Ejmax, flux_o_flux0) #flux_o_flux0=qdt.call_func("flux_over_flux0", voltage=self.yoko, offset=offset, flux_factor=flux_factor) freq, frq2=flux_parabola(self.yoko, offset, flux_factor, Ejmax, qdt.Ec) fq1=lamb_shifted_fq2(qEj/qdt.Ec, qdt.ft, qdt.Np, f0, qdt.epsinf, qdt.W, qdt.Dvv) line(self.yoko, freq, plotter=pl, linewidth=1.0, alpha=0.5) line(self.yoko, fq1/2, plotter=pl, linewidth=1.0, alpha=0.5)
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), color="red", plot_name="onres_{}".format(self.on_res_ind),label="{:.4g}".format(self.flux_axis[self.on_res_ind]), **kwargs) #line(self.time_axis, self.filt.fftshift(strt), pl=pl, linewidth=1.0, color="purple", # plot_name="strt {}".format(self.start_ind), label="{:.4g}".format(self.flux_axis[self.start_ind])) #line(self.time_axis, self.filt.fftshift(stop), pl=pl, linewidth=1.0, color="blue", # plot_name="stop {}".format(self.stop_ind), label="{:.4g}".format(self.flux_axis[self.stop_ind])) filt.N=len(on_res) filt_frq=filt.freqz #filt=filt_prep(len(on_res), self.filt_start_ind, self.filt_end_ind) top=amax(on_res)#, amax(strt), amax(stop)]) line(filt_frq*top, plotter=pl, color="green", label="wdw") pl.xlabel=kwargs.pop("xlabel", self.time_axis_label) pl.ylabel=kwargs.pop("ylabel", "Mag abs") if 1: double_filt= array([[filt.fft_filter(a.MagcomFilt[m,:, n]) for n in range(len(a.frq2))] for m in a.flat_indices])#.transpose() print double_filt.shape double_filt=swapaxes(double_filt, 1, 2) endskip=2 colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 56, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 58, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 58, 134]).transpose())#-absolute(double_filt[250, 10:-10, 134])) colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 60, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 60, 134]).transpose())#-absolute(double_filt[450, 10:-10, 134])) print a.yoko[58] colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 20, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 20, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 45, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 45, 134]).transpose())#-absolute(double_filt[250, 10:-10, 134])) colormesh(absolute(double_filt[a.end_skip:-a.end_skip, 70, :]).transpose()-absolute(double_filt[a.end_skip:-a.end_skip, 70, 134]).transpose())#-absolute(double_filt[450, 10:-10, 134])) colormesh(absolute(a.MagcomData[50, :, :]).transpose()) pl=colormesh(absolute(a.MagcomFilt[50, endskip:-endskip, :]).transpose()) colormesh(absolute(double_filt[50, endskip:-endskip, :]).transpose(), pl=pl)#-absolute(double_filt[50, 10:-10, 134])) colormesh(absolute(double_filt[250, endskip:-endskip, :]).transpose())#-absolute(double_filt[250, 10:-10, 134])) colormesh(absolute(double_filt[450, endskip:-endskip, :]).transpose())#-absolute(double_filt[450, 10:-10, 134])) colormesh(absolute(double_filt[50, endskip:-endskip, :]).transpose()/absolute(double_filt[50, endskip:-endskip, 134])) colormesh(absolute(double_filt[250, endskip:-endskip, :]).transpose()/absolute(double_filt[250, endskip:-endskip, 134])) colormesh(absolute(double_filt[450, endskip:-endskip, :]).transpose()/absolute(double_filt[450, endskip:-endskip, 134])) colormesh(angle(double_filt[50, 10:-10, :]).transpose())#-absolute(double_filt[50, 10:-10, 134])) colormesh(angle(double_filt[250, 10:-10, :]).transpose())#-absolute(double_filt[250, 10:-10, 134])) colormesh(angle(double_filt[450, 10:-10, :]).transpose())#-absolute(double_filt[450, 10:-10, 134])) #colormesh(absolute(double_filt[:, :, 75])) #colormesh(absolute(double_filt[:, :, 50])) #colormesh(absolute(double_filt[:, :, 25])) return pl
def filt_compare(self, ind): pl, pf = line(self.frequency, self.Magcom[:, ind], label="MagAbs (unfiltered)", plotter="filtcomp_{}".format(self.name)) line(self.frequency, self.MagcomFilt[:, ind], label="MagAbs (filtered)", plotter=pl) return pl
def MagdB_cs(self, pl, ind): pl, pf = line(self.frequency, self.MagdB[:, ind], label="MagAbs (unfiltered)", plotter="filtcomp_{}".format(self.name)) line(self.frequency, self.MagdBFilt[:, ind], label="MagAbs (filtered)", plotter=pl) return pl
def ifft_plot(self): pl=Plotter(fig_width=6, fig_height=4) line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:,self.on_res_ind])), label="On resonance") line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:,0])), label="Off resonance", color="red") pl.legend() pl.set_xlim(0, 100) pl.xlabel="Time (#)" pl.ylabel="Absolute Magnitude" return pl
def giant_atom_variety_check(pl="giant_atom_check", **kwargs): idt=IDT.process_kwargs(kwargs) idt.Y0_type="center" idt.df_type="center" idt.mus_type="center" idt.Ga_type="giant atom"#, "full sum" idt.Ba_type="formula" frq=linspace(0e9, 10e9, 10000) idt.fixed_freq_max=20.0*idt.f0 pl=line(frq/idt.f0, idt._get_Ga(frq)/idt.Ga0_approx, plotter=pl, label="giant atom", **kwargs) idt.Y0_type="formula" line(frq/idt.f0, idt._get_Ga(frq)/idt.Ga0_approx, plotter=pl, label="Y0", color="red", **kwargs) idt.Y0_type="center" idt.df_type="formula" line(frq/idt.f0, idt._get_Ga(frq)/idt.Ga0_approx, plotter=pl, label="df", color="green", **kwargs) idt.df_type="center" idt.mus_type="formula" line(frq/idt.f0, idt._get_Ga(frq)/idt.Ga0_approx, plotter=pl, label="alpha", color="purple", **kwargs) X=idt.Np*pi*(frq-idt.f0)/idt.f0 line(frq/idt.f0, (sin(X)/X)**2, plotter=pl, label="sinc", color="blue", **kwargs) #line(frq/idt.f0, idt._get_Ba(frq)/idt.Ga0_approx, plotter=pl, label=idt.Ga_type, **kwargs) #idt.Ba_type="hilbert" #line(frq/idt.f0, idt._get_Ba(frq)/idt.Ga0_approx, plotter=pl, label=idt.Ga_type, **kwargs) #line(frq/idt.f0, -imag(hilbert(idt._get_Ga(frq)/idt.Ga0_approx)), plotter=pl, label=idt.Ga_type, **kwargs) #print idt.Ga0, idt.Ga0_approx #print idt.Ga0_mult #print idt.max_coupling, idt.max_coupling_approx return pl
def circle(x=0, y=0, r=1, Nsteps=101, color=color, linewidth=linewidth, **kwargs): theta = linspace(0, 2 * pi, Nsteps) x_arr = x + r * cos(theta) y_arr = y + r * sin(theta) line(x_arr, y_arr, color=color, linewidth=linewidth, **kwargs)
def flux_par3(self, offset=-0.07, flux_factor=0.52, Ejmax=h*44.0e9, f0=5.35e9, alpha=0.0, C=qdt.Ct, pl=None): set_all_tags(qdt, log=False) #flux_o_flux0=qdt.call_func("flux_over_flux0", voltage=self.yoko, offset=offset, flux_factor=flux_factor) #print flux_o_flux0-pi/2*trunc(flux_o_flux0/(pi/2.0)) #Ej=qdt.call_func("Ej", flux_over_flux0=flux_o_flux0, Ejmax=Ejmax) #EjdivEc=Ej/qdt.Ec #fq_vec=array([sqrt(f*(f+1.0*qdt.call_func("calc_Lamb_shift", fqq=f))) for f in self.frequency]) fq_vec=array([f-qdt.call_func("Lamb_shift", f=f, f0=f0) for f in self.frequency]) fq_vec=array([sqrt(f*(f-2*qdt.call_func("Lamb_shift", f=f, f0=f0, couple_mult=alpha))) for f in self.frequency]) Ec=qdt.call_func("Ec", Cq=C) Ej=qdt._get_Ej(fq=fq_vec, Ec=Ec) #Ej_from_fq(fq_vec, qdt.Ec) flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)+pi) flux_d_flux0=append(flux_d_flux0, arccos(Ej/Ejmax)-pi) if pl is not None: volt=qdt._get_voltage(flux_over_flux0=flux_d_flux0, offset=offset, flux_factor=flux_factor) freq=s3a4_wg.frequency[:]/1e9 freq=append(freq, freq) #append(freq, append(freq, freq))) freq=append(freq, freq) #freq=append(freq, freq) line(freq, volt, plotter=pl, linewidth=1.0, alpha=0.5) #EjdivEc=Ej/qdt.Ec #ls_fq2=qdt.call_func("lamb_shifted_fq2", EjdivEc=EjdivEc) #E0, E1, E2=qdt.call_func("transmon_energy_levels", EjdivEc=EjdivEc, n_energy=3) #fq2=(E2-E1)/h #f_vec=lamb_shifted_anharm(EjdivEc, qdt.ft, qdt.Np, qdt.f0, qdt.epsinf, qdt.W, qdt.Dvv) #ah=-ls_fq2/2#-fq2) #fq_vec=array([sqrt((f-ah[n])*(f-ah[n]+alpha*calc_freq_shift(f-ah[n], qdt.ft, qdt.Np, f0, qdt.epsinf, qdt.W, qdt.Dvv))) for n, f in enumerate(self.frequency)]) #fq_vec=array([f/2-qdt.call_func("calc_Lamb_shift", fqq=f/2) for f in self.frequency]) #freq=(s3a4_wg.frequency[:]-1.45e9)/1e9 #freq=append(freq, freq) #freq=append(freq, freq) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)+pi) #flux_d_flux0=append(flux_d_flux0, arccos(Ej/Ejmax)-pi) #freq=append(freq, freq) #fq_vec+=f_vec/h/2 #fq2_vec=fq2(Ej, qdt.Ec) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #qdt.call_func("lamb_shifted_fq2", EjdivEc=EjdivEc) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) #volt=voltage_from_flux(flux_d_flux0, offset, flux_factor) #line(freq, volt, plotter=pl, plot_name="second", color="green", linewidth=1.0, alpha=0.5) #flux_d_flux0.append(-) return qdt._get_voltage(flux_over_flux0=flux_d_flux0, offset=offset, flux_factor=flux_factor)
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, self.fq) print self.p_guess, fit_p fit = lorentzian(self.fq, fit_p[1:]) pl, pf = line(self.fq, self.MagAbsFilt_sq[263, :]) line(self.fq, fit, plotter=pl, color="red") pl.show() fit_params = self.full_fano_fit(self.fq) 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) + 0 * 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 flux_par3(self, offset=-0.07, flux_factor=0.52, Ejmax=h*44.0e9, f0=5.35e9, alpha=0.0, C=qdt.Ct, pl=None): set_all_tags(qdt, log=False) #flux_o_flux0=qdt.call_func("flux_over_flux0", voltage=self.yoko, offset=offset, flux_factor=flux_factor) #print flux_o_flux0-pi/2*trunc(flux_o_flux0/(pi/2.0)) #Ej=qdt.call_func("Ej", flux_over_flux0=flux_o_flux0, Ejmax=Ejmax) #EjdivEc=Ej/qdt.Ec #fq_vec=array([sqrt(f*(f+1.0*qdt.call_func("calc_Lamb_shift", fqq=f))) for f in self.frequency]) fq_vec=array([f-qdt.call_func("Lamb_shift", f=f, f0=f0) for f in self.frequency]) fq_vec=array([sqrt(f*(f-2*qdt.call_func("Lamb_shift", f=f, f0=f0, couple_mult=alpha))) for f in self.frequency]) Ec=qdt.call_func("Ec", Cq=C) Ej=qdt._get_Ej(fq=fq_vec, Ec=Ec) #Ej_from_fq(fq_vec, qdt.Ec) flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)+pi) flux_d_flux0=append(flux_d_flux0, arccos(Ej/Ejmax)-pi) if pl is not None: volt=qdt._get_voltage(flux_over_flux0=flux_d_flux0, offset=offset, flux_factor=flux_factor) freq=s3a4_wg.frequency[:]/1e9 freq=append(freq, freq) #append(freq, append(freq, freq))) freq=append(freq, freq) #freq=append(freq, freq) line(freq, volt, plotter=pl, linewidth=1.0, alpha=0.5) #EjdivEc=Ej/qdt.Ec #ls_fq2=qdt.call_func("lamb_shifted_fq2", EjdivEc=EjdivEc) #E0, E1, E2=qdt.call_func("transmon_energy_levels", EjdivEc=EjdivEc, n_energy=3) #fq2=(E2-E1)/h #f_vec=lamb_shifted_anharm(EjdivEc, qdt.ft, qdt.Np, qdt.f0, qdt.epsinf, qdt.W, qdt.Dvv) #ah=-ls_fq2/2#-fq2) #fq_vec=array([sqrt((f-ah[n])*(f-ah[n]+alpha*calc_freq_shift(f-ah[n], qdt.ft, qdt.Np, f0, qdt.epsinf, qdt.W, qdt.Dvv))) for n, f in enumerate(self.frequency)]) #fq_vec=array([f/2-qdt.call_func("calc_Lamb_shift", fqq=f/2) for f in self.frequency]) #freq=(s3a4_wg.frequency[:]-1.45e9)/1e9 #freq=append(freq, freq) #freq=append(freq, freq) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)+pi) #flux_d_flux0=append(flux_d_flux0, arccos(Ej/Ejmax)-pi) #freq=append(freq, freq) #fq_vec+=f_vec/h/2 #fq2_vec=fq2(Ej, qdt.Ec) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #qdt.call_func("lamb_shifted_fq2", EjdivEc=EjdivEc) #Ej=Ej_from_fq(fq_vec, qdt.Ec) #flux_d_flux0=arccos(Ej/Ejmax)#-pi/2 #flux_d_flux0=append(flux_d_flux0, -arccos(Ej/Ejmax)) #volt=voltage_from_flux(flux_d_flux0, offset, flux_factor) #line(freq, volt, plotter=pl, plot_name="second", color="green", linewidth=1.0, alpha=0.5) #flux_d_flux0.append(-) return qdt._get_voltage(flux_over_flux0=flux_d_flux0, offset=offset, flux_factor=flux_factor)
def ifft_plot(self): pl=Plotter(fig_width=6, fig_height=4) line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:,self.on_res_ind])), label="On resonance") line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:,0])), label="Off resonance", color="red") pl.legend() pl.set_xlim(0, 100) pl.xlabel="Time (#)" pl.ylabel="Absolute Magnitude" return pl #ifft_plot(s4a1_mp).show() #d.savefig("/Users/thomasaref/Dropbox/Current stuff/Linneaus180416/", "trans_ifft.pdf") #d.show()
def wave(x=0, y=0, Nsteps=101, w=8, f=2, A=3, color=color, linewidth=linewidth, **kwargs): theta = linspace(0, 2 * pi * f, Nsteps) x_arr = linspace(x, x + w, Nsteps) y_arr = y + A * sin(theta) line(x_arr, y_arr, color=color, linewidth=linewidth, **kwargs)
def anton_lamb_shift_plot(fig_width=9.0, fig_height=6.0): """reproduces coupling/lamb shift plot in Anton's paper""" pl=Plotter(fig_width=fig_width, fig_height=fig_height) EjdivEc=linspace(0.1, 300, 10000) Ej=EjdivEc*antonqdt.Ec #E0, E1, E2=antonqdt._get_transmon_energy_levels(Ej=Ej, n_energy=3) fq=antonqdt._get_fq(Ej) #anharm=(E2-E1)-(E1-E0) #E0p, E1p, E2p=antonqdt._get_lamb_shifted_transmon_energy_levels(Ej=Ej, n_energy=3) #anharmp=(E2p-E1p)-(E1p-E0p) #fq= (E1-E0)/h#qdt.call_func("fq", Ej=EjdivEc*qdt.Ec) coup=antonqdt._get_coupling(fq) ls=antonqdt._get_Lamb_shift(fq) line(fq/antonqdt.f0, 2.0*coup/(2.0*antonqdt.max_coupling), plotter=pl, linewidth=0.5, color="red", label=r"$\Gamma$, $N=10$") line(fq/antonqdt.f0, ls/(2.0*antonqdt.max_coupling), plotter=pl, color="green", linewidth=0.5, label=r"$\Delta$, $N=10$") #antonqdt.Np=3 Ej=EjdivEc*antonqdt3.Ec fq=antonqdt3._get_fq(Ej) coup=antonqdt3._get_coupling(fq) ls=antonqdt3._get_Lamb_shift(fq) line(fq/antonqdt3.f0, 2.0*coup/(2.0*antonqdt3.max_coupling), plotter=pl, linewidth=0.5, color="blue", label=r"$\Gamma$, $N=3$") line(fq/antonqdt3.f0, ls/(2.0*antonqdt3.max_coupling), plotter=pl, color="black", linewidth=0.5, label=r"$\Delta$, $N=3$") pl.set_ylim(-0.4, 1.0) pl.set_xlim(0.2, 1.8) pl.xlabel=r"$f_{10}/f_{IDT}$" pl.ylabel=r"$\Delta/\Gamma_{10}^{MAX}$" pl.legend(loc='upper right') return pl
def heights_plot(self, pl=None): pl = line(self.freq_axis[self.flat_indices], array([fp[2] for fp in self.fit_params]), pl=pl) if self.show_quick_fit: if self.fitter.p_guess is not None: line( self.freq_axis[self.flat_indices], array([pg[2] 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 Lamb_shift_comparison(pl="ls_comp", **kwargs): idt=IDT.process_kwargs(kwargs) #idt.rs=-0.01j #idt.dloss2=0.1*1e6 #idt.eta=0.4 frq=linspace(0e9, 10e9, 10000) #idt.N_fixed=100000 idt.fixed_freq_max=20.0*idt.f0 idt.S_type="RAM" pl=line(frq/idt.f0, idt._get_Lamb_shift(f=frq), plotter=pl, color="cyan", linewidth=0.5, label=idt.S_type, **kwargs) idt.S_type="simple" idt.fixed_reset() idt.Lamb_shift_type="formula" idt.couple_type="sinc sq" pl=line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, linewidth=0.5, label="sinc^2", **kwargs) idt.couple_type="giant atom" line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="red", linewidth=0.5, label=idt.couple_type) idt.Lamb_shift_type="hilbert" idt.couple_type="df giant atom" line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="green", linewidth=0.5, label=idt.couple_type) idt.couple_type="full expr" line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="black", linewidth=0.5, label=idt.couple_type) #idt.couple_type="full sum" #line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="purple", linewidth=0.5, label=idt.couple_type) pl.xlabel="frequency/center frequency" pl.ylabel="Lamb shift" pl.set_ylim(-1e9, 1e9) pl.legend(loc="lower right") 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 Lamb_shift_check(pl="ls_check", **kwargs): idt=IDT.process_kwargs(kwargs) idt.fixed_freq_max=20.0*idt.f0 frq=linspace(0e9, 10e9, 10000) idt.S_type="RAM" pl=line(frq/idt.f0, idt._get_Lamb_shift(f=frq)/idt.max_coupling, plotter=pl, color="cyan", linewidth=0.5, label=idt.S_type, **kwargs) idt.S_type="simple" idt.fixed_reset() idt.Lamb_shift_type="formula" idt.couple_type="sinc sq" pl=line(frq/idt.f0, idt._get_Lamb_shift(frq)/idt.max_coupling, plotter=pl, linewidth=0.5, label=idt.couple_type, **kwargs) idt.couple_type="giant atom" line(frq/idt.f0, idt._get_Lamb_shift(frq)/idt.max_coupling, plotter=pl, color="red", linewidth=0.5, label=idt.couple_type) idt.couple_type="df giant atom" line(frq/idt.f0, idt._get_Lamb_shift(frq)/idt.max_coupling, plotter=pl, color="green", linewidth=0.5, label=idt.couple_type) idt.couple_type="full expr" line(frq/idt.f0, idt._get_Lamb_shift(frq)/idt.max_coupling, plotter=pl, color="black", linewidth=0.5, label=idt.couple_type) #idt.couple_type="full sum" #line(frq/idt.f0, idt._get_Lamb_shift(frq)/idt.max_coupling, plotter=pl, color="purple", linewidth=0.5, label=idt.couple_type) pl.xlabel="frequency/center frequency" pl.ylabel="Lamb shift/max coupling (dB)" pl.set_ylim(-1.0, 1.0) pl.legend(loc="lower right") #line(frq, a._get_full_Lamb_shift(frq)/a.max_coupling, plotter=pl, color="black", linewidth=0.3) return pl
def Lamb_shift_comparison(pl="ls_comp", **kwargs): idt = IDT.process_kwargs(kwargs) #idt.rs=-0.01j #idt.dloss2=0.1*1e6 #idt.eta=0.4 frq = linspace(0e9, 10e9, 10000) #idt.N_fixed=100000 idt.fixed_freq_max = 20.0 * idt.f0 idt.S_type = "RAM" pl = line(frq / idt.f0, idt._get_Lamb_shift(f=frq), plotter=pl, color="cyan", linewidth=0.5, label=idt.S_type, **kwargs) idt.S_type = "simple" idt.fixed_reset() idt.Lamb_shift_type = "formula" idt.couple_type = "sinc sq" pl = line(frq / idt.f0, idt._get_Lamb_shift(frq), plotter=pl, linewidth=0.5, label="sinc^2", **kwargs) idt.couple_type = "giant atom" line(frq / idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="red", linewidth=0.5, label=idt.couple_type) idt.Lamb_shift_type = "hilbert" idt.couple_type = "df giant atom" line(frq / idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="green", linewidth=0.5, label=idt.couple_type) idt.couple_type = "full expr" line(frq / idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="black", linewidth=0.5, label=idt.couple_type) #idt.couple_type="full sum" #line(frq/idt.f0, idt._get_Lamb_shift(frq), plotter=pl, color="purple", linewidth=0.5, label=idt.couple_type) pl.xlabel = "frequency/center frequency" pl.ylabel = "Lamb shift" pl.set_ylim(-1e9, 1e9) pl.legend(loc="lower right") return pl
def element_factor_plot(pl="element_factor", **kwargs): rho=Rho.process_kwargs(kwargs) rho.ft="single" f=linspace(0.0, 500e9, 10000) print "start plot" pl=line(f/rho.f0, rho._get_alpha(f=f), plotter=pl, plot_name="single", color="blue", label="single finger", **kwargs) print "finish plot" rho.ft="double" pl= line(f/rho.f0, rho._get_alpha(f=f), plotter=pl, plot_name="double", color="red", label="double finger", linestyle="dashed") pl.xlabel="frequency/center frequency" pl.ylabel="element factor" pl.set_ylim(-1.0, 2.0) pl.set_xlim(0.0, 20.0) pl.legend() return pl
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(self.filt.window_ifft(self.Magcom)) pl=line(self.time_axis, self.filt.fftshift(on_res), color="red", plot_name="onres_{}".format(self.on_res_ind),label="blah", **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=amax(on_res) 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
def ifft_plot(self): pl = Plotter(fig_width=6, fig_height=4) line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:, self.on_res_ind])), label="On resonance") line("ifft_{}".format(self.name), absolute(fft.ifft(self.Magcom[:, 0])), label="Off resonance", color="red") pl.legend() pl.set_xlim(0, 100) pl.xlabel = "Time (#)" pl.ylabel = "Absolute Magnitude" return pl
def filt_compare(self, ind, **kwargs): process_kwargs(self, kwargs, pl="filtcomp_{0}_{1}_{2}".format( self.filter_type, self.bgsub_type, self.name)) self.filter_type = "None" pl = line(self.frequency, self.MagdB[:, ind], label="MagAbs (unfiltered)", **kwargs) self.filter_type = "FFT" line(self.frequency, self.MagdB[:, ind], label="MagAbs (filtered)", plotter=pl) return pl
def line_cs(self, ind=210): print self.frequency[ind]/1e9 pl=Plotter(fig_width=9.0, fig_height=6.0, name="magabs_cs_{}".format(self.name)) pl, pf=line(self.yoko, (self.MagdB.transpose()-self.MagdB[:, 0])[:, ind], plotter=pl, linewidth=1.0) pl.xlabel="Yoko (V)" pl.ylabel="Magnitude (dB)" return pl
def giant_atom_variety_check(pl="giant_atom_check", **kwargs): idt = IDT.process_kwargs(kwargs) idt.Y0_type = "center" idt.df_type = "center" idt.mus_type = "center" idt.Ga_type = "giant atom" #, "full sum" idt.Ba_type = "formula" frq = linspace(0e9, 10e9, 10000) idt.fixed_freq_max = 20.0 * idt.f0 pl = line(frq / idt.f0, idt._get_Ga(frq) / idt.Ga0_approx, plotter=pl, label="giant atom", **kwargs) idt.Y0_type = "formula" line(frq / idt.f0, idt._get_Ga(frq) / idt.Ga0_approx, plotter=pl, label="Y0", color="red", **kwargs) idt.Y0_type = "center" idt.df_type = "formula" line(frq / idt.f0, idt._get_Ga(frq) / idt.Ga0_approx, plotter=pl, label="df", color="green", **kwargs) idt.df_type = "center" idt.mus_type = "formula" line(frq / idt.f0, idt._get_Ga(frq) / idt.Ga0_approx, plotter=pl, label="alpha", color="purple", **kwargs) X = idt.Np * pi * (frq - idt.f0) / idt.f0 line(frq / idt.f0, (sin(X) / X)**2, plotter=pl, label="sinc", color="blue", **kwargs) #line(frq/idt.f0, idt._get_Ba(frq)/idt.Ga0_approx, plotter=pl, label=idt.Ga_type, **kwargs) #idt.Ba_type="hilbert" #line(frq/idt.f0, idt._get_Ba(frq)/idt.Ga0_approx, plotter=pl, label=idt.Ga_type, **kwargs) #line(frq/idt.f0, -imag(hilbert(idt._get_Ga(frq)/idt.Ga0_approx)), plotter=pl, label=idt.Ga_type, **kwargs) #print idt.Ga0, idt.Ga0_approx #print idt.Ga0_mult #print idt.max_coupling, idt.max_coupling_approx return pl
def line_cs2(self, ind=210, f0=5.35e9, alpha=0.45): fq_vec=array([sqrt(f*(f-2*qdt.call_func("Lamb_shift", f=f, f0=f0, couple_mult=alpha))) for f in self.frequency]) print self.frequency[ind]/1e9, fq_vec[ind]/1e9 pl=Plotter(fig_width=9.0, fig_height=6.0, name="magabs_cs_{}".format(self.name)) pl, pf=line(self.yoko, (self.MagdB.transpose()-self.MagdB[:, 0])[:, ind], plotter=pl, linewidth=1.0) pl.xlabel="Yoko (V)" pl.ylabel="Magnitude (dB)" return pl
def metallization_plot(pl="metalization", **kwargs): rho=Rho.process_kwargs(kwargs) rho.eta=0.5 rho.ft="single" pl=line(rho.fixed_freq/rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.5", color="blue", label="0.5", **kwargs) rho.eta=0.75 rho.fixed_reset() line(rho.fixed_freq/rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.6", color="red", label="0.6", **kwargs) rho.eta=0.25 rho.fixed_reset() line(rho.fixed_freq/rho.f0, rho.fixed_alpha, plotter=pl, plot_name="0.4", color="green", label="0.4", **kwargs) pl.set_xlim(0.0, 20.0) pl.set_ylim(-2.0, 2.0) pl.xlabel="frequency/center frequency" pl.ylabel="element factor" pl.legend() return pl
def line_cs2(self, ind=210, f0=5.35e9, alpha=0.45): fq_vec=array([sqrt(f*(f-2*qdt.call_func("Lamb_shift", f=f, f0=f0, couple_mult=alpha))) for f in self.frequency]) print self.frequency[ind]/1e9, fq_vec[ind]/1e9 pl=Plotter(fig_width=9.0, fig_height=6.0, name="magabs_cs_{}".format(self.name)) pl, pf=line(self.yoko, (self.MagdB.transpose()-self.MagdB[:, 0])[:, ind], plotter=pl, linewidth=1.0) pl.xlabel="Yoko (V)" pl.ylabel="Magnitude (dB)" return pl
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(fil.window_ifft(self.MagAbs[211, :])) strt = absolute(fil.window_ifft(self.MagAbs[524, :])) stop = absolute(fil.window_ifft(self.MagAbs[stop_ind, :])) pl = line(fil.fftshift(on_res), color="red", plot_name="onres_{}".format(self.on_res_ind), label="{:.4g}".format(self.flux_axis[self.on_res_ind]), **kwargs) line(fil.fftshift(strt), pl=pl, linewidth=1.0, color="purple", plot_name="strt {}".format(self.start_ind), label="{:.4g}".format(self.flux_axis[self.start_ind])) line(fil.fftshift(stop), pl=pl, linewidth=1.0, color="blue", plot_name="stop {}".format(self.stop_ind), label="{:.4g}".format(self.flux_axis[self.stop_ind])) fil.N = len(on_res) 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
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(self.filt.window_ifft(self.MagcomData[:,self.on_res_ind, self.pwr2_ind])) strt=absolute(self.filt.window_ifft(self.MagcomData[:,self.start_ind, self.pwr2_ind])) stop=absolute(self.filt.window_ifft(self.MagcomData[:,self.stop_ind, self.pwr2_ind])) pl=line(self.time_axis, self.filt.fftshift(on_res), color="red", plot_name="onres_{}".format(self.on_res_ind),label="{:.4g}".format(self.on_res_ind), **kwargs) line(self.time_axis, self.filt.fftshift(strt), pl=pl, linewidth=1.0, color="purple", plot_name="strt {}".format(self.start_ind), label="{:.4g}".format(self.start_ind)) line(self.time_axis, self.filt.fftshift(stop), pl=pl, linewidth=1.0, color="blue", 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") if 1: double_filt= array([[self.filt.fft_filter(a.MagcomData[:,n, m]) for n in range(len(a.frq2))] for m in range(len(a.pwr2))])#.transpose() print double_filt.shape double_filt=swapaxes(double_filt, 0, 2) print double_filt.shape print a.pwr2[10] colormesh(self.freq_axis[a.end_skip:-a.end_skip], self.frq2, absolute(double_filt[a.end_skip:-a.end_skip, :, 10]).transpose()) #-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) pl=colormesh(a.frq2, a.pwr2, absolute(double_filt[493, :, :]).transpose()) #-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) print a.frequency[493] colormesh(absolute(double_filt[329, :, :]).transpose()) #-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) colormesh(absolute(double_filt[93, :, :]).transpose()) #-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) colormesh(absolute(double_filt[880, :, :]).transpose()) #-absolute(double_filt[a.end_skip:-a.end_skip, 56, 134]).transpose())#-absolute(double_filt[50, 10:-10, 134])) return pl
def _default_plotter(self): if self.plot_name=="": self.plot_name=self.name freq=s3a4_wg.frequency[:]/1e9 freq=append(freq, freq) freq=append(freq, freq) pl1, pf=line(freq, self.data, plot_name=self.plot_name, plotter=pl) self.plot_name=pf.plot_name return pl1
def _default_plotter(self): if self.plot_name=="": self.plot_name=self.name pl=Plotter(name=self.name) for param in get_all_tags(self, "plot"): print param pl, pf=line(*getattr(self, param), plot_name=get_tag(self, param, "plot"), plotter=pl, pf_too=True) self.data_dict[param]=pf.plot_name return pl
def plot_alpha(self, pl=None, **kwargs): if pl is None: pl="alpha_"+self.name f, alpha=self.fixed_freq, self.fixed_alpha pl=line(f/self.f0, alpha, plotter=pl, plot_name=self.name, color="blue", label=self.name, **kwargs) pl.xlabel="frequency/center frequency" pl.ylabel="element factor" pl.set_ylim(-1.0, 2.0) return pl
def plot_surface_voltage(self, pl=None, **kwargs): if pl is None: pl="surface_voltage_"+self.name x, voltage=self.surface_x, self.surface_voltage pl=line(x, voltage, plotter=pl, plot_name=self.name, color="blue", label=self.name, **kwargs) pl.xlabel="x/center wavelength" pl.ylabel="surface voltage" #pl.set_ylim(-1.0, 2.0) return pl