def plot_main(params, name=None): output_name, R, IC, L, tmax = params if name is None: name = io.sim_name(R, IC, L, tmax) else: name = name output_name, R, IC, L, tmax = params results = io.read_results(params, typ='C') data_list = results['b'] w_list = results['w'] mi_nets = results['mi'] st_mi_measures = measure_networks(mi_nets, tasks=['EV', 'CC', 'Y'], typ='st') avg_mi_measures = measure_networks(mi_nets, tasks=['ND', 'CC', 'Y'], typ='avg') probability_plots(data_list, w_list, fignum=0) avg_nm_plots(avg_mi_measures, fignum=1) st_nm_plots(st_mi_measures, fignum=2) io.multipage(io.file_name(output_name, 'plots', 'C' + name, '.pdf'))
def plot_nmVsL(L_list, IC_list, typical_nm, fignum=2, saveQ=False): fig = plt.figure(fignum, figsize=(7,8.5)) #obs_list_flat = list(set([obs for obs_list in obs_list_list # for obs in obs_list])) obs_list_flat = ['ND', 'CC', 'Y'] letters = {0:'a', 1:'b', 2:'c', 3:'d'} M = len(IC_list) N = len(obs_list_flat) for m, IC in enumerate(IC_list): if IC[0] == 'R': IC = 'R' for n, obs in enumerate(obs_list_flat): i = 1+m*(M-1) + n ax = fig.add_subplot(M,N,i) x = typical_nm[IC]['L'] xs = np.linspace(min(x), max(x), 100) y = typical_nm[IC][obs] ys = nm_exact(IC, obs, xs) #error = max(np.abs(y - nm_exact(IC, obs, x[:]))) if m != M-1: pass #plt.setp([ax.get_xticklabels()], visible=False) ax.set_ylim(0, max(y)*5/4) if np.std(y)<1e-10: ax.set_ylim(np.mean(y)-0.1, np.mean(y)+0.1) if IC == 'W': ax.set_ylim(top=0.4) if IC == 'c2_B0-1_3': if obs == 'Y': ax.set_ylim(top=0.6) #plot_loglog_fit(x, y, ax) #plot_semilogy(x, y, ax) ax.plot(x,y, 'ok', alpha=0.6, markersize=4) plt.setp([ax.get_xticklabels()], visible=True) ax.xaxis.major.locator.set_params(nbins=6) ax.yaxis.major.locator.set_params(nbins=3) ax.plot(xs, ys, '-k', alpha=0.7) #ax.set_title('$\mathrm{error}_\mathrm{max} = 0$' , fontsize=12) #if error != 0: # ax.set_title('$\mathrm{error}_\mathrm{max} = ' + # pt.as_sci(error,1)+'$', fontsize=12) if n == 0: ax.text(-0.5, 1.1, '('+letters[m]+') '+pretty_names_dict(IC), transform=ax.transAxes, fontsize=13) ax.set_ylabel(pretty_names_dict(obs)) if m == M-1: ax.set_xlabel(r'$L$') ax.margins(0.1) fig.subplots_adjust(hspace=0.4, wspace=0.7, left=0.13, right=.98, top=.94, bottom=.05) if saveQ: bnp = io.base_name('typical_nm', 'plots') fnamep = 'nmVsL.pdf' io.multipage(bnp + fnamep, clip=False) else: plt.show()
def plot_scatters(L_list, IC_list, typical_nm, fignum=1, saveQ=True): fig = plt.figure(fignum, figsize=(6.5, 2.1)) letters = ['(a)', '(b)', '(c)'] for IC in IC_list: c, c_full = make_c_list(IC, L_list, typical_nm) for i, obs_list in enumerate(obs_list_list): ax = scatter_plot(fig, typical_nm, obs_list, IC, c, c_full, i, cmap=cmap, letter=letters[i]) plot_config(fig, ax, L_list, IC_list) if saveQ: bnp = io.base_name('typical_nm', 'plots') fnamep = 'typical_net_meas.pdf' io.multipage(bnp + fnamep, clip=False) else: plt.show()
def rule_plot(params_list_list, show_S=[1, 6, 9, 14], show_L=[15]): fignum = 0 c_list = ['c', 'orange', 'crimson', 'limegreen'] c_list = cycle(c_list) m_list = ['s', 'o', '^', 'd'] m_list = cycle(m_list) fig = plt.figure(fignum, figsize=(3, 3)) ax = fig.add_subplot(1, 1, 1) for m, params_list in enumerate(params_list_list): avg_list = [] for n, params in enumerate(params_list): if data_repo is not None: sname = io.sim_name(params) data_path = data_repo + sname + '_v0.hdf5' else: sname = io.sim_name(params) data_path = io.default_file_name(params, 'data', '.hdf5') data_set = h5py.File(data_path) L = params['L'] S = params['S'] T = params['T'] sb = data_set['sbond'][::] print(sb[0:3, int(L / 2)]) sb[::, int(L / 2)] = np.zeros(params['T'] + 1) sb /= [min(c + 1, L - c - 1) for c in range(L - 1)] center_sb = sb[::, int(L / 2)] avg_sb = np.mean(sb, axis=1) avg_avg_sb = np.mean(avg_sb[500::]) avg_center_sb = np.mean(center_sb[500::]) avg_list.append([L, S, avg_avg_sb]) #S_plot(ax, c_list, center_sb, r'$L={}$'.format(L), r'$S={}$'.format(S)) L_avg_plot(ax, c_list, m_list, avg_list, r'$S={}$'.format(S)) bn = io.base_name(output_dir, 'plots/sbond/') #fn = 'S1_sbond_center_growth'+'.pdf' fn = 'S1-6-9-14_th0_sbond_center_tavg_Lscale' + '.pdf' io.multipage(bn + fn)
def plot_R(R_list, L, IC, tmax, fname): fignum = 0 for R in R_list: state_list = run_sim(R, IC, L, tmax, mode='eca') plot_spacetime_grid(state_list, ' R ' + str(R), fignum=fignum, ax=121) plt.xlabel('site number') plt.ylabel('time') state_list2 = run_sim(R, IC, L, tmax, mode='sweep') plot_spacetime_grid(state_list2, 'sweep R ' + str(R), fignum=fignum, ax=122) plt.xlabel('site number') plt.ylabel('time') plt.tight_layout() fignum += 1 io.multipage(io.file_name('classical', 'plots', fname, '.pdf'), dpi=100)
def plot_all_IC(R_list, L, lc, tmax, fname): fignum = 0 for R in R_list: ic_list = gen_ics(L, lc) print('R: ', R) for IC in ic_list: print(IC) fignum += 1 state_list = run_sim(R, IC, L, tmax, mode='eca') plot_spacetime_grid(state_list, 'ECA R ' + str(R), fignum=fignum, ax=121) plt.xlabel('site number') plt.ylabel('time') #plt.show() plt.tight_layout() io.multipage(io.file_name('classical', 'plots', 'R' + str(R) + fname, '.pdf'), dpi=100) plt.close('all')
def make_speeds(fixed_params_dict, var_params_dict, **kwargs): params_list_list = io.make_params_list_list(fixed_params_dict, var_params_dict) fignum = 3 for c, params_list in zip(['b', 'g', 'r'], params_list_list): speeds_0, dspeeds_0, diffs_0, ddiffs_0 = [], [], [], [] speeds_1, dspeeds_1, diffs_1, ddiffs_1 = [], [], [], [] ths = [] transport = {'tmax_1': None} for params in params_list: transport, fignum = add_speed(params, transport, fignum, speeds_0, dspeeds_0, diffs_0, ddiffs_0, speeds_1, dspeeds_1, diffs_1, ddiffs_1, ths, **kwargs) plot_speed_diffs(params, transport, fignum, speeds_0, dspeeds_0, diffs_0, ddiffs_0, speeds_1, dspeeds_1, diffs_1, ddiffs_1, ths, c) io.multipage( io.base_name(fixed_params_dict['output_dir'][0], 'plots') + 'L' + str(params['L']) + '_S6_speeds_' + kwargs['dirr'] + '_90_gaussian.pdf')
def run_1d_ft(): params_list_list, obs_list, data_repo, plots_out_pathf = init_params_1d() M, N = params_list_list.shape J = len(obs_list) interval_factor = 5.991 for m, params_list in enumerate(params_list_list): params_res_list = [] for n, params in enumerate(params_list): data_in_path = get_data_in_path(data_repo, params) params['fpks'] = {} params['pks'] = {} L = params['L'] T = params['T'] i = N * m + n for j, obs_key in enumerate(obs_list): res = h5py.File(data_in_path) freqs, FT, rn = get_ft_1d(res, obs_key) fpks, pks, FT, freqs_trunc = get_ft_peaks( freqs, FT, rn, interval_factor=interval_factor) # save peaks to params dict params['fpks'][obs_key] = fpks params['pks'][obs_key] = pks params_res_list.append(params) plot_ft_1d(freqs, FT, rn, params, j, J, obs_key, fignum=n, interval_factor=interval_factor) j += 1 plot_agg_peaks(params_res_list, obs_list, id_by='S') # save all plots plots_out_path = plots_out_pathf(L) print(plots_out_path) io.multipage(plots_out_path, clip=True)
obs[np.isnan(obs)] = 0 obs_mean = np.nanmean(obs) obs_means[m, j, n] = obs_mean colors[m, j, n] = val if typ == 'PCA': plot_PCA(obs_means, fignum) clip = False if typ == 'scatter': ncplus = False if color_by == 'S': ncplus = True plot_scatter(fig, ax, m, obs_means, colors, val_min, val_max, cbar_label, obs_list, cmap, ncplus, cb_tick_labels) ax.set_title(letter) clip = True if typ == 'hist3D': plot_3D_hist(fignum, m, colors, val_min, val_max, obs_means, cbar_label, obs_list, letter) clip = False bn = io.base_name(fixed_params_dict['output_dir'][0], 'plots/scatters') fname = IC_label + '_' + '-'.join(modes) + '_L' + '-'.join(map( str, Ls)) + uID + typ + '.pdf' print(fname) io.multipage(bn + fname, clip=clip)
def mem(L): return 2**(L + 4) nb_list = [] L_list = [] for L in range(Lmin, Lmax): state = ss.make_state(L, 'f0') nb = state.nbytes del state nb_list.append(nb) L_list.append(L) fig = plt.figure(1, (7, 2.5)) ax = fig.add_subplot(111) ax.plot(Ls, mem(Ls), '--c', label='theoretical', lw=2) ax.plot(L_list, nb_list, 'ks', label='measured', ms=5) ax.set_ylabel(r'$N_{\mathrm{bytes}}$') ax.set_xlabel(r'system size [$L$]') ax.set_yscale('log', basey=2) ax.set_yticks([2**n for n in range(6, 29, 4)]) #ax.get_yaxis().set_major_formatter(mpl.ticker.ScalarFormatter()) ax.legend(loc='lower right') ax.grid('on') ax.set_ylim([2**(Lmin + 3), 2**(Lmax + 4)]) ax.set_xlim([Lmin - 0.5, Lmax - 0.5]) #plt.show() plots_fname = io.base_name('timing', 'plots') + 'state_memory_use.pdf' io.multipage(plots_fname)
delta = max(1, int(len(x_tick_labels)/n_xticks)) ax.set_xticks(range(0, len(x_tick_labels), delta )) ax.set_xticklabels(x_tick_labels[::delta]) n_yticks = 3 delta = max(1, int(len(y_tick_labels)/n_yticks)) ax.set_yticks(range(0, len(y_tick_labels), delta )) ax.set_yticklabels(y_tick_labels[::delta]) ax.spines['bottom'].set_position(('data',0.1)) ax.spines['left'].set_bounds(0.1, 60) ax.spines['right'].set_bounds(0.1, 60) im_ext = im.get_extent() box = ax.get_position() # cax = plt.axes([box.x1+0.01, box.y0, 0.02, box.height - 0.03]) cax = plt.axes([box.x1-0.03, box.y0, 0.02, box.height - 0.01]) cb = plt.colorbar(im, cax = cax, ticks = [0.0,0.5, 1.0]) # cb.ax.tick_params(labelsize=9) # cb.set_label(r'$s_j$', rotation=0, labelpad = -24, y=1.12) cb.set_label(r'$s^{\mathrm{bond}}$', rotation=0, labelpad = -24, y=1.1, fontsize=14) # cb.set_label(r'$P_1(j,t)$', rotation=0, labelpad = -22, y=1.10) #cax = plt.axes([box.x1-0.05, box.y0+0.2, 0.02, box.height + 0.02]) #cb = plt.colorbar(im, cax = cax) fig.subplots_adjust(wspace=-0.5, hspace=0.2) bn = io.base_name(output_dir,'plots') #plt.savefig(bn+params['mode']+'_sbond_comp.pdf', # dpi=300, clip=True) io.multipage(bn+params['mode']+'_sbond_comp.pdf') #plt.show()
def main(): # locate the data you're interested in output_dir = 'fock_IC' mount_point = '/mnt/ext0/' data_repo = mount_point + 'qca_output/' + output_dir + '/data/' #data_repo = None # describe the simulations you'd like to load # params looped through at outer layer fixed_params_dict = { 'output_dir': [output_dir], 'T': [1000], 'BC': ['1_00'], 'mode': ['alt'], 'S': [1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14] } # params looped through at inner layer var_params_dict = { 'L': [19], 'V': ['HP_' + str(deg) for deg in [0, 45, 90]], 'IC': ['c3_f1'], } colors = ['c', 'm', 'limegreen'] # histogram parameters partition_size = 19 n_partitions = 49 include_remaining = True n_bins = 40 barmode = False aggregate_mode = True measure_name = "$\Delta s^{\mathrm{bond}}$" #measure_name = "$\Delta ND$" colormap = plt.cm.get_cmap('jet') # function to extract data to put into histogram def obtain_hist(data_set, i, j): # helper def delta(values): return np.abs(values[i:j - 1] - values[i + 1:j]) #return data_set['Y'][i:j] # Y #return delta(data_set['Y']) # \Delta Y #return data_set['ND'][i:j] # ND #return delta(data_set['ND']) # \Delta ND #return data_set['CC'][i:j] # ND #return delta(data_set['CC']) # \Delta CC #return data_set['m'][i:j] # Mutual information #return delta(data_set['m']) # Mutual information change #return data_set['s'][i:j] # s #return delta(data_set['s']) # \Delta s #return get_diag_vecs(data_set['zz'][i:j]) # Z #return np.abs(get_diag_vecs(data_set['zz'][i:j-1]) - # get_diag_vecs(data_set['zz'][i+1:j])) # \Delta Z L = len(data_set['sbond'][1]) sb = data_set['sbond'][::] sb /= [min(c + 1, L - c) for c in range(L)] return delta(sb) #aggregate data params_list_list = io.make_params_list_list(fixed_params_dict, var_params_dict) fignum = 0 for m, params_list in enumerate(params_list_list): all_means = [] all_stds = [] names = [] labels = [] #print(fignum) fig = plt.figure(fignum, figsize=(3, 3)) ax = fig.add_subplot(1, 1, 1) for n, params in enumerate(params_list): if data_repo is not None: sname = io.sim_name(params) data_path = data_repo + sname + '_v0.hdf5' else: sname = io.sim_name(params) data_path = io.default_file_name(params, 'data', '.hdf5') data_set = h5py.File(data_path) names.append(sname) #full_hist(ax, params, data_set) simulation_hists = [] #aggregate means = [] stds = [] #bin range maximum = 0 minimum = 0 for i in range(0, partition_size * n_partitions, partition_size): # get data from helper defined above partition_hist = obtain_hist(data_set, i, i + partition_size) # dataset may be multi-dimensional. reduce to one dimension while (len(partition_hist.shape) > 1): partition_hist = np.concatenate(partition_hist) simulation_hists.append( (partition_hist, i, i + partition_size)) means.append(np.mean(partition_hist)) stds.append(np.std(partition_hist)) # update minima and maxima if (np.max(partition_hist) > maximum): maximum = np.max(partition_hist) if (np.min(partition_hist) > minimum): minimum = np.min(partition_hist) # same thing for the remaining iterations if include_remaining: low = partition_size * n_partitions partition_hist = obtain_hist(data_set, low, 1000) while (len(partition_hist.shape) > 1): partition_hist = np.concatenate(partition_hist) simulation_hists.append((partition_hist, low, 1000)) means.append(np.mean(partition_hist)) stds.append(np.std(partition_hist)) if (np.max(partition_hist) > maximum): maximum = np.max(partition_hist) if (np.min(partition_hist) > minimum): minimum = np.min(partition_hist) means = np.array(means) stds = np.array(stds) all_means.append(means) all_stds.append(stds) labels.append(r'$\theta = ' + str(pt.get_th(params['V'])) + '^\circ$') #compute bin range if (minimum == maximum): raise ValueError("Values are constant throughout simulation.") bins = np.arange(minimum, maximum, (maximum - minimum) / n_bins) maxbin = 0 if aggregate_mode: continue plt.clf() idx = 0 for (values, i, j) in simulation_hists: #make histogram hist, _ = np.histogram(values, bins=bins) hist = hist / (j - i) #normalize #hist = hist/sum(hist) #normalize # help decide y axis maximum if (np.max(hist) > maxbin): maxbin = np.max(hist) fraction = idx / len(simulation_hists) color = colormap(fraction) if barmode: #plot as bar graph width = (0.75 + 0.75 * fraction) * (bins[1] - bins[0]) center = (bins[:-1] + bins[1:]) / 2 plt.bar(center, hist, align='center', width=width, color=color, alpha=0.5, label="%d to %d" % (i, j)) plt.gca().set_yscale("log") plt.gca().set_ylim([min(hist), max(hist)]) else: #plot as filled region centers = (bins[:-1] + bins[1:]) / 2 plt.fill_between(centers, 0, hist, color=color, alpha=0.5, label="%d to %d" % (i, j)) idx += 1 #configure plot plt.xlim(bins[0], bins[-1]) plt.ylim(0, maxbin + 1) plt.title("Histograms of %s in %s in groups of %d iterations" % (measure_name, sname, partition_size)) plt.ylabel("Frequency (normalized by partition size)") plt.xlabel(measure_name) plt.grid(True) plt.legend(loc='best') plt.show() if aggregate_mode: if include_remaining: agg_range = np.arange(n_partitions + 1) else: agg_range = np.arange(n_partitions) mins, maxs = [], [] for i, c in zip(range(len(all_means)), ['c', 'm', 'limegreen']): fraction = i / len(all_means) means = all_means[i] stds = all_stds[i] label = labels[i] # color=colormap(fraction) ax.plot(agg_range, means, color=c, markeredgecolor=c, label=label, lw=0.8, markeredgewidth=1.2, marker='o', markerfacecolor='None') #ax.fill_between(agg_range, means+stds, means-stds, alpha=0.5,color=c) #ax.errorbar(agg_range, means, stds) #plt.plot(agg_range, [1.0/20]*len(means)) mins.append(min(means)) maxs.append(max(means)) ax.set_title(r'$S=' + str(params['S']) + '$') ax.set_ylabel(measure_name) ax.set_xlabel(r"Iteration [$t/\tau$]") ax.grid(True) ax.legend(loc='best', fontsize=11, numpoints=1, handlelength=1) ax.set_xscale("log", nonposx='clip') ax.set_yscale("log", nonposy='clip') ax.set_ylim([min(mins), max(maxs)]) ax.margins(0.001) letters = ['(a)', '(b)', '(c)', '(d)'] labeled_rules = [6, 7, 9, 14] letter_dict = dict(zip(labeled_rules, letters)) S = params['S'] if S in labeled_rules: panel_label = letter_dict[S] ax.text(0.5, -0.28, panel_label, verticalalignment='bottom', horizontalalignment='center', transform=ax.transAxes) ax.set_ylim([1e-5, 1e-1]) fignum += 1 io.multipage('./../output/fock_IC/plots/L19_delta_sbond_means.pdf')
def plot(params, corrj=None): print('Plotting results...') results = h5py.File(params['fname'], 'r+') # get spin projections along x, y, and z x_grid, y_grid, z_grid = [ measures.get_diag_vecs(results[ab][::]) for ab in ('xx', 'yy', 'zz') ] proj_grids_stats = results['stats'] # get g2 correlators at constant row j if corrj is None: corrj = results['gstats']['corrj'][0] x_g2grid, y_g2grid, z_g2grid = [ measures.get_row_vecs(results[ab][::], j=corrj) for ab in ['gxx', 'gyy', 'gzz'] ] g2grids_stats = results['gstats'] # get mi measure results and place in ordered dict for plotting meas_keys = ['ND', 'CC', 'Y'] meas_list = [results[meas_key][::] for meas_key in meas_keys] Fmeas_list = [{ 'amps': results['F' + meas_key][::], 'RN': results['RN' + meas_key][::] } for meas_key in meas_keys] meas_dict = OrderedDict( (key, data) for key, data in zip(meas_keys, meas_list)) Fmeas_dict = OrderedDict( (key, Fdata) for key, Fdata in zip(meas_keys, Fmeas_list)) # get local and entropies stj = results['s'][::] # get mutual information adjacency matrices mtjk = results['m'][::] # plot spin projections proj_titles = [ r'$\langle \sigma^x_j \rangle$', r'$\langle \sigma^y_j \rangle$', r'$\langle \sigma^z_j \rangle$' ] prob_titles = [ r'$\frac{\sum_j j P_j(x-)}{\sum_j P_j(x-)}$', r'$\frac{\sum_j j P_j(y-)}{\sum_j P_j(y-)}$', r'$\frac{\sum_j j P_j(z-)}{\sum_j P_j(z-)}$' ] plot_grids([x_grid, y_grid, z_grid], fignum=0, titles=proj_titles, suptitle='Spin Projections', xlabels=['site', 'site', 'site'], wspace=.05) plot_grid_time_avg_stats(proj_grids_stats, fignum=1, titles=proj_titles) # this makes three figures #plot_grid_center_stats(proj_grids_stats, fignum=2, titles=prob_titles) # plot two-point correlator w.r.t site corrj g2_titles = [ '$g_2(\sigma^x_{%i},\sigma^x_k;t)$' % corrj, '$g_2(\sigma^y_{%i},\sigma^y_k;t)$' % corrj, '$g_2(\sigma^z_{%i},\sigma^z_k;t)$' % corrj ] plot_grids([x_g2grid, y_g2grid, z_g2grid], fignum=5, titles=g2_titles, suptitle='Two Point Correlator', xlabels=['site', 'site', 'site'], wspace=0.05) plot_grid_time_avg_stats(g2grids_stats, fignum=6, titles=g2_titles) #plot_grid_space_center_stats(g2grids_stats, fignum=7, titles=g2_titles) # plot local and bond entropies entropies = [stj] if 'sbond' in results: stc = results['sbond'][::] entropies.append(stc) if len(entropies) == 2: wspace = 0.088 elif len(entropies) == 1: wspace = -0.23 plot_grids(entropies, titles=[r'$S(j,t)$', r'$S_c(j,t)$'], xlabels=['site', 'cut'], suptitle='von Neumann entropies', wspace=wspace, fignum=10) # plot probabilities of spin down and space/time averages plot_grid_with_avgs(z_grid, fignum=11, suptitle='average probability of measuring 1') # plot mi measures plot_measures(meas_dict, fignum=12) # plot measure Fourier transforms plot_measure_fts(Fmeas_dict, fignum=13) # plot distribution of mutual information over time #plot_edge_strength_contour(mtjk, # bins=60, rng=(0,.1), emax=150, fignum=14) # create the full path to where plots will be saved fname = params['fname'] io.base_name(params['output_dir'], 'plots') path_list = fname.split('/') sub_dir_ind = path_list.index('data') path_list[sub_dir_ind] = 'plots' path_ext_list = '/'.join(path_list).split('.') path_ext_list[-1] = '.pdf' out_fname = ''.join(path_ext_list) # save all figures to one pdf io.multipage(out_fname) results.close() plt.close('all') return out_fname
def run_2d_ft(fs=12): params_list_list, obs_list, data_repo, plots_out_pathf = init_params_2d() M, N = params_list_list.shape interval_factor = 5.991 letters = ['(c)', '(a)', '(b)', '(c)'] labeled_rules = [1, 4, 6, 14] letter_dict = dict(zip(labeled_rules, letters)) for m, params_list in enumerate(params_list_list): params_res_list = [] for n, params in enumerate(params_list): data_in_path = get_data_in_path(data_repo, params) params['fpks'] = {} params['pks'] = {} L = params['L'] T = params['T'] S = params['S'] V = params['V'] th = pt.get_th(V) i = N * m + n for j, obs_key in enumerate(obs_list): res = h5py.File(data_in_path) tmn = 300 tmx = 1000 ws, ks, amps, iboard, board = get_ft_2d(res, obs_key, tmn, tmx) fig = plt.figure(i, figsize=(1.5, 4)) tfig = plt.figure(i + 100, figsize=(2, 6)) fax = fig.add_subplot(111) tax = tfig.add_subplot(111) amps[0, 0] = np.nan try: cax = fax.imshow(amps, interpolation="none", origin='lower', aspect='auto', norm=LogNorm()) cbar = fig.colorbar(cax) tcax = tax.imshow(iboard, interpolation="none", origin='lower', aspect='auto') tcbar = tfig.colorbar(tcax) except: cax = fax.imshow(amps, interpolation="none", origin='lower', aspect='auto') tcax = tax.imshow(iboard, interpolation="none", origin='lower', aspect='auto') tcbar = tfig.colorbar(tcax) cbar.ax.tick_params(labelsize=fs) cbar.set_label(r'$\mathcal{F}\big(' + obs_label(obs_key, _2d=True) + r'\big)$', fontsize=fs, rotation=0, y=.75, labelpad=-0.1) cbar.ax.yaxis.set_major_locator(mpl.ticker.AutoLocator()) cbar.ax.locator_params(nbins=4) #cbar.update_ticks() tcbar.set_label(r'$' + obs_label(obs_key, _2d=True) + r'$', fontsize=fs) wtick_lbls = ws[::int(len(ws) / 5)] iw = np.in1d(ws, wtick_lbls) wticks = np.arange(0, len(amps) + 1)[iw] ktick_lbls = ks[::int(len(ks) / 2) + 1] ik = np.in1d(ks, ktick_lbls) kticks = np.arange(0, len(amps[0]))[ik] fax.set_yticks(wticks) fax.set_yticklabels(np.around(wtick_lbls, decimals=2), fontsize=fs) fax.set_xticks([0, L / 4, L / 2]) fax.set_xticklabels([0, 0.25, 0.5], fontsize=fs) fax.set_ylabel(r'$f$', fontsize=fs) fax.set_xlabel(r'$k$', fontsize=fs) tax.set_ylabel(r'$Iteration$', fontsize=fs) tax.set_xlabel(r'$Site$', fontsize=fs) if S == 1: title = r'$' + str(th) + r'^{\circ}$' if th == 0: title = r'$\theta=' + str(th) + r'^{\circ}$' if S != 1: title = r'${}$'.format(S) if S == 6: title = r'$S={}$'.format(S) if S in labeled_rules: panel_label = letter_dict[S] #fax.text(0.5, -0.17, panel_label, #verticalalignment='bottom', horizontalalignment='center', #transform=fax.transAxes, fontsize=fs) fax.set_title(' ' + title, fontsize=fs + 1) tax.set_title(title, fontsize=fs + 1) plt.subplots_adjust(top=0.85, bottom=0.15, wspace=0.6) plots_out_path = plots_out_pathf(L) print(plots_out_path) io.multipage(plots_out_path, clip=True)