Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
School_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
encinass1u
School_project
Commits
885a50ec
Commit
885a50ec
authored
3 years ago
by
encinass1u
Browse files
Options
Downloads
Patches
Plain Diff
Cell behavior Codes
parent
20e04f41
No related branches found
No related tags found
1 merge request
!2
Update README.md
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cell_behavior_initial_steps/Pluri_cell_prolif_migr.py
+83
-0
83 additions, 0 deletions
Cell_behavior_initial_steps/Pluri_cell_prolif_migr.py
with
83 additions
and
0 deletions
Cell_behavior_initial_steps/Pluri_cell_prolif_migr.py
0 → 100644
+
83
−
0
View file @
885a50ec
import
numpy
as
np
import
pickle
import
random
import
matplotlib.pyplot
as
ptl
import
copy
from
matplotlib
import
pyplot
as
plt
import
random
from
scipy
import
ndimage
from
bio2mslib.inout.inout
import
WriteData
as
WD
import
os
from
Gts_selection
import
L
,
Lx
,
Ly
from
bio2mslib.analysis.models
import
CellModels
as
DM
from
matplotlib.pyplot
import
figure
#Declaring saving paths for results
ls_images
=
[]
results_path
=
os
.
getcwd
()
+
os
.
sep
+
"
Pluri_cell
"
path_simulation_gif
=
os
.
getcwd
()
+
os
.
sep
+
"
Pluri_cell
"
path_simulation
=
results_path
+
os
.
sep
+
"
prolif_migr
"
if
os
.
path
.
isdir
(
path_simulation
)
==
False
:
os
.
mkdir
(
path_simulation
)
#Reopening choosen surface
with
open
(
'
G_surface_empty.pkl
'
,
'
rb
'
)
as
csv_file
:
Gts
=
pickle
.
load
(
csv_file
)
# #Visual preentation in image of the matrix
# im1 = plt.imshow(Gts, cmap="copper_r")
# plt.show()
#Gs is ground seeded, a copy of the choosen surface to seed the cells,
Gs
=
copy
.
deepcopy
(
Gts
)
#Milticelular seeding
for
i
in
range
(
4
,
L
-
6
):
for
j
in
range
(
4
,
L
-
7
):
if
Gs
[
i
,
j
]
==
0.5
:
Gs
[
i
,
j
]
=
1.5
else
:
Gs
[
i
,
j
]
=
1
#images of the cell in the surface
couture
=
plt
.
imshow
(
Gs
,
cmap
=
"
copper_r
"
)
plt
.
show
()
#Variable deffinition for PDE proliferation & migration model
Cd
=
1
*
10
**-
5
#Cell density
NO2
=
10
**
2
#nutrient concentration
Cdmax
=
10
**
7
#maximum cell density
Dm
=
0.001
#Cell motility coefficient
CRgrw
=
1
#rate of cell growth
CRNO2
=
10
**-
8
#Consumption rate of nutrients
DNO2
=
2
*
10
**-
5
dt
=
1
#time step
time_lapse
=
0.1
Gscopy
=
copy
.
deepcopy
(
Gs
)
Laplace
=
ndimage
.
laplace
(
Gs
)
#Migration
iter
=
0
while
iter
<=
15
:
for
mi
in
range
(
1
,
len
(
Lx
)
-
1
):
for
mj
in
range
(
1
,
len
(
Ly
)
-
1
):
x
=
random
.
randint
(
-
1
,
1
)
#horizontal value for the movement of the cell
y
=
random
.
randint
(
-
1
,
1
)
#vertival value for the movement of the cell
if
Gs
[
mi
,
mj
]
==
1
and
(
x
!=
0
or
y
!=
0
)
and
((
mi
+
x
)
<
len
(
Lx
))
and
((
mj
+
y
)
<
len
(
Ly
)):
Gs
[
mi
+
x
,
mj
+
y
]
=
1
Gs
[
mi
,
mj
]
=
0
#Proliferation after migration
Gs
[
mi
,
mj
]
=
Gscopy
[
mi
,
mj
]
+
dt
*
Dm
*
Laplace
[
mi
,
mj
]
*
(
1
-
(
Gscopy
[
mi
,
mj
]
/
Cdmax
))
+
CRgrw
*
1
*
Gscopy
[
mi
,
mj
]
*
(
1
-
(
Gscopy
[
mi
,
mj
]
/
Cdmax
))
if
Gs
[
mi
,
mj
]
>
0
and
Gs
[
mi
,
mj
]
!=
0.7
and
Gs
[
mi
,
mj
]
!=
0.5
:
Gs
[
mi
,
mj
]
=
1
im2
=
plt
.
imshow
(
Gs
,
cmap
=
"
copper_r
"
,
norm
=
None
,
aspect
=
'
equal
'
,
vmin
=
0
,
vmax
=
12
)
plt
.
show
()
name
=
'
Single_cell_migr_prolif
'
+
str
(
iter
)
+
'
.png
'
# plt.imsave(os.path.join(path_simulation, name), Gs, cmap="copper_r")
filename
=
name
ls_images
.
append
(
im2
)
iter
+=
1
WD
().
create_gif_from_images
(
files_path
=
results_path
+
os
.
sep
+
"
prolif_migr
"
,
results_path
=
path_simulation_gif
,
filename
=
'
Cell_behavior.gif
'
,
time_lapse
=
time_lapse
,
deleteOriginFiles
=
0
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment