forked from ucl-cssb/colony-com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Two_bacterial_groups.py
84 lines (71 loc) · 2.34 KB
/
Two_bacterial_groups.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 13:42:37 2021
@author: savan
"""
#simulation R N S
from plate import Plate
from species import Species
import numpy as np
import helper_functions as hf
def main():
## experimental parameters
D = 0.03
rho_n = 0.5
rc = 3.33e-2 #6e-4
Dc = 1e-5
w = 0.75
Da = 2.94e-6
rho_A = 0.01
Dt = 0
environment_size = (59, 59)
plate = Plate(environment_size)
##add nutrient to the plate
U_N = np.zeros(environment_size)
for i in np.linspace(0, 58, 59):
for j in np.linspace(0,58,59):
U_N[int(i),int(j)]=100
N = Species("N", U_N)
def N_behaviour(species, params):
## unpack params
D, rho_n, Dc, rc, w, rho_A, Da, Dt = params
n = D*hf.ficks(species['N'], w) - (species['R']+species['S'])*rho_n*hf.leaky_hill(s=species['N'], K=80, lam=1, max=rc, min=0) #rho_n * species['N'] * (species['R'])
return n
N.set_behaviour(N_behaviour)
plate.add_species(N)
##add sender strain to the plate
U_S = np.zeros(environment_size)
for i in np.linspace(29, 29, 1):
U_S[int(i), int(i)] = 0.001
S = Species("S", U_S)
def S_behaviour(species, params):
## unpack params
D, rho_n, Dc, rc, w, rho_A, Da, Dt = params
s = Dc*hf.ficks(species['S'], w) + species['S']*hf.leaky_hill(s=species['N'], K=80, lam = 1, max=rc, min=0)
return s
S.set_behaviour(S_behaviour)
plate.add_species(S)
##add uninformed strain to the plate
U_R = np.zeros(environment_size)
for i in np.linspace(29, 29, 1):
for j in np.linspace(29,29, 1):
U_R[int(i), int(j)] = 0.001
R = Species("R", U_R)
def R_behaviour(species, params):
## unpack params
D, rho_n, Dc, rc, w, rho_A, Da, Dt = params
r = Dc*hf.ficks(species['R'], w) + species['R']*hf.leaky_hill(s=species['N'], K=80, lam = 1, max=rc, min=0)
return r
R.set_behaviour(R_behaviour)
plate.add_species(R)
params = (D, rho_n, Dc, rc, w, rho_A, Da, Dt)
sim = plate.run(t_final = 200*60,
dt = 1.,
params = params)
#plate.plot_simulation(sim, 3)
idx = 0
#colour = 'b'
#S = plate.get_all_species()
plate.compare_species(sim, S, 10, idx)
#plate.plot_conc_target(sim, S, 10)
main()