<jupyter_start><jupyter_text>loop<jupyter_code>gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
# error_d_wc=[]
# param_d_wc=[]
for d_wc in np.arange(-50e6,200.1e6,10e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_wc.append(DATA.fun)
    param_d_wc.append(DATA.x)
    print('d_wc:',d_wc,';error:',DATA.fun,';param:',DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_wc.txt',np.array(error_d_wc))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_wc.txt',np.array(param_d_wc))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]

[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)

error_d_w1=[]
param_d_w1=[]
for d_w1 in np.arange(-200e6,200.1e6,10e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_w1.append(DATA.fun)
    param_d_w1.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_w1.txt',np.array(error_d_w1))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_w1.txt',np.array(param_d_w1))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]

[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)

error_d_w2=[]
param_d_w2=[]
for d_w2 in np.arange(-200e6,200.1e6,10e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_w2.append(DATA.fun)
    param_d_w2.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_w2.txt',np.array(error_d_w2))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_w2.txt',np.array(param_d_w2))

# gate_time=30e-9
# SRATE=10e9
# raw_initial_seeds=[0.8]
# [d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
# error_d_r1c=[]
# param_d_r1c=[]
# for d_r1c in np.arange(-0.2,0.2,0.01):
#     DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
#     raw_initial_seeds=DATA.x
#     error_d_r1c.append(DATA.fun)
#     param_d_r1c.append(DATA.x)
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r1c.txt',np.array(error_d_r1c))
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r1c.txt',np.array(param_d_r1c))
    
    
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r1c=[]
param_d_r1c=[]

for d_r1c in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r1c.append(DATA.fun)
    param_d_r1c.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r1c_05.txt',np.array(error_d_r1c))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r1c_05.txt',np.array(param_d_r1c))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r2c=[]
param_d_r2c=[]
for d_r2c in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r2c.append(DATA.fun)
    param_d_r2c.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r2c_05.txt',np.array(error_d_r2c))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r2c_05.txt',np.array(param_d_r2c))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r1c=[]
param_d_r1c=[]

for d_r1c in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r1c.append(DATA.fun)
    param_d_r1c.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r1c_05.txt',np.array(error_d_r1c))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r1c_05.txt',np.array(param_d_r1c))

gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r2c=[]
param_d_r2c=[]
for d_r2c in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r2c.append(DATA.fun)
    param_d_r2c.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r2c_05.txt',np.array(error_d_r2c))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r2c_05.txt',np.array(param_d_r2c))

gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r12=[]
param_d_r12=[]
for d_r12 in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r12.append(DATA.fun)
    param_d_r12.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r12_05.txt',np.array(error_d_r12))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r12_05.txt',np.array(param_d_r12))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]

[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_alpha1=[]
param_d_alpha1=[]
for d_alpha1 in np.arange(-100e6,100.1e6,5e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_alpha1.append(DATA.fun)
    param_d_alpha1.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_alpha1.txt',np.array(error_d_alpha1))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_alpha1.txt',np.array(param_d_alpha1))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]

[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_alpha2=[]
param_d_alpha2=[]
for d_alpha2 in np.arange(-100e6,100.1e6,5e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_alpha2.append(DATA.fun)
    param_d_alpha2.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_alpha2.txt',np.array(error_d_alpha2))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_alpha2.txt',np.array(param_d_alpha2))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]

[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_alphac=[]
param_d_alphac=[]
for d_alphac in np.arange(-100e6,100.1e6,5e6):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_alphac.append(DATA.fun)
    param_d_alphac.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_alphac.txt',np.array(error_d_alphac))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_alphac.txt',np.array(param_d_alphac))
