diff --git a/DiffractionGratings/grating2D.pro b/DiffractionGratings/grating2D.pro index f80a9920530389df090fe743dd63c1916bd2718b..f00d774f798f03ac7abab7e3318328a62d616390 100644 --- a/DiffractionGratings/grating2D.pro +++ b/DiffractionGratings/grating2D.pro @@ -443,7 +443,7 @@ PostOperation { { Name postop_energy; NameOfPostProcessing postpro_energy ; Operation { If (flag_Hparallel==1) - Print[ lambda_step, OnPoint{0,0,0}, Format Table, File StrCat[myDir, "temp_lambda_step.txt"], SendToServer "GetDP/Lambda_step" ] ; + Print[ lambda_step, OnPoint{0,0,0}, Format Table, File > StrCat[myDir, "temp_lambda_step.txt"], SendToServer "GetDP/Lambda_step" ] ; For i In {0:2*nb_orders} Print[ s_r~{i}[SurfCutSuper1], OnGlobal, Store i , Format Table , File > StrCat[myDir, Sprintf("temp_s_r_%g.txt", i-nb_orders)]]; Print[ s_t~{i}[SurfCutSubs1] , OnGlobal, Store (2*nb_orders+1+i), Format Table , File > StrCat[myDir, Sprintf("temp_s_t_%g.txt", i-nb_orders)]]; diff --git a/DiffractionGratings/grating2D_postplot.py b/DiffractionGratings/grating2D_postplot.py index 8504011740a4ecf944acbde2d70f5bd48d91d7c4..b0c880b714d7fe1e93f454d7083792b14d67d9d9 100644 --- a/DiffractionGratings/grating2D_postplot.py +++ b/DiffractionGratings/grating2D_postplot.py @@ -5,24 +5,14 @@ import subprocess import numpy as np import scipy as sc import matplotlib -matplotlib.use('Agg') import pylab as pl pi=np.pi -pl.rc('font', family='serif',size=20) -pl.rc('legend',fontsize=20) -# pl.rc('text', usetex=True) -# pl.rc('figure', **{'autolayout': True}) -#### scaling the problem (*10^12) -nm = 1.e3 -ep0 = 8.854187817e-3*nm -mu0 = 400.*pi*nm -cel = 1.0/(np.sqrt(ep0 * mu0)) -#### + nb_orders = int(int(subprocess.check_output("ls ./run_results/efficiency_r_* | grep -c efficiency_r_", shell=True))/2) nb_rods = int(int(subprocess.check_output("ls ./run_results/absorption-Q_rod_* | grep -c absorption-Q_rod_", shell=True))-1) zerotol = 0.001 if len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==2: - tab_lambdas = cel/nm/np.loadtxt('./run_results/efficiency_r_0.txt')[:,0] + tab_lambdas = np.loadtxt('./run_results/temp_lambda_step.txt')[:,8] nb_lambdas = tab_lambdas.shape[0] R = np.zeros((nb_lambdas,2*nb_orders+1),dtype=complex) T = np.zeros((nb_lambdas,2*nb_orders+1),dtype=complex) @@ -46,9 +36,9 @@ if len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==2: pl.savez('last_run_RTA.npz',R0=R0,T0=T0,A=A) - pl.figure(figsize=(12,8));ax = pl.subplot(111) - ax.plot(tab_lambdas,Rtot,'g',label='$R_{tot}$') #R_0 - ax.plot(tab_lambdas,Ttot,'b',label='$T_{tot}$') #T_0 + pl.figure();ax = pl.subplot(111) + ax.plot(tab_lambdas,Rtot,'g',label='$R_{tot}=\sum_k R_k$') #R_0 + ax.plot(tab_lambdas,Ttot,'b',label='$T_{tot}=\sum_k T_k$') #T_0 ax.plot(tab_lambdas, A ,'r',label='$A$') ax.plot(tab_lambdas, Rtot+Ttot+A,'k',label='$R_{tot}+T_{tot}+A$') ax.set_ylim([-0.07,1.07]) @@ -56,10 +46,10 @@ if len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==2: ax.grid() box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) - ax.legend(loc='center left', bbox_to_anchor=(1, 0.5),fontsize=16) + ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) pl.savefig('energy_balance_global.pdf') - pl.figure(figsize=(12,8));ax = pl.subplot(111) + pl.figure();ax = pl.subplot(111) absorption_list=[A_rod_out,A_layer_cov,A_layer_dep,A_sub] absorption_list_label=['$A_{rod_{out}}$','$A_{layer_{cov}}$','$A_{layer_{dep}}$','$A_{sub}$'] count=0 @@ -93,7 +83,7 @@ if len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==2: if not np.all(np.isclose(tran.real,np.zeros_like(tran),atol=zerotol)): if(k==0):ax.plot(tab_lambdas,tran.real ,lw=3, c=next(color),label='$T_{%g}$'%(k)) else:ax.plot(tab_lambdas,tran.real ,lw=1, c=next(color),label='$T_{%g}$'%(k)) - pl.title('details : diffraction orders (>%.0fpercent for clarity)'%(zerotol*100.)) + pl.title('details : diffraction orders (>%.0f%% for clarity)'%(zerotol*100.)) ax.set_ylim([-0.07,1.07]) ax.set_xlim([tab_lambdas.min(),tab_lambdas.max()]) ax.grid() @@ -103,7 +93,7 @@ if len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==2: pl.savefig('energy_balance_detailed.pdf') pl.show() elif len(np.loadtxt('./run_results/efficiency_r_0.txt').shape)==1: - lambdas=cel/nm/np.loadtxt('./run_results/efficiency_r_0.txt')[0] + lambdas=np.loadtxt('./run_results/efficiency_r_0.txt')[0] R = np.zeros(2*nb_orders+1,dtype=complex) T = np.zeros(2*nb_orders+1,dtype=complex) angle_r = np.zeros(2*nb_orders+1)