-
encinass1u authoredencinass1u authored
Gts_selection.py 1.59 KiB
#Gst generator,it is possible to choose a type of texture for the cell couture.
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
#Selection of desire treated surface, Gts
First_Pickle= True
square_grid=False
highs_grid=False
diagonal=True
if First_Pickle== True:
#L is the matrix dimension
L =12
Lx =np.linspace(0, L, 12)
Ly =np.linspace(0, L, 12)
#G is the ground, an empty matrix to add the desire surface
G= np.zeros((L,L))
#Gts us the ground for treated surface
Gts = copy.deepcopy(G)
if square_grid==True:
# #Square grid
for i in range (1,len(Lx)-1):
for j in range(1,len(Ly)-1):
if ((i % 2) !=0) or ((j % 2) ==0):
Gts[i,j] = 0.5
elif highs_grid==True:
for i in range (1,len(Lx)-1):
for j in range(1,len(Ly)-1):
if i==0 or j==0 or i==len(Lx)-1 or j==len(Ly)-1:
Gst[i,j] = 0.5
elif i==1 or j==1 or i==len(Lx)-2 or j==len(Ly)-2:
Gts[i,j] = 0.7
elif diagonal==True:
for i in range (1,len(Lx)-1):
for j in range (1,len(Ly)-1):
if (i == j):
Gts[i,j]=0.5
else:
with open('G_surface_empty.pkl', 'rb') as csv_file:
Gts = pickle.load(csv_file)
with open('G_surface_empty.pkl', 'wb') as csv_file:
pickle.dump(Gts,csv_file)
im = plt.imshow(Gts, cmap="copper_r")
plt.show()