gate_time=30e-9
SRATE=10e9
raw_initial_seeds=[0.8]
[d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
error_d_r1c=[]
param_d_r1c=[]

for d_r1c in np.arange(0.2,0.501,0.02):
    DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
    raw_initial_seeds=DATA.x
    error_d_r1c.append(DATA.fun)
    param_d_r1c.append(DATA.x)
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r1c_02_05.txt',np.array(error_d_r1c))
    np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r1c_02_05.txt',np.array(param_d_r1c))

# gate_time=30e-9
# SRATE=10e9
# raw_initial_seeds=[0.8]
# [d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
# error_d_r2c=[]
# param_d_r2c=[]
# for d_r2c in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
#     DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
#     raw_initial_seeds=DATA.x
#     error_d_r2c.append(DATA.fun)
#     param_d_r2c.append(DATA.x)
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r2c_05.txt',np.array(error_d_r2c))
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r2c_05.txt',np.array(param_d_r2c))

# gate_time=30e-9
# SRATE=10e9
# raw_initial_seeds=[0.8]
# [d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12]=np.zeros(9)
# error_d_r12=[]
# param_d_r12=[]
# for d_r12 in np.append(np.arange(-0.5,-0.2,0.02),np.arange(0.2,0.501,0.02)):
#     DATA = sci_op.minimize(cost_func_deviation,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c,d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})
#     raw_initial_seeds=DATA.x
#     error_d_r12.append(DATA.fun)
#     param_d_r12.append(DATA.x)
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\error_d_r12_05.txt',np.array(error_d_r12))
#     np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\param_d_r12_05.txt',np.array(param_d_r12))
# DATA = sci_op.minimize(cost_func_distor,raw_initial_seeds,args=(gate_time,SRATE,d_w1,d_w2,d_wc,d_alpha1,d_alpha2,d_alphac,d_r1c,d_r2c_d_r12), method='Nelder-Mead', options={'disp': True,'ftol':1e-4,'xtol':1e-4,'maxiter':30})

# np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\robustness_deviation\params_two1_distor_0ns_30ns.txt',error )
# SRATE=6e9
# gate_time=30e-9
# f_terms=2

# Tr_arr = np.arange(0e-9,30.1e-9,1e-9)
# factor_r_arr = np.linspace(-0.1,0.1,21)

# gate_fidelity_two = np.zeros([len(Tr_arr),len(factor_r_arr)])
# gate_params_two_1 = np.zeros([len(Tr_arr),len(factor_r_arr)])
# gate_params_two_2 = np.zeros([len(Tr_arr),len(factor_r_arr)])
# raw_initial_seeds=np.array([0.8,-0.06])

# ii = 0
# for T_r in Tr_arr:
#     jj = 0
#     for factor_r in factor_r_arr:
#         time_start = time.time()
#         DATA = sci_op.minimize(cost_func_distor,raw_initial_seeds,args=(gate_time,SRATE,f_terms,factor_r,T_r), method='Nelder-Mead', options={'disp': True,'ftol':5e-5,'xtol':5e-5,'maxiter':50})

#         gate_fidelity_two[ii,jj] = DATA.fun
#         gate_params_two_1[ii,jj] = DATA.x[0]
#         gate_params_two_2[ii,jj] = DATA.x[1]
        
#         print('fidelity',DATA.fun)
#         print(time.time()-time_start)
#         np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\params_two1_distor_0ns_30ns.txt',gate_params_two_1 )
#         np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\params_two2_distor_0ns_30ns.txt',gate_params_two_2 )
#         np.savetxt(r'C:\Chuji\Latex_Papers\Mypapers\ZZ_coupling_20210205\fig_zz\Robustness\error_two_distor_0ns_30ns.txt',gate_fidelity_two )
#         jj+=1
#     ii+=1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16281138790035588, 'fraction_numerical': 0.0804817957842869, 'mean_word_length': 7.904936014625228, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '576971', 'license': 'MIT', 'n_tokens_mistral': 7990, 'n_tokens_neox': 7511, 'n_words': 353, 'path': "examples/code for 'Coupler-assisted C-phase gate'/Robustness/Robustness to parameter deviation.ipynb", 'repo_name': 'tsuji29/Circuit_Simulator', 'size': '14612'}