diff --git a/examples/fault_tolerance/ADVECTION_residuals_allstrategies.png b/examples/fault_tolerance/ADVECTION_residuals_allstrategies.png deleted file mode 100644 index 8ce3ca42e9..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_residuals_allstrategies.png and /dev/null differ diff --git a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP.png b/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP.png deleted file mode 100644 index 4a81687eda..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP.png and /dev/null differ diff --git a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png b/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png deleted file mode 100644 index 2036b09e59..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png and /dev/null differ diff --git a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_NOFAULT.png b/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_NOFAULT.png deleted file mode 100644 index 6311adf85f..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_NOFAULT.png and /dev/null differ diff --git a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD.png b/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD.png deleted file mode 100644 index 9a821b4f07..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD.png and /dev/null differ diff --git a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png b/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png deleted file mode 100644 index 6ea544d11d..0000000000 Binary files a/examples/fault_tolerance/ADVECTION_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_residuals_allstrategies.png b/examples/fault_tolerance/HEAT_residuals_allstrategies.png deleted file mode 100644 index af23a26b9f..0000000000 Binary files a/examples/fault_tolerance/HEAT_residuals_allstrategies.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP.png b/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP.png deleted file mode 100644 index bcef246d71..0000000000 Binary files a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png b/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png deleted file mode 100644 index 20b0af3e5e..0000000000 Binary files a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_INTERP_PREDICT.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_NOFAULT.png b/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_NOFAULT.png deleted file mode 100644 index 3b9ed3b67a..0000000000 Binary files a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_NOFAULT.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD.png b/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD.png deleted file mode 100644 index 4a2cbb36b8..0000000000 Binary files a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD.png and /dev/null differ diff --git a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png b/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png deleted file mode 100644 index a3e5d12c07..0000000000 Binary files a/examples/fault_tolerance/HEAT_steps_vs_iteration_hf_7x7_SPREAD_PREDICT.png and /dev/null differ diff --git a/examples/fault_tolerance/heatmaps.py b/examples/fault_tolerance/heatmaps.py index ab35a70b46..0aabea9562 100644 --- a/examples/fault_tolerance/heatmaps.py +++ b/examples/fault_tolerance/heatmaps.py @@ -1,17 +1,13 @@ import numpy as np -from matplotlib import rc import matplotlib.pyplot as plt +from pylab import rcParams import os -rc('text', usetex=True) -rc("font", **{"sans-serif": ["Arial"], "size": 30}) -# rc('font', family='serif',size=30) -rc('legend', fontsize='small') -rc('xtick', labelsize='small') -rc('ytick', labelsize='small') +axis_font = {'fontname':'Arial', 'size':'8', 'family':'serif'} +fs = 8 -# setup = 'HEAT' -setup = 'ADVECTION' +setup = 'HEAT' +#setup = 'ADVECTION' fields = [(setup+'_results_hf_SPREAD.npz','SPREAD'), (setup+'_results_hf_INTERP.npz','INTERP'), (setup+'_results_hf_INTERP_PREDICT.npz','INTERP_PREDICT'), @@ -46,34 +42,46 @@ ft_iter = infile['ft_iter'] ft_step = infile['ft_step'] - fig, ax = plt.subplots(figsize=(15,10)) + rcParams['figure.figsize'] = 3.0, 2.5 + fig, ax = plt.subplots() cmap = plt.get_cmap('Reds', vmax-vmin+1) - plt.pcolor(data, cmap=cmap, vmin=vmin, vmax=vmax) + pcol = plt.pcolor(data, cmap=cmap, vmin=vmin, vmax=vmax) + pcol.set_edgecolor('face') plt.axis([ft_step[0],ft_step[-1]+1,ft_iter[0]-1,ft_iter[-1]]) - ticks = np.arange(vmin,vmax+1,2) + ticks = np.arange(int(vmin), int(vmax+1) , 2) tickpos = np.linspace(ticks[0]+0.5, ticks[-1]-0.5, len(ticks)) - cax = plt.colorbar(ticks=tickpos) - cax.set_ticklabels(ticks) - cax.set_label('number of iterations') + cax = plt.colorbar(pcol, ticks=tickpos, format='%2i') + + plt.tick_params(axis='both', which='major', labelsize=fs) - ax.set_xlabel('affected step') - ax.set_ylabel('affected iteration') + cax.set_ticklabels(ticks) + cax.set_label('number of iterations', **axis_font) + cax.ax.tick_params(labelsize=fs) + ax.set_xlabel('affected step', labelpad=1, **axis_font) + ax.set_ylabel('affected iteration', labelpad=1, **axis_font) + ax.set_xticks(np.arange(len(ft_step))+0.5, minor=False) + ax.set_xticklabels(ft_step, minor=False) ax.set_yticks(np.arange(len(ft_iter))+0.5, minor=False) - ax.set_xticklabels(ft_step+1, minor=False) ax.set_yticklabels(ft_iter, minor=False) + + # Set every second label to invisible + for label in ax.xaxis.get_ticklabels()[::2]: + label.set_visible(False) - ax.tick_params(pad=8) - + ax.tick_params(pad=2) plt.tight_layout() - fname = setup+'_iteration_counts_hf_'+strategy+'.png' + #fname = setup+'_iteration_counts_hf_'+strategy+'.png' + fname = setup+'_iteration_counts_hf_'+strategy+'.pdf' - plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') + #plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') + plt.savefig(fname, bbox_inches='tight') + os.system('pdfcrop '+fname+' '+fname) # plt.show() diff --git a/examples/fault_tolerance/postproc_grayscott.py b/examples/fault_tolerance/postproc_grayscott.py index bc65a50ff2..670b4b7307 100644 --- a/examples/fault_tolerance/postproc_grayscott.py +++ b/examples/fault_tolerance/postproc_grayscott.py @@ -1,17 +1,16 @@ import numpy as np import math import os -from matplotlib import rc import matplotlib.pyplot as plt +from pylab import rcParams +axis_font = {'fontname':'Arial', 'size':'8', 'family':'serif'} +fs = 8 +ms = 8 +lw = 2 if __name__ == "__main__": - rc('font', family='sans-serif',size=30) - rc('legend', fontsize='small') - rc('xtick', labelsize='small') - rc('ytick', labelsize='small') - # ref = 'PFASST_GRAYSCOTT_stats_hf_NOFAULT_new.npz' ref = 'PFASST_GRAYSCOTT_stats_hf_SPREAD_P32.npz' @@ -25,8 +24,6 @@ xtick_dist = 16 - lw = 2 - minstep = 288 maxstep = 384 # minstep = 0 @@ -52,9 +49,8 @@ data = np.load(ref) ref_iter_count = data['iter_count'][minstep:maxstep] - fig, ax = plt.subplots(figsize=(20,7)) - - + rcParams['figure.figsize'] = 6.0, 2.5 + fig, ax = plt.subplots() plt.plot(range(minstep,maxstep),[0]*nsteps,'k-',linewidth=2) @@ -69,22 +65,25 @@ ymin = min(ymin,min(ref_iter_count-iter_count)) ymax = max(ymax,max(ref_iter_count-iter_count)) - plt.plot(range(minstep,maxstep),ref_iter_count-iter_count,color=color,label=label,marker=marker,linestyle='',linewidth=lw,markersize=12) + plt.plot(range(minstep,maxstep),ref_iter_count-iter_count,color=color,label=label,marker=marker,linestyle='',linewidth=lw,markersize=ms) - plt.xlabel('step') - plt.ylabel('saved iterations') + plt.xlabel('step', **axis_font) + plt.ylabel('saved iterations', **axis_font) plt.xlim(-1+minstep,maxstep+1) plt.ylim(-1+ymin,ymax+1) ax.set_xticks(np.arange(minstep,maxstep,xtick_dist)+0.5, minor=False) ax.set_xticklabels(np.arange(minstep,maxstep,xtick_dist), minor=False) - plt.legend(loc=2,numpoints=1) - + plt.legend(loc=2,numpoints=1,fontsize=fs) + plt.tick_params(axis='both', which='major', labelsize=fs) + ax.xaxis.labelpad = -0.5 + ax.yaxis.labelpad = -1 plt.tight_layout() # fname = 'GRAYSCOTT_saved_iteration_vs_NOFAULT_hf.png' - fname = 'GRAYSCOTT_saved_iteration_vs_SPREAD_hf.png' - plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') + fname = 'GRAYSCOTT_saved_iteration_vs_SPREAD_hf.pdf' + plt.savefig(fname, bbox_inches='tight') + os.system('pdfcrop '+fname+' '+fname) for file,strategy,label,color,marker in list: @@ -96,10 +95,12 @@ residual = np.where(residual > 0, np.log10(residual), -99) - fig, ax = plt.subplots(figsize=(20,7)) + rcParams['figure.figsize'] = 6.0, 2.5 + fig, ax = plt.subplots() cmap = plt.get_cmap('Reds',vmax-vmin+1) - plt.pcolor(residual,cmap=cmap,vmin=vmin,vmax=vmax) + pcol = plt.pcolor(residual,cmap=cmap,vmin=vmin,vmax=vmax) + pcol.set_edgecolor('face') if not "NOFAULT" in strategy: for item in stats: @@ -110,12 +111,17 @@ ticks = np.arange(vmin,vmax+1,2) tickpos = np.linspace(ticks[0]+0.5, ticks[-1]-0.5, len(ticks)) - cax = plt.colorbar(ticks=tickpos) + cax = plt.colorbar(pcol, ticks=tickpos, pad=0.02) cax.set_ticklabels(ticks) - cax.set_label('log10(residual)') + cax.ax.tick_params(labelsize=fs) + + cax.set_label('log10(residual)', **axis_font) + plt.tick_params(axis='both', which='major', labelsize=fs) + ax.xaxis.labelpad = -0.5 + ax.yaxis.labelpad = -0.5 - ax.set_xlabel('step') - ax.set_ylabel('iteration') + ax.set_xlabel('step', **axis_font) + ax.set_ylabel('iteration', **axis_font) ax.set_yticks(np.arange(1,maxiter,2)+0.5, minor=False) ax.set_xticks(np.arange(0,nsteps,xtick_dist)+0.5, minor=False) @@ -124,8 +130,9 @@ plt.tight_layout() - fname = 'GRAYSCOTT_steps_vs_iteration_hf_'+strategy+'.png' - plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') + fname = 'GRAYSCOTT_steps_vs_iteration_hf_'+strategy+'.pdf' + plt.savefig(fname, bbox_inches='tight') + os.system('pdfcrop '+fname+' '+fname) # exit() diff --git a/examples/fault_tolerance/postproc_hard_faults_detail.py b/examples/fault_tolerance/postproc_hard_faults_detail.py index 799242a75a..4d6c8d8046 100644 --- a/examples/fault_tolerance/postproc_hard_faults_detail.py +++ b/examples/fault_tolerance/postproc_hard_faults_detail.py @@ -1,17 +1,12 @@ import numpy as np -from matplotlib import rc import matplotlib.pyplot as plt +from pylab import rcParams +import os +axis_font = {'fontname':'Arial', 'size':'8', 'family':'serif'} +fs = 8 -# rc('text', usetex=True) -rc("font", **{"sans-serif": ["Arial"], "size": 30}) -rc('font', family='serif',size=30) -rc('legend', fontsize='small') -rc('xtick', labelsize='small') -rc('ytick', labelsize='small') - - -# setup = 'HEAT' +#setup = 'HEAT' setup = 'ADVECTION' list = [(setup+'_steps_vs_iteration_hf_NOFAULT.npz','NOFAULT','no fault','k','^'), @@ -45,39 +40,53 @@ residual[0:len(input[:,0]),0:len(input[0,:])] = input - fig, ax = plt.subplots(figsize=(15,10)) + rcParams['figure.figsize'] = 3.0, 2.5 + fig, ax = plt.subplots() cmap = plt.get_cmap('Reds') - plt.pcolor(residual.T, cmap=cmap, vmin=minres, vmax=maxres) + pcol = plt.pcolor(residual.T, cmap=cmap, vmin=minres, vmax=maxres) + pcol.set_edgecolor('face') plt.axis([0,maxiter,0,maxsteps]) - cax = plt.colorbar() - cax.set_label('log10(residual)') + cax = plt.colorbar(pcol) + cax.set_label('log10(residual)', **axis_font) + cax.ax.tick_params(labelsize=fs) + + plt.tick_params(axis='both', which='major', labelsize=fs) - ax.set_xlabel('iteration') - ax.set_ylabel('step') + ax.set_xlabel('iteration', labelpad=1, **axis_font) + ax.set_ylabel('step', labelpad=1, **axis_font) ax.set_xticks(np.arange(maxiter)+0.5, minor=False) ax.set_yticks(np.arange(maxsteps)+0.5, minor=False) ax.set_xticklabels(np.arange(maxiter)+1, minor=False) ax.set_yticklabels(np.arange(maxsteps), minor=False) - - ax.tick_params(pad=8) + + # Set every second label to invisible + for label in ax.xaxis.get_ticklabels()[::2]: + label.set_visible(False) + for label in ax.yaxis.get_ticklabels()[::2]: + label.set_visible(False) + + ax.tick_params(pad=2) plt.tight_layout() if strategy is not 'NOFAULT': plt.text(step-1+0.5,iter+0.5,'xxx',horizontalalignment='center',verticalalignment='center') - fname = setup+'_steps_vs_iteration_hf_'+str(step)+'x'+str(iter)+'_'+strategy+'.png' - plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') - - + fname = setup+'_steps_vs_iteration_hf_'+str(step)+'x'+str(iter)+'_'+strategy+'.pdf' + plt.savefig(fname, bbox_inches='tight') + os.system('pdfcrop '+fname+' '+fname) -fig, ax = plt.subplots(figsize=(15,10)) +# +# +# +rcParams['figure.figsize'] = 6.0, 3.0 +fig, ax = plt.subplots() maxiter = 0 lw = 2 -ms = 10 +ms = 8 for file,strategy,label,color,marker in list: @@ -99,7 +108,7 @@ xvals = range(1,maxiter+1) plt.plot(xvals,[-9 for i in range(maxiter)],'k--') -plt.annotate('tolerance',xy=(1,-9.4),fontsize=24) +plt.annotate('tolerance',xy=(1,-9.4),fontsize=fs) left = 6.15 bottom = -12 @@ -109,25 +118,29 @@ top = bottom + height rect = plt.Rectangle(xy=(left,bottom),width=width,height=height,color='lightgrey') plt.text(0.5*(left+right),0.5*(bottom+top),'node failure',horizontalalignment='center', - verticalalignment='center',rotation=90, color='k',fontsize=24) + verticalalignment='center',rotation=90, color='k',fontsize=fs) fig.gca().add_artist(rect) plt.xlim(1-0.25,maxiter+0.25) plt.ylim(minres-0.25,maxres+0.25) -plt.xlabel('iteration') -plt.ylabel('log10(residual)') +plt.xlabel('iteration', **axis_font) +plt.ylabel('log10(residual)', **axis_font) +ax.xaxis.labelpad = 0 +ax.yaxis.labelpad = 0 +plt.tick_params(axis='both', which='major', labelsize=fs) -plt.legend(numpoints=1) +plt.legend(numpoints=1, fontsize=fs) plt.xticks(range(1,maxiter+1)) plt.yticks(range(minres,maxres+1)) -ax.tick_params(pad=8) +ax.tick_params(pad=2) plt.tight_layout() -fname = setup+'_residuals_allstrategies.png' -plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight') +fname = setup+'_residuals_allstrategies.pdf' +plt.savefig(fname, bbox_inches='tight') +os.system('pdfcrop '+fname+' '+fname) # plt.show() \ No newline at end of file