Example #1
0
 for i2 in range(X[2]):
     par1[vals[2]] = pars[2][i2]
     for i3 in range(X[3]):
         par1[vals[3]] = pars[3][i3]
         for i4 in range(X[4]):
             par1[vals[4]] = pars[4][i4]
             for i5 in range(X[5]):
                 par1[vals[5]] = pars[5][i5]
                 for i6 in range(X[6]):
                     par1[vals[6]] = pars[6][i6]
                     for i7 in range(X[7]):
                         c = g.discr_gen(par1)
                         # This will initialize the subsequent simulations for this model
                         temp = g.starting_popn_seeded([obj for obj in c if obj.exists], par1)
                         # initial pop seeded from c
                         c1, obs1 = g.discr_time_1(par1, temp)
                         for i8 in range(X[8]):
                             x1 = [obj.vb for obj in c if obj.isdaughter == i8]
                             y1 = [obj.vd for obj in c if obj.isdaughter == i8]
                             z1 = np.mean([obj.t_grow - obj.t_bud for obj in c if obj.isdaughter == i8])
                             u1 = [obj for obj in c if obj.mother and obj.mother.isdaughter == i8 and obj.wb < obj.vb]
                             uu1 = []
                             for obj in u1:  # this step is necessary just to avoid duplicates
                                 if obj.mother in uu1:
                                     continue
                                 uu1.append(obj.mother)
                             # print len(uu1), len(u1)
                             w1 = len(uu1) * 100.0 / len(x1)
                             # print len(u1) * 100.0 / len(x1)
                             # print len([obj for obj in c if obj.wb<obj.vb and obj.isdaughter])*100.0/len([obj for obj in c if obj.isdaughter])
                             # print len(
Example #2
0
delta = 10.0

par_vals = dict([('dt', 0.01), ('td', 10.0), ('num_s1', 500), ('nstep', 500),
                 ('num_gen', 10), ('modeltype', 27), ('delta', 10.0),
                 ('l_std', 0.2), ('r', 0.67),
                 ('d_std', 0.02)])  # r picked to give same as 'cd'=0.6

celltype = ['Mothers', 'Daughters']
path = './check_correlations_1_output'

full_title = ['Mothers $t_d$ z-score', 'Daughters $t_d$ z-score']
sub_title = [r'Growth rate $\sigma={0}$'.format(par_vals['l_std'])]
# while not os.path.isfile(path+'_td_celltype+{0}'.format(0)+'.npy'):  # ensures that this dataset is there
temp = g.discr_gen(par_vals)
temp1 = g.starting_popn_seeded([obj for obj in temp if obj.exists], par_vals)
temp2 = g.discr_time_1(par_vals, temp1)
td = []
td.append(
    np.asarray([
        max(obj.t_grow, 0.0) for obj in temp2[0]
        if obj.exists and obj.isdaughter == 1
    ]))
# print len(td[-1])
td.append(
    np.asarray([
        max(obj.mother.nextgen.t_grow, 0.0) for obj in temp2[0]
        if obj.exists and obj.isdaughter == 1
    ]))
# print len(td[-1])
nan_inds = ~(np.isnan(td[0]) + np.isnan(td[1]))
for i1 in range(2):
Example #3
0
 par1 = par_vals
 for i1 in range(len(temp)):  # set the values for each of the different indices in this range.
     par1[fv[model_vars[model_num][i1]]] = fp[model_vars[model_num][i1]][temp[i1]]
 if model_num == 0:
     par1['K'] = delta/par1['CD']
 for i1 in range(num_rep):
     # tic1 = time.clock()
     c = []
     # print par1
     temp1 = g.discr_gen(par1)
     c.append(temp1)
     del temp1
     # This will initialize the subsequent simulations for this model
     temp2 = g.starting_popn_seeded([obj for obj in c[0] if obj.exists], par1)
     # initial pop seeded from c
     temp1, obs1 = g.discr_time_1(par1, temp2)
     c.append(temp1)
     del temp1, temp2
     for i2 in range(num_celltype):  # celltype
         for i3 in range(num_sims):  # sim number
             x1 = [obj.vb for obj in c[i3][1000:] if obj.isdaughter == i2]
             x2 = [obj.vb for obj in c[i3][1000:] if obj.isdaughter == i2 and obj.wd / obj.vd < 1.0]
             x3 = [obj.vb for obj in c[i3][1000:] if obj.isdaughter == i2 and obj.wb / obj.vb < 1.0]
             y1 = [obj.vd for obj in c[i3][1000:] if obj.isdaughter == i2]
             val1 = scipy.stats.linregress(x1, y1)
             a[temp[0], temp[1], temp[2], temp[3], temp[4], i1, i2, i3, 0] = val1[0]  # slope result
             a[temp[0], temp[1], temp[2], temp[3], temp[4], i1, i2, i3, 1] = len(x2) * 100.0 / len(x1)
             # % with low div conc result
             a[temp[0], temp[1], temp[2], temp[3], temp[4], i1, i2, i3, 2] = len(x3) * 100.0 / len(x1)
             # % with low birth conc result
     del c, obs1
