diff --git a/Cell_behavior_initial_steps/Uni_cell.py b/Cell_behavior_initial_steps/Uni_cell.py new file mode 100644 index 0000000000000000000000000000000000000000..9abe05633008e8e3edbd0d4e3b9addd9897cae4f --- /dev/null +++ b/Cell_behavior_initial_steps/Uni_cell.py @@ -0,0 +1,71 @@ +#Single cell migration giving a trace of the path it takes + +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) +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 = 3 +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]==1 and (h != 0 or v!= 0): + Z[i,j]= 0.7 + Z[h + i, v + 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 + + + + + + +