I want to simulate basic cell division using python arrays. I have u, which is an array of arrays defined as:
n=2
each u [i] is a cell in the system, and u is the whole system. Then I define some functions that I will use for my cell division algorithm later.
Mx=np.zeros((n,n)) My=np.zeros((n,n)) for x in range (n): Mx[x]=xn/2 for y in range (n): My[y]=yn/2
Here I initialize my cells so that they take the values ββ1 or 0:
for i in range(N): for x in range(n): for y in range(n): if (xn/2)**2+(yn/2)**2<5: u[i][x,y]=1
After I multiply my cell, I want to check for cells that have grown more, say, volume V
for i in range (N): if (np.sum([i]>V): theta=random.uniform(0, 2*math.pi) u.append(np.zeros((n,n))) u[-1]=u[i]/2.0* (1+np.tanh((math.cos(theta)*Mx+math.sin(theta)*My/epsilon)) u[i]=u[i]/2.0* (1-np.tanh((math.cos(theta)*Mx+math.sin(theta)*My)/epsilon)) N+=1
Now I say if my volume is larger than a specific volume V, then I add a cell to the system (adding an array of zeros) and I define my two child cells as
u[-1]=u[i]/2.0*(1-np.tanh((math.cos(theta)*Mx+math.sin(theta)*My/epsilon))
and
u[i]=u[i]/2.0* (1+np.tanh((math.cos(theta)*Mx+math.sin(theta)*My/epsilon))
where the new array u [i] replaces my original one. As an alternative, I tried to add two arrays np.zero ((n, n)) and defined two child cells as
u[-1] and u[-2]
then deleting the original parent cell with
del u[i]
but that didn't work either. After running this code, I get more arrays in U than I should receive. If N = 2, then I should have N = 4 after cell division.
Ideally, I want my original u array to look something like this:
u=[array([[0,1], [1,0]]), array([[1,1],[1,0]])]
and I want to check
np.sum(u[0])>V
then I will define two new components in u, namely
u[-1] and u[i]
where the new u [i] replaces the original u [i]
as
np.sum(u[0]) and np.sum(u[1]) are both > V
then my new u array should look something like this:
u=[array([[1,1], [1,0]]), array([[1,1], [1,0]]), array([[1,1], [1,0]]), array([[1,1], [1,0]])]
(these values ββin my array are just approximate values. The actual value depends on my function
u[-1]=u[i]/2.0*(1+np.tanh((math.cos(theta)*Mx+math.sin(theta)*My/epsilon)) u[i]=u[i]/2.0*(1- np.tanh((math.cos(theta)*Mx+math.sin(theta)*My)/epsilon))