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
60055ffb
Commit
60055ffb
authored
3 years ago
by
encinass1u
Browse files
Options
Downloads
Patches
Plain Diff
Cell behavior Codes
parent
40f1d43b
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/Uni_cell_add.py
+92
-0
92 additions, 0 deletions
Cell_behavior_initial_steps/Uni_cell_add.py
with
92 additions
and
0 deletions
Cell_behavior_initial_steps/Uni_cell_add.py
0 → 100644
+
92
−
0
View file @
60055ffb
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 21 13:34:54 2022
@author: encinass1u
"""
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
#Empty matrix size declaration
lengthx
=
12
lengthy
=
12
G
=
np
.
zeros
((
lengthx
,
lengthy
))
ST
=
copy
.
deepcopy
(
G
)
#Loop to add the \ surface
for
i
in
range
(
0
,
12
):
for
j
in
range
(
0
,
12
):
if
(
i
==
j
):
ST
[
i
,
j
]
=
0.5
#Pickle of the obtained matrix
with
open
(
'
Cell_grid.pkl
'
,
'
wb
'
)
as
csv_file
:
pickle
.
dump
(
ST
,
csv_file
)
with
open
(
'
Cell_grid.pkl
'
,
'
rb
'
)
as
csv_file
:
data_saved
=
pickle
.
load
(
csv_file
)
#print(data_saved)
# print(type(ST))
# #Visual preentation in image of the matrix
#im = plt.imshow(data_saved, cmap="copper_r")
#plt.colorbar(data_saved) #Error hereeeee
#plt.show()
#Create a copy of the initial surface to seed the cells
Z
=
copy
.
deepcopy
(
ST
)
im2
=
plt
.
imshow
(
Z
,
cmap
=
"
copper_r
"
)
plt
.
show
()
#incertion of a single cell to track its movement based on the simpspn model
uni_cell
=
Z
[(
5
,
4
)]
Z
[(
5
,
4
)]
=
1
iter
=
1
itermax
=
5
im2
=
plt
.
imshow
(
Z
,
cmap
=
"
copper_r
"
)
plt
.
show
()
while
iter
<=
itermax
:
for
i
in
range
(
0
,
12
):
for
j
in
range
(
0
,
12
):
# if Zcopy[im,jm]>= 1:
# Zcopyinitial = copy.deepcopy(Zcopy[im,jm])
h
=
random
.
randint
(
-
1
,
1
)
#horizontal value for the movement of the cell
v
=
random
.
randint
(
-
1
,
1
)
#vertival value for the movement of the cell
if
Z
[
i
,
j
]
>=
uni_cell
and
(
h
!=
0
or
v
!=
0
):
Z
[
h
+
i
,
v
+
j
]
+=
1
Z
[
i
,
j
]
+=
uni_cell
im2
=
plt
.
imshow
(
Z
,
cmap
=
"
hot
"
)
plt
.
show
()
with
open
(
'
Cell_migration_
'
+
str
(
iter
)
+
'
.pkl
'
,
'
wb
'
)
as
csv_file
:
pickle
.
dump
(
Z
,
csv_file
)
iter
+=
1
# elif Z[i,j]>0.71 and (h != 0 or v!= 0):
# Z[h + i, v + j]= Z[i,j]+1
# Z[i,j]+=1
# #Print the image to locate the cell each iteration.
# #Saving the file of pickle
# im2 = plt.imshow(Z, cmap="copper_r")
# plt.show()
# with open('Cell_migration_'+str(iter)+'.pkl', 'wb') as csv_file:
# pickle.dump(Z,csv_file)
# iter +=1
# Z[h + i, v + j]= 1
# Z[i,j]= 0
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