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 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 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 magdB_colormesh(self, **kwargs): process_kwargs(self, kwargs, pl="magdB_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) if self.filter_type=="Fit": flux_axis=self.flux_axis[self.flat_flux_indices] freq_axis=self.freq_axis[self.indices] start_ind=0 for ind in self.fit_indices: pl=colormesh(flux_axis, self.freq_axis[ind], self.MagdB[start_ind:start_ind+len(ind), :], **kwargs) start_ind+=len(ind) elif self.filter_type=="None": flux_axis=self.flux_axis freq_axis=self.freq_axis pl=colormesh(self.flux_axis, self.freq_axis, self.MagdB, **kwargs) else: flux_axis=self.flux_axis[self.flat_flux_indices] freq_axis=self.freq_axis[self.indices] pl=colormesh(flux_axis, freq_axis, self.MagdB, **kwargs) if isinstance(pl, tuple): pl, pf=pl else: pf=None if pl.auto_ylim: pl.set_ylim(min(freq_axis), max(freq_axis)) if pl.auto_xlim: pl.set_xlim(min(flux_axis), max(flux_axis)) pl.xlabel=kwargs.pop("xlabel", self.flux_axis_label) pl.ylabel=kwargs.pop("ylabel", self.freq_axis_label) if pf is None: return pl return pl, pf
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 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 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 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 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 phase_colormesh(self, **kwargs): process_kwargs(self, kwargs, pl="phase_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) if self.filter_type=="Fit": start_ind=0 for ind in self.fit_indices: pl=colormesh(self.flux_axis, self.freq_axis[ind], self.Phase[start_ind:start_ind+len(ind), :], **kwargs) start_ind+=len(ind) else: pl=colormesh(self.flux_axis, self.freq_axis[self.indices], self.Phase, **kwargs) pl.set_ylim(min(self.freq_axis[self.indices]), max(self.freq_axis[self.indices])) pl.set_xlim(min(self.flux_axis), max(self.flux_axis)) pl.xlabel=kwargs.pop("xlabel", self.flux_axis_label) pl.ylabel=kwargs.pop("ylabel", self.freq_axis_label) 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 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 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])) strt=absolute(self.filt.window_ifft(self.Magcom[:,self.start_ind])) stop=absolute(self.filt.window_ifft(self.Magcom[:,self.stop_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.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])) self.filt.N=len(on_res) filt=self.filt.freqz #filt=filt_prep(len(on_res), self.filt_start_ind, self.filt_end_ind) top=max([amax(on_res), amax(strt), amax(stop)]) line(self.time_axis, filt*top, plotter=pl, color="green", label="wdw") pl.xlabel=kwargs.pop("xlabel", self.time_axis_label) pl.ylabel=kwargs.pop("ylabel", "Mag abs") return pl
def ifft_plot_time(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])) strt=absolute(self.filt.window_ifft(self.MagcomData[:,self.start_ind])) stop=absolute(self.filt.window_ifft(self.MagcomData[:,self.stop_ind])) self.filt.N=len(on_res) pl=line(self.ifft_time/1e-6, self.filt.fftshift(on_res), color="red", plot_name="onres_{}".format(self.on_res_ind),label="i {}".format(self.on_res_ind), **kwargs) line(self.ifft_time/1e-6, self.filt.fftshift(strt), pl=pl, linewidth=1.0, plot_name="strt {}".format(self.start_ind), label="i {}".format(self.start_ind)) line(self.ifft_time/1e-6, self.filt.fftshift(stop), pl=pl, linewidth=1.0, plot_name="stop {}".format(self.stop_ind), label="i {}".format(self.stop_ind)) 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.ifft_time/1e-6, filt*top, plotter=pl, color="green") pl.xlabel=kwargs.pop("xlabel", "Time (us)") pl.ylabel=kwargs.pop("ylabel", "Time (us)") 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 ifft_plot_time(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])) strt = absolute( self.filt.window_ifft(self.MagcomData[:, self.start_ind])) stop = absolute( self.filt.window_ifft(self.MagcomData[:, self.stop_ind])) self.filt.N = len(on_res) pl = line(self.ifft_time / 1e-6, self.filt.fftshift(on_res), color="red", plot_name="onres_{}".format(self.on_res_ind), label="i {}".format(self.on_res_ind), **kwargs) line(self.ifft_time / 1e-6, self.filt.fftshift(strt), pl=pl, linewidth=1.0, plot_name="strt {}".format(self.start_ind), label="i {}".format(self.start_ind)) line(self.ifft_time / 1e-6, self.filt.fftshift(stop), pl=pl, linewidth=1.0, plot_name="stop {}".format(self.stop_ind), label="i {}".format(self.stop_ind)) 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.ifft_time / 1e-6, filt * top, plotter=pl, color="green") pl.xlabel = kwargs.pop("xlabel", "Time (us)") pl.ylabel = kwargs.pop("ylabel", "Time (us)") return pl
def phase_colormesh(self, **kwargs): process_kwargs(self, kwargs, pl="phase_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) if self.filter_type == "Fit": start_ind = 0 for ind in self.fit_indices: pl = colormesh(self.flux_axis, self.freq_axis[ind], self.Phase[start_ind:start_ind + len(ind), :], **kwargs) start_ind += len(ind) else: pl = colormesh(self.flux_axis, self.freq_axis[self.indices], self.Phase, **kwargs) pl.set_ylim(min(self.freq_axis[self.indices]), max(self.freq_axis[self.indices])) pl.set_xlim(min(self.flux_axis), max(self.flux_axis)) pl.xlabel = kwargs.pop("xlabel", self.flux_axis_label) pl.ylabel = kwargs.pop("ylabel", self.freq_axis_label) 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[:, 0])) 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 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
def magdB_colormesh(self, **kwargs): process_kwargs(self, kwargs, pl="magdB_{0}_{1}_{2}".format(self.filter_type, self.bgsub_type, self.name)) if self.filter_type == "Fit": flux_axis = self.flux_axis[self.flat_flux_indices] freq_axis = self.freq_axis[self.indices] start_ind = 0 for ind in self.fit_indices: pl = colormesh(flux_axis, self.freq_axis[ind], self.MagdB[start_ind:start_ind + len(ind), :], **kwargs) start_ind += len(ind) elif self.filter_type == "None": flux_axis = self.flux_axis freq_axis = self.freq_axis pl = colormesh(self.flux_axis, self.freq_axis, self.MagdB, **kwargs) else: flux_axis = self.flux_axis[self.flat_flux_indices] freq_axis = self.freq_axis[self.indices] pl = colormesh(flux_axis, freq_axis, self.MagdB, **kwargs) if isinstance(pl, tuple): pl, pf = pl else: pf = None if pl.auto_ylim: pl.set_ylim(min(freq_axis), max(freq_axis)) if pl.auto_xlim: pl.set_xlim(min(flux_axis), max(flux_axis)) pl.xlabel = kwargs.pop("xlabel", self.flux_axis_label) pl.ylabel = kwargs.pop("ylabel", self.freq_axis_label) if pf is None: return pl return pl, pf
def hline(self, *args, **kwargs): kwargs=process_kwargs(self, kwargs) return hline_plot(self, *args, **kwargs)
def colormesh(self, *args, **kwargs): kwargs=process_kwargs(self, kwargs) return colormesh_plot(self, *args, **kwargs)
def multiline(self, *args,**kwargs): kwargs=process_kwargs(self, kwargs) return multiline_plot(self, *args,**kwargs)
def polygon(self, *args, **kwargs): kwargs=process_kwargs(self, kwargs) return polygon_plot(self, *args, **kwargs)
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 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 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 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.frq2_ind, self.pwr2_ind])) strt = absolute( self.filt.window_ifft(self.MagcomData[:, self.start_ind, self.frq2_ind, self.pwr2_ind])) stop = absolute( self.filt.window_ifft(self.MagcomData[:, self.stop_ind, self.frq2_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 0: 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 scatter(self, *args, **kwargs): kwargs=process_kwargs(self, kwargs) return scatter_plot(self, *args, **kwargs)