Ejemplo n.º 1
0
 par1[vals[1]] = pars[1][i1]
 par1['K'] = delta / par1['CD']  # Keep the value of Delta fixed throughout
 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)
Ejemplo n.º 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]))
Ejemplo n.º 3
0
                 ('K', delta / td), ('CD', 1.0), ('r', 1.0), ('r_std', 0.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)):
Ejemplo n.º 4
0
 for i0 in xrange(start, stop):  # varying the different growth conditions
     temp = np.unravel_index(i0, tuple(Z))  # gives the indices of this in phase space as implied by model_vars
     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)
 for i0 in xrange(start, stop):
     # Reset par1 for each new model, with settings appropriate for that model
     par1 = par_set
     for temp in range(len(par1_vals[i0])):
         par1[par1_vals[i0][temp][0]] = par1_vals[i0][temp][1]
     c = g.discr_gen(
         par1
     )  # This will initialize the subsequent simulations for this model
     for i1 in range(X1):
         par1[vals[1]] = pars[1][i1]
         for i2 in range(X2):
             par1[vals[2]] = pars[2][i2]
             par1['nstep'] = int(pars[2][i2] * 1.0 / par1['dt'])
             for i3 in range(X3):
                 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)
                 del temp
                 temp = g.starting_popn_seeded(
                     [obj for obj in c if obj.exists],
                     par1)  # initial pop seeded from c
                 c2 = g.discr_gen_1(par1, temp)
                 del temp
                 for i4 in range(X4):
                     x1 = [obj.vb for obj in c1 if obj.isdaughter == i4]
                     y1 = [obj.vd for obj in c1 if obj.isdaughter == i4]
                     x2 = [obj.vb for obj in c2 if obj.isdaughter == i4]
                     y2 = [obj.vd for obj in c2 if obj.isdaughter == i4]
                     val1 = scipy.stats.linregress(x1, y1)
                     val2 = scipy.stats.linregress(x2, y2)