Skip to content
Snippets Groups Projects
Commit 7c6740f9 authored by encinass1u's avatar encinass1u
Browse files

Replace Pluri_cell_prolif_migr.py

parent 4e439887
Branches
No related tags found
1 merge request!2Update README.md
...@@ -8,7 +8,7 @@ import random ...@@ -8,7 +8,7 @@ import random
from scipy import ndimage from scipy import ndimage
from bio2mslib.inout.inout import WriteData as WD from bio2mslib.inout.inout import WriteData as WD
import os import os
from Gts_selection import L, Lx, Ly from Gts_selection import L
from bio2mslib.analysis.models import CellModels as DM from bio2mslib.analysis.models import CellModels as DM
from matplotlib.pyplot import figure from matplotlib.pyplot import figure
...@@ -21,29 +21,26 @@ if os.path.isdir(path_simulation) == False : ...@@ -21,29 +21,26 @@ if os.path.isdir(path_simulation) == False :
os.mkdir(path_simulation) os.mkdir(path_simulation)
#Reopening choosen surface #Reopening choosen surface
with open('G_surface_empty.pkl', 'rb') as csv_file: with open('Gts_sample.cvs', 'rb') as csv_file:
Gts = pickle.load(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 is ground seeded, a copy of the choosen surface to seed the cells,
Gs = copy.deepcopy(Gts) Gs = copy.deepcopy(Gts)
#Milticelular seeding #Milticelular seeding
for i in range (4,L-6): for i in range (4,L-6):
for j in range (4,L-7): for j in range (4,L-7):
if Gs[i,j]==0.5: if Gs[i,j]==1:
Gs[i,j]=1.5 Gs[i,j]+=0.5
else: else:
Gs[i,j]=1 Gs[i,j]=1.5
#images of the cell in the surface #images of the cell in the surface
couture= plt.imshow(Gs, cmap="copper_r") couture= plt.imshow(Gs, cmap="bone")
plt.title("Gts, Inital seeding",
size=20)
plt.show() plt.show()
#Variable deffinition for PDE proliferation & migration model #Variable deffinition for PDE proliferation & migration model
Cd = 1*10**-5 #Cell density Cd = 1*10**-5 #Cell density
...@@ -60,24 +57,26 @@ Gscopy = copy.deepcopy(Gs) ...@@ -60,24 +57,26 @@ Gscopy = copy.deepcopy(Gs)
Laplace = ndimage.laplace(Gs) Laplace = ndimage.laplace(Gs)
#Migration #Migration
iter = 0 iter = 0
while iter<= 15: while iter<= 5:
for mi in range(1, len(Lx)-1): for mi in range(1, L-1):
for mj in range(1, len(Ly)-1): for mj in range(1, L-1):
x = random.randint(-1,1)#horizontal value for the movement of the cell 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 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)): if Gs[mi,mj]==1.5 and (x != 0 or y!= 0) and ((mi+x)<L) and ((mj+y)< L):
Gs[mi+x,mj+y]= 1 Gs[mi+x,mj+y]= 1.5
Gs[mi,mj]=0 Gs[mi,mj]=0
#Proliferation after migration #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)) 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 : if Gs[mi,mj]>0 and Gs[mi,mj]!=1:
Gs[mi,mj]=1 Gs[mi,mj]=1.5
im2 = plt.imshow(Gs, cmap="copper_r", norm = None, aspect ='equal', vmin=0 ,vmax=12) plt.title("Gts, Proliferation and migration",
size=20)
im2 = plt.imshow(Gs, cmap="bone")
plt.show() plt.show()
name = 'Single_cell_migr_prolif'+str(iter)+'.png' name = 'Single_cell_migr_prolif'+str(iter)+'.png'
# plt.imsave(os.path.join(path_simulation, name), Gs, cmap="copper_r") plt.imsave(os.path.join(path_simulation, name), Gs, cmap="bone")
filename = name filename = name
ls_images.append(im2) ls_images.append(im2)
iter+=1 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) WD().create_gif_from_images(files_path=results_path+os.sep+"prolif_migr",results_path=path_simulation_gif,filename='Multiple_cell_behavior.gif', time_lapse= time_lapse, deleteOriginFiles=0)
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment