def fast_pi2(): folder = toolbox.latest_data('cal_fast_pi_over_2') a = mbi.MBIAnalysis(folder) a.get_sweep_pts() a.get_readout_results(name='adwindata') a.get_electron_ROC() #a.plot_results_vs_sweepparam(ax=ax, name='adwindata') x = a.sweep_pts y = a.p0.reshape(-1) u_y = a.u_p0.reshape(-1) n = a.sweep_name x2 = x[::2] y2 = y[1::2] - y[::2] u_y2 = np.sqrt(u_y[1::2]**2 + u_y[::2]**2) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4), sharex=True) ax1.errorbar(x2, y2, yerr=u_y2, fmt='o') ax1.set_xlabel(n) ax1.set_title('Difference btw. Pi/2-Pi and Pi/2' + '\n' + a.timestamp) ax1.set_ylabel('Difference') m = fit.Parameter((y[-1] - y[0]) / (x[-1] - x[0]), 'm') x0 = fit.Parameter(x2.mean(), 'x0') p0 = [m, x0] def ff(x): return m() * (x - x0()) fitfunc_str = 'm * (x - x0)' fit_result = fit.fit1d(x2, y2, None, p0=p0, fitfunc=ff, fitfunc_str=fitfunc_str, do_print=True, ret=True) ax2.errorbar(x2, y[0::2], yerr=u_y[0::2], fmt='o', label='Pi/2') ax2.errorbar(x2, y[1::2], yerr=u_y[1::2], fmt='o', label='Pi/2 - Pi') ax2.legend(frameon=True, framealpha=0.5) ax2.set_ylabel('P(0)') ax2.set_xlabel(n) if fit_result != False: ax2.axvline(x0(), c='k', lw=2) ax2.axhline(0.5, c='k', lw=2) ax2.set_title('X marks the spot') plot.plot_fit1d(fit_result, np.linspace(x2[0], x2[-1], 201), ax=ax1, plot_data=False, print_info=True) return x0(), 0
def stage_4_calibrations(): fig, ax = plt.subplots(1, 1, figsize=(5, 4)) folder = toolbox.latest_data('t_between_pulses') print 80 * '=' print 'time between pi pulses' print 80 * '=' t_between_pi_pulses = t_between_pi(folder, ax) fig.savefig(os.path.join(folder, 'stage_4_calibrations.png'))
def stage_3_calibrations(): fig, ax = plt.subplots(1,1, figsize = (5,4)) folder = toolbox.latest_data('calibrate_LDE_spin_echo') print 80*'=' print 'LDE-DD spin echo time' print 80*'=' DD_spin_echo_time = DD_spin_echo(folder, ax) fig.savefig(os.path.join(folder, 'stage_3_calibrations.png'))
def stage_4_calibrations(): fig, ax = plt.subplots(1,1, figsize = (5,4)) folder = toolbox.latest_data('t_between_pulses') print 80*'=' print 'time between pi pulses' print 80*'=' t_between_pi_pulses = t_between_pi(folder, ax) fig.savefig(os.path.join(folder, 'stage_4_calibrations.png'))
def stage_3_calibrations(): fig, ax = plt.subplots(1, 1, figsize=(5, 4)) folder = toolbox.latest_data('calibrate_LDE_spin_echo') print 80 * '=' print 'LDE-DD spin echo time' print 80 * '=' DD_spin_echo_time = DD_spin_echo(folder, ax) fig.savefig(os.path.join(folder, 'stage_3_calibrations.png'))
def stage_0p5_calibrations(): # ssro first fig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,4)) print 80*'=' print 'Dark ESR' print 80*'=' f0,u_f0 = dark_esr_analysis.analyze_dark_esr( toolbox.latest_data('DarkESR'), ax=ax1, ret='f0', print_info=False)
def fast_rabi(ax=None): folder = toolbox.latest_data("cal_fast_rabi" + name) if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_rabi(folder, ax, 1.0 / 125, 0.5, fit_k=False) f = fit_result["params_dict"]["f"] u_f = fit_result["error_dict"]["f"] ax.text(100, 0.9, "$f_r$ = (%.3f +/- %.3f) MHz" % (f * 1e3, u_f * 1e3), va="bottom", ha="left") return (f * 1e3, u_f * 1e3)
def stage_0p5_calibrations(): # ssro first fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) print 80 * '=' print 'Dark ESR' print 80 * '=' f0, u_f0 = dark_esr_analysis.analyze_dark_esr( toolbox.latest_data('DarkESR'), ax=ax1, ret='f0', print_info=False) fig.savefig(os.path.join(folder, 'stage_0p5_calibrations.png'))
def N_frq(ax=None): folder = toolbox.latest_data("NMR_frq_scan") if ax == None: fig, ax = plt.subplots(1, 1) fit_result = fit_population_vs_detuning(folder, ax, 7.135) x0 = fit_result["params_dict"]["x0"] u_x0 = fit_result["error_dict"]["x0"] ax.text(7.1, 0.3, "$N_{frq}$ = (%.3f +/- %.3f) MHz" % (x0, u_x0), va="bottom", ha="left") return (f * 1e3, u_f * 1e3)
def pi_pi2pi_mI0(ax=None): folder = toolbox.latest_data("cal_pi2pi_pi_mI0") if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.11, 1, 0) A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] ax.text(0.1, 0.5, "A = (%.3f +/- %.3f) V" % (A, u_A)) return A, u_A
def t_between_pi(ax=None): folder = toolbox.latest_data('t_between_pulses') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.02, 1, 0 ) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival, 0.3, 'tbetweenpi = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def DD_spin_echo(ax=None): folder = toolbox.latest_data('calibrate_LDE_spin_echo') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, -.1, 1, 0 ) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] ax.text(0., 0.5, 'dt = (%.3f +/- %.3f) us' % (A, u_A)) return A, u_A
def C13_rev_small_range(ax=None): folder = toolbox.latest_data('calibrate_first_revival') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, 110, 1, 0 ) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival-20, 0.3, 'tfet = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def N_frq(ax=None): folder = toolbox.latest_data('NMR_frq_scan') if ax==None: fig,ax = plt.subplots(1,1) fit_result = fit_population_vs_detuning(folder, ax, 7.135) x0 = fit_result['params_dict']['x0'] u_x0 = fit_result['error_dict']['x0'] ax.text(7.1, 0.3, '$N_{frq}$ = (%.3f +/- %.3f) MHz' % (x0, u_x0), va='bottom', ha='left') return (f*1e3, u_f*1e3)
def CORPSE_fidelity(ax=None): folder = toolbox.latest_data() if ax == None: fig, ax = plt.subplots(1, 1) fit_result = epulse_fidelity(folder, ax, 1) fid = fit_result['params_dict']['of'] u_fid = fit_result['error_dict']['of'] ax.text(429, 0.5, 'of = (%.3f +/- %.3f)' % (fid, u_fid)) return fid, u_fid
def CORPSE_fidelity(ax=None): folder = toolbox.latest_data() if ax==None: fig,ax = plt.subplots(1,1) fit_result = epulse_fidelity(folder, ax, 1) fid = fit_result['params_dict']['of'] u_fid = fit_result['error_dict']['of'] ax.text(429, 0.5, 'of = (%.3f +/- %.3f)' % (fid, u_fid)) return fid, u_fid
def CORPSE_pi2_fidelity(ax=None): folder = toolbox.latest_data('CORPSEPi2Calibration') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = epulse_fidelity(folder, ax, 0.5) fid = fit_result['params_dict']['of'] u_fid = fit_result['error_dict']['of'] ax.text(0.6, 0.2, 'of = (%.3f +/- %.3f)' % (fid, u_fid)) return fid, u_fid
def C13_rev(ax=None): folder = toolbox.latest_data('calibrate_first_revival') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = fit_gaussian(folder, ax, 110) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival - 20, 0.3, 'tfet = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def calibrate_xy4_fet(ax=None): folder = toolbox.latest_data('bare_xy4') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, 107, 0, 0 ) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival, 0.5, 'tfet = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def dd_delta_t(ax=None): folder = toolbox.latest_data('DynamicalDecoupling') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, -0.24, 1, 0 ) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] ax.text(-0.24, 0.5, 'dt = (%.3f +/- %.3f) ns' % (A, u_A)) return A, u_A
def C13_rev(ax=None): folder = toolbox.latest_data('calibrate_first_revival') if ax==None: fig,ax = plt.subplots(1,1) fit_result = fit_gaussian(folder, ax, 110) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival-20, 0.3, 'tfet = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def CORPSE_pi2_fidelity(ax=None): folder = toolbox.latest_data('CORPSEPi2Calibration') if ax==None: fig,ax = plt.subplots(1,1) fit_result = epulse_fidelity(folder, ax, 0.5) fid = fit_result['params_dict']['of'] u_fid = fit_result['error_dict']['of'] ax.text(0.6, 0.2, 'of = (%.3f +/- %.3f)' % (fid, u_fid)) return fid, u_fid
def dd_calibrate_fidelity(r, ax=None): folder = toolbox.latest_data('DynamicalDecoupling') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, r*108, 1, 0 ) A = fit_result['params_dict']['of'] u_A = fit_result['error_dict']['of'] ax.text(r*108, 0.5, 'F = (%.3f +/- %.3f)' % (A, u_A)) return A, u_A
def dd_calibrate_fidelity(r, ax=None): folder = toolbox.latest_data('DynamicalDecoupling') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, r * 108, 1, 0) A = fit_result['params_dict']['of'] u_A = fit_result['error_dict']['of'] ax.text(r * 108, 0.5, 'F = (%.3f +/- %.3f)' % (A, u_A)) return A, u_A
def calibrate_xy4_fet(ax=None): folder = toolbox.latest_data('bare_xy4') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 107, 0, 0) revival = fit_result['params_dict']['x0'] u_revival = fit_result['error_dict']['x0'] ax.text(revival, 0.5, 'tfet = (%.3f +/- %.3f)' % (revival, u_revival)) return revival, u_revival
def fast_rabi(ax=None): folder = toolbox.latest_data('cal_fast_rabi'+name) if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_rabi(folder, ax, 1./125, 0.5, fit_k=False) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] ax.text(100, 0.9, '$f_r$ = (%.3f +/- %.3f) MHz' % (f*1e3, u_f*1e3), va='bottom', ha='left') return (f*1e3, u_f*1e3)
def CORPSE_pi2_alt(sil,M,ax=None): folder = toolbox.latest_data('CORPSEPi2Calibration_sil'+str(sil)+str(M)) if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.46, 0, 0 ) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] ax.text(0.42, 0.5, 'A = (%.3f +/- %.3f) V' % (A, u_A)) return A, u_A
def dd_delta_t(ax=None): folder = toolbox.latest_data('DynamicalDecoupling') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, -0.24, 1, 0) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] ax.text(-0.24, 0.5, 'dt = (%.3f +/- %.3f) ns' % (A, u_A)) return A, u_A
def slow_pi(ax=None): folder = toolbox.latest_data("cal_slow_pi_" + name) if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_rabi(folder, ax, 0.015, 1.0, 0.0, fit_x0=False, fit_k=False) f = fit_result["params_dict"]["f"] u_f = fit_result["error_dict"]["f"] # ax.text(500, 0.4, 'pi = (%.0f +/- %.0f) ns' % (0.5/f, 0.5/f**2 * u_f), # va='bottom', ha='left') ax.text(0.015, 0.4, "pi = (%.4f +/- %.4f) V" % (0.5 / f, 0.5 / f ** 2 * u_f), va="bottom", ha="left") return (0.5 / f, 0.5 / f ** 2 * u_f)
def CORPSE_pi2_alt(sil, M, ax=None): folder = toolbox.latest_data('CORPSEPi2Calibration_sil' + str(sil) + str(M)) if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.46, 0, 0) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] ax.text(0.42, 0.5, 'A = (%.3f +/- %.3f) V' % (A, u_A)) return A, u_A
def fast_pi2(): folder = toolbox.latest_data('cal_fast_pi_over_2') a = mbi.MBIAnalysis(folder) a.get_sweep_pts() a.get_readout_results(name='adwindata') a.get_electron_ROC() #a.plot_results_vs_sweepparam(ax=ax, name='adwindata') x = a.sweep_pts y = a.p0.reshape(-1) u_y = a.u_p0.reshape(-1) n = a.sweep_name x2 = x[::2] y2 = y[1::2] - y[::2] u_y2 = np.sqrt( u_y[1::2]**2 + u_y[::2]**2 ) fig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,4), sharex=True) ax1.errorbar(x2, y2, yerr=u_y2, fmt='o') ax1.set_xlabel(n) ax1.set_title('Difference btw. Pi/2-Pi and Pi/2'+'\n'+a.timestamp) ax1.set_ylabel('Difference') m = fit.Parameter((y[-1]-y[0])/(x[-1]-x[0]), 'm') x0 = fit.Parameter(x2.mean(), 'x0') p0 = [m, x0] def ff(x): return m() * (x-x0()) fitfunc_str = 'm * (x - x0)' fit_result = fit.fit1d(x2, y2, None, p0=p0, fitfunc=ff, fitfunc_str=fitfunc_str, do_print=True, ret=True) ax2.errorbar(x2, y[0::2], yerr=u_y[0::2], fmt='o', label='Pi/2') ax2.errorbar(x2, y[1::2], yerr=u_y[1::2], fmt='o', label='Pi/2 - Pi') ax2.legend(frameon=True, framealpha=0.5) ax2.set_ylabel('P(0)') ax2.set_xlabel(n) if fit_result != False: ax2.axvline(x0(), c='k', lw=2) ax2.axhline(0.5, c='k', lw=2) ax2.set_title('X marks the spot') plot.plot_fit1d(fit_result, np.linspace(x2[0],x2[-1],201), ax=ax1, plot_data=False, print_info=True) return x0(), 0
def N_rabi(ax=None): folder = toolbox.latest_data("Nuclear_rabi") if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_Npulse_rabi(folder, ax, 1.0 / 100, 0.5) f = fit_result["params_dict"]["f"] u_f = fit_result["error_dict"]["f"] ax.text(100, 0.9, "$f_r$ = (%.3f +/- %.3f) MHz" % (f * 1e3, u_f * 1e3), va="bottom", ha="left") ax.text( 100, 0.7, "pi pulse = (%.3f +/- %.3f) us" % (1.0 / (2 * f), 1.0 / (2 * f) * u_f / f), va="bottom", ha="left" ) return (f * 1e3, u_f * 1e3)
def N_rabi(ax=None): folder = toolbox.latest_data('Nuclear_rabi') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_Npulse_rabi(folder, ax, 1./100, 0.5) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] ax.text(100, 0.9, '$f_r$ = (%.3f +/- %.3f) MHz' % (f*1e3, u_f*1e3), va='bottom', ha='left') ax.text(100, 0.7, 'pi pulse = (%.3f +/- %.3f) us' % (1./(2*f), 1./(2*f)*u_f/f), va='bottom', ha='left') return (f*1e3, u_f*1e3)
def Hadamard_phase(ax=None, do_print_text=True): folder = toolbox.latest_data('TestBSM_LDE_calibrate_H_phase') # _'+name) if ax==None: do_print_text = False fig,ax = plt.subplots(1,1) fit_result = fit_correlation_parabolic(folder, ax, 100, 1, 0., which_correlation=0) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(10, 0.8, 'H phase = (%.3f +/- %.3f) ' % (A, u_A)) return A, u_A
def Hadamard_phase_large_range(ax=None, do_print_text=True): folder = toolbox.latest_data("TestBSM_LDE_calibrate_H_phase") # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_oscillation(folder, ax, 100, 1.0 / 360, 0.25, which_correlation=0) A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] if do_print_text: ax.text(10, 0.8, "H phase = (%.3f +/- %.3f) " % (A, u_A)) return A, u_A
def Hadamard_ev_time_large_range(ax=None, do_print_text=True): folder = toolbox.latest_data("calibrate_H_ev_time") # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_oscillation(folder, ax, 35.08, 1.0 / 0.05 / 10.0, 0.25, which_correlation=3) A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] if do_print_text: ax.text(35.07, 0.8, "H phase = (%.4f +/- %.4f) " % (A, u_A)) return A, u_A
def stage_2_calibrations(): # fig, ax = plt.subplots(1,1, figsize = (5,4)) # print 80*'=' # print 'first C13 revival' # print 80*'=' # C13_revival = C13_rev(ax) fig, ax = plt.subplots(1, 1, figsize=(5, 4)) folder = toolbox.latest_data('calibrate_first_revival') print 80 * '=' print 'first C13 revival' print 80 * '=' C13_revival_small_range = C13_rev_small_range(folder, ax) fig.savefig(os.path.join(folder, 'stage_2_calibrations.png'))
def CORPSE_pi(ax=None): folder = toolbox.latest_data('CORPSEPiCalibration') if ax==None: fig,ax = plt.subplots(1,1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.38, 1, 0 ) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] of = fit_result['params_dict']['of'] u_of = fit_result['error_dict']['of'] ax.text(0.42, 0.5, 'A = (%.3f +/- %.3f) V' % (A, u_A)) ax.text(0.42, 0.8, 'fid = (%.3f +/- %.3f) V' % (of, u_of)) return A, u_A
def stage_2_calibrations(): # fig, ax = plt.subplots(1,1, figsize = (5,4)) # print 80*'=' # print 'first C13 revival' # print 80*'=' # C13_revival = C13_rev(ax) fig, ax = plt.subplots(1,1, figsize = (5,4)) folder = toolbox.latest_data('calibrate_first_revival') print 80*'=' print 'first C13 revival' print 80*'=' C13_revival_small_range = C13_rev_small_range(folder, ax) fig.savefig(os.path.join(folder, 'stage_2_calibrations.png'))
def spin_echo(ax=None, do_print_text=True): folder = toolbox.latest_data("calibrate_echo") # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 200, 1, 0.0, double_ro="electron") A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] if do_print_text: ax.text(100, 0.5, "echo = (%.3f +/- %.3f) ns" % (A, u_A)) return A, u_A
def Hadamard_ev_time(ax=None, do_print_text=True): folder = toolbox.latest_data("calibrate_H_ev_time") # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_parabolic(folder, ax, 35.0, 1, 0.0, which_correlation=3) A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] if do_print_text: ax.text(35.0, 0.8, "evo time = (%.3f +/- %.3f) us" % (A, u_A)) return A, u_A
def rabi_8mhz(ax=None): folder = toolbox.latest_data('cal_8mhz_rabi') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_rabi(folder, ax, 1. / 125, 0.5, fit_k=False) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] ax.text(50, 0.85, '$f_r$ = (%.3f +/- %.3f) MHz' % (f * 1e3, u_f * 1e3), va='bottom', ha='left') return (f * 1e3, u_f * 1e3)
def CORPSE_pi(ax=None, do_print_text=True): folder = toolbox.latest_data('CORPSEPiCalibration') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.5, 1, 0) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(0.53, 0.5, 'A = (%.3f +/- %.3f) V' % (A, u_A)) return A, u_A
def pi_pi2pi(ax=None, do_print_text=True): folder = toolbox.latest_data("cal_pi2pi_pi_" + name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 0.11, 1, 0) # ax, 0.085, 1, 0) A = fit_result["params_dict"]["x0"] u_A = fit_result["error_dict"]["x0"] if do_print_text: ax.text(0.1, 0.5, "A = (%.3f +/- %.3f) V" % (A, u_A)) return A, u_A
def N_frq(ax=None): folder = toolbox.latest_data('NMR_frq_scan') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = fit_population_vs_detuning(folder, ax, 7.135) x0 = fit_result['params_dict']['x0'] u_x0 = fit_result['error_dict']['x0'] ax.text(7.1, 0.3, '$N_{frq}$ = (%.3f +/- %.3f) MHz' % (x0, u_x0), va='bottom', ha='left') return (f * 1e3, u_f * 1e3)
def get_data(name_contains): folder = toolbox.latest_data(name_contains) print folder a = mbi.MBIAnalysis(folder) a.get_sweep_pts() a.get_readout_results(name='measurement0') a.get_electron_ROC() #ax = a.plot_results_vs_sweepparam(ret='ax', ) t_shift = 0 # t_start=0 # t_0=10 x = a.sweep_pts.reshape(-1)[:] y = a.p0.reshape(-1)[:] return x, y, folder
def stage_1_calibrations(): fig, ax = plt.subplots(1, 1, figsize=(5, 4)) # print 80*'=' # print '8 MHz electron Rabi' # print 80*'=' # CORPSE_freq = rabi_8mhz(ax2) folder = toolbox.latest_data('CORPSEPiCalibration') print 80 * '=' print 'CORPSE pi' print 80 * '=' CORPSE_pi_amp = CORPSE_pi(folder, ax) # print 80*'=' # print 'CORPSE pi/2' # print 80*'=' # CORPSE_pi2_amp = CORPSE_pi2(ax2) fig.savefig(os.path.join(folder, 'stage_0p5_calibrations.png'))
def Hadamard_phase_large_range(ax=None, do_print_text=True): folder = toolbox.latest_data('TestBSM_LDE_calibrate_H_phase') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_oscillation(folder, ax, 100, 1. / 360, 0.25, which_correlation=0) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(10, 0.8, 'H phase = (%.3f +/- %.3f) ' % (A, u_A)) return A, u_A
def Hadamard_ev_time_large_range(ax=None, do_print_text=True): folder = toolbox.latest_data('calibrate_H_ev_time') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_oscillation(folder, ax, 35.08, 1. / 0.05 / 10., 0.25, which_correlation=3) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(35.07, 0.8, 'H phase = (%.4f +/- %.4f) ' % (A, u_A)) return A, u_A
def CORPSE_vs_angle(ax=None): folder = toolbox.latest_data('CORPSECalibration') if ax == None: fig, ax = plt.subplots(1, 1) f0 = 1. / 360 fit_result = calibrate_epulse_rabi(folder, ax, f0, 0.5, fit_k=False) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] ax.text(50, 0.35, '$f_r$ = (%.6f +/- %.6f) \n $(f_r-f_0)/f_0$ = %.3f' % (f, u_f, (f - f0) / f0), va='bottom', ha='left') return f, u_f
def CORPSE_phase(ax=None, do_print_text=True): folder = toolbox.latest_data('CalibrateCORPSEPiPhase') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 107, 1, 0., double_ro='electron') A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(100, 0.5, 'A = (%.3f +/- %.3f) V' % (A, u_A)) return A, u_A
def UNROT_evtime(ax=None, do_print_text=True): folder = toolbox.latest_data('Calibrate_UNROT_X_timing') if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 51, 0, 1., double_ro='nitrogen') A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(51.03, 0.5, 'A = (%.3f +/- %.3f) us' % (A, u_A)) return A, u_A
def spin_echo(ax=None, do_print_text=True): folder = toolbox.latest_data('calibrate_echo') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_amplitude(folder, ax, 200, 1, 0., double_ro='electron') A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(100, 0.5, 'echo = (%.3f +/- %.3f) ns' % (A, u_A)) return A, u_A
def Hadamard_ev_time(ax=None, do_print_text=True): folder = toolbox.latest_data('calibrate_H_ev_time') # _'+name) if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) fit_result = fit_correlation_parabolic(folder, ax, 35.0, 1, 0., which_correlation=3) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(35.0, 0.8, 'evo time = (%.3f +/- %.3f) us' % (A, u_A)) return A, u_A
def N_rabi(ax=None): folder = toolbox.latest_data('Nuclear_rabi') if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_Npulse_rabi(folder, ax, 1. / 100, 0.5) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] ax.text(100, 0.9, '$f_r$ = (%.3f +/- %.3f) MHz' % (f * 1e3, u_f * 1e3), va='bottom', ha='left') ax.text(100, 0.7, 'pi pulse = (%.3f +/- %.3f) us' % (1. / (2 * f), 1. / (2 * f) * u_f / f), va='bottom', ha='left') return (f * 1e3, u_f * 1e3)
def UNROT_evtime_large_range(ax=None, do_print_text=True): folder = toolbox.latest_data('Calibrate_UNROT_X_timing') if ax == None: do_print_text = False fig, ax = plt.subplots(1, 1) guess_x0 = 52.5 fit_result = calibrate_epulse_rabi(folder, ax, 1. / 0.45, 0.5, guess_x0=guess_x0, double_ro='nitrogen', fit_x0=True) A = fit_result['params_dict']['x0'] u_A = fit_result['error_dict']['x0'] if do_print_text: ax.text(guess_x0, 0.5, 'A = (%.3f +/- %.3f) us' % (A, u_A)) return A, u_A
def slow_pi(ax=None): folder = toolbox.latest_data('cal_slow_pi_' + name) if ax == None: fig, ax = plt.subplots(1, 1) fit_result = calibrate_epulse_rabi(folder, ax, 0.015, 1.0, 0., fit_x0=False, fit_k=False) f = fit_result['params_dict']['f'] u_f = fit_result['error_dict']['f'] #ax.text(500, 0.4, 'pi = (%.0f +/- %.0f) ns' % (0.5/f, 0.5/f**2 * u_f), # va='bottom', ha='left') ax.text(0.015, 0.4, 'pi = (%.4f +/- %.4f) V' % (0.5 / f, 0.5 / f**2 * u_f), va='bottom', ha='left') return (0.5 / f, 0.5 / f**2 * u_f)
import os, sys import numpy as np import h5py import logging from matplotlib import pyplot as plt from measurement.lib.tools import toolbox FOLDER = toolbox.latest_data('out-003') FN = toolbox.measurement_filename(FOLDER) BINEDGES = np.arange(3001) - 0.5 def get_photon_times_ns(FN): f = h5py.File(FN, 'r') channel = f['/HH_channel-1'].value special = f['/HH_special-1'].value sync_time = f['/HH_sync_time-1'].value f.close() # TODO this could maybe be done more efficient with cython is_not_special = special == 0 is_channel_0 = channel == 0 is_channel_1 = channel == 1 is_photon_0 = np.logical_and(is_not_special, is_channel_0) is_photon_1 = np.logical_and(is_not_special, is_channel_1) return sync_time[is_photon_0] * 1e-3, sync_time[is_photon_1] * 1e-3
from analysis.lib.fitting import fit, common from measurement.lib.tools import toolbox from analysis.lib.tools import plot from analysis.lib.m2.ssro import ssro from analysis.lib.m2.ssro import sequence reload(sequence) folder = None timestamp = None#'095551'#'180057'# None if folder == None: if timestamp != None: folder = toolbox.data_from_time(timestamp) else: folder = toolbox.latest_data('AdwinSSRO') a = ssro.SSROAnalysis(folder) b = sequence.SequenceAnalysis(folder) runs = 1 debug = False if debug: runs =2 max_ts = [ ] taus = [ ] u_taus =[ ] means = [ ] u_means = [] percentage_passes = [ ]
from matplotlib import pyplot as plt from analysis.lib import fitting from analysis.lib.m2.ssro import mbi from measurement.lib.tools import toolbox from analysis.lib.tools import plot from analysis.lib.math import error ### settings timestamp = None # ### script if timestamp != None: folder = toolbox.data_from_time(timestamp) else: folder = toolbox.latest_data('MBI_fidelity') a = mbi.MBIAnalysis(folder) a.get_sweep_pts() a.get_readout_results(name='adwindata') a.get_electron_ROC() ax = a.plot_results_vs_sweepparam(ret='ax', name='adwindata') x = a.sweep_pts.reshape(-1)[:] y = a.p0.reshape(-1)[:] u_y = a.u_p0.reshape(-1)[:] ax.set_ylim(0.4, 1.05) for (_x, _y, _u_y) in zip(x, y, u_y): ax.annotate("{:.3f} +/- {:.3f}".format(_y, _u_y), (_x, _y),