Example #4
0
                 ('g2_std', 0.2), ('d_std', 0.1), ('k_std', None),
                 ('g1_thresh_std', 0.1)])
cd = [0.5, 1.0]
vb = [[[], []], [[], []]]
vd = [[[], []], [[], []]]

# for i0 in range(len(cd)):
i0 = 1
par1 = par_vals
par1['CD'] = cd[i0]
c = g.discr_gen(par_vals)
temp = [obj for obj in c if obj.exists]
# del c
for i1 in range(100000):
    val = g.starting_popn_seeded(temp, par1)
    c = g.discr_time_1(par1, val)
    temp = [obj for obj in c[0] if obj.exists]
    for i2 in range(2):
        temp1 = np.asarray(
            [obj.vb for obj in temp if obj.isdaughter == i2 and obj.exists])
        temp2 = np.asarray(
            [obj.vd for obj in temp if obj.isdaughter == i2 and obj.exists])
        np.save('../../Documents/data_storage/celltype_{0}'.format(i2) +
                '_vb_it_{0}'.format(i1), temp1)  # saving data
        np.save('../../Documents/data_storage/celltype_{0}'.format(i2) +
                '_vd_it_{0}'.format(i1), temp2)  # saving data
        vb[i0][i2].append(temp1)
        vd[i0][i2].append(temp2)

# for i0 in range(len(cd)):
# for i1 in range(2):
Example #5
0
                                                    str(stop))
 tic = time.clock()
 for i0 in xrange(start, stop):  # variable number of repeats for each core
     c = g.discr_gen(par_vals)
     temp = [obj for obj in c if obj.exists]
     for i1 in range(X[1]):
         # tic = time.clock()
         temp0, temp1 = g.starting_popn_seeded_1(temp,
                                                 par_vals,
                                                 discr_time=True)
         if np.mod(i1, save_freq) == 0:
             np.save(
                 '../../Documents/data_storage/March17_dilution_symmetric_3_savedpop_model_{0}_rep_{1}_it_{2}_asymm'
                 .format(str(par_vals['modeltype']), str(i0),
                         str(i1)), temp1)
         new_c = g.discr_time_1(par_vals, temp0)
         mothers = [obj.mother for obj in new_c[0] if obj.exists]
         del temp  # just to make sure it isn't stored.
         temp = [obj for obj in new_c[0] if obj.exists]
         for i2 in range(num_cells):  # full population included
             if i2 <= 1:  # in this case we deal with mothers and daughters
                 temp2 = np.asarray(
                     [obj.vb for obj in temp if obj.isdaughter == i2])
                 temp3 = np.asarray(
                     [obj.wb for obj in temp if obj.isdaughter == i2])
                 a[i0, i1, i2, 0] = np.mean(temp2)
                 a[i0, i1, i2, 1] = np.std(temp2)
                 a[i0, i1, i2, 2] = np.mean(temp3)
                 a[i0, i1, i2, 3] = np.std(temp3)
                 a[i0, i1, i2, 4] = np.mean(np.log(temp2))
                 a[i0, i1, i2, 5] = np.std(np.log(temp2))
Example #6
0
#                         str(par1['modeltype']), str(i0), str(i1)), bbox_inches='tight', dpi=fig.dpi)

for i1 in range(2):
    fig = plt.figure(figsize=[14, 6])
    for i0 in range(len(r_std)):
        ax = plt.subplot(1, 2, 1 + i0)
        par1['r_std'] = r_std[i0]
        if i0 == 0:
            print par1
        print 'r_std:', par1['r_std']
        temp1 = g.discr_gen(par1)
        # This will initialize the subsequent simulations for this model
        temp2 = g.starting_popn_seeded([obj for obj in temp1 if obj.exists],
                                       par1)
        # initial pop seeded from c
        temp3, obs3 = g.discr_time_1(par1, temp2)
        plt.xlabel('$V_b$')
        plt.ylabel('$V_d$')
        # plt.title(plotlab[i0])
        x = np.asarray(
            [obj.vb for obj in temp3 if obj.exists and obj.isdaughter == i1])
        y = np.asarray(
            [obj.vd for obj in temp3 if obj.exists and obj.isdaughter == i1])

        plt.hexbin(x, y, cmap="Purples", gridsize=40)
        plt.ylim(ymin=np.mean(y) - l * np.std(y),
                 ymax=np.mean(y) + l * np.std(y))
        plt.xlim(xmin=np.mean(x) - l * np.std(x),
                 xmax=np.mean(x) + l * np.std(x))
        bin_means, bin_edges, binnumber = scipy.stats.binned_statistic(
            x, np.arange(len(x)), statistic='mean', bins=num_bins, range=None)