def gen_fig_1(var):
    labels = [
        r'$\sigma_s/\langle \tilde{\Delta}\rangle$', '$\sigma_{t}/t_{db}$'
    ]
    titles = ['$f=0.5$, $(C+D)/t_{db}=0.7$', '$f=0.5$, $(C+D)/t_{db}=0.9$']
    tit_num = ['(A)', '(B)', '(C)', '(D)']
    cmap_lims = [0.0, 2.0]
    ticks = np.linspace(0.01, 0.3, num=30)
    figs = []
    for i0 in range(len(var)):
        print var[i0]
        temp = np.load(var[i0] + '.npy')

        fig = plt.figure(figsize=[8, 8])
        ax = plt.subplot(1, 1, 1)
        a = np.absolute(temp - 1.0) < 0.1
        ax = plt.imshow(scipy.ndimage.morphology.binary_fill_holes(a))
        fig.savefig(var[i0] + '_bin.png', bbox_inches='tight', dpi=fig.dpi)
        del fig
        fig = plt.figure(figsize=[8, 8])
        ax = plt.subplot(1, 1, 1)
        ax = g.heat_map_pd(temp,
                           ticks,
                           ticks,
                           ax,
                           xlabel=labels[0],
                           ylabel=labels[1],
                           title=tit_num[i0] + titles[np.mod(i0, 2)],
                           cmap_lims=cmap_lims)
        plt.show()
        fig.savefig(var[i0] + '.eps', bbox_inches='tight', dpi=fig.dpi)
        del temp, fig
    return var
labels = [r'$\sigma_s/\langle \tilde{\Delta}\rangle$', '$\sigma_{t}/t_{db}$']
titles = ['$f=0.5$, $(C+D)/t_{db}=0.7$', '$f=0.5$, $(C+D)/t_{db}=0.9$']
tit_num = ['(A)', '(B)', '(C)', '(D)']
cmap_lims = [0.0, 2.0]
ticks = np.linspace(0.01, 0.3, num=30)
figs = []
i0 = 0
# for i0 in range(len(var)):
print var[i0]
temp = np.load(var[i0] + '.npy')

fig = plt.figure(figsize=[8, 8])
ax = plt.subplot(1, 1, 1)
a = np.absolute(temp - 1.0) < 0.1
ax = plt.imshow(scipy.ndimage.morphology.binary_fill_holes(a))
fig.savefig(var[i0] + '_bin.png', bbox_inches='tight', dpi=fig.dpi)
del fig
fig = plt.figure(figsize=[8, 8])
ax = plt.subplot(1, 1, 1)
ax = g.heat_map_pd(temp,
                   ticks,
                   ticks,
                   ax,
                   xlabel=labels[0],
                   ylabel=labels[1],
                   title=tit_num[i0] + titles[np.mod(i0, 2)],
                   cmap_lims=cmap_lims)
fig.savefig(var[i0] + '.eps', bbox_inches='tight', dpi=fig.dpi)
del temp, fig

for i0 in range(len(g1_thresh_std)):
    for i1 in range(len(r_nums)):
        for i2 in range(num_meas):
            i3 = 1
            i4=0  # Mothers
            plotlab = ['(A) ', '(B) ', '(C) ', '(D) ']
            fig = plt.figure(figsize=[8, 8])
            # plots for the paper. Daughters only. Individual plots so can be mixed and matched.
            # Discretized time only.
            ax = plt.subplot(1, 1, 1)
            obs = np.mean(data[r_nums[i1], :, i0, :, :, i4, i3, i2], axis=-1)
            temp = plotlab[2*np.mod(i0,2)+i1]+labels[3] + str(g1_thresh_std[i0]) + r', $\langle x\rangle=$' + str(r[r_nums[i1]])
            if i2 == 0:
                ax = g.heat_map_pd(obs, r_std, d_std, ax, xlabel=labels[0], ylabel=labels[1], title=temp,
                                color='black', cmap_lims=cmap_lims)
                fig.savefig(
                    './1705_inh_yeast_asymm_fig_{0}_meas_{1}_si_{2}_r_{3}_sim_{4}_celltype_{5}_v2.eps'.format(
                        str(par1['modeltype']), str(i2), str(i0), str(r_nums[i1]), str(i3), str(i4)),
                    bbox_inches='tight', dpi=fig.dpi)
                del fig, obs, ax
            i4=1  #Daughters
            plotlab = ['(C) ', '(D) ', '(E) ', '(F) ']
            fig = plt.figure(figsize=[8, 8])
            # plots for the paper. Daughters only. Individual plots so can be mixed and matched.
            # Discretized time only.
            ax = plt.subplot(1, 1, 1)
            obs = np.mean(data[r_nums[i1], :, i0, :, :, i4, i3, i2], axis=-1)
            temp = plotlab[2*np.mod(i0,2)+i1]+labels[3] + str(g1_thresh_std[i0]) + r', $\langle x\rangle=$' + str(r[r_nums[i1]])
            if i2 == 0:
                ax = g.heat_map_pd(obs, r_std, d_std, ax, xlabel=labels[0], ylabel=labels[1], title=temp,
label = ['(A) ', '(B) ', '(C) ', '(D) ']
cmap_lims = [0.7, 1.3]
for i1 in range(num_celltype):
    # for i2 in range(num_sims):
    i2 = 1  # discretized time. num_sims
    i3 = 0  # slope only. num_meas
        # for i3 in range(num_meas):
    for i4 in range(len(r_vals)):
        obs = np.mean(data[r_vals[i4], :, :, :, i1, i2, i3], axis=-1)
        fig = plt.figure(figsize=[8, 8])
        ax = plt.subplot(1, 1, 1)
        ax = plt.imshow(np.absolute(obs - 1.0) > 0.1)
        fig.savefig('./temp_{0}_{1}_{2}_{3}'.format(str(i1), str(i3),
                                                    str(i2), str(r_vals[i4])))
        del fig
        fig = plt.figure(figsize=[8, 8])
        ax = plt.subplot(1, 1, 1)
        temp = label[2*(1-i1)+i4] + celltype[i1]+', '+r' $\langle x\rangle=${0}'.format(np.round(r[r_vals[i4]], 2))
        print i1, i3, i2, i4
        ax = g.heat_map_pd(obs, r_std, g1_thresh_std, ax, xlabel=lab[0], ylabel=lab[1], title=temp,
                           cmap_lims=cmap_lims)
        #ax = g.heat_map(obs, r_std, g1_thresh_std, ax, xlabel=lab[0], ylabel=lab[1], title=temp)
        fig.savefig('./1705_init_yeast_asymm_celltype_{0}_meas_{1}_sim_{2}_r_{3}_v1.eps'.format(str(i1), str(i3),
                                                        str(i2), str(r_vals[i4])), bbox_inches='tight', dpi=fig.dpi)
        del fig

# April17_paper_scripts_4_model_{0}_celltype_{1}_meas_{2}_sim_{3}_r_{4}.eps allows negative growth through noise, but not
# in G1. Comes from March17_accumulator1_V0.npy
# April17_paper_scripts_4_model_{0}_celltype_{1}_meas_{2}_sim_{3}_r_{4}.eps has no negative growth whatsoever in models
# 2 and 4. comes from April17_paper_scripts_5_v0.