Ib1 = Vb / rb1 Ib2 = Vb / rb2 Ib3 = Vb / rb3 I7 = Ib1 num_it = 20 I6_vec = np.zeros([num_it]) I4_vec = np.zeros([num_it]) Ia_vec = np.zeros([num_it]) for ii in range(num_it): print('ii = {} of {}'.format(ii + 1, num_it)) La = (L1 + Ljj(Ic, Ia)) / 2 Lb = L2 + L8 Lc = L3 + L10 Ld = La + Lb Lt = L6 + Ljj(Ic, I4) Lq = L6 + Ljj(Ic, I6) Le = ip(Ld, Lt) Lf = Le + Lc Lg = ip(Lf, Lq) Lh = L4 + L11 Li = ip(Lh, Lf) Lj = Lq + Li Lk = ip(Lh, Lq) Lm = Lc + Lk Ln = ip(Lt, Lm) Lp = Lb + Ln
#%% step through time I1 = np.zeros([len(time_vec)]) I1[0] = I_bias I2 = np.zeros([len(time_vec)]) state = 'subthreshold' for ii in range(len(time_vec) - 1): # if ii < 100: # print('ii = {:d} of {:d}; time_vec[ii] = {:7.2f}ns; I1[ii] = {:5.2f}uA; I2[ii] = {:5.2f}uA; Ic = {:5.2f}uA'.format(ii+1,len(time_vec),time_vec[ii]*1e9,I1[ii]*1e6,I2[ii]*1e6,Ic*1e6)) # if Vj(I_bias-I2[ii],Ic,r) > 0: # print('I2[ii] = {:5.2f}uA; Ic = {:5.2f}uA; Vj = {}uV'.format(I2[ii]*1e6,Ic*1e6,Vj(I_bias-I2[ii],Ic,r)*1e6)) # I2[ii+1] = (1-r*dt/Lt)*I2[ii] - ( M/Lt )*( I_drive[ii+1] - I_drive[ii] ) + ( dt/Lt )*Vj(I1[ii],Ic,rj) Ltt = Lt + Ljj(Ic, I1[ii]) # if ii < 20: # print('Ltt = {}pH'.format(Ltt*1e12)) if state == 'subthreshold': V_j = 0 elif state == 'spiking': # print('spiking') V_j = Phi0 state = 'subthreshold' I2[ii + 1] = (1 - r * dt / Ltt) * I2[ii] + (M / Ltt) * ( I_drive[ii + 1] - I_drive[ii]) + (1 / Ltt) * V_j I1[ii + 1] = I_bias - I2[ii + 1] if I1[ii + 1] >= Ic: state = 'spiking' #%% import WR
peaks_I_j_3, _ = find_peaks(I_j_3, height = 100e-9, distance = 20) # plot_fq_peaks(time_vec,I_j_df,peaks_I_j_df) I_j_df__init = I_j_df[initial_ind] I_j_df__peaks = I_j_df[peaks_I_j_df] I_j_df__fluxon_wr = I_j_df__peaks[0]-I_j_df__init I_j_2__init = I_j_2[initial_ind] I_j_2__peaks = I_j_2[peaks_I_j_2] I_j_2__fluxon_wr = I_j_2__peaks[0]-I_j_2__init I_j_3__init = I_j_3[initial_ind] I_j_3__peaks = I_j_3[peaks_I_j_3] I_j_3__fluxon_wr = I_j_3__peaks[0]-I_j_3__init Ljdr1 = Ljj(Ic,Ic) Ljdr2 = Ljj(Ic,Ic) Lj2 = Ljj(Ic,Ic) Lj3 = Ljj(Ic,Ic) L_ppp = Lj3*L3/(Lj3+L3) L_pp = L2+L_ppp L_p = Lj2*L_pp/(Lj2+L_pp) L_qqq = Ldr1+Lm2+Ljdr1 L_qq = Ldr2+Ljdr2 L_q = L_qq*L_qqq/(L_qq+L_qqq) Phi0 = p['Phi0'] # I_j_df_fluxon_soen = Phi0/(L1+Ldr2+L_p) # I_j_df_fluxon_soen = Phi0/(L1+L_p+L_q)
Ldr1 = 10e-12 Ldr2 = 26e-12 L1 = 200e-12 L2 = 77.5e-12 L3 = 77.5e-9 Ib = [71.5e-6, 36e-6, 35e-6] Lm2 = 10e-12 M = np.sqrt(200e-12 * Lm2) #%% calculate I_drive_vec = np.arange(19e-6, 27e-6, 1e-6) Idr1_vec = np.zeros([len(I_drive_vec), 1]) Idr2_vec = np.zeros([len(I_drive_vec), 1]) Lj0 = Ljj(Ic, 0) Iflux = 0 Idr2_prev = ( (Lm2 + Ldr1 + Lj0) * Ib[0] + M * Iflux) / (Lm2 + Ldr1 + Ldr2 + 2 * Lj0 + (Lm2 + Ldr1 + Lj0) * (Ldr2 + Lj0) / L1) Idr1_prev = Ib[0] - (1 + (Ldr2 + Lj0) / L1) * Idr2_prev for ii in range(len(I_drive_vec)): for jj in range(10): Idr1_next, Idr2_next = dendrite_current_splitting( Ic, I_drive_vec[ii], Ib[0], Ib[1], Ib[2], M, Lm2, Ldr1, Ldr2, L1, L2, L3, Idr1_prev, Idr2_prev) Idr1_prev = Idr1_next Idr2_prev = Idr2_next Idr1_vec[ii] = Idr1_next
#%% calculated quantities M1 = np.sqrt(L3 * L4) M2 = -np.sqrt(L5 * L6) #%% iterate Ia = 0 I3 = 0 num_it = 10 Ia_vec = np.zeros([num_it]) I3_vec = np.zeros([num_it]) for ii in range(num_it): # print('ii = {} of {}'.format(ii+1,num_it)) La = L1 + Ljj(Ic, Ia) Lb = L4 + Ljj(Ic, I3) Lc = L2 + L6 Ld = 2 * (Lb + Lc) + La Ia = (Lb / Ld) * Ib1 + (M1 / Ld) * Ib2 - (M2 / Ld) * Isy Ia_vec[ii] = Ia I3 = Ib1 - 2 * Ia I3_vec[ii] = I3 print( 'Ib1 = {:9.4f}uA; Ib2 = {:9.4f}uA; Isy = {:9.4f}uA; I3 = {:9.4f}uA; Ia = {:9.4f}uA' .format(Ib1, Ib2, Isy, I3, Ia)) #%% plot
I7a = 0 I7b = 0 Ib1 = Vb / rb1 Ib2 = Vb / rb2 Ib3 = Vb / rb3 num_it = 20 I6_vec = np.zeros([num_it]) I4_vec = np.zeros([num_it]) Ia_vec = np.zeros([num_it]) for ii in range(num_it): print('ii = {} of {}'.format(ii + 1, num_it)) La = (L1 + Ljj(Ic, Ia)) / 2 Lb = L2 + La Lc = ip(Lb, L6 + Ljj(Ic, I4)) Ld = L3 + Lc Le = ip(Ld, Ljj(Ic, I6)) Lf = ip(Ld, L4) Lg = Lf + L6 + Ljj(Ic, I6) Lh = ip(L4, L6 + Ljj(Ic, I6)) Li = L3 + Lh Lj = ip(Lb, Li) Lk = Lj + L6 + Ljj(Ic, I4) Lm = Ld + L6 + Ljj(Ic, I6) Ln = Ld + L4 Lp = Lb + L6 + Ljj(Ic, I4) Lq = L4 + L6 + Ljj(Ic, I6)
import numpy as np from matplotlib import pyplot as plt from _functions import Ljj from _util import physical_constants, color_dictionary, set_plot_params p = physical_constants() colors = color_dictionary() fig_size = set_plot_params('large') # 'publication' or 'large' plt.close('all') #%% inputs Ic = 100e-6 L1 = 200e-12 L2 = 5.17e-12 k = 1 Ib = 140e-6 I_in = 10e-6 #%% L_sq = 2 * L2 L_sq_tot = 2 * L2 + Ljj(Ic, 86e-6) + Ljj(Ic, 54e-6) # L_sq_tot = 2*L2 # + Ljj(Ic,0) + Ljj(Ic,Ic) I2__with_JJs = Ib / 2 + (k * np.sqrt(L1 * L2) / L_sq_tot) * I_in I2__without_JJs = Ib / 2 + (k * np.sqrt(L1 * L2) / L_sq) * I_in print('with JJs: I2 = {:7.4f}uA'.format(I2__with_JJs * 1e6)) print('without JJs: I2 = {:7.4f}uA'.format(I2__without_JJs * 1e6))
k2 = [0.5,0.75] L_dc3 = 10e-12 # pH L_di1 = [0,2e-9,10e-9] I_ind_over_sat = np.zeros([len(k1),len(L_di1),len(N_vec)]) fig, ax = plt.subplots(nrows = 1, ncols = 1, sharex = True, sharey = False) plt.suptitle('Cross talk when all loops are saturated\nIc = {:6.2f}uA, I_di_sat = {:6.2f}uA, L_dc1 = {:5.2f}pH, L_dc2 = {:4.2f}L_dc3, L_dc3 = {:6.2f}pH'.format(Ic*1e6,I_di_sat*1e6,L_dc1*1e12,alpha,L_dc3*1e12)) color_list = [['blue3','yellow3','green3'],['blue2','yellow2','green2']] linestyle_list = ['solid','dotted'] for ii in range(len(k1)): for jj in range(len(L_di1)): L_di2 = (1/L_dc3) * ( (Phi_dr_max/(k1[ii]*k2[ii]*N_vec[:]*I_di_sat)) * ( N_vec[:] + (2*Ic/p['Phi0'])*L_dc3*(1+alpha) ) )**2 L_di_tot = Ljj(Ic,0) + L_di1[jj] + L_di2 L_dc_tot = N_vec[:]*L_dc1 + L_dc3*(1+alpha) # print('L_di2[0] = {:5.2f}pH, L_di2[-1] = {:5.2f}pH, L_di_tot[0] = {:5.2f}nH, L_di_tot[-1] = {:5.2f}nH'.format(L_di2[0]*1e12,L_di2[-1]*1e12,L_di_tot[0]*1e9,L_di_tot[-1]*1e9)) I_ind_over_sat[ii,jj,:] = ( (k1[ii]**2 * L_di2 * L_dc1) / (L_di_tot*L_dc_tot) ) * N_vec[:] ax.loglog(N_vec[:],I_ind_over_sat[ii,jj,:], color = colors[color_list[ii][jj]], linestyle = linestyle_list[ii], label = 'k = {:4.2f}, L_di1 = {:5.2f}nH'.format(k1[ii],L_di1[jj]*1e9)) ax.set_ylabel(r'$I^{di}_{ind}/I^{di}_{sat}$') ax.set_xlabel(r'$N$') ax.tick_params(axis = 'both') ax.grid(which = 'major', axis = 'both') ax.set_xlim([N_vec[0],N_vec[-1]]) ax.set_ylim([1e-4,1]) # plt.subplots_adjust(wspace=0, hspace=0) ax.legend() plt.tight_layout()
Ib1 = Vb / rb1 Ib2 = Vb / rb2 Ib3 = Vb / rb3 I7 = Ib1 num_it = 20 I6_vec = np.zeros([num_it]) I4_vec = np.zeros([num_it]) Ia_vec = np.zeros([num_it]) for ii in range(num_it): print('ii = {} of {}'.format(ii + 1, num_it)) La = (L1 + Ljj(Ic, Ia)) / 2 Ld = L6 + Ljj(Ic, I4) Le = L6 + Ljj(Ic, I6) Lf = Le + Lc + Ld alpha = 2 * (1 + Lb / Ld - Ld / Lf) - La / Ld Ia = (-M1 * (1 / Lf + 1 / Ld) * Ib3 + (1 - ((Lc + Ld) / Lf)) * Ib1 + (M1 / Lf) * Ib2 - (M2 / Ld) * Isy1 + (M3 / Lf) * Isy2) / alpha Ia_vec[ii] = Ia I6 = Ib1 + (M1 / Ld) * Ib3 + (M2 / Ld) * Isy1 - (2 * (1 + (Lb / Ld)) - La / Ld) * Ia I6_vec[ii] = I6 I4 = Ib1 - I6 - 2 * Ia
error_mat_master__mu1_mu2__exp_pls_trn_per100ns) # error_mat_master__mu1_mu2 = ( error_mat_master__mu1_mu2__no_leak__vary_Ldi # +error_mat_master__mu1_mu2__vary_taudi # +error_mat_master__mu1_mu2__vary_Idrive_20uA # +error_mat_master__mu1_mu2__vary_Idrive_25uA # +error_mat_master__mu1_mu2__vary_Idrive_30uA # +error_mat_master__mu1_mu2__sq_pls_trn_per20ns # +error_mat_master__mu1_mu2__sq_pls_trn_per100ns # +error_mat_master__mu1_mu2__exp_pls_trn_per100ns # +error_mat_master__mu1_mu2__exp_pls_trn_per1000ns ) ind_best = np.where(error_mat_master__mu1_mu2 == np.amin( error_mat_master__mu1_mu2)) #error_mat.argmin() mu1_best = mu1_vec[ind_best[0]][0] mu2_best = mu2_vec[ind_best[1]][0] print('mu1_best = {}'.format(mu1_best)) print('mu2_best = {}\n\n'.format(mu2_best)) pre_str = 'dend_fit_master' title_string = '{}; mu1_best = {:1.2f}, mu2_best = {:1.2f}'.format( pre_str, mu1_best, mu2_best) save_str_1 = '{}__master_error__mu1_mu2'.format(pre_str) plot_error_mat(error_mat_master__mu1_mu2[:, :], mu1_vec, mu2_vec, 'mu1', 'mu2', title_string, save_str_1) #%% load data # load_string = 'session_data__wr_fits__no_leak__vary_L_di__finding_amp_mu1_mu2+mu3_mu4__2020-04-08_14-29-15.dat' # data_array_imported = load_session_data(load_string) Ljj(40e-6, 35e-6)