def main(): args = parse_args() tags = ['staplestates{}'.format(i) for i in range(1, args.stapletypes + 1)] filebase = '{}/{}-{}'.format(args.input_dir, args.system, args.vari) out_filebase = '{}/{}-{}_staplestates-means'.format(args.output_dir, args.system, args.vari) figsize = (plot.cm_to_inches(18), plot.cm_to_inches(12)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(1, 2, width_ratios=[10, 1], height_ratios=[1]) ax = create_axis(f, gs, args.system) aves, stds = plot.read_expectations(filebase) if args.rtag: aves = aves[aves[args.rtag] == args.rvalue] stds = stds[stds[args.rtag] == args.rvalue] for j, tag in enumerate(tags): xvars = aves[args.xtag] ax.errorbar(xvars, aves[tag], yerr=stds[tag], marker='o') # Write to file plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig(out_filebase + '.png', transparent=True) f.savefig(out_filebase + '.pdf', transparent=True)
def main(): args = parse_args() inp_filebase = '{}/{}-{}'.format(args.input_dir, args.system, args.vari) out_filebase = '{}/{}-{}_staplestates-melting'.format(args.output_dir, args.system, args.vari) index_to_stapletype = np.loadtxt(args.mapfile, dtype=int) figsize = (plot.cm_to_inches(18), plot.cm_to_inches(12)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(1, 1, width_ratios=[1], height_ratios=[1]) gs_main = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[:, :]) ax = f.add_subplot(gs_main[0]) ax.axis('off') aves, stds = plot.read_expectations(inp_filebase) if args.rtag: aves = aves[aves[args.rtag] == args.rvalue] stds = stds[stds[args.rtag] == args.rvalue] temps = aves.temp melting_points = estimate_melting_points(args.stapletypes, aves, temps) melting_array = fill_assembled_shape_array(melting_points, index_to_stapletype) # Plot simulation melting points min_t = np.min(melting_array) max_t = np.max(melting_array) im = ax.imshow(melting_array, vmin=min_t, vmax=max_t) plt.colorbar(im, orientation='horizontal') plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig(out_filebase + '.png', transparent=True) f.savefig(out_filebase + '.pdf', transparent=True)
def main(): args = parse_args() out_filebase = '{}_{}-barrier-vs-temp'.format(args.output_filebase, args.tag) figsize = (plot.cm_to_inches(18), plot.cm_to_inches(12)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) ax = f.add_subplot() # Calculate barriers barriers = [] barrier_stds = [] for system, vari in zip(args.systems, args.varis): filebase = '{}/{}-{}_{}-lfes-melting'.format(args.input_dir, system, vari, args.tag) lfes = pd.read_csv('{}.aves'.format(filebase), sep=' ', index_col=0) lfes = lfes[lfes.index <= args.assembled_op] lfe_stds = pd.read_csv('{}.stds'.format(filebase), sep=' ', index_col=0) temp = lfes.columns[0] lfes = lfes[temp] lfe_stds = lfe_stds[temp] peaks, stds = calc_barrier_heights_and_errors(lfes, lfe_stds, temp) barriers.append(peaks[0]) barrier_stds.append(stds[0]) ax.errorbar(args.x_range, barriers, yerr=barrier_stds, marker='o') # plt.legend() plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig(out_filebase + '.png', transparent=True) f.savefig(out_filebase + '.pdf', transparent=True)
def main(): args = parse_args() out_filebase = '{}_{}-lfes-melting'.format(args.output_filebase, args.tag) figsize = (plot.cm_to_inches(14), plot.cm_to_inches(10)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) ax = f.add_subplot(1, 1, 1) ax.set_ylabel('$k_\mathrm{b}T$') ax.set_ylim([-0.5, 20]) for system, vari in zip(args.systems, args.varis): filebase = '{}/{}-{}_{}-lfes-melting'.format(args.input_dir, system, vari, args.tag) lfes = pd.read_csv('{}.aves'.format(filebase), sep=' ', index_col=0) lfe_stds = pd.read_csv('{}.stds'.format(filebase), sep=' ', index_col=0) temp = lfes.columns[0] lfes = lfes[temp] lfe_stds = lfe_stds[temp] ax.errorbar(lfes.index, lfes, yerr=lfe_stds, marker='o', label='{}-{}, {} K'.format(system, vari, temp)) plt.legend() plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig('{}.png'.format(out_filebase), transparent=True) f.savefig('{}.pdf'.format(out_filebase), transparent=True)
def main(): args = parse_args() tags = ['numstaples', 'numfulldomains', 'nummisdomains', 'numstackedpairs'] yaxis_labels = [ '(Mis)bound staples', 'Bound domain pairs', 'Misbound domain pairs', 'Stacked pairs' ] figsize = (plot.cm_to_inches(14), plot.cm_to_inches(11)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(3, 2, width_ratios=[1, 1], height_ratios=[10, 10, 1]) gs_main = gridspec.GridSpecFromSubplotSpec(2, 2, subplot_spec=gs[:2, :], wspace=0.3, hspace=0.3) axes = create_axes(f, gs_main, yaxis_labels) all_assembled_values = [] for assembled_values in args.all_assembled_values: parsed_values = [] for assembled_value in assembled_values.split(','): parsed_values.append(int(assembled_value)) all_assembled_values.append(parsed_values) for assembled_values in all_assembled_values: for i, assembled_value in enumerate(assembled_values): ax = axes[i] ax.axhline(assembled_value, linestyle='--', color='0.8') for system, vari in zip(args.systems, args.varis): sim_filebases = '{}/{}-{}'.format(args.input_dir, system, vari) all_aves, all_stds = plot.read_expectations(sim_filebases) xvars = all_aves[args.xtag] for i, tag in enumerate(tags): means = all_aves[tag] stds = all_stds[tag] ax = axes[i] ax.errorbar(xvars, means, yerr=stds, marker='o', label=vari) # Plot legend gs_lgd = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[2, :]) ax = f.add_subplot(gs_lgd[0]) ax.set_axis_off() handles, labels = axes[0].get_legend_handles_labels() ax.legend(handles, labels, loc='center', frameon=False, ncol=1) gs.tight_layout(f, pad=1.0, h_pad=0, w_pad=0) f.savefig(args.output_filebase + '.png', transparent=True) f.savefig(args.output_filebase + '.pdf', transparent=True)
def main(): args = parse_args() op_tag = 'numfulldomains' tagbase = 'domainstate' tags = ['{}{}'.format(tagbase, i) for i in range(args.scaffolddomains)] inp_filebase = '{}/{}-{}-{}'.format(args.input_dir, args.system, args.vari, op_tag) index_to_domaintype = np.loadtxt(args.mapfile, dtype=int) figsize = (plot.cm_to_inches(18), plot.cm_to_inches(12)) for op_value in range(1, args.scaffolddomains + 1): out_filebase = '{}/{}-{}_{}-{}-{}-freqs'.format( args.output_dir, args.system, args.vari, op_tag, op_value, tagbase) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(1, 1, width_ratios=[1], height_ratios=[1]) gs_main = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[:, :]) ax = f.add_subplot(gs_main[0]) ax.axis('off') aves, stds = plot.read_expectations(inp_filebase) if not op_value in aves[op_tag].values: continue reduced_aves = aves[aves[op_tag] == op_value] freqs = [reduced_aves[t] for t in tags] freq_array = fill_assembled_shape_array(freqs, index_to_domaintype) # Plot simulation melting points min_t = np.min(0) max_t = np.max(1) im = ax.imshow(freq_array, vmin=min_t, vmax=max_t) plt.colorbar(im, orientation='horizontal') plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig(out_filebase + '.png', transparent=True) f.savefig(out_filebase + '.pdf', transparent=True)
def main(): args = parse_args() skip = 1 out_filebase = '{}/{}-{}_timeseries'.format(args.output_dir, args.system, args.vari) tags = ['numstaples', 'numfulldomains', 'nummisdomains', 'numstackedpairs'] labels = [ 'Bound staples', 'Bound domains', 'Misbound domains', 'Stacked pairs' ] figsize = (plot.cm_to_inches(18), plot.cm_to_inches(36)) plot.set_default_appearance() f, axes = plt.subplots(3, 1, figsize=figsize, dpi=300) for rep in range(args.reps): ax = axes[rep] ax.set_xlabel('Walltime / s') timeseries = {} times = [] for tag in tags: timeseries[tag] = [] for run in range(args.runs): filebase = '{}/{}-{}_run-{}_rep-{}-{}'.format( args.input_dir, args.system, args.vari, run, rep, args.temp) ops_filename = '{}.ops'.format(filebase) ops = read_ops_from_file(ops_filename, tags, skip) times_filename = '{}.times'.format(filebase) new_times = np.loadtxt(times_filename, skiprows=1)[::skip, 1] if run != 0: new_times += times[-1] times.extend(new_times.tolist()) for tag in tags: timeseries[tag].extend(ops[tag]) # Plot timeseries for i, tag in enumerate(tags): ax.plot(times, timeseries[tag], marker=None, label=labels[i], color='C{}'.format(i), zorder=4 - i) # Plot expected value for i, tag in enumerate(tags): if args.assembled_values[i] != 0: ax.axhline(args.assembled_values[i], linestyle='--', color='C{}'.format(i)) # Plot legend ax = axes[0] handles, labels = ax.get_legend_handles_labels() lgd = ax.legend(handles, labels, frameon=False, loc='center', bbox_to_anchor=(0.7, 0.25)) plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig('{}.pdf'.format(out_filebase), transparent=True) f.savefig('{}.png'.format(out_filebase), transparent=True)
def main(): args = parse_args() tags = ['numstaples', 'numfulldomains', 'nummisdomains', 'numstackedpairs'] yaxis_labels = [ '(Mis)bound staples', 'Bound domain pairs', 'Misbound domain pairs', 'Stacked pairs' ] figsize = (plot.cm_to_inches(14), plot.cm_to_inches(11)) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(3, 2, width_ratios=[1, 1], height_ratios=[10, 10, 1]) gs_main = gridspec.GridSpecFromSubplotSpec(2, 2, subplot_spec=gs[:2, :], wspace=0.3, hspace=0.3) gs_cb = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[2, :]) axes = create_axes(f, gs_main, yaxis_labels) norm = mpl.colors.Normalize(vmin=args.smults[0], vmax=args.smults[-1]) cmap = mpl.cm.viridis scalarmap = mpl.cm.ScalarMappable(norm=norm, cmap=cmap) all_assembled_values = [] for assembled_values in args.all_assembled_values: parsed_values = [] for assembled_value in assembled_values.split(','): parsed_values.append(int(assembled_value)) all_assembled_values.append(parsed_values) for assembled_values in all_assembled_values: for i, assembled_value in enumerate(assembled_values): ax = axes[i] ax.axhline(assembled_value, linestyle='--', color='0.8') for system, vari in zip(args.systems, args.varis): sim_filebases = '{}/{}-{}'.format(args.input_dir, system, vari) all_aves, all_stds = plot.read_expectations(sim_filebases) for smult in args.smults: reduced_aves = all_aves[all_aves['bias'] == smult] reduced_stds = all_stds[all_stds['bias'] == smult] xvars = reduced_aves['temp'] for i, tag in enumerate(tags): means = reduced_aves[tag] stds = reduced_stds[tag] ax = axes[i] ax.errorbar(xvars, means, yerr=stds, marker='o', label=vari, color=scalarmap.to_rgba(smult)) # Plot legend ax = f.add_subplot(gs_cb[0]) cbar = mpl.colorbar.ColorbarBase(ax, orientation='horizontal', cmap=cmap, norm=norm) gs.tight_layout(f, pad=1.0, h_pad=0, w_pad=0) f.savefig(args.output_filebase + '.png', transparent=True) f.savefig(args.output_filebase + '.pdf', transparent=True)
def main(): args = parse_args() skip = 1 out_filebase = '{}/{}-{}_timeseries'.format(args.output_dir, args.system, args.vari) tags = ['numstaples', 'numfulldomains', 'nummisdomains', 'numstackedpairs'] labels = [ 'Bound staples', 'Bound domains', 'Misbound domains', 'Stacked pairs' ] bias_tags, windows = us_process.read_windows_file(args.windows_filename) figsize = (plot.cm_to_inches(18), plot.cm_to_inches(36 * len(windows))) plot.set_default_appearance() f, axes = plt.subplots(3 * len(windows), 1, figsize=figsize, dpi=300) ax_i = -1 for window in windows: for rep in range(args.reps): ax_i += 1 ax = axes[ax_i] ax.set_xlabel('Walltime / s') timeseries = {} times = [] for tag in tags: timeseries[tag] = [] # Create window file postfix postfix = '_win' for win_min in window[0]: postfix += '-' + str(win_min) postfix += '-' for win_max in window[1]: postfix += '-' + str(win_max) filebase = '{}/{}-{}_run-{}_rep-{}{}_iter-prod'.format( args.input_dir, args.system, args.vari, args.run, rep, postfix) ops_filename = '{}.ops'.format(filebase) ops = read_ops_from_file(ops_filename, tags, skip) times_filename = '{}.times'.format(filebase) times = np.loadtxt(times_filename, skiprows=1)[::skip, 1] for tag in tags: timeseries[tag] = ops[tag] # Plot timeseries for i, tag in enumerate(tags): ax.plot(times, timeseries[tag], marker=None, label=labels[i], color='C{}'.format(i), zorder=4 - i) # Plot expected value for i, tag in enumerate(tags): if args.assembled_values[i] != 0: ax.axhline(args.assembled_values[i], linestyle='--', color='C{}'.format(i)) # Plot legend ax = axes[0] handles, labels = ax.get_legend_handles_labels() lgd = ax.legend(handles, labels, frameon=False, loc='center', bbox_to_anchor=(0.7, 0.25)) plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig('{}.pdf'.format(out_filebase), transparent=True) f.savefig('{}.png'.format(out_filebase), transparent=True)
def main(): args = parse_args() tag2 = args.tag2 figsize = (plot.cm_to_inches(8.5), plot.cm_to_inches(7)) tag1s = [ 'staplestates{}'.format(i) for i in range(1, args.stapletypes + 1) ] for tag1 in tag1s: inp_filebase = '{}/{}-{}_{}-{}-lfes'.format(args.input_dir, args.system, args.vari, tag1, tag2) out_filebase = '{}/{}-{}_{}-{}-lfes-all'.format( args.output_dir, args.system, args.vari, tag1, tag2) plot.set_default_appearance() f = plt.figure(figsize=figsize, dpi=300) gs = gridspec.GridSpec(2, 1, width_ratios=[1], height_ratios=[20, 1]) gs_main = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[0, :], wspace=0, hspace=0) gs_cb = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec=gs[1, :]) ax = f.add_subplot(gs[0]) ax.set_ylabel('$k_\mathrm{b}T$') norm = mpl.colors.Normalize(vmin=args.temps[0], vmax=args.temps[-1]) cmap = mpl.cm.viridis scalarmap = mpl.cm.ScalarMappable(norm=norm, cmap=cmap) aves_filename = '{}.aves'.format(inp_filebase, tag1, tag2) aves = pd.read_csv(aves_filename, sep=' ') aves_one = aves[aves[tag1] == 1].sort_values(tag2).set_index(tag2) aves_zero = aves[aves[tag1] == 0].sort_values(tag2).set_index(tag2) aves_diff = aves_one - aves_zero stds_filename = '{}.stds'.format(inp_filebase, tag1, tag2) stds = pd.read_csv(stds_filename, sep=' ') stds_one = stds[stds[tag1] == 1].sort_values(tag2).set_index(tag2) stds_zero = stds[stds[tag1] == 0].sort_values(tag2).set_index(tag2) stds_prop = np.sqrt(stds_one**2 + stds_zero**2) for i, temp in enumerate(args.temps): temp_key = '{:.3f}'.format(temp) ax.errorbar(aves_diff.index, aves_diff[temp_key], yerr=stds_prop[temp_key], marker='o', color=scalarmap.to_rgba(temp)) # Colorbar ax = f.add_subplot(gs_cb[0]) cbar = mpl.colorbar.ColorbarBase(ax, orientation='horizontal', cmap=cmap, norm=norm) ax.set_xlabel('Temperature / K') plt.tight_layout(pad=0.5, h_pad=0, w_pad=0) f.savefig('{}.png'.format(out_filebase), transparent=True) f.savefig('{}.pdf'.format(out_filebase), transparent=True)