] }) #%%============================================================================== # Plot results for sweep #============================================================================== if 1: swpvar = 'pin_shift' RES = [] SWP = [] for key, s in sol.iteritems(): varz = hfss_variables[key] SWP += [ureg.Quantity(varz['_' + swpvar]).magnitude] RES += [ eBBQ_Pmj_to_H_params(s, meta_datas[key], cos_trunc=cos_trunc, fock_trunc=fock_trunc) ] import matplotlib.gridspec as gridspec #%% fig = plt.figure(num=1, figsize=(19, 5)) gs1 = gridspec.GridSpec(1, 4, width_ratios=[2, 2, 2, 1]) gs1.update(left=0.05, right=0.98) # wspace=0.05 ax1 = plt.subplot(gs1[0]) ax2 = plt.subplot(gs1[1]) ax3 = plt.subplot(gs1[2]) ax3b = plt.subplot(gs1[3]) ax = ax1 ID = 1 args = {'lw': 0, 'marker': 'o', 'ms': 5}
swp_var = 'inductance_shift' bba = BbqAnalysis(file_name) hfss_variables = bba.hfss_variables sols = bba.sols meta_datas = bba.meta_data #%% if analyze_BBQ: RES = []; SWP = []; for key, s in sols.iteritems(): print '\r Analyzing ', key, try: varz = hfss_variables[key] SWP += [ ureg.Quantity(varz['_'+swp_var]).magnitude ] RES += [ eBBQ_Pmj_to_H_params(s, meta_datas[key], cos_trunc = cos_trunc, fock_trunc = fock_trunc) ] except Exception as e: print_color(" !ERROR %s" % e) #%%============================================================================== # Plot Chis #============================================================================== if plot_Fs: #Fs = bba.get_Fs(swp_var=swp_var) Fs = [] for i in range(len(RES)): Fs.append(RES[i][9]) plt.plot(sorted(SWP), np.array(Fs).transpose()[0]*10**-9, label='D mode freq', marker = 'o', lw =1) plt.plot(sorted(SWP), np.array(Fs).transpose()[1]*10**-9, label='B mode freq', marker = 'o', lw =1) plt.title('D and B mode frequencies (nonlinear)');
# print 'Q={:8.1e} {:7.1e} {:6.0f}'.format(*(Qs)) #print pd.Series({ key:varz[key] for key in ['_join_w','_join_h','_padV_width', '_padV_height','_padH_width', '_padH_height','_scaleV','_scaleH', '_LJ1','_LJ2'] }) #%%============================================================================== # Plot results for sweep #============================================================================== if 1: swpvar='LJ' use_1st_order = True # use 1st O PT to identify correct eigenvectors in ND RES = []; SWP = []; for key, s in sol.iteritems(): print '\r Analyzing ', key, try: varz = hfss_variables[key] SWP += [ ureg.Quantity(varz['_'+swpvar]).magnitude ] RES += [ eBBQ_Pmj_to_H_params(s, meta_datas[key], cos_trunc = cos_trunc, fock_trunc = fock_trunc, use_1st_order = False) ] except Exception as e: print_color(" !ERROR %s" % e) import matplotlib.gridspec as gridspec; #%% fig = plt.figure(num = 1, figsize=(19,5)) gs1 = gridspec.GridSpec(1, 4, width_ratios=[2,2,2,1]); gs1.update(left=0.05, right=0.98) # wspace=0.05 ax1 = plt.subplot(gs1[0]); ax2 = plt.subplot(gs1[1]); ax3 = plt.subplot(gs1[2]); ax3b = plt.subplot(gs1[3]) ax = ax1; ID = 1; args = {'lw':0,'marker':'o','ms':5} ax.plot(SWP, [r[ID][0,1]for r in RES], label = '$\\chi_{DB}$', **args) ax.plot(SWP, [r[ID][0,2]for r in RES], label = '$\\chi_{DC}$', **args) ax.plot(SWP, [r[ID][1,2]for r in RES], label = '$\\chi_{BC}$', **args) ax.set_ylim([0.01,10**2]); ax.set_xlabel(swpvar); ax.set_title('cross-Kerr'); ax.set_ylabel('$\\chi$ (MHz)'); ax.legend(loc = 0) ax.set_yscale('log'); ax.set_ylim(0.1,100)
# print 'Q={:8.1e} {:7.1e} {:6.0f}'.format(*(Qs)) #print pd.Series({ key:varz[key] for key in ['_join_w','_join_h','_padV_width', '_padV_height','_padH_width', '_padH_height','_scaleV','_scaleH', '_LJ1','_LJ2'] }) #%%============================================================================== # Plot results for sweep #============================================================================== if 1: swpvar='LJ' RES = []; SWP = []; for key, s in sol.iteritems(): print '\r Analyzing ', key, try: varz = hfss_variables[key] SWP += [ ureg.Quantity(varz['_'+swpvar]).magnitude ] RES += [ eBBQ_Pmj_to_H_params(s, meta_datas[key], cos_trunc = cos_trunc, fock_trunc = fock_trunc, _renorm_pj = True) ] except Exception as e: print_color(" !ERROR %s" % e) import matplotlib.gridspec as gridspec; #%% fig = plt.figure(num = 1, figsize=(19,5)) gs1 = gridspec.GridSpec(1, 4, width_ratios=[2,2,2,1]); gs1.update(left=0.05, right=0.98) # wspace=0.05 ax1 = plt.subplot(gs1[0]); ax2 = plt.subplot(gs1[1]); ax3 = plt.subplot(gs1[2]); ax3b = plt.subplot(gs1[3]) ax = ax1; ID = 1; ax.set_title('cross-Kerr') args = {'lw':0,'marker':'o','ms':5} ax.plot(SWP, [r[ID][0,1]for r in RES], label = '$\\chi_{DB}$', **args) ax.set_xlabel(swpvar) ax.axhline(5)