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
Merge requests
!2
Update README.md
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Update README.md
Student
into
main
Overview
0
Commits
51
Pipelines
0
Changes
1
Merged
encinass1u
requested to merge
Student
into
main
3 years ago
Overview
0
Commits
51
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
60055ffb
Prev
Next
Show latest version
1 file
+
92
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
60055ffb
Cell behavior Codes
· 60055ffb
encinass1u
authored
3 years ago
Cell_behavior_initial_steps/Uni_cell_add.py
0 → 100644
+
92
−
0
Options
# -*- 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
Loading