本文整理汇总了Python中taref.plotter.api.line函数的典型用法代码示例。如果您正苦于以下问题:Python line函数的具体用法?Python line怎么用?Python line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: background_plot
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
示例2: ifft_plot
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
示例3: filt_compare
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
示例4: anharm_plot
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
示例5: Pmatrix
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)
示例6: flux_line
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
示例7: ifft_plot
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
示例8: arc_arrow
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)
示例9: ifft_plot
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))
示例10: magabsfilt2_colormesh
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
示例11: flux_par4
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)
示例12: ifft_plot
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
示例13: ifft_plot
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
示例14: giant_atom_variety_check
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
示例15: flux_par3
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)