-
Notifications
You must be signed in to change notification settings - Fork 0
/
Placozoan_Feeding_Dev.jl
96 lines (74 loc) · 3.08 KB
/
Placozoan_Feeding_Dev.jl
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
85
86
87
88
89
90
91
92
93
94
95
96
# Placozoan_Dev.jl
# function trichoplax_sim()
# MAIN
bodylayers = 6 # number of body cell layers
margin = 2 # number of layers in gut margin ("brain")
celldiameter = 10.0
skeleton_springconstant= 5.0e-2
cell_pressureconstant = 1.0e0
cell_surface_energy_density = 5.0e1
dt = .001
param = trichoplaxparameters( bodylayers,
margin,
skeleton_springconstant,
cell_pressureconstant,
cell_surface_energy_density,
celldiameter,
dt)
@time trichoplax = Trichoplax(param)
# trichoplax.param.k2[] = 5.0e-2 # cytoskeleton spring constant /2
# trichoplax.param.σ[] = 5.0e1 # cell surface energy density
# trichoplax.param.ρ[] = 1.0e0 #1.0e2 # cell turgor pressure energy per unit volume
# Draw
R = bodylayers*celldiameter # approx radius of Trichoplax (for scene setting)
D = 3*R # scene diameter
limits=FRect(-D/2, -D/2, D, D)
scene = Scene(resolution = (800,800), scale_plot = false,
show_axis = false, limits=limits)
# scatter bacteria (point objects) over the scene
nbacteria = 50
bactrect = FRect(20,20, 30, 30)
bacteria = growbacteria(nbacteria, bactrect)
# draw trichoplax cells
cells_handle = draw(scene, trichoplax, RGB(.25, .25, .25), 1)
# colour the cells
ch = potentialmap(scene, trichoplax)
display(scene)
restvolume = copy(trichoplax.state.volume)
i0 = 4
i1 = vcat(i0, trichoplax.anatomy.neighbourcell[i0,:])
# record(scene, "trichoplaxdev.mp4", 1:100) do tick
for tick in 1:25
global trichoplax
global scene
if tick < 50
which_bacteriahere = bacteriahere(bacteria, trichoplax)
for j in 1:trichoplax.anatomy.stomach
for k in 1:length(which_bacteriahere[j])
trichoplax.state.potential[j] = trichoplax.state.potential[j] -
1.0/(bacteria.deadticks[which_bacteriahere[j][k]] .+ 1)
bacteria.deadticks[which_bacteriahere[j][k]] =
bacteria.deadticks[which_bacteriahere[j][k]] .+ 1
end
end
end
trichoplax = diffusepotential(trichoplax,600)
trichoplax.state.volume[:] =
restvolume.*(1.0 .-
sign.(trichoplax.state.potential).*
sqrt.(abs.(trichoplax.state.potential/4.0)))
trichoplax = morph(trichoplax, .0001, 25)
redraw(trichoplax,cells_handle)
# potential_remap(trichoplax, ch, 1)
println(tick)
display(scene)
sleep(.005)
end
# end
# ch[12][:color] = [ RGB{Float64}(0.913603,0.0,0.0),
# RGB{Float64}(0.,0.,1.0),
# RGB{Float64}(0.913603,0.0,0.788739),
# RGB{Float64}(0.913603,0.61886,0.788739),
# RGB{Float64}(0.913603,0.61886,0.788739),
# RGB{Float64}(0.913603,0.61886,0.788739),
# RGB{Float64}(0.913603,0.61886,0.788739)]