%run nb_init.py
eptm = lj.Epithelium(graphXMLfile='../saved_graphs/xml/before_apoptosis.xml',
paramfile='../default/params.xml')
def do_update():
eptm.update_geometry()
eptm.update_gradient()
import cProfile
cProfile.run('do_update()')
lj.running_local_optimum(eptm, tol=1e-3)
ax = lj.draw.plot_cells_sz(eptm, text=True)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-9-c4563efe857c> in <module>() ----> 1 ax = lj.draw.plot_cells_sz(eptm, text=True) AttributeError: 'function' object has no attribute 'plot_cells_sz'
%run ../src/sandbox.py
eptm.graph.save('../saved_graphs/xml/latest.xml')
lj.draw(eptm)
import skimage as si
import skimage.io as io
import scipy.ndimage as ndi
img0.shape
(600, 600, 4)
kernel_1c = np.array([[0, 0., 1., 0, 0],
[0, 1., 2., 1., 0],
[1, 2, 3, 2, 1],
[0, 1, 2, 1, 0],
[0, 0, 1, 0, 0]])
kernel_1c /= kernel_1c.sum()
kernel = np.zeros((5, 5, 4))
kernel[..., 0] = kernel_1c
kernel[..., 1] = kernel_1c
kernel[..., 2] = kernel_1c
kernel
array([[[ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ]], [[ 0. , 0. , 0. , 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0.10526316, 0.10526316, 0.10526316, 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0. , 0. , 0. , 0. ]], [[ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0.10526316, 0.10526316, 0.10526316, 0. ], [ 0.15789474, 0.15789474, 0.15789474, 0. ], [ 0.10526316, 0.10526316, 0.10526316, 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ]], [[ 0. , 0. , 0. , 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0.10526316, 0.10526316, 0.10526316, 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0. , 0. , 0. , 0. ]], [[ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ], [ 0.05263158, 0.05263158, 0.05263158, 0. ], [ 0. , 0. , 0. , 0. ], [ 0. , 0. , 0. , 0. ]]])
import os
dir0 = '../saved_graphs/png/apopto_vr0.90_ctr1.00_rt0.50'
all_pngs = os.listdir(dir0)
all_3ds = [fname for fname in all_pngs if '3d' in fname]
all_3ds.sort()
for fname in all_3ds:
img0 = io.imread(os.path.join(dir0, fname))
img1 = (img0 + ndi.convolve(img0, kernel)) / 2.
io.imsave(os.path.join(dir0, 'comp_'+fname), img1)
from skimage import viskskimage
edge_zeds, edge_sigmas, edge_rhos, raw_dsigmas = create_properties(eptm)
eptm.set_edge_state([(eptm.is_junction_edge, False)])
eptm.set_vertex_state([(eptm.is_alive, False)])
period = 2 * np.pi * edge_rhos.fa
abs_ds = np.abs(raw_dsigmas.fa)
first_period_dsigma = raw_dsigmas.fa[abs_ds < period / 2.]
first_period_ez = edge_zeds.fa[abs_ds < period / 2.]
second_period_dsigma = raw_dsigmas.fa[abs_ds > period / 2.]
second_period_ez = edge_zeds.fa[abs_ds > period / 2.]
eptm.set_edge_state()
eptm.set_vertex_state()
lj.draw.plot_cells_sz(eptm, text=False)
<matplotlib.axes.AxesSubplot at 0xb566b2c>
figure()
eptm.set_edge_state([(eptm.is_junction_edge, False)])
eptm.set_vertex_state([(eptm.is_alive, False)])
plot(edge_zeds.fa, eptm.edge_lengths.fa, 'ko', alpha=0.8)
plot(edge_zeds.fa, np.abs(eptm.dzeds.fa), 'bo')
plot(first_period_ez, np.abs(first_period_dsigma), 'ro')
plot(second_period_ez, np.abs(second_period_dsigma), 'go')
[<matplotlib.lines.Line2D at 0xc7ffc2c>]
figure()
h = plt.hist(eptm.edge_lengths.fa, bins=20, alpha=0.5)
h = plt.hist(np.abs(first_period_dsigma), bins=20, alpha=0.5)
h = plt.hist(np.abs(eptm.dzeds.fa), bins=20, alpha=0.5)