diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2abe4f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +**/*.ipynb_checkpoints +**/*.egg-info +**/__pycache__ \ No newline at end of file diff --git a/examples/.ipynb_checkpoints/example_simulation-checkpoint.ipynb b/examples/.ipynb_checkpoints/example_simulation-checkpoint.ipynb new file mode 100644 index 0000000..28e7b30 --- /dev/null +++ b/examples/.ipynb_checkpoints/example_simulation-checkpoint.ipynb @@ -0,0 +1,2023 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "import itertools\n", + "get_ipython().magic(u'matplotlib inline')\n", + "import numpy as np\n", + "import matplotlib\n", + "%matplotlib qt5\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib import animation, rc\n", + "from IPython.display import HTML\n", + "import vertex_model as model\n", + "from vertex_model.run_select import run_simulation_INM, definecolors\n", + "import vertex_model.initialisation as init" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "test\n" + ] + } + ], + "source": [ + "import vertex_model\n", + "print(\"test\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.001\n", + "[2937] [10008 10009 10010 10011 10012 10013]\n", + "[3322] [ 6360 6361 6362 11163 11164 11165]\n", + "[3474] [ 2670 2671 2672 11613 11614 11615]\n", + "[3538] [11796 11797 11798 11799 11800 11801]\n", + "[6687] [ 5574 5575 5576 21234 21235 21236]\n", + "[6390] [ 3273 3274 3275 20343 20344 20345]\n", + "[7650] [15252 15253 15254 24117 24118 24119]\n", + "[8348] [12585 12586 12587 26205 26206 26207]\n", + "[8349] [15249 15250 15251 26199 26200 26201]\n", + "[7566] [ 7338 7339 7340 10206 10207 10208]\n", + "[13538] [ 7188 7189 7190 41757 41758 41759]\n", + "[13539] [21912 21913 21914 24897 24898 24899]\n", + "[11405] [15846 15847 15848 15849 15850 15851]\n", + "[14039] [ 1653 1654 1655 12792 12793 12794]\n", + "[16474] [27372 27373 27374 31614 31615 31616]\n", + "[15458] [ 5544 5545 5546 47487 47488 47489]\n", + "[16475] [15360 15361 15362 31605 31606 31607]\n", + "[15642] [ 4194 4195 4196 48027 48028 48029]\n", + "[16277] [26148 26149 26150 49923 49924 49925]\n", + "[16683] [ 6252 6253 6254 51135 51136 51137]\n", + "[15447] [ 6639 6640 6641 15099 15100 15101]\n", + "[19364] [ 7584 7585 7586 26499 26500 26501]\n", + "[15643] [ 4191 4192 4193 48003 48004 48005]\n", + "[19768] [15639 15640 15641 22497 22498 22499]\n", + "[19769] [ 7728 7729 7730 60363 60364 60365]\n", + "[18781] [31053 31054 31055 31056 31057 31058]\n", + "[21896] [34137 34138 34139 66732 66733 66734]\n", + "[21897] [40233 40234 40235 66729 66730 66731]\n", + "[22213] [ 1521 1522 1523 20712 20713 20714]\n", + "[17775] [ 561 562 563 29148 29149 29150]\n", + "[22224] [67686 67687 67688 67692 67693 67694]\n" + ] + } + ], + "source": [ + "#### Parameter used in the simulation are picked up form Gobal_Constant.py file\n", + "\n", + "### Choose simulation to run\n", + "# def run_simulation_INM(x, timend,rand, type):\n", + "# sim_type 0 simulation_with_division_clone (no differentiation rate)\n", + "# sim_type 1 simulation_with_division_clone_differentiation (all differentiation rate)\n", + "# sim_type 2 simulation_with_division_clone_differenciation_3stripes (2 population with and without diffentiation rate)\n", + "# sim_type 3 simulation_with_division_clone_whole_tissue_differenciation (differentiation rate everywhere)\n", + "\n", + "#use type 2 and parameter i=4 for floor plate\n", + "import numpy as np\n", + "type_=2\n", + "L_point = [-.4, -0.2,-0.3, -0.05, 0.075, 0.15]\n", + "G_point = [0.14, 0.12, 0.1, 0.065, 0.04, 0.02]\n", + "i=4\n", + "G=G_point[i]\n", + "L=L_point[i]\n", + "K=1.0\n", + "#run simulation with the choosen parameters ; line 521 in run_select.py\n", + "rand = np.random.RandomState() #random number to choose Lambda\n", + "params = [K,G,L] # K=x[0],G=x[1],L=x[2]\n", + "history= run_simulation_INM(params,300,rand,type_) #return hist; simulation time = 300?\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "def definecolors(cells):\n", + " peach = '#eed5b7'\n", + " light_blue ='#87cefa'\n", + " pink = '#ffc0cb'\n", + " light_green = '#98fb98'\n", + " palette = np.array([peach,'g',peach, 'r',peach,'g',peach])\n", + " colors = cells.properties['parent_group']\n", + "\n", + " return palette[colors]\n", + "\n", + "\n", + "for cells in history:\n", + " cells.properties['color'] = definecolors(cells)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "fig=plt.figure()\n", + "ax = fig.gca()\n", + "# initialization function: plot the background of each frame\n", + "def init_fig():\n", + " ax = plt.figure()\n", + " return (ax,)\n", + "# animation function. This is called sequentially\n", + "def animate_fig(i):\n", + " cells_array=history\n", + " v_max = np.max((np.max(cells_array[0].mesh.vertices), np.max(cells_array[-1].mesh.vertices)))\n", + " size = 2.0*v_max\n", + " cells= history[i]\n", + " return model.draw(cells,ax,size)\n", + "# call the animator. blit=True means only re-draw the parts that have changed.\n", + "anim = animation.FuncAnimation(fig,animate_fig, init_func=init_fig,\n", + " frames=len(history))\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "RuntimeError", + "evalue": "Requested MovieWriter (ffmpeg) not available", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mHTML\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0manim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_html5_video\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36mto_html5_video\u001b[0;34m(self, embed_limit)\u001b[0m\n\u001b[1;32m 1314\u001b[0m \u001b[0;31m# We create a writer manually so that we can get the\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1315\u001b[0m \u001b[0;31m# appropriate size for the tag\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1316\u001b[0;31m \u001b[0mWriter\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mwriters\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mmpl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'animation.writer'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1317\u001b[0m writer = Writer(codec='h264',\n\u001b[1;32m 1318\u001b[0m \u001b[0mbitrate\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmpl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'animation.bitrate'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 164\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_available\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_registered\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 166\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Requested MovieWriter ({name}) not available\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 167\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 168\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mRuntimeError\u001b[0m: Requested MovieWriter (ffmpeg) not available" + ] + } + ], + "source": [ + "HTML(anim.to_html5_video())" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "0.003860953347055751\n", + "3.1399356201466135\n", + "0.8926051064870122\n", + "0.6809692572214547\n", + "2290\n" + ] + } + ], + "source": [ + "# Determine if cell cycle length has an Erlang distribution - if our model matches experimental data.\n", + "\n", + "print(cells.properties['age'])\n", + "print(min(cells.properties['age']))\n", + "print(max(cells.properties['age']))\n", + "h = plt.hist(cells.properties['age'], bins = 30)\n", + "plt.show()\n", + "\n", + "\n", + "\n", + "#find mean of distribution\n", + "mu = sum(cells.properties['age'])/len(cells.properties['age'])\n", + "print(sum(cells.properties['age'])/len(cells.properties['age']))\n", + "# find sd of distribution\n", + "sigma = np.std(cells.properties['age'])\n", + "print(np.std(cells.properties['age']))\n", + "print(len(cells.properties['age']))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 261, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ True True True ... False False False]\n", + "2290\n", + "945\n", + "\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(len(cells.empty())) # 2290 cells in total: dead and alive\n", + "print(len(np.where(cells.empty())[0])) # 945 dead cells - np.where finds where values of array = True vals\n", + "print(type(cells.empty()))# Returns an array with True and False: true where cells are dead, false where they are alive" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n" + ] + } + ], + "source": [ + "deadcells = np.where(cells.empty())[0]\n", + "print(cells.properties['age'][deadcells])" + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,\n", + " 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\n", + " 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,\n", + " 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\n", + " 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,\n", + " 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,\n", + " 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\n", + " 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,\n", + " 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,\n", + " 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,\n", + " 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,\n", + " 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,\n", + " 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,\n", + " 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n", + " 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,\n", + " 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,\n", + " 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,\n", + " 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,\n", + " 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,\n", + " 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,\n", + " 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,\n", + " 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,\n", + " 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,\n", + " 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263,\n", + " 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,\n", + " 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,\n", + " 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,\n", + " 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,\n", + " 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,\n", + " 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,\n", + " 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340,\n", + " 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,\n", + " 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,\n", + " 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,\n", + " 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,\n", + " 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395,\n", + " 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406,\n", + " 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,\n", + " 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428,\n", + " 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439,\n", + " 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450,\n", + " 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461,\n", + " 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472,\n", + " 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483,\n", + " 484, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495,\n", + " 496, 497, 498, 499, 500, 501, 502, 504, 505, 506, 507,\n", + " 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518,\n", + " 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529,\n", + " 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541,\n", + " 542, 543, 544, 545, 546, 548, 549, 550, 551, 552, 553,\n", + " 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564,\n", + " 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575,\n", + " 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586,\n", + " 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597,\n", + " 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608,\n", + " 610, 611, 612, 613, 614, 616, 617, 618, 619, 620, 621,\n", + " 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632,\n", + " 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643,\n", + " 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655,\n", + " 656, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667,\n", + " 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678,\n", + " 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689,\n", + " 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700,\n", + " 701, 702, 703, 704, 706, 707, 708, 709, 710, 711, 712,\n", + " 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723,\n", + " 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735,\n", + " 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746,\n", + " 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758,\n", + " 759, 760, 761, 762, 763, 764, 766, 768, 769, 770, 772,\n", + " 773, 774, 775, 776, 779, 780, 782, 783, 784, 785, 786,\n", + " 787, 788, 789, 790, 791, 792, 793, 795, 796, 798, 800,\n", + " 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 813,\n", + " 814, 815, 816, 817, 818, 819, 820, 822, 826, 827, 828,\n", + " 829, 830, 831, 832, 833, 835, 837, 838, 839, 842, 844,\n", + " 846, 848, 849, 851, 852, 853, 854, 855, 856, 857, 858,\n", + " 859, 860, 861, 864, 866, 867, 868, 869, 870, 872, 875,\n", + " 877, 879, 884, 887, 889, 890, 892, 893, 895, 896, 900,\n", + " 902, 903, 904, 905, 906, 908, 909, 910, 911, 913, 915,\n", + " 917, 918, 919, 920, 921, 922, 923, 924, 925, 928, 930,\n", + " 932, 933, 937, 940, 941, 944, 945, 946, 949, 952, 953,\n", + " 955, 958, 959, 960, 963, 965, 967, 968, 971, 976, 977,\n", + " 979, 982, 984, 985, 986, 988, 991, 997, 999, 1000, 1002,\n", + " 1007, 1008, 1013, 1015, 1021, 1022, 1026, 1028, 1029, 1030, 1034,\n", + " 1042, 1043, 1049, 1054, 1062, 1065, 1074, 1078, 1083, 1094, 1095,\n", + " 1096, 1098, 1105, 1111, 1117, 1120, 1123, 1124, 1135, 1138, 1140,\n", + " 1144, 1152, 1163, 1169, 1176, 1183, 1195, 1197, 1299, 1445]),)\n", + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n", + " 14 15 16 17 18 19 20 21 22 23 24 25 26 27\n", + " 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n", + " 42 43 44 45 46 47 48 49 50 51 52 53 54 55\n", + " 56 57 58 59 60 61 62 63 64 65 66 67 68 69\n", + " 70 71 72 73 74 75 76 77 78 79 80 81 82 83\n", + " 84 85 86 87 88 89 90 91 92 93 94 95 96 97\n", + " 98 99 100 101 102 103 104 105 106 107 108 109 110 111\n", + " 112 113 114 115 116 117 118 119 120 121 122 123 124 125\n", + " 126 127 128 129 130 131 132 133 134 135 136 137 138 139\n", + " 140 141 142 143 144 145 146 147 148 149 150 151 152 153\n", + " 154 155 156 157 158 159 160 161 162 163 164 165 166 167\n", + " 168 169 170 171 172 173 174 175 176 177 178 179 180 181\n", + " 182 183 184 185 186 187 188 189 190 191 192 193 194 195\n", + " 196 197 198 199 200 201 202 203 204 205 206 207 208 209\n", + " 210 211 212 213 214 215 216 217 218 219 220 221 222 223\n", + " 224 225 226 227 228 229 230 231 232 233 234 235 236 237\n", + " 238 239 240 241 242 243 244 245 246 247 248 249 250 251\n", + " 252 253 254 255 256 257 258 259 260 261 262 263 264 265\n", + " 266 267 268 269 270 271 272 273 274 275 276 277 278 279\n", + " 280 281 282 283 284 285 286 287 288 289 290 291 292 293\n", + " 294 295 296 297 298 299 300 301 302 303 304 305 306 307\n", + " 308 309 310 311 312 313 314 315 316 317 318 319 320 321\n", + " 322 323 324 325 326 327 328 329 330 331 332 333 334 335\n", + " 336 337 338 339 340 341 342 343 344 345 346 347 348 349\n", + " 350 351 352 353 354 355 356 357 358 359 360 361 362 363\n", + " 364 365 366 367 368 369 370 371 372 373 374 375 376 377\n", + " 378 379 380 381 382 383 384 385 386 387 388 389 390 391\n", + " 392 393 394 395 396 397 398 399 400 401 402 403 404 405\n", + " 406 407 408 409 410 411 412 413 414 415 416 417 418 419\n", + " 420 421 422 423 424 425 426 427 428 429 430 431 432 433\n", + " 434 435 436 437 438 439 440 441 442 443 444 445 446 447\n", + " 448 449 450 451 452 453 454 455 456 457 458 459 460 461\n", + " 462 463 464 465 466 467 468 469 470 471 472 473 474 475\n", + " 476 477 478 479 480 481 482 483 484 486 487 488 489 490\n", + " 491 492 493 494 495 496 497 498 499 500 501 502 504 505\n", + " 506 507 508 509 510 511 512 513 514 515 516 517 518 519\n", + " 520 521 522 523 524 525 526 527 528 529 530 532 533 534\n", + " 535 536 537 538 539 540 541 542 543 544 545 546 548 549\n", + " 550 551 552 553 554 555 556 557 558 559 560 561 562 563\n", + " 564 565 566 567 568 569 570 571 572 573 574 575 576 577\n", + " 578 579 580 581 582 583 584 585 586 587 588 589 590 591\n", + " 592 593 594 595 596 597 598 599 600 601 602 603 604 605\n", + " 606 607 608 610 611 612 613 614 616 617 618 619 620 621\n", + " 622 623 624 625 626 627 628 629 630 631 632 633 634 635\n", + " 636 637 638 639 640 641 642 643 645 646 647 648 649 650\n", + " 651 652 653 654 655 656 658 659 660 661 662 663 664 665\n", + " 666 667 668 669 670 671 672 673 674 675 676 677 678 679\n", + " 680 681 682 683 684 685 686 687 688 689 690 691 692 693\n", + " 694 695 696 697 698 699 700 701 702 703 704 706 707 708\n", + " 709 710 711 712 713 714 715 716 717 718 719 720 721 722\n", + " 723 725 726 727 728 729 730 731 732 733 734 735 736 737\n", + " 738 739 740 741 742 743 744 745 746 747 748 749 750 751\n", + " 752 753 754 755 756 758 759 760 761 762 763 764 766 768\n", + " 769 770 772 773 774 775 776 779 780 782 783 784 785 786\n", + " 787 788 789 790 791 792 793 795 796 798 800 802 803 804\n", + " 805 806 807 808 809 810 811 813 814 815 816 817 818 819\n", + " 820 822 826 827 828 829 830 831 832 833 835 837 838 839\n", + " 842 844 846 848 849 851 852 853 854 855 856 857 858 859\n", + " 860 861 864 866 867 868 869 870 872 875 877 879 884 887\n", + " 889 890 892 893 895 896 900 902 903 904 905 906 908 909\n", + " 910 911 913 915 917 918 919 920 921 922 923 924 925 928\n", + " 930 932 933 937 940 941 944 945 946 949 952 953 955 958\n", + " 959 960 963 965 967 968 971 976 977 979 982 984 985 986\n", + " 988 991 997 999 1000 1002 1007 1008 1013 1015 1021 1022 1026 1028\n", + " 1029 1030 1034 1042 1043 1049 1054 1062 1065 1074 1078 1083 1094 1095\n", + " 1096 1098 1105 1111 1117 1120 1123 1124 1135 1138 1140 1144 1152 1163\n", + " 1169 1176 1183 1195 1197 1299 1445]\n" + ] + } + ], + "source": [ + "print((np.where(cells.empty()))) # array of list with indices of cells (both dead and alive)\n", + "print((np.where(cells.empty())[0])) # returns the first dimension of the array above -> list up to 1445\n", + "# = take the first element from the tuple of ndarrays returned by np.where()" + ] + }, + { + "cell_type": "code", + "execution_count": 264, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "1\n", + "\n", + "945\n", + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "\n", + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n", + "\n", + "945\n", + "0.9038814166491465\n", + "3.1399356201466135\n" + ] + } + ], + "source": [ + "print(type(np.where(cells.empty())))\n", + "print(len(np.where(cells.empty())))\n", + "print(type(np.where(cells.empty())[0])) # deadcells\n", + "print(len(np.where(cells.empty())[0]))\n", + "print(cells.properties['age'])\n", + "print(type(cells.properties['age']))\n", + "deadcells = np.where(cells.empty())[0]\n", + "print(cells.properties['age'][deadcells]) # age of all the cells\n", + "print(type(cells.properties['age'][deadcells]))\n", + "print(len(cells.properties['age'][deadcells])) # age of deadcells = length of cell cycle\n", + "cell_cycle_lengths = cells.properties['age'][deadcells] # cell cycle lenghts\n", + "print(min(cell_cycle_lengths))\n", + "print(max(cell_cycle_lengths))" + ] + }, + { + "cell_type": "code", + "execution_count": 324, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "2290\n", + "[1. 1. 1. ... 0.98815157 0.98732521 0.98940059]\n", + "[ 609 1101 1171 1186 1409 1413 1416 1434 1437 1439 1450 1460 1462 1477\n", + " 1489 1496 1502 1508 1515 1516 1517 1529 1530 1532 1533 1539 1542 1544\n", + " 1545 1549 1558 1559 1565 1566 1567 1569 1572 1575 1579 1581 1590 1593\n", + " 1595 1599 1600 1602 1605 1606 1609 1611 1613 1614 1615 1620 1623 1626\n", + " 1629 1634 1635 1637 1639 1644 1645 1646 1649 1650 1654 1657 1658 1659\n", + " 1661 1662 1663 1664 1665 1666 1669 1670 1671 1672 1673 1677 1678 1679\n", + " 1680 1681 1682 1684 1686 1690 1691 1692 1693 1694 1695 1696 1697 1698\n", + " 1700 1702 1703 1705 1706 1708 1709 1711 1712 1715 1716 1719 1720 1721\n", + " 1722 1723 1724 1725 1726 1727 1728 1729 1731 1732 1734 1735 1736 1737\n", + " 1738 1739 1741 1742 1743 1744 1745 1747 1748 1749 1750 1751 1752 1753\n", + " 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767\n", + " 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781\n", + " 1782 1783 1784 1785 1786 1788 1789 1790 1791 1792 1793 1794 1795 1797\n", + " 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811\n", + " 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825\n", + " 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839\n", + " 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853\n", + " 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867\n", + " 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881\n", + " 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895\n", + " 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909\n", + " 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923\n", + " 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937\n", + " 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951\n", + " 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965\n", + " 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979\n", + " 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993\n", + " 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007\n", + " 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021\n", + " 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035\n", + " 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049\n", + " 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063\n", + " 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077\n", + " 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091\n", + " 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105\n", + " 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119\n", + " 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133\n", + " 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147\n", + " 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161\n", + " 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175\n", + " 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189\n", + " 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203\n", + " 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217\n", + " 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231\n", + " 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245\n", + " 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259\n", + " 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273\n", + " 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287\n", + " 2288 2289]\n", + "\n", + "674\n", + "[0.27507485 0.32634808 0.36479329 0.36966567 0.3298538 0.36863424\n", + " 0.38981568 0.39971899 0.39155409 0.35382398 0.35629978 0.36618413\n", + " 0.36453336 0.3345184 0.38357383 0.38329241 0.3934211 0.35246068\n", + " 0.33402754 0.38462791 0.34511051 0.3467997 0.3503884 0.35804341\n", + " 0.3822569 0.29190495 0.39712929 0.25368857 0.38839145 0.31136291\n", + " 0.39268951 0.28988279 0.32346867 0.37969086 0.3843704 0.3457614\n", + " 0.32802012 0.30845849 0.39568242 0.22881718 0.31051023 0.39445633\n", + " 0.32739096 0.2956509 0.34049671 0.38018692 0.34458571 0.34612583\n", + " 0.39843217 0.35015896 0.22916001 0.38743318 0.32195265 0.38801403\n", + " 0.24560388 0.37719944 0.36829089 0.26940526 0.31824346 0.38591568\n", + " 0.33805303 0.33990341 0.20130467 0.3718422 0.22891187 0.33123628\n", + " 0.38214629 0.23632022 0.36372377 0.2821754 0.36142599 0.36143238\n", + " 0.36848804 0.374931 0.23075125 0.34173542 0.30869727 0.22693439\n", + " 0.36186094 0.30997681 0.33521751 0.29059686 0.37646209 0.28505736\n", + " 0.35572996 0.27732256 0.31734833 0.34021457 0.32542903 0.32078313\n", + " 0.38934302 0.35644578 0.35874423 0.34210415 0.33663652 0.29862961\n", + " 0.34678968 0.25444136 0.38622909 0.27415182 0.20278139 0.39652051\n", + " 0.34431831 0.33767831 0.32255784 0.30825264 0.30174684 0.30929282\n", + " 0.30087306 0.30939439 0.29650797 0.25360075 0.2693617 0.31498135\n", + " 0.18231819 0.31003718 0.29420267 0.34902154 0.39078276 0.32699485\n", + " 0.37228137 0.17090958 0.24063828 0.28347118 0.3634516 0.25022641\n", + " 0.26816886 0.36005134 0.21301197 0.24010781 0.16451834 0.31758871\n", + " 0.25008686 0.31328882 0.37014873 0.31754461 0.2886183 0.34562783\n", + " 0.33789498 0.33219706 0.36209514 0.37019904 0.17513621 0.30855206\n", + " 0.19406274 0.27730245 0.20958137 0.34623243 0.2906068 0.24789108\n", + " 0.33021914 0.32042803 0.19663485 0.33632733 0.22639061 0.29841583\n", + " 0.36604686 0.30416827 0.34450978 0.39245085 0.39914076 0.26275612\n", + " 0.31420844 0.31489482 0.37796243 0.23705688 0.26288454 0.30436969\n", + " 0.34300716 0.34618628 0.27855521 0.26904222 0.29191475 0.35237724\n", + " 0.36399123 0.34105831 0.28558964 0.20512314 0.3363727 0.3891023\n", + " 0.31742904 0.33645406 0.32553356 0.29511548 0.27405203 0.27957988\n", + " 0.2897189 0.36169603 0.28034985 0.34662764 0.29331355 0.31037442\n", + " 0.31335007 0.28911017 0.39851944 0.22878786 0.36021367 0.37191676\n", + " 0.24778396 0.35083892 0.26720532 0.25845516 0.33741637 0.16894\n", + " 0.32499118 0.19532473 0.22058667 0.25526382 0.34008902 0.26996038\n", + " 0.25110184 0.15933831 0.31302199 0.31157871 0.27786396 0.30350476\n", + " 0.24860865 0.28531776 0.28050897 0.32927304 0.36343334 0.29445707\n", + " 0.36650879 0.2598823 0.31373479 0.24024589 0.25102916 0.2673124\n", + " 0.32140762 0.29106952 0.27785973 0.32988639 0.26401073 0.31528969\n", + " 0.2196844 0.2647984 0.28746416 0.31407052 0.22606254 0.33411767\n", + " 0.25171046 0.21477327 0.2986568 0.35812663 0.3154566 0.1321756\n", + " 0.31540073 0.36982381 0.32688413 0.19361488 0.15209431 0.35256176\n", + " 0.25852386 0.17432857 0.24608667 0.18365395 0.27177357 0.16568748\n", + " 0.14676997 0.29236768 0.2585451 0.2370383 0.30441073 0.20409349\n", + " 0.30949233 0.21761768 0.36494235 0.14609741 0.23260368 0.24068986\n", + " 0.14420949 0.25460502 0.23346684 0.25595801 0.30767354 0.18848665\n", + " 0.19431965 0.20005977 0.15942812 0.27812323 0.24380461 0.26672322\n", + " 0.23763047 0.23436293 0.17064327 0.23925039 0.19504362 0.16283743\n", + " 0.33785325 0.11852507 0.27515353 0.25197752 0.19865398 0.32427387\n", + " 0.22271876 0.15782291 0.22674305 0.2209183 0.24897319 0.21040403\n", + " 0.28867542 0.24332805 0.22099288 0.20157004 0.17637416 0.13367296\n", + " 0.28712284 0.26980168 0.25480982 0.2525332 0.20453044 0.23303212\n", + " 0.18544269 0.1262869 0.2311203 0.21095655 0.13427623 0.14825133\n", + " 0.1851296 0.2240715 0.18135415 0.2374447 0.26391586 0.24520094\n", + " 0.19936544 0.23928403 0.17621185 0.21138798 0.1714516 0.14451181\n", + " 0.20304702 0.16720894 0.11128549 0.12342179 0.20042446 0.22050152\n", + " 0.23255362 0.15957409 0.178853 0.24336334 0.18638234 0.16320659\n", + " 0.17486458 0.19684502 0.1878484 0.29028298 0.22354555 0.12801\n", + " 0.20724888 0.16984704 0.27065948 0.21393514 0.14708808 0.15832582\n", + " 0.21143929 0.18278027 0.21549379 0.14252754 0.17673557 0.16610907\n", + " 0.15522181 0.19275825 0.15953912 0.13378182 0.2239515 0.24140036\n", + " 0.16066688 0.18534023 0.18225995 0.13627516 0.17535759 0.14004639\n", + " 0.16433421 0.10829191 0.17354218 0.16916823 0.12544862 0.15470538\n", + " 0.16733104 0.17140804 0.12765164 0.20969706 0.16081282 0.11965094\n", + " 0.13639809 0.12431362 0.17133518 0.12869063 0.1877851 0.13101397\n", + " 0.16983851 0.13626966 0.15149298 0.12163627 0.13187609 0.14188461\n", + " 0.11849658 0.1912544 0.12295395 0.16791384 0.16485884 0.16367117\n", + " 0.19418568 0.12809467 0.19039847 0.08397739 0.13168879 0.07751311\n", + " 0.18488557 0.14629888 0.14864885 0.09208947 0.15926318 0.1481686\n", + " 0.1528102 0.20774806 0.14646004 0.12798614 0.11162776 0.09333624\n", + " 0.15736335 0.15160006 0.14688373 0.12354459 0.1056778 0.16094178\n", + " 0.08872422 0.16601335 0.16335997 0.11639472 0.08528807 0.12994309\n", + " 0.1787022 0.16750493 0.15858929 0.16146801 0.11883934 0.17731331\n", + " 0.1017936 0.16756136 0.17025127 0.10080344 0.11038031 0.11202349\n", + " 0.10400799 0.11586304 0.11478402 0.103487 0.1441356 0.09877421\n", + " 0.11658555 0.12048134 0.12728891 0.13855749 0.11184019 0.12455317\n", + " 0.11014508 0.09877301 0.12048464 0.09450232 0.10859748 0.13658568\n", + " 0.08206561 0.10297034 0.14163527 0.09670097 0.0828804 0.11411406\n", + " 0.10530234 0.11962397 0.11118944 0.09570904 0.09316501 0.08247491\n", + " 0.13725772 0.09328402 0.10813783 0.1054955 0.09863445 0.12126109\n", + " 0.07683497 0.1230234 0.09965356 0.08300049 0.09057839 0.06486102\n", + " 0.09237685 0.10880456 0.07536213 0.09910248 0.11390867 0.12114133\n", + " 0.13135206 0.11898628 0.09539656 0.07716468 0.11203112 0.11085351\n", + " 0.06855003 0.08322042 0.06629175 0.11139433 0.08916176 0.09730246\n", + " 0.04573674 0.10462004 0.1039188 0.10223585 0.09087662 0.07745381\n", + " 0.07992557 0.07063628 0.08160766 0.08747338 0.08652499 0.08047762\n", + " 0.07248412 0.06046589 0.09637276 0.09486968 0.06044758 0.09681456\n", + " 0.09013573 0.0697879 0.09431376 0.08712534 0.08568985 0.07818021\n", + " 0.08394492 0.08884556 0.07001691 0.08791231 0.06283723 0.07172767\n", + " 0.07870283 0.06365503 0.06780927 0.05146621 0.05389296 0.07611799\n", + " 0.0881995 0.07118621 0.08219562 0.04143611 0.07698686 0.07094164\n", + " 0.05340964 0.08028647 0.07777439 0.07022081 0.04998748 0.08082805\n", + " 0.07966655 0.05848425 0.06579435 0.08222389 0.06064832 0.06956484\n", + " 0.06438981 0.04858499 0.05954675 0.08677043 0.07028887 0.06278704\n", + " 0.0637738 0.05318376 0.05160562 0.03522411 0.03835095 0.05039851\n", + " 0.05977831 0.0574864 0.04916415 0.05872324 0.04175034 0.06183115\n", + " 0.0314742 0.05373084 0.03143355 0.04570845 0.04159614 0.05049678\n", + " 0.04255133 0.02979028 0.04215304 0.03941879 0.04819666 0.03936482\n", + " 0.02143645 0.04340395 0.0477597 0.04337677 0.03714704 0.0267654\n", + " 0.02766563 0.03618362 0.03856688 0.03444501 0.03604569 0.02750404\n", + " 0.02722625 0.03156114 0.03288378 0.03162399 0.03677413 0.0252794\n", + " 0.02851775 0.03170035 0.01898705 0.02155805 0.03033238 0.03175147\n", + " 0.02570288 0.01995876 0.01821526 0.02125357 0.02394908 0.01835626\n", + " 0.02932881 0.02031618 0.02209903 0.02802877 0.02689228 0.02752586\n", + " 0.024422 0.02585882 0.02804595 0.01774791 0.01625897 0.01641527\n", + " 0.01764849 0.0141256 0.01806682 0.0211881 0.01489747 0.01534379\n", + " 0.01881593 0.01567713 0.01391472 0.01942991 0.00926461 0.02037508\n", + " 0.01326585 0.01333529 0.01697402 0.01313462 0.00796651 0.00899021\n", + " 0.01345362 0.01441229 0.01420017 0.01440912 0.01150357 0.01425772\n", + " 0.0113467 0.00880243 0.00801116 0.00902487 0.00722425 0.00736783\n", + " 0.00544564 0.00581654 0.00584187 0.00682445 0.00545508 0.00524607\n", + " 0.00545983 0.00477358 0.00609707 0.00504779 0.00386095 0.00473937\n", + " 0.00506991 0.00423976]\n", + "[3.12312886e-01 1.84129795e-01 8.80167713e-02 7.58358271e-02\n", + " 1.75365498e-01 7.84144109e-02 2.54607878e-02 7.02531024e-04\n", + " 2.11147829e-02 1.15440046e-01 1.09250554e-01 8.45396763e-02\n", + " 8.86666021e-02 1.63703991e-01 4.10654292e-02 4.17689769e-02\n", + " 1.64472398e-02 1.18848310e-01 1.64931149e-01 3.84302288e-02\n", + " 1.37223724e-01 1.33000746e-01 1.24028992e-01 1.04891475e-01\n", + " 4.43577441e-02 2.70237629e-01 7.17676267e-03 3.65778570e-01\n", + " 2.90213823e-02 2.21592718e-01 1.82762146e-02 2.75293024e-01\n", + " 1.91328336e-01 5.07728414e-02 3.90740040e-02 1.35596500e-01\n", + " 1.79949706e-01 2.28853770e-01 1.07939448e-02 4.27957055e-01\n", + " 2.23724414e-01 1.38591691e-02 1.81522603e-01 2.60872746e-01\n", + " 1.48758215e-01 4.95327047e-02 1.38535720e-01 1.34685424e-01\n", + " 3.91958063e-03 1.24602608e-01 4.27099966e-01 3.14170473e-02\n", + " 1.95118382e-01 2.99649170e-02 3.85990293e-01 5.70013939e-02\n", + " 7.92727707e-02 3.26486848e-01 2.04391349e-01 3.52107950e-02\n", + " 1.54867422e-01 1.50241468e-01 4.96738324e-01 7.03945049e-02\n", + " 4.27720328e-01 1.71909288e-01 4.46342743e-02 4.09199459e-01\n", + " 9.06905824e-02 2.94561506e-01 9.64350128e-02 9.64190532e-02\n", + " 7.87799088e-02 6.26724900e-02 4.23121872e-01 1.45661450e-01\n", + " 2.28256827e-01 4.32664020e-01 9.53476385e-02 2.25057986e-01\n", + " 1.61956235e-01 2.73507855e-01 5.88447676e-02 2.87356597e-01\n", + " 1.10675104e-01 3.06693608e-01 2.06629181e-01 1.49463577e-01\n", + " 1.86427420e-01 1.98042167e-01 2.66424527e-02 1.08885543e-01\n", + " 1.03139436e-01 1.44739634e-01 1.58408710e-01 2.53425976e-01\n", + " 1.33025812e-01 3.63896597e-01 3.44272792e-02 3.14620460e-01\n", + " 4.93046521e-01 8.69872787e-03 1.39204220e-01 1.55804236e-01\n", + " 1.93605401e-01 2.29368390e-01 2.45632890e-01 2.26767938e-01\n", + " 2.47817342e-01 2.26514016e-01 2.58730071e-01 3.65998127e-01\n", + " 3.26595758e-01 2.12546617e-01 5.44204530e-01 2.24907040e-01\n", + " 2.64493321e-01 1.27446161e-01 2.30431091e-02 1.82512870e-01\n", + " 6.92965731e-02 5.72726049e-01 3.98404297e-01 2.91322057e-01\n", + " 9.13709974e-02 3.74433979e-01 3.29577862e-01 9.98716464e-02\n", + " 4.67470072e-01 3.99730482e-01 5.88704152e-01 2.06028234e-01\n", + " 3.74782850e-01 2.16777953e-01 7.46281734e-02 2.06138481e-01\n", + " 2.78454244e-01 1.35930418e-01 1.55262553e-01 1.69507354e-01\n", + " 9.47621402e-02 7.45024064e-02 5.62159469e-01 2.28619846e-01\n", + " 5.14843154e-01 3.06743866e-01 4.76046570e-01 1.34418932e-01\n", + " 2.73482993e-01 3.80272301e-01 1.74452140e-01 1.98929928e-01\n", + " 5.08412884e-01 1.59181682e-01 4.34023484e-01 2.53960436e-01\n", + " 8.48828605e-02 2.39579316e-01 1.38725539e-01 1.88728747e-02\n", + " 2.14809961e-03 3.43109703e-01 2.14478897e-01 2.12762957e-01\n", + " 5.50939290e-02 4.07357812e-01 3.42788641e-01 2.39075778e-01\n", + " 1.42482101e-01 1.34534306e-01 3.03611977e-01 3.27394442e-01\n", + " 2.70213117e-01 1.19056900e-01 9.00219230e-02 1.47354218e-01\n", + " 2.86025888e-01 4.87192151e-01 1.59068256e-01 2.72442560e-02\n", + " 2.06427411e-01 1.58864859e-01 1.86166106e-01 2.62211293e-01\n", + " 3.14869927e-01 3.01050303e-01 2.75702760e-01 9.57599347e-02\n", + " 2.99125368e-01 1.33430911e-01 2.66716135e-01 2.24063962e-01\n", + " 2.16624818e-01 2.77224563e-01 3.70140531e-03 4.28030348e-01\n", + " 9.94658160e-02 7.02080908e-02 3.80540094e-01 1.22902692e-01\n", + " 3.31986709e-01 3.53862102e-01 1.56459073e-01 5.77649996e-01\n", + " 1.87522061e-01 5.11688168e-01 4.48533327e-01 3.61840443e-01\n", + " 1.49777457e-01 3.25099061e-01 3.72245390e-01 6.01654227e-01\n", + " 2.17445016e-01 2.21053216e-01 3.05340111e-01 2.41238105e-01\n", + " 3.78478378e-01 2.86705606e-01 2.98727563e-01 1.76817400e-01\n", + " 9.14166466e-02 2.63857331e-01 8.37280263e-02 3.50294249e-01\n", + " 2.15663021e-01 3.99385276e-01 3.72427111e-01 3.31719000e-01\n", + " 1.96480946e-01 2.72326199e-01 3.05350682e-01 1.75284026e-01\n", + " 3.39973180e-01 2.11775767e-01 4.50788995e-01 3.38004011e-01\n", + " 2.81339611e-01 2.14823702e-01 4.34843641e-01 1.64705835e-01\n", + " 3.70723846e-01 4.63066830e-01 2.53357995e-01 1.04683419e-01\n", + " 2.11358489e-01 6.69560996e-01 2.11498185e-01 7.54404792e-02\n", + " 1.82789684e-01 5.15962799e-01 6.19764225e-01 1.18595611e-01\n", + " 3.53690341e-01 5.64178565e-01 3.84783323e-01 5.40865132e-01\n", + " 3.20566070e-01 5.85781311e-01 6.33075070e-01 2.69080810e-01\n", + " 3.53637255e-01 4.07404245e-01 2.38973177e-01 4.89766271e-01\n", + " 2.26269164e-01 4.55955793e-01 8.76441352e-02 6.34756486e-01\n", + " 4.18490812e-01 3.98275345e-01 6.39476264e-01 3.63487457e-01\n", + " 4.16332906e-01 3.60104985e-01 2.30816148e-01 5.28783369e-01\n", + " 5.14200873e-01 4.99850566e-01 6.01429710e-01 3.04691926e-01\n", + " 3.90488469e-01 3.33191941e-01 4.05923832e-01 4.14092682e-01\n", + " 5.73391815e-01 4.01874017e-01 5.12390949e-01 5.92906415e-01\n", + " 1.55366882e-01 7.03687334e-01 3.12116177e-01 3.70056204e-01\n", + " 5.03365039e-01 1.89315318e-01 4.43203090e-01 6.05442713e-01\n", + " 4.33142384e-01 4.47704262e-01 3.77567035e-01 4.73989923e-01\n", + " 2.78311444e-01 3.91679886e-01 4.47517801e-01 4.96074888e-01\n", + " 5.59064606e-01 6.65817597e-01 2.82192896e-01 3.25495809e-01\n", + " 3.62975439e-01 3.68667000e-01 4.88673889e-01 4.17419690e-01\n", + " 5.36393270e-01 6.84282739e-01 4.22199257e-01 4.72608621e-01\n", + " 6.64309420e-01 6.29371687e-01 5.37176000e-01 4.39821257e-01\n", + " 5.46614636e-01 4.06388253e-01 3.40210355e-01 3.86997646e-01\n", + " 5.01586388e-01 4.01789921e-01 5.59470385e-01 4.71530045e-01\n", + " 5.71370993e-01 6.38720484e-01 4.92382445e-01 5.81977640e-01\n", + " 7.21786279e-01 6.91445533e-01 4.98938850e-01 4.48746191e-01\n", + " 4.18615953e-01 6.01064786e-01 5.52867512e-01 3.91591640e-01\n", + " 5.34044159e-01 5.91983515e-01 5.62838557e-01 5.07887439e-01\n", + " 5.30378997e-01 2.74292561e-01 4.41136124e-01 6.79975009e-01\n", + " 4.81877803e-01 5.75382398e-01 3.23351289e-01 4.65162161e-01\n", + " 6.32279805e-01 6.04185439e-01 4.71401770e-01 5.43049332e-01\n", + " 4.61265534e-01 6.43681162e-01 5.58161086e-01 5.84727317e-01\n", + " 6.11945480e-01 5.18104369e-01 6.01152206e-01 6.65545460e-01\n", + " 4.40121257e-01 3.96499109e-01 5.98332806e-01 5.36649434e-01\n", + " 5.44350113e-01 6.59312088e-01 5.61606028e-01 6.49884020e-01\n", + " 5.89164463e-01 7.29270224e-01 5.66144544e-01 5.77079428e-01\n", + " 6.86378446e-01 6.13236547e-01 5.81672397e-01 5.71479907e-01\n", + " 6.80870907e-01 4.75757344e-01 5.97967944e-01 7.00872639e-01\n", + " 6.59004771e-01 6.89215943e-01 5.71662061e-01 6.78273429e-01\n", + " 5.30537247e-01 6.72465068e-01 5.75403719e-01 6.59325862e-01\n", + " 6.21267547e-01 6.95909326e-01 6.70309764e-01 6.45288476e-01\n", + " 7.03758543e-01 5.21864000e-01 6.92615136e-01 5.80215398e-01\n", + " 5.87852899e-01 5.90822075e-01 5.14535792e-01 6.79763337e-01\n", + " 5.24003831e-01 7.90056537e-01 6.70778024e-01 8.06217233e-01\n", + " 5.37786078e-01 6.34252811e-01 6.28377875e-01 7.69776331e-01\n", + " 6.01842049e-01 6.29578506e-01 6.17974504e-01 4.80629852e-01\n", + " 6.33849891e-01 6.80034643e-01 7.20930589e-01 7.66659395e-01\n", + " 6.06591629e-01 6.20999850e-01 6.32790668e-01 6.91138533e-01\n", + " 7.35805493e-01 5.97645562e-01 7.78189461e-01 5.84966623e-01\n", + " 5.91600079e-01 7.09013196e-01 7.86779835e-01 6.75142287e-01\n", + " 5.53244488e-01 5.81237668e-01 6.03526774e-01 5.96329978e-01\n", + " 7.02901661e-01 5.56716724e-01 7.45516005e-01 5.81096610e-01\n", + " 5.74371814e-01 7.47991399e-01 7.24049217e-01 7.19941266e-01\n", + " 7.39980026e-01 7.10342397e-01 7.13039959e-01 7.41282510e-01\n", + " 6.39661009e-01 7.53064465e-01 7.08536133e-01 6.98796647e-01\n", + " 6.81777736e-01 6.53606279e-01 7.20399527e-01 6.88617078e-01\n", + " 7.24637304e-01 7.53067484e-01 6.98788396e-01 7.63744192e-01\n", + " 7.28506298e-01 6.58535795e-01 7.94835963e-01 7.42574138e-01\n", + " 6.45911817e-01 7.58247570e-01 7.92798988e-01 7.14714851e-01\n", + " 7.36744149e-01 7.00940065e-01 7.22026388e-01 7.60727388e-01\n", + " 7.67087464e-01 7.93812728e-01 6.56855692e-01 7.66789954e-01\n", + " 7.29655423e-01 7.36261257e-01 7.53413887e-01 6.96847272e-01\n", + " 8.07912586e-01 6.92441497e-01 7.50866089e-01 7.92498766e-01\n", + " 7.73554033e-01 8.37847461e-01 7.69057880e-01 7.27988600e-01\n", + " 8.11594668e-01 7.52243797e-01 7.15228320e-01 6.97146668e-01\n", + " 6.71619840e-01 7.02534299e-01 7.61508611e-01 8.07088288e-01\n", + " 7.19922191e-01 7.22866236e-01 8.28624930e-01 7.91948955e-01\n", + " 8.34270620e-01 7.21514185e-01 7.77095594e-01 7.56743852e-01\n", + " 8.85658141e-01 7.38449899e-01 7.40203002e-01 7.44410369e-01\n", + " 7.72808449e-01 8.06365472e-01 8.00186069e-01 8.23409308e-01\n", + " 7.95980841e-01 7.81316553e-01 7.83687521e-01 7.98805960e-01\n", + " 8.18789711e-01 8.48835268e-01 7.59068101e-01 7.62825800e-01\n", + " 8.48881054e-01 7.57963612e-01 7.74660682e-01 8.25530240e-01\n", + " 7.64215602e-01 7.82186646e-01 7.85775380e-01 8.04549472e-01\n", + " 7.90137705e-01 7.77886100e-01 8.24957730e-01 7.80219236e-01\n", + " 8.42906933e-01 8.20680813e-01 8.03242930e-01 8.40862428e-01\n", + " 8.30476813e-01 8.71334464e-01 8.65267596e-01 8.09705016e-01\n", + " 7.79501252e-01 8.22034486e-01 7.94510945e-01 8.96409729e-01\n", + " 8.07532841e-01 8.22645893e-01 8.66475888e-01 7.99283822e-01\n", + " 8.05564036e-01 8.24447972e-01 8.75031289e-01 7.97929867e-01\n", + " 8.00833614e-01 8.53789383e-01 8.35514119e-01 7.94440273e-01\n", + " 8.48379210e-01 8.26087907e-01 8.39025485e-01 8.78537523e-01\n", + " 8.51133120e-01 7.83073925e-01 8.24277834e-01 8.43032392e-01\n", + " 8.40565489e-01 8.67040612e-01 8.70985956e-01 9.11939714e-01\n", + " 9.04122632e-01 8.74003727e-01 8.50554235e-01 8.56284012e-01\n", + " 8.77089622e-01 8.53191904e-01 8.95624156e-01 8.45422126e-01\n", + " 9.21314493e-01 8.65672906e-01 9.21416117e-01 8.85728882e-01\n", + " 8.96009661e-01 8.73758050e-01 8.93621686e-01 9.25524309e-01\n", + " 8.94617400e-01 9.01453013e-01 8.79508346e-01 9.01587941e-01\n", + " 9.46408867e-01 8.91490127e-01 8.80600748e-01 8.91558080e-01\n", + " 9.07132395e-01 9.33086500e-01 9.30835923e-01 9.09540958e-01\n", + " 9.03582805e-01 9.13887477e-01 9.09885764e-01 9.31239892e-01\n", + " 9.31934379e-01 9.21097143e-01 9.17790549e-01 9.20940018e-01\n", + " 9.08064673e-01 9.36801489e-01 9.28705628e-01 9.20749119e-01\n", + " 9.52532377e-01 9.46104882e-01 9.24169059e-01 9.20621328e-01\n", + " 9.35742798e-01 9.50103090e-01 9.54461843e-01 9.46866064e-01\n", + " 9.40127301e-01 9.54109348e-01 9.26677975e-01 9.49209544e-01\n", + " 9.44752432e-01 9.29928086e-01 9.32769294e-01 9.31185354e-01\n", + " 9.38945007e-01 9.35352960e-01 9.29885128e-01 9.55630226e-01\n", + " 9.59352574e-01 9.58961836e-01 9.55878779e-01 9.64685992e-01\n", + " 9.54832941e-01 9.47029745e-01 9.62756333e-01 9.61640515e-01\n", + " 9.52960179e-01 9.60807185e-01 9.65213205e-01 9.51425233e-01\n", + " 9.76838465e-01 9.49062309e-01 9.66835363e-01 9.66661785e-01\n", + " 9.57564942e-01 9.67163455e-01 9.80083730e-01 9.77524471e-01\n", + " 9.66365951e-01 9.63969268e-01 9.64499582e-01 9.63977189e-01\n", + " 9.71241072e-01 9.64355711e-01 9.71633251e-01 9.77993928e-01\n", + " 9.79972100e-01 9.77437835e-01 9.81939380e-01 9.81580420e-01\n", + " 9.86385900e-01 9.85458640e-01 9.85395334e-01 9.82938877e-01\n", + " 9.86362289e-01 9.86884824e-01 9.86350419e-01 9.88066060e-01\n", + " 9.84757327e-01 9.87380532e-01 9.90347617e-01 9.88151573e-01\n", + " 9.87325214e-01 9.89400589e-01]\n", + "0.9903476166323606\n" + ] + } + ], + "source": [ + "print(properties['age'])\n", + "print(len(properties['age'])) # ages of all cells: dead & alive\n", + "print(properties['zposn']) # nuclei position for all cells\n", + "zt = properties['zposn']\n", + "z0 = np.zeros_like(zt) # Return an array of zeros with the same shape and type as the nucl position array (all cells).\n", + "# G1\n", + "t_G1 = 0.4\n", + "G1_cells = np.where(properties['age'] <= t_G1)[0] # array with indices of G1 cells\n", + "print(G1_cells)\n", + "print(type(G1_cells))\n", + "print(len(G1_cells)) # 674 cells are in G1\n", + "G1_cells_ages = properties['age'][G1_cells]\n", + "print(G1_cells_ages)\n", + "z0[G1_cells] = 1-1.0/t_G1*G1_cells_ages\n", + "print((z0[G1_cells]))\n", + "print(max((z0[G1_cells])))\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 327, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 615 767 794 797 823 825 836 840 843 850 862 873 881 885\n", + " 888 891 897 899 926 935 936 950 956 969 970 972 973 975\n", + " 978 998 1003 1004 1009 1010 1014 1016 1025 1033 1036 1041 1047 1050\n", + " 1052 1056 1057 1059 1060 1066 1067 1070 1071 1073 1075 1077 1081 1082\n", + " 1087 1089 1090 1097 1102 1107 1108 1109 1114 1115 1116 1118 1126 1127\n", + " 1128 1129 1130 1132 1133 1134 1136 1141 1145 1146 1147 1149 1153 1155\n", + " 1160 1161 1162 1166 1167 1174 1177 1178 1179 1182 1184 1185 1188 1189\n", + " 1190 1191 1192 1193 1196 1198 1200 1201 1203 1204 1206 1207 1208 1209\n", + " 1212 1213 1214 1215 1216 1217 1218 1219 1220 1222 1223 1224 1225 1229\n", + " 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1241 1242 1243 1244\n", + " 1245 1248 1249 1250 1251 1252 1253 1255 1256 1257 1258 1259 1260 1261\n", + " 1262 1265 1266 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278\n", + " 1280 1281 1282 1283 1284 1285 1288 1289 1290 1291 1292 1295 1296 1297\n", + " 1298 1300 1301 1302 1304 1305 1306 1308 1310 1311 1312 1313 1314 1315\n", + " 1316 1317 1318 1319 1320 1321 1322 1323 1324 1326 1327 1328 1330 1331\n", + " 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1346\n", + " 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1361\n", + " 1362 1363 1364 1365 1367 1368 1369 1370 1371 1372 1373 1374 1375 1377\n", + " 1378 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392\n", + " 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406\n", + " 1407 1408 1410 1411 1412 1414 1415 1417 1418 1419 1420 1421 1422 1424\n", + " 1425 1426 1427 1428 1429 1430 1431 1432 1433 1435 1436 1438 1441 1442\n", + " 1443 1444 1446 1447 1448 1449 1451 1452 1453 1454 1455 1456 1457 1458\n", + " 1459 1461 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474\n", + " 1475 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1490 1491\n", + " 1492 1493 1494 1495 1497 1498 1499 1500 1501 1503 1504 1505 1506 1507\n", + " 1509 1510 1511 1512 1513 1514 1518 1519 1520 1521 1522 1523 1524 1525\n", + " 1526 1527 1528 1531 1534 1535 1536 1537 1538 1540 1541 1543 1546 1547\n", + " 1548 1550 1551 1552 1553 1554 1555 1556 1557 1560 1561 1562 1563 1564\n", + " 1568 1570 1571 1573 1574 1576 1577 1578 1580 1582 1583 1584 1585 1586\n", + " 1587 1588 1589 1591 1592 1594 1596 1597 1598 1601 1603 1604 1607 1608\n", + " 1610 1612 1616 1617 1618 1619 1621 1622 1624 1625 1627 1628 1630 1631\n", + " 1632 1633 1636 1638 1640 1641 1642 1643 1647 1648 1651 1652 1653 1655\n", + " 1656 1660 1667 1668 1674 1675 1676 1683 1685 1687 1688 1689 1699 1701\n", + " 1704 1707 1710 1713 1714 1717 1718 1730 1733 1740 1746 1787 1796]\n", + "\n", + "489\n", + "[0.64157361 0.65491811 0.41801418 0.68959252 0.49639229 0.63936217\n", + " 0.55910522 0.586693 0.63933327 0.70388555 0.52106527 0.67126684\n", + " 0.61647237 0.70463219 0.69183245 0.68445778 0.6489377 0.65001309\n", + " 0.70632512 0.71323456 0.51008442 0.56062304 0.69724646 0.61254586\n", + " 0.67811768 0.63970152 0.62671322 0.48118841 0.61081102 0.72464076\n", + " 0.65372371 0.66248867 0.52704712 0.7081486 0.61067973 0.60044476\n", + " 0.73327949 0.58065592 0.65710186 0.69311208 0.64471483 0.65104744\n", + " 0.5504001 0.6910737 0.65535844 0.7312306 0.63916483 0.54037477\n", + " 0.73155877 0.71348703 0.59106339 0.67204563 0.72476224 0.62877579\n", + " 0.66659493 0.67802069 0.62054771 0.66375947 0.70290508 0.68545518\n", + " 0.65099407 0.40843607 0.51289796 0.68052596 0.57412916 0.65625465\n", + " 0.63386932 0.64972225 0.70223209 0.71383394 0.63374535 0.6441953\n", + " 0.52224674 0.70655674 0.73241971 0.6239582 0.70625914 0.57104005\n", + " 0.59361139 0.62922427 0.5694332 0.71948007 0.73030373 0.54530872\n", + " 0.52988486 0.60884503 0.48105886 0.70733541 0.61750601 0.71624355\n", + " 0.73279592 0.71338867 0.73053115 0.40279438 0.71245826 0.55081207\n", + " 0.48135141 0.64958218 0.62262795 0.40727384 0.53841003 0.6023118\n", + " 0.59789139 0.57982195 0.57157939 0.64499238 0.73200756 0.61563812\n", + " 0.72897554 0.59165066 0.63724701 0.70879992 0.47534123 0.62395296\n", + " 0.66851555 0.64996851 0.61472163 0.52251732 0.50611525 0.54538742\n", + " 0.60330192 0.68909017 0.56559467 0.45736694 0.54429134 0.6198984\n", + " 0.65870911 0.72598965 0.6711842 0.64589289 0.64251744 0.67157181\n", + " 0.72798859 0.66419558 0.46610816 0.64296526 0.5429461 0.65793378\n", + " 0.71046293 0.67316972 0.68842301 0.59619167 0.68572971 0.72846281\n", + " 0.71034881 0.67846015 0.66298242 0.64656092 0.5809042 0.63017954\n", + " 0.58109001 0.42165972 0.4811979 0.64885034 0.61928588 0.70004535\n", + " 0.63830708 0.60702527 0.69093695 0.71630033 0.59546581 0.65786177\n", + " 0.70728129 0.5805037 0.6223076 0.55602069 0.59202277 0.52543244\n", + " 0.59085546 0.63829755 0.59283289 0.54557557 0.68209082 0.65163608\n", + " 0.71607632 0.57171332 0.59849291 0.66462129 0.61557157 0.56217237\n", + " 0.6307263 0.63675021 0.64142258 0.57818462 0.56239586 0.61674848\n", + " 0.4977424 0.61359711 0.64817978 0.53066583 0.71020324 0.60904467\n", + " 0.52680677 0.58291482 0.53026002 0.58787992 0.62962954 0.66990019\n", + " 0.69245025 0.71999744 0.620965 0.71701571 0.57700372 0.60952981\n", + " 0.62009741 0.53029047 0.56652652 0.6773378 0.55996372 0.64656006\n", + " 0.63206428 0.6540212 0.56641032 0.66312805 0.50737934 0.68638448\n", + " 0.57321374 0.43854311 0.72545405 0.45094224 0.53781127 0.42090587\n", + " 0.66409626 0.48948869 0.54036662 0.68751399 0.59109035 0.5165423\n", + " 0.46335106 0.53945223 0.59943671 0.47012878 0.40117567 0.6091697\n", + " 0.61452748 0.53673484 0.70828835 0.6432291 0.5847587 0.54050628\n", + " 0.50567587 0.60216736 0.59904018 0.57671619 0.72557384 0.7019895\n", + " 0.68039466 0.49238469 0.48038667 0.60270654 0.60491563 0.66526348\n", + " 0.49780421 0.57333072 0.54312235 0.69134596 0.61139929 0.69364436\n", + " 0.62437134 0.49149508 0.53378429 0.60015689 0.60240739 0.55366172\n", + " 0.56929644 0.54385027 0.62290503 0.53933917 0.52347534 0.51962715\n", + " 0.71407567 0.5718649 0.66161948 0.59806726 0.66818359 0.56516576\n", + " 0.51264332 0.57661897 0.54974964 0.5833369 0.48550926 0.47839636\n", + " 0.62578715 0.48432571 0.41791854 0.45120535 0.72305495 0.64317898\n", + " 0.61921408 0.54009816 0.50405943 0.61031122 0.51428604 0.65107774\n", + " 0.45634068 0.51491099 0.54363172 0.50979736 0.53561169 0.41093875\n", + " 0.51086893 0.64822512 0.65222833 0.58386474 0.44818663 0.72712454\n", + " 0.64013684 0.55948713 0.49525375 0.56889011 0.45707875 0.60572589\n", + " 0.52112289 0.50860086 0.66021002 0.54403257 0.59089118 0.5025572\n", + " 0.64220697 0.51990217 0.5277887 0.47586873 0.53154907 0.66718594\n", + " 0.61461014 0.57194755 0.52621507 0.43894311 0.6735714 0.50237919\n", + " 0.60579838 0.55898339 0.54221184 0.54332144 0.43564715 0.48317643\n", + " 0.59151559 0.49717159 0.42539352 0.47672573 0.44020729 0.44133066\n", + " 0.59327228 0.59425881 0.5604871 0.40771564 0.4540139 0.61698284\n", + " 0.51225501 0.59011075 0.51258955 0.67690058 0.48352239 0.50049437\n", + " 0.52133525 0.55635466 0.50675487 0.46092059 0.4368103 0.57280962\n", + " 0.51077845 0.65543689 0.5741646 0.40612087 0.41957489 0.59570865\n", + " 0.53787294 0.46327724 0.56371404 0.4786888 0.50440314 0.47434323\n", + " 0.73211992 0.56363612 0.4349859 0.48328523 0.41816252 0.40493663\n", + " 0.56606117 0.44578127 0.44743403 0.41574492 0.50876731 0.61999593\n", + " 0.42712775 0.57460968 0.46366478 0.55830078 0.45453358 0.49267633\n", + " 0.43392311 0.47926951 0.40830024 0.46884177 0.56097121 0.49402874\n", + " 0.44756177 0.43830587 0.49432922 0.48203058 0.69960473 0.59031056\n", + " 0.40262995 0.46208044 0.42624395 0.40440125 0.44861967 0.48370675\n", + " 0.49687656 0.47137563 0.4208225 0.46431989 0.40338142 0.45137471\n", + " 0.40528925 0.48654929 0.52594616 0.42752294 0.46608097 0.49982583\n", + " 0.47474779 0.59867938 0.64487241 0.43300995 0.41248015 0.44662595\n", + " 0.4083111 0.46890053 0.43326265 0.48760209 0.47161883 0.43644639\n", + " 0.40688056 0.48265327 0.57705047 0.42594954 0.4287506 0.44853951\n", + " 0.51840912 0.47042074 0.46208992 0.46558858 0.4337064 0.50226599\n", + " 0.45104209 0.4470574 0.42291391 0.49383839 0.46781948 0.47615685\n", + " 0.43879399 0.54647011 0.51160176 0.49771417 0.43074936 0.52318615\n", + " 0.43716879 0.42828944 0.41026915 0.44857098 0.44639464 0.47814469\n", + " 0.53687999 0.53628365 0.49038061 0.43217923 0.47035978 0.47336243\n", + " 0.4329382 0.4097164 0.47372478 0.47661498 0.52997761 0.41356427\n", + " 0.43043039 0.46092853 0.42734881 0.40780353 0.41206249 0.41103665\n", + " 0.40475425 0.44149503 0.50805282 0.40657365 0.43051399 0.48507318\n", + " 0.4231975 0.40301852 0.41184107]\n" + ] + } + ], + "source": [ + "# S\n", + "S_cells = np.where((t_G1 < properties['age']) & (properties['age'] <= t_G1+t_S))[0] # array with indices of S cells\n", + "print(S_cells)\n", + "print(type(S_cells))\n", + "print(len(S_cells)) # 489 cells are in S\n", + "S_cells_ages = properties['age'][S_cells]\n", + "print(S_cells_ages)\n", + "z0[S_cells] = 0.0 # positions of S cells\n" + ] + }, + { + "cell_type": "code", + "execution_count": 330, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 485 503 531 547 644 657 705 724 757 765 771 777 778 781\n", + " 799 801 812 821 824 834 841 845 847 863 865 871 874 876\n", + " 878 880 882 883 886 894 898 901 907 912 914 916 927 929\n", + " 931 934 938 939 942 943 947 948 951 954 957 961 962 964\n", + " 966 974 980 981 983 987 989 990 992 993 994 995 996 1001\n", + " 1005 1006 1011 1012 1017 1018 1019 1020 1023 1024 1027 1031 1032 1035\n", + " 1037 1038 1039 1040 1044 1045 1046 1048 1051 1053 1055 1058 1061 1063\n", + " 1064 1068 1069 1072 1076 1079 1080 1084 1085 1086 1088 1091 1092 1093\n", + " 1099 1100 1103 1104 1106 1110 1112 1113 1119 1121 1122 1125 1131 1137\n", + " 1139 1142 1143 1148 1150 1151 1154 1156 1157 1158 1159 1164 1165 1168\n", + " 1170 1172 1173 1175 1180 1181 1187 1194 1199 1202 1205 1210 1211 1221\n", + " 1226 1227 1228 1240 1246 1247 1254 1263 1264 1267 1279 1286 1287 1293\n", + " 1294 1303 1307 1309 1325 1329 1345 1360 1366 1376 1379 1423 1440 1476]\n", + "\n", + "182\n", + "[0.82901339 0.89161993 0.82629799 0.87000095 0.89248013 0.73728592\n", + " 0.79415605 0.86828026 0.86508464 0.75459108 0.82149574 0.74572376\n", + " 0.76388786 0.84371072 0.88855764 0.86559633 0.87365401 0.78905901\n", + " 0.7445525 0.89782485 0.83650063 0.83031165 0.82605319 0.86961583\n", + " 0.85720151 0.8360214 0.89737405 0.88232912 0.88616699 0.83453145\n", + " 0.84885615 0.77293974 0.86927832 0.75456081 0.87775318 0.84261326\n", + " 0.80765903 0.77504581 0.83460928 0.88540981 0.80079319 0.82498291\n", + " 0.8242084 0.8090536 0.86464023 0.76233723 0.85784392 0.75242994\n", + " 0.86284909 0.89237556 0.87045416 0.86889381 0.88377943 0.73919557\n", + " 0.8718014 0.82622778 0.78397213 0.79761281 0.86328453 0.89823878\n", + " 0.76793363 0.82432058 0.76505399 0.76905209 0.8635099 0.82372687\n", + " 0.80116299 0.7959263 0.83553813 0.7871669 0.87999738 0.79396342\n", + " 0.85011634 0.87275604 0.82588273 0.8650302 0.84973194 0.87647789\n", + " 0.79801604 0.82143478 0.77185079 0.82558209 0.78214264 0.75728689\n", + " 0.86254607 0.7624457 0.75326466 0.88954745 0.88577562 0.86987876\n", + " 0.8365247 0.89883435 0.8077233 0.89247586 0.80559534 0.84385428\n", + " 0.81841414 0.78006178 0.82297827 0.88471836 0.76267324 0.74420216\n", + " 0.8346765 0.84488461 0.8891258 0.84742891 0.76383173 0.73719951\n", + " 0.81500546 0.88111505 0.89567196 0.7460369 0.88110483 0.78749294\n", + " 0.85297279 0.85659824 0.83517785 0.78808273 0.82355308 0.81794391\n", + " 0.76973913 0.75176593 0.81296508 0.78303833 0.75889729 0.75518761\n", + " 0.7496409 0.84745271 0.81928656 0.76189649 0.88925804 0.77406102\n", + " 0.84532186 0.7568031 0.87896916 0.8858597 0.84459528 0.85816321\n", + " 0.89871947 0.73558088 0.79870787 0.75505686 0.76128689 0.85374951\n", + " 0.82751112 0.85731753 0.84919586 0.83540719 0.80246903 0.84050576\n", + " 0.85795994 0.75272696 0.78461014 0.86769768 0.77289034 0.76632912\n", + " 0.7808672 0.79881748 0.75423576 0.77803525 0.75006416 0.73533747\n", + " 0.74915373 0.73541664 0.77642663 0.81729561 0.77295319 0.79197296\n", + " 0.81813976 0.79021949 0.79803653 0.82510471 0.77254396 0.7607412\n", + " 0.76087598 0.7356409 0.73787185 0.79057345 0.82968253 0.73552341\n", + " 0.75572487 0.74522678]\n", + "[0.57408034 0.94971957 0.55778791 0.82000569 0.95488081 0.0237155\n", + " 0.36493627 0.80968153 0.79050784 0.1275465 0.52897446 0.07434258\n", + " 0.18332718 0.66226435 0.93134583 0.79357796 0.84192408 0.33435407\n", + " 0.06731501 0.98694912 0.6190038 0.5818699 0.55631916 0.81769495\n", + " 0.74320907 0.61612839 0.98424428 0.89397473 0.91700195 0.60718873\n", + " 0.6931369 0.23763841 0.81566989 0.12736489 0.86651909 0.65567956\n", + " 0.44595421 0.25027487 0.60765571 0.91245887 0.40475911 0.54989745\n", + " 0.54525041 0.45432158 0.78784137 0.1740234 0.74706352 0.11457967\n", + " 0.77709455 0.95425337 0.82272497 0.81336289 0.9026766 0.03517344\n", + " 0.8308084 0.55736666 0.3038328 0.38567684 0.77970721 0.98943268\n", + " 0.20760177 0.54592348 0.19032391 0.21431256 0.78105937 0.54236125\n", + " 0.40697797 0.37555778 0.61322877 0.32300141 0.87998426 0.36378051\n", + " 0.70069802 0.83653621 0.55529638 0.79018117 0.69839166 0.85886732\n", + " 0.38809626 0.52860866 0.23110471 0.55349252 0.29285585 0.14372137\n", + " 0.77527644 0.17467421 0.11958795 0.93728473 0.91465374 0.81927255\n", + " 0.61914819 0.99300609 0.44633977 0.95485515 0.43357205 0.66312565\n", + " 0.51048484 0.28037069 0.53786964 0.90831013 0.17603947 0.06521297\n", + " 0.60805902 0.66930767 0.93475483 0.68457343 0.18299036 0.02319708\n", + " 0.49003273 0.8866903 0.97403178 0.0762214 0.88662896 0.32495761\n", + " 0.71783676 0.73958947 0.61106707 0.32849636 0.54131849 0.50766348\n", + " 0.21843475 0.11059558 0.47779045 0.29822998 0.15338377 0.13112565\n", + " 0.09784537 0.68471628 0.51571938 0.17137892 0.93554821 0.2443661\n", + " 0.67193115 0.1408186 0.87381495 0.91515819 0.66757165 0.74897923\n", + " 0.99231684 0.0134853 0.39224724 0.13034116 0.16772135 0.72249705\n", + " 0.56506675 0.74390516 0.69517513 0.61244315 0.41481416 0.64303458\n", + " 0.74775964 0.11636175 0.30766085 0.80618609 0.23734202 0.19797471\n", + " 0.28520319 0.39290487 0.12541453 0.26821147 0.10038494 0.01202485\n", + " 0.09492236 0.01249985 0.25855976 0.50377367 0.23771913 0.35183775\n", + " 0.50883857 0.34131695 0.3882192 0.55062825 0.23526373 0.16444723\n", + " 0.16525591 0.01384541 0.02723113 0.34344073 0.57809517 0.01314044\n", + " 0.13434922 0.07136066]\n" + ] + } + ], + "source": [ + "# G2\n", + "G2_cells = np.where((t_G1+t_S < properties['age']) & (properties['age'] <= t_G1+t_S+t_G2))[0] # array with indices of G2 cells\n", + "print(G2_cells)\n", + "print(type(G2_cells))\n", + "print(len(G2_cells)) # 182 cells are in G2\n", + "G2_cells_ages = properties['age'][G2_cells]\n", + "print(G2_cells_ages)\n", + "z0[G2_cells] = 1.0/(t_G2)*(G2_cells_ages-(t_G1+t_S)) # positions of G2 cells\n", + "print((z0[G2_cells]))" + ] + }, + { + "cell_type": "code", + "execution_count": 331, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n", + " 14 15 16 17 18 19 20 21 22 23 24 25 26 27\n", + " 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n", + " 42 43 44 45 46 47 48 49 50 51 52 53 54 55\n", + " 56 57 58 59 60 61 62 63 64 65 66 67 68 69\n", + " 70 71 72 73 74 75 76 77 78 79 80 81 82 83\n", + " 84 85 86 87 88 89 90 91 92 93 94 95 96 97\n", + " 98 99 100 101 102 103 104 105 106 107 108 109 110 111\n", + " 112 113 114 115 116 117 118 119 120 121 122 123 124 125\n", + " 126 127 128 129 130 131 132 133 134 135 136 137 138 139\n", + " 140 141 142 143 144 145 146 147 148 149 150 151 152 153\n", + " 154 155 156 157 158 159 160 161 162 163 164 165 166 167\n", + " 168 169 170 171 172 173 174 175 176 177 178 179 180 181\n", + " 182 183 184 185 186 187 188 189 190 191 192 193 194 195\n", + " 196 197 198 199 200 201 202 203 204 205 206 207 208 209\n", + " 210 211 212 213 214 215 216 217 218 219 220 221 222 223\n", + " 224 225 226 227 228 229 230 231 232 233 234 235 236 237\n", + " 238 239 240 241 242 243 244 245 246 247 248 249 250 251\n", + " 252 253 254 255 256 257 258 259 260 261 262 263 264 265\n", + " 266 267 268 269 270 271 272 273 274 275 276 277 278 279\n", + " 280 281 282 283 284 285 286 287 288 289 290 291 292 293\n", + " 294 295 296 297 298 299 300 301 302 303 304 305 306 307\n", + " 308 309 310 311 312 313 314 315 316 317 318 319 320 321\n", + " 322 323 324 325 326 327 328 329 330 331 332 333 334 335\n", + " 336 337 338 339 340 341 342 343 344 345 346 347 348 349\n", + " 350 351 352 353 354 355 356 357 358 359 360 361 362 363\n", + " 364 365 366 367 368 369 370 371 372 373 374 375 376 377\n", + " 378 379 380 381 382 383 384 385 386 387 388 389 390 391\n", + " 392 393 394 395 396 397 398 399 400 401 402 403 404 405\n", + " 406 407 408 409 410 411 412 413 414 415 416 417 418 419\n", + " 420 421 422 423 424 425 426 427 428 429 430 431 432 433\n", + " 434 435 436 437 438 439 440 441 442 443 444 445 446 447\n", + " 448 449 450 451 452 453 454 455 456 457 458 459 460 461\n", + " 462 463 464 465 466 467 468 469 470 471 472 473 474 475\n", + " 476 477 478 479 480 481 482 483 484 486 487 488 489 490\n", + " 491 492 493 494 495 496 497 498 499 500 501 502 504 505\n", + " 506 507 508 509 510 511 512 513 514 515 516 517 518 519\n", + " 520 521 522 523 524 525 526 527 528 529 530 532 533 534\n", + " 535 536 537 538 539 540 541 542 543 544 545 546 548 549\n", + " 550 551 552 553 554 555 556 557 558 559 560 561 562 563\n", + " 564 565 566 567 568 569 570 571 572 573 574 575 576 577\n", + " 578 579 580 581 582 583 584 585 586 587 588 589 590 591\n", + " 592 593 594 595 596 597 598 599 600 601 602 603 604 605\n", + " 606 607 608 610 611 612 613 614 616 617 618 619 620 621\n", + " 622 623 624 625 626 627 628 629 630 631 632 633 634 635\n", + " 636 637 638 639 640 641 642 643 645 646 647 648 649 650\n", + " 651 652 653 654 655 656 658 659 660 661 662 663 664 665\n", + " 666 667 668 669 670 671 672 673 674 675 676 677 678 679\n", + " 680 681 682 683 684 685 686 687 688 689 690 691 692 693\n", + " 694 695 696 697 698 699 700 701 702 703 704 706 707 708\n", + " 709 710 711 712 713 714 715 716 717 718 719 720 721 722\n", + " 723 725 726 727 728 729 730 731 732 733 734 735 736 737\n", + " 738 739 740 741 742 743 744 745 746 747 748 749 750 751\n", + " 752 753 754 755 756 758 759 760 761 762 763 764 766 768\n", + " 769 770 772 773 774 775 776 779 780 782 783 784 785 786\n", + " 787 788 789 790 791 792 793 795 796 798 800 802 803 804\n", + " 805 806 807 808 809 810 811 813 814 815 816 817 818 819\n", + " 820 822 826 827 828 829 830 831 832 833 835 837 838 839\n", + " 842 844 846 848 849 851 852 853 854 855 856 857 858 859\n", + " 860 861 864 866 867 868 869 870 872 875 877 879 884 887\n", + " 889 890 892 893 895 896 900 902 903 904 905 906 908 909\n", + " 910 911 913 915 917 918 919 920 921 922 923 924 925 928\n", + " 930 932 933 937 940 941 944 945 946 949 952 953 955 958\n", + " 959 960 963 965 967 968 971 976 977 979 982 984 985 986\n", + " 988 991 997 999 1000 1002 1007 1008 1013 1015 1021 1022 1026 1028\n", + " 1029 1030 1034 1042 1043 1049 1054 1062 1065 1074 1078 1083 1094 1095\n", + " 1096 1098 1105 1111 1117 1120 1123 1124 1135 1138 1140 1144 1152 1163\n", + " 1169 1176 1183 1195 1197 1299 1445]\n", + "\n", + "945\n", + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n" + ] + } + ], + "source": [ + "# M\n", + "M_cells = np.where(properties['age'] > t_G1+t_S+t_G2)[0] # array with indices of M cells\n", + "print(M_cells)\n", + "print(type(M_cells))\n", + "print(len(M_cells)) # 945 cells are in M\n", + "M_cells_ages = properties['age'][M_cells]\n", + "print(M_cells_ages)\n", + "z0[M_cells] = 1.0 # position of M cells\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# All cell cycle phases - target positions calculations\n", + "\n", + "zt = properties['zposn']\n", + "z0 = np.zeros_like(zt) # Return an array of zeros with the same shape and type as the nucl position array (all cells).\n", + "\n", + "# G1\n", + "G1_cells = np.where(properties['age'] <= t_G1)[0] # array with indices of G1 cells\n", + "print(len(G1_cells)) # 674 cells are in G1\n", + "G1_cells_ages = properties['age'][G1_cells]\n", + "z0[G1_cells] = 1-1.0/t_G1*G1_cells_ages\n", + "\n", + "\n", + "# S\n", + "S_cells = np.where((t_G1 < properties['age']) & (properties['age'] <= t_G1+t_S))[0] # array with indices of S cells\n", + "print(len(S_cells)) # 489 cells are in S\n", + "S_cells_ages = properties['age'][S_cells]\n", + "z0[S_cells] = 0.0 # positions of S cells\n", + "\n", + "\n", + "# G2\n", + "G2_cells = np.where((t_G1+t_S < properties['age']) & (properties['age'] <= t_G1+t_S+t_G2))[0] # array with indices of G2 cells\n", + "print(len(G2_cells)) # 182 cells are in G2\n", + "G2_cells_ages = properties['age'][G2_cells]\n", + "z0[G2_cells] = 1.0/(t_G2)*(G2_cells_ages-(t_G1+t_S)) # positions of G2 cells\n", + "\n", + "# M\n", + "M_cells = np.where(properties['age'] > t_G1+t_S+t_G2)[0] # array with indices of M cells\n", + "print(len(M_cells)) # 945 cells are in M\n", + "M_cells_ages = properties['age'][M_cells]\n", + "z0[M_cells] = 1.0 # position of M cells\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 339, + "metadata": {}, + "outputs": [], + "source": [ + "# Calculate zt = current position of the nucleus by adding noise to target position\n", + "zt = properties['zposn']\n", + "D=0.15\n", + "k = 0.015 # a constant\n", + "timend=300 # length of simulation\n", + "\n", + "dt = 0.001\n", + "for t in np.arange(0, timend, dt):\n", + " zt = zt + k*(z0 - zt)*dt + np.sqrt(2*D*dt)*np.random.randn(len(zt))\n", + "\n", + "# Define mean position neighbors:\n", + "# cell has min 3 neighbors\n", + "# Define neighbors: neighbors = cells whose 2 of their vertices coincide with 2 of the cell's. store in a list, neighbors.\n", + "# n = number of neighbors: n = len(neighbors)\n", + "# Position of neighbors (nuclei) = zj: repeat np.where statements for each neighbor to find out \n", + "sum = 0\n", + "for neighbor in np.arange(3, n+1, 1): # do this under for t in np.arange(0, timend, dt)\n", + " zt = zt + k*(z0 - zt)*dt + np.sqrt(2*D*dt)*np.random.randn(len(zt))\n", + " sum = sum + zt\n", + "zj = sum/n #calculate mean neighbor position\n", + " \n", + " \n", + " \n", + "# Adding crowding\n", + "def force_on_cell(zi): #force on cell at position zi\n", + " force = 0\n", + " for zj in neighbors(zi): \n", + " if zi-zj < 0:\n", + " f(zi-zj) = -f(zj-zi)\n", + " elif zi-zj > 0.2: # if the nuclei do not overlap - say nucl length along AB axis = 0.1\n", + " # nuclei do not overlap if zi-zj > 2 x nucl length\n", + " f(zi-zj) = 1/m*f(zi-zj) # make the force vanishing\n", + " else :\n", + " f(zi-zj) = f(zi-zj)\n", + " \n", + " force += f(zi-zj)\n", + " \n", + " return force" + ] + }, + { + "cell_type": "code", + "execution_count": 348, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n" + ] + } + ], + "source": [ + "print(ready)" + ] + }, + { + "cell_type": "code", + "execution_count": 269, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.5622115244563757 0.8864373671362452 0.44292649985797733\n" + ] + } + ], + "source": [ + "# Fit line to histogram\n", + "import matplotlib.mlab as mlab\n", + "from scipy.stats import gamma\n", + "from scipy.stats import erlang\n", + "x = np.linspace(0,3.2,945)\n", + "\n", + "# Gamma\n", + "shape, loc, scale = erlang.fit(cell_cycle_lengths) # loc = position of cutoff\n", + "print(shape, loc, scale)\n", + "y = erlang.pdf(x, shape, loc, scale) # inverse of scale = rate\n", + "h = plt.hist(cell_cycle_lengths, bins = 40)\n", + "plt.plot(x, y*60, lw=2)\n", + "plt.show()\n", + "\n", + "\n", + "\n", + "# Cell cycle length distribution - influenced by correlated samples?\n" + ] + }, + { + "cell_type": "code", + "execution_count": 273, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "KstestResult(statistic=0.509154783907775, pvalue=1.1710738031941171e-227)" + ] + }, + "execution_count": 273, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Perform Kolmogorov-Smirnov test to test whether or not or not cells.properties['age'] comes from Erlang distribution.\n", + "\n", + "from scipy.stats import kstest\n", + "kstest(cell_cycle_lengths, 'gamma', args=(1.5622115244563757, 0, 0.7119333243592108)) # it is gamma.\n", + "# modify shape to 1 to check for Erlang (not general gamma) => p-value = 0" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# IKNM dynamics 1 -> drift = velocity from current model\n", + "\n", + "#G1. if 0 <= properties['age'] <= t_G1:\n", + "v1 = -1/t_G1\n", + "#elif t_G1 < properties['age'] <= t_G1 + t_S :\n", + "v1 = 0\n", + "# elif t_G1 + t_S < properties['age'] <= t_G1 + t_S + t_G2:\n", + "v1 = 1/t_G2\n", + "# else: (t_G1 + t_S + t_G2 < properties['age'])\n", + "v1 = 0\n", + "\n", + "# v2 = A*(properties['zposn'] - mean_neigh_pos)\n", + "# cell has min 3 neighbors\n", + "# Define neighbors: neighbors = cells whose 2 of their vertices coincide with 2 of the cell's. store in a list, neighbors.\n", + "# n = number of neighbors: len(neighbors)\n", + "# Position of neighbors (nuclei) = neigh_pos: repeat if statements for each neighbor to find out v1\n", + " sum = 0\n", + "for i in range(3, n+1, 1):\n", + "sum = sum + neigh_pos\n", + "# mean neigh position: \n", + "mean_neigh_pos = sum/n\n", + "\n", + "# A = ct; value?\n", + "\n", + "v = v1 + v2\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "# Euler–Maruyama method - Wikipedia code - Potentially add noise dependence on the current position -> if cell is in\n", + "# G1 or S => higher noise. But this might be counteracted by the low position of the nuclei, which are pushed further\n", + "# down by neighbors above -> this noise might be counteracted in this way so probs not worth adding dependence on pos.\n", + "\n", + "num_sims = 5 # Display five runs\n", + "\n", + "t_init = 3\n", + "t_end = 7\n", + "N = 1000 # Compute 1000 grid points\n", + "dt = float(t_end - t_init) / N\n", + "y_init = 0\n", + "\n", + "c_theta = 0.7\n", + "c_mu = 1.5\n", + "c_sigma = 0.06\n", + "\n", + "def mu(y, t):\n", + " \"\"\"Implement the Ornstein–Uhlenbeck mu.\"\"\" # = \\theta (\\mu-Y_t)\n", + " # replace with v\n", + " return c_theta * (c_mu - y)\n", + "\n", + "def sigma(y, t):\n", + " \"\"\"Implement the Ornstein–Uhlenbeck sigma.\"\"\" # = \\sigma\n", + " # Diffusion coefficient\n", + " return c_sigma\n", + "\n", + "def dW(delta_t):\n", + " \"\"\"Sample a random number at each call.\"\"\"\n", + " # White Gaussian noise\n", + " return np.random.normal(loc=0.0, scale=np.sqrt(delta_t))\n", + "\n", + "ts = np.arange(t_init, t_end + dt, dt)\n", + "ys = np.zeros(N + 1)\n", + "\n", + "ys[0] = y_init\n", + "\n", + "for _ in range(num_sims):\n", + " for i in range(1, ts.size):\n", + " t = t_init + (i - 1) * dt\n", + " y = ys[i - 1]\n", + " ys[i] = y + mu(y, t) * dt + sigma(y, t) * dW(dt)\n", + " plt.plot(ts, ys)\n", + "\n", + "plt.xlabel(\"time (s)\")\n", + "h = plt.ylabel(\"y\")\n", + "h.set_rotation(0)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ True True True ... False False False]\n", + "[False False False ... True True True]\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(~cells.empty()) # Turns Trues into Falses and viceversa." + ] + }, + { + "cell_type": "code", + "execution_count": 240, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 0.34678344 0.09469718 1.41721669 1.67473528 -0.33489884]\n", + "\n", + "\n" + ] + } + ], + "source": [ + "a = np.random.normal(size=5)\n", + "print(a)\n", + "print(type(np.where(a>0)))\n", + "print(type(np.where(a>0)[0]))" + ] + }, + { + "cell_type": "code", + "execution_count": 219, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 1.217858 -1.07929465 -0.64485792]\n", + " [ 0.94932936 0.97203389 0.25382137]\n", + " [ 1.46529953 0.4708984 0.64353754]\n", + " [-0.00430902 0.84851356 -0.42626672]\n", + " [ 0.71115515 -1.30060859 -1.01177399]]\n", + "(array([0, 1, 1, 1, 2, 2, 2, 3, 4]), array([0, 0, 1, 2, 0, 1, 2, 1, 0]))\n", + "[0 1 1 1 2 2 2 3 4]\n" + ] + } + ], + "source": [ + "a = np.random.normal(size=(5,3))\n", + "print(a)\n", + "print(np.where(a>0)) # first array gives rows where a>0; second array gives columns where a>0, for each row\n", + "print(np.where(a>0)[0]) # returns only the first dimension = the rows of the array where a>0, repeated for as many..\n", + "# ..times a number a>0 exists" + ] + }, + { + "cell_type": "code", + "execution_count": 347, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m print(type(np.where(cells.empty())[0])) # indices in array of T and F where there are T vals\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(type(np.where(cells.empty()))\n", + "print(type(np.where(cells.empty())[0])) # indices in array of T and F where there are T vals" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/example_simulation.ipynb b/examples/example_simulation.ipynb index 2dcce52..28e7b30 100644 --- a/examples/example_simulation.ipynb +++ b/examples/example_simulation.ipynb @@ -2,10 +2,11 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ + "\n", "import itertools\n", "get_ipython().magic(u'matplotlib inline')\n", "import numpy as np\n", @@ -21,9 +22,66 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "test\n" + ] + } + ], + "source": [ + "import vertex_model\n", + "print(\"test\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.001\n", + "[2937] [10008 10009 10010 10011 10012 10013]\n", + "[3322] [ 6360 6361 6362 11163 11164 11165]\n", + "[3474] [ 2670 2671 2672 11613 11614 11615]\n", + "[3538] [11796 11797 11798 11799 11800 11801]\n", + "[6687] [ 5574 5575 5576 21234 21235 21236]\n", + "[6390] [ 3273 3274 3275 20343 20344 20345]\n", + "[7650] [15252 15253 15254 24117 24118 24119]\n", + "[8348] [12585 12586 12587 26205 26206 26207]\n", + "[8349] [15249 15250 15251 26199 26200 26201]\n", + "[7566] [ 7338 7339 7340 10206 10207 10208]\n", + "[13538] [ 7188 7189 7190 41757 41758 41759]\n", + "[13539] [21912 21913 21914 24897 24898 24899]\n", + "[11405] [15846 15847 15848 15849 15850 15851]\n", + "[14039] [ 1653 1654 1655 12792 12793 12794]\n", + "[16474] [27372 27373 27374 31614 31615 31616]\n", + "[15458] [ 5544 5545 5546 47487 47488 47489]\n", + "[16475] [15360 15361 15362 31605 31606 31607]\n", + "[15642] [ 4194 4195 4196 48027 48028 48029]\n", + "[16277] [26148 26149 26150 49923 49924 49925]\n", + "[16683] [ 6252 6253 6254 51135 51136 51137]\n", + "[15447] [ 6639 6640 6641 15099 15100 15101]\n", + "[19364] [ 7584 7585 7586 26499 26500 26501]\n", + "[15643] [ 4191 4192 4193 48003 48004 48005]\n", + "[19768] [15639 15640 15641 22497 22498 22499]\n", + "[19769] [ 7728 7729 7730 60363 60364 60365]\n", + "[18781] [31053 31054 31055 31056 31057 31058]\n", + "[21896] [34137 34138 34139 66732 66733 66734]\n", + "[21897] [40233 40234 40235 66729 66730 66731]\n", + "[22213] [ 1521 1522 1523 20712 20713 20714]\n", + "[17775] [ 561 562 563 29148 29149 29150]\n", + "[22224] [67686 67687 67688 67692 67693 67694]\n" + ] + } + ], "source": [ "#### Parameter used in the simulation are picked up form Gobal_Constant.py file\n", "\n", @@ -35,6 +93,7 @@ "# sim_type 3 simulation_with_division_clone_whole_tissue_differenciation (differentiation rate everywhere)\n", "\n", "#use type 2 and parameter i=4 for floor plate\n", + "import numpy as np\n", "type_=2\n", "L_point = [-.4, -0.2,-0.3, -0.05, 0.075, 0.15]\n", "G_point = [0.14, 0.12, 0.1, 0.065, 0.04, 0.02]\n", @@ -42,18 +101,19 @@ "G=G_point[i]\n", "L=L_point[i]\n", "K=1.0\n", - "#run simulation with the choosen parameters\n", + "#run simulation with the choosen parameters ; line 521 in run_select.py\n", "rand = np.random.RandomState() #random number to choose Lambda\n", "params = [K,G,L] # K=x[0],G=x[1],L=x[2]\n", - "history= run_simulation_INM(params,300,rand,type_) #return hist\n" + "history= run_simulation_INM(params,300,rand,type_) #return hist; simulation time = 300?\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ + "\n", "def definecolors(cells):\n", " peach = '#eed5b7'\n", " light_blue ='#87cefa'\n", @@ -66,16 +126,17 @@ "\n", "\n", "for cells in history:\n", - " cells.properties['color'] = definecolors(cells,sampleset)\n", + " cells.properties['color'] = definecolors(cells)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ + "\n", "fig=plt.figure()\n", "ax = fig.gca()\n", "# initialization function: plot the background of each frame\n", @@ -98,14 +159,1844 @@ "\n" ] }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "RuntimeError", + "evalue": "Requested MovieWriter (ffmpeg) not available", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mHTML\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0manim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_html5_video\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36mto_html5_video\u001b[0;34m(self, embed_limit)\u001b[0m\n\u001b[1;32m 1314\u001b[0m \u001b[0;31m# We create a writer manually so that we can get the\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1315\u001b[0m \u001b[0;31m# appropriate size for the tag\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1316\u001b[0;31m \u001b[0mWriter\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mwriters\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mmpl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'animation.writer'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1317\u001b[0m writer = Writer(codec='h264',\n\u001b[1;32m 1318\u001b[0m \u001b[0mbitrate\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmpl\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'animation.bitrate'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/animation.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 164\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_available\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_registered\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 166\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Requested MovieWriter ({name}) not available\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 167\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 168\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mRuntimeError\u001b[0m: Requested MovieWriter (ffmpeg) not available" + ] + } + ], + "source": [ + "HTML(anim.to_html5_video())" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "0.003860953347055751\n", + "3.1399356201466135\n", + "0.8926051064870122\n", + "0.6809692572214547\n", + "2290\n" + ] + } + ], + "source": [ + "# Determine if cell cycle length has an Erlang distribution - if our model matches experimental data.\n", + "\n", + "print(cells.properties['age'])\n", + "print(min(cells.properties['age']))\n", + "print(max(cells.properties['age']))\n", + "h = plt.hist(cells.properties['age'], bins = 30)\n", + "plt.show()\n", + "\n", + "\n", + "\n", + "#find mean of distribution\n", + "mu = sum(cells.properties['age'])/len(cells.properties['age'])\n", + "print(sum(cells.properties['age'])/len(cells.properties['age']))\n", + "# find sd of distribution\n", + "sigma = np.std(cells.properties['age'])\n", + "print(np.std(cells.properties['age']))\n", + "print(len(cells.properties['age']))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 261, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ True True True ... False False False]\n", + "2290\n", + "945\n", + "\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(len(cells.empty())) # 2290 cells in total: dead and alive\n", + "print(len(np.where(cells.empty())[0])) # 945 dead cells - np.where finds where values of array = True vals\n", + "print(type(cells.empty()))# Returns an array with True and False: true where cells are dead, false where they are alive" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n" + ] + } + ], + "source": [ + "deadcells = np.where(cells.empty())[0]\n", + "print(cells.properties['age'][deadcells])" + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,\n", + " 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\n", + " 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,\n", + " 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\n", + " 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,\n", + " 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,\n", + " 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\n", + " 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,\n", + " 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,\n", + " 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,\n", + " 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,\n", + " 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,\n", + " 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,\n", + " 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,\n", + " 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,\n", + " 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,\n", + " 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,\n", + " 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,\n", + " 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,\n", + " 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,\n", + " 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,\n", + " 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,\n", + " 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,\n", + " 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263,\n", + " 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,\n", + " 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,\n", + " 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,\n", + " 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,\n", + " 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,\n", + " 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329,\n", + " 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340,\n", + " 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,\n", + " 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,\n", + " 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,\n", + " 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,\n", + " 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395,\n", + " 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406,\n", + " 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,\n", + " 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428,\n", + " 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439,\n", + " 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450,\n", + " 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461,\n", + " 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472,\n", + " 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483,\n", + " 484, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495,\n", + " 496, 497, 498, 499, 500, 501, 502, 504, 505, 506, 507,\n", + " 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518,\n", + " 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529,\n", + " 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541,\n", + " 542, 543, 544, 545, 546, 548, 549, 550, 551, 552, 553,\n", + " 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564,\n", + " 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575,\n", + " 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586,\n", + " 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597,\n", + " 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608,\n", + " 610, 611, 612, 613, 614, 616, 617, 618, 619, 620, 621,\n", + " 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632,\n", + " 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643,\n", + " 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655,\n", + " 656, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667,\n", + " 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678,\n", + " 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689,\n", + " 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700,\n", + " 701, 702, 703, 704, 706, 707, 708, 709, 710, 711, 712,\n", + " 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723,\n", + " 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735,\n", + " 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746,\n", + " 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758,\n", + " 759, 760, 761, 762, 763, 764, 766, 768, 769, 770, 772,\n", + " 773, 774, 775, 776, 779, 780, 782, 783, 784, 785, 786,\n", + " 787, 788, 789, 790, 791, 792, 793, 795, 796, 798, 800,\n", + " 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 813,\n", + " 814, 815, 816, 817, 818, 819, 820, 822, 826, 827, 828,\n", + " 829, 830, 831, 832, 833, 835, 837, 838, 839, 842, 844,\n", + " 846, 848, 849, 851, 852, 853, 854, 855, 856, 857, 858,\n", + " 859, 860, 861, 864, 866, 867, 868, 869, 870, 872, 875,\n", + " 877, 879, 884, 887, 889, 890, 892, 893, 895, 896, 900,\n", + " 902, 903, 904, 905, 906, 908, 909, 910, 911, 913, 915,\n", + " 917, 918, 919, 920, 921, 922, 923, 924, 925, 928, 930,\n", + " 932, 933, 937, 940, 941, 944, 945, 946, 949, 952, 953,\n", + " 955, 958, 959, 960, 963, 965, 967, 968, 971, 976, 977,\n", + " 979, 982, 984, 985, 986, 988, 991, 997, 999, 1000, 1002,\n", + " 1007, 1008, 1013, 1015, 1021, 1022, 1026, 1028, 1029, 1030, 1034,\n", + " 1042, 1043, 1049, 1054, 1062, 1065, 1074, 1078, 1083, 1094, 1095,\n", + " 1096, 1098, 1105, 1111, 1117, 1120, 1123, 1124, 1135, 1138, 1140,\n", + " 1144, 1152, 1163, 1169, 1176, 1183, 1195, 1197, 1299, 1445]),)\n", + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n", + " 14 15 16 17 18 19 20 21 22 23 24 25 26 27\n", + " 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n", + " 42 43 44 45 46 47 48 49 50 51 52 53 54 55\n", + " 56 57 58 59 60 61 62 63 64 65 66 67 68 69\n", + " 70 71 72 73 74 75 76 77 78 79 80 81 82 83\n", + " 84 85 86 87 88 89 90 91 92 93 94 95 96 97\n", + " 98 99 100 101 102 103 104 105 106 107 108 109 110 111\n", + " 112 113 114 115 116 117 118 119 120 121 122 123 124 125\n", + " 126 127 128 129 130 131 132 133 134 135 136 137 138 139\n", + " 140 141 142 143 144 145 146 147 148 149 150 151 152 153\n", + " 154 155 156 157 158 159 160 161 162 163 164 165 166 167\n", + " 168 169 170 171 172 173 174 175 176 177 178 179 180 181\n", + " 182 183 184 185 186 187 188 189 190 191 192 193 194 195\n", + " 196 197 198 199 200 201 202 203 204 205 206 207 208 209\n", + " 210 211 212 213 214 215 216 217 218 219 220 221 222 223\n", + " 224 225 226 227 228 229 230 231 232 233 234 235 236 237\n", + " 238 239 240 241 242 243 244 245 246 247 248 249 250 251\n", + " 252 253 254 255 256 257 258 259 260 261 262 263 264 265\n", + " 266 267 268 269 270 271 272 273 274 275 276 277 278 279\n", + " 280 281 282 283 284 285 286 287 288 289 290 291 292 293\n", + " 294 295 296 297 298 299 300 301 302 303 304 305 306 307\n", + " 308 309 310 311 312 313 314 315 316 317 318 319 320 321\n", + " 322 323 324 325 326 327 328 329 330 331 332 333 334 335\n", + " 336 337 338 339 340 341 342 343 344 345 346 347 348 349\n", + " 350 351 352 353 354 355 356 357 358 359 360 361 362 363\n", + " 364 365 366 367 368 369 370 371 372 373 374 375 376 377\n", + " 378 379 380 381 382 383 384 385 386 387 388 389 390 391\n", + " 392 393 394 395 396 397 398 399 400 401 402 403 404 405\n", + " 406 407 408 409 410 411 412 413 414 415 416 417 418 419\n", + " 420 421 422 423 424 425 426 427 428 429 430 431 432 433\n", + " 434 435 436 437 438 439 440 441 442 443 444 445 446 447\n", + " 448 449 450 451 452 453 454 455 456 457 458 459 460 461\n", + " 462 463 464 465 466 467 468 469 470 471 472 473 474 475\n", + " 476 477 478 479 480 481 482 483 484 486 487 488 489 490\n", + " 491 492 493 494 495 496 497 498 499 500 501 502 504 505\n", + " 506 507 508 509 510 511 512 513 514 515 516 517 518 519\n", + " 520 521 522 523 524 525 526 527 528 529 530 532 533 534\n", + " 535 536 537 538 539 540 541 542 543 544 545 546 548 549\n", + " 550 551 552 553 554 555 556 557 558 559 560 561 562 563\n", + " 564 565 566 567 568 569 570 571 572 573 574 575 576 577\n", + " 578 579 580 581 582 583 584 585 586 587 588 589 590 591\n", + " 592 593 594 595 596 597 598 599 600 601 602 603 604 605\n", + " 606 607 608 610 611 612 613 614 616 617 618 619 620 621\n", + " 622 623 624 625 626 627 628 629 630 631 632 633 634 635\n", + " 636 637 638 639 640 641 642 643 645 646 647 648 649 650\n", + " 651 652 653 654 655 656 658 659 660 661 662 663 664 665\n", + " 666 667 668 669 670 671 672 673 674 675 676 677 678 679\n", + " 680 681 682 683 684 685 686 687 688 689 690 691 692 693\n", + " 694 695 696 697 698 699 700 701 702 703 704 706 707 708\n", + " 709 710 711 712 713 714 715 716 717 718 719 720 721 722\n", + " 723 725 726 727 728 729 730 731 732 733 734 735 736 737\n", + " 738 739 740 741 742 743 744 745 746 747 748 749 750 751\n", + " 752 753 754 755 756 758 759 760 761 762 763 764 766 768\n", + " 769 770 772 773 774 775 776 779 780 782 783 784 785 786\n", + " 787 788 789 790 791 792 793 795 796 798 800 802 803 804\n", + " 805 806 807 808 809 810 811 813 814 815 816 817 818 819\n", + " 820 822 826 827 828 829 830 831 832 833 835 837 838 839\n", + " 842 844 846 848 849 851 852 853 854 855 856 857 858 859\n", + " 860 861 864 866 867 868 869 870 872 875 877 879 884 887\n", + " 889 890 892 893 895 896 900 902 903 904 905 906 908 909\n", + " 910 911 913 915 917 918 919 920 921 922 923 924 925 928\n", + " 930 932 933 937 940 941 944 945 946 949 952 953 955 958\n", + " 959 960 963 965 967 968 971 976 977 979 982 984 985 986\n", + " 988 991 997 999 1000 1002 1007 1008 1013 1015 1021 1022 1026 1028\n", + " 1029 1030 1034 1042 1043 1049 1054 1062 1065 1074 1078 1083 1094 1095\n", + " 1096 1098 1105 1111 1117 1120 1123 1124 1135 1138 1140 1144 1152 1163\n", + " 1169 1176 1183 1195 1197 1299 1445]\n" + ] + } + ], + "source": [ + "print((np.where(cells.empty()))) # array of list with indices of cells (both dead and alive)\n", + "print((np.where(cells.empty())[0])) # returns the first dimension of the array above -> list up to 1445\n", + "# = take the first element from the tuple of ndarrays returned by np.where()" + ] + }, + { + "cell_type": "code", + "execution_count": 264, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "1\n", + "\n", + "945\n", + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "\n", + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n", + "\n", + "945\n", + "0.9038814166491465\n", + "3.1399356201466135\n" + ] + } + ], + "source": [ + "print(type(np.where(cells.empty())))\n", + "print(len(np.where(cells.empty())))\n", + "print(type(np.where(cells.empty())[0])) # deadcells\n", + "print(len(np.where(cells.empty())[0]))\n", + "print(cells.properties['age'])\n", + "print(type(cells.properties['age']))\n", + "deadcells = np.where(cells.empty())[0]\n", + "print(cells.properties['age'][deadcells]) # age of all the cells\n", + "print(type(cells.properties['age'][deadcells]))\n", + "print(len(cells.properties['age'][deadcells])) # age of deadcells = length of cell cycle\n", + "cell_cycle_lengths = cells.properties['age'][deadcells] # cell cycle lenghts\n", + "print(min(cell_cycle_lengths))\n", + "print(max(cell_cycle_lengths))" + ] + }, + { + "cell_type": "code", + "execution_count": 324, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1.1860919 1.14153715 2.16681666 ... 0.00473937 0.00506991 0.00423976]\n", + "2290\n", + "[1. 1. 1. ... 0.98815157 0.98732521 0.98940059]\n", + "[ 609 1101 1171 1186 1409 1413 1416 1434 1437 1439 1450 1460 1462 1477\n", + " 1489 1496 1502 1508 1515 1516 1517 1529 1530 1532 1533 1539 1542 1544\n", + " 1545 1549 1558 1559 1565 1566 1567 1569 1572 1575 1579 1581 1590 1593\n", + " 1595 1599 1600 1602 1605 1606 1609 1611 1613 1614 1615 1620 1623 1626\n", + " 1629 1634 1635 1637 1639 1644 1645 1646 1649 1650 1654 1657 1658 1659\n", + " 1661 1662 1663 1664 1665 1666 1669 1670 1671 1672 1673 1677 1678 1679\n", + " 1680 1681 1682 1684 1686 1690 1691 1692 1693 1694 1695 1696 1697 1698\n", + " 1700 1702 1703 1705 1706 1708 1709 1711 1712 1715 1716 1719 1720 1721\n", + " 1722 1723 1724 1725 1726 1727 1728 1729 1731 1732 1734 1735 1736 1737\n", + " 1738 1739 1741 1742 1743 1744 1745 1747 1748 1749 1750 1751 1752 1753\n", + " 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767\n", + " 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781\n", + " 1782 1783 1784 1785 1786 1788 1789 1790 1791 1792 1793 1794 1795 1797\n", + " 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811\n", + " 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825\n", + " 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839\n", + " 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853\n", + " 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867\n", + " 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881\n", + " 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895\n", + " 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909\n", + " 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923\n", + " 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937\n", + " 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951\n", + " 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965\n", + " 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979\n", + " 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993\n", + " 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007\n", + " 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021\n", + " 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035\n", + " 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049\n", + " 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063\n", + " 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077\n", + " 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091\n", + " 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105\n", + " 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119\n", + " 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133\n", + " 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147\n", + " 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161\n", + " 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175\n", + " 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189\n", + " 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203\n", + " 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217\n", + " 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231\n", + " 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245\n", + " 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259\n", + " 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273\n", + " 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287\n", + " 2288 2289]\n", + "\n", + "674\n", + "[0.27507485 0.32634808 0.36479329 0.36966567 0.3298538 0.36863424\n", + " 0.38981568 0.39971899 0.39155409 0.35382398 0.35629978 0.36618413\n", + " 0.36453336 0.3345184 0.38357383 0.38329241 0.3934211 0.35246068\n", + " 0.33402754 0.38462791 0.34511051 0.3467997 0.3503884 0.35804341\n", + " 0.3822569 0.29190495 0.39712929 0.25368857 0.38839145 0.31136291\n", + " 0.39268951 0.28988279 0.32346867 0.37969086 0.3843704 0.3457614\n", + " 0.32802012 0.30845849 0.39568242 0.22881718 0.31051023 0.39445633\n", + " 0.32739096 0.2956509 0.34049671 0.38018692 0.34458571 0.34612583\n", + " 0.39843217 0.35015896 0.22916001 0.38743318 0.32195265 0.38801403\n", + " 0.24560388 0.37719944 0.36829089 0.26940526 0.31824346 0.38591568\n", + " 0.33805303 0.33990341 0.20130467 0.3718422 0.22891187 0.33123628\n", + " 0.38214629 0.23632022 0.36372377 0.2821754 0.36142599 0.36143238\n", + " 0.36848804 0.374931 0.23075125 0.34173542 0.30869727 0.22693439\n", + " 0.36186094 0.30997681 0.33521751 0.29059686 0.37646209 0.28505736\n", + " 0.35572996 0.27732256 0.31734833 0.34021457 0.32542903 0.32078313\n", + " 0.38934302 0.35644578 0.35874423 0.34210415 0.33663652 0.29862961\n", + " 0.34678968 0.25444136 0.38622909 0.27415182 0.20278139 0.39652051\n", + " 0.34431831 0.33767831 0.32255784 0.30825264 0.30174684 0.30929282\n", + " 0.30087306 0.30939439 0.29650797 0.25360075 0.2693617 0.31498135\n", + " 0.18231819 0.31003718 0.29420267 0.34902154 0.39078276 0.32699485\n", + " 0.37228137 0.17090958 0.24063828 0.28347118 0.3634516 0.25022641\n", + " 0.26816886 0.36005134 0.21301197 0.24010781 0.16451834 0.31758871\n", + " 0.25008686 0.31328882 0.37014873 0.31754461 0.2886183 0.34562783\n", + " 0.33789498 0.33219706 0.36209514 0.37019904 0.17513621 0.30855206\n", + " 0.19406274 0.27730245 0.20958137 0.34623243 0.2906068 0.24789108\n", + " 0.33021914 0.32042803 0.19663485 0.33632733 0.22639061 0.29841583\n", + " 0.36604686 0.30416827 0.34450978 0.39245085 0.39914076 0.26275612\n", + " 0.31420844 0.31489482 0.37796243 0.23705688 0.26288454 0.30436969\n", + " 0.34300716 0.34618628 0.27855521 0.26904222 0.29191475 0.35237724\n", + " 0.36399123 0.34105831 0.28558964 0.20512314 0.3363727 0.3891023\n", + " 0.31742904 0.33645406 0.32553356 0.29511548 0.27405203 0.27957988\n", + " 0.2897189 0.36169603 0.28034985 0.34662764 0.29331355 0.31037442\n", + " 0.31335007 0.28911017 0.39851944 0.22878786 0.36021367 0.37191676\n", + " 0.24778396 0.35083892 0.26720532 0.25845516 0.33741637 0.16894\n", + " 0.32499118 0.19532473 0.22058667 0.25526382 0.34008902 0.26996038\n", + " 0.25110184 0.15933831 0.31302199 0.31157871 0.27786396 0.30350476\n", + " 0.24860865 0.28531776 0.28050897 0.32927304 0.36343334 0.29445707\n", + " 0.36650879 0.2598823 0.31373479 0.24024589 0.25102916 0.2673124\n", + " 0.32140762 0.29106952 0.27785973 0.32988639 0.26401073 0.31528969\n", + " 0.2196844 0.2647984 0.28746416 0.31407052 0.22606254 0.33411767\n", + " 0.25171046 0.21477327 0.2986568 0.35812663 0.3154566 0.1321756\n", + " 0.31540073 0.36982381 0.32688413 0.19361488 0.15209431 0.35256176\n", + " 0.25852386 0.17432857 0.24608667 0.18365395 0.27177357 0.16568748\n", + " 0.14676997 0.29236768 0.2585451 0.2370383 0.30441073 0.20409349\n", + " 0.30949233 0.21761768 0.36494235 0.14609741 0.23260368 0.24068986\n", + " 0.14420949 0.25460502 0.23346684 0.25595801 0.30767354 0.18848665\n", + " 0.19431965 0.20005977 0.15942812 0.27812323 0.24380461 0.26672322\n", + " 0.23763047 0.23436293 0.17064327 0.23925039 0.19504362 0.16283743\n", + " 0.33785325 0.11852507 0.27515353 0.25197752 0.19865398 0.32427387\n", + " 0.22271876 0.15782291 0.22674305 0.2209183 0.24897319 0.21040403\n", + " 0.28867542 0.24332805 0.22099288 0.20157004 0.17637416 0.13367296\n", + " 0.28712284 0.26980168 0.25480982 0.2525332 0.20453044 0.23303212\n", + " 0.18544269 0.1262869 0.2311203 0.21095655 0.13427623 0.14825133\n", + " 0.1851296 0.2240715 0.18135415 0.2374447 0.26391586 0.24520094\n", + " 0.19936544 0.23928403 0.17621185 0.21138798 0.1714516 0.14451181\n", + " 0.20304702 0.16720894 0.11128549 0.12342179 0.20042446 0.22050152\n", + " 0.23255362 0.15957409 0.178853 0.24336334 0.18638234 0.16320659\n", + " 0.17486458 0.19684502 0.1878484 0.29028298 0.22354555 0.12801\n", + " 0.20724888 0.16984704 0.27065948 0.21393514 0.14708808 0.15832582\n", + " 0.21143929 0.18278027 0.21549379 0.14252754 0.17673557 0.16610907\n", + " 0.15522181 0.19275825 0.15953912 0.13378182 0.2239515 0.24140036\n", + " 0.16066688 0.18534023 0.18225995 0.13627516 0.17535759 0.14004639\n", + " 0.16433421 0.10829191 0.17354218 0.16916823 0.12544862 0.15470538\n", + " 0.16733104 0.17140804 0.12765164 0.20969706 0.16081282 0.11965094\n", + " 0.13639809 0.12431362 0.17133518 0.12869063 0.1877851 0.13101397\n", + " 0.16983851 0.13626966 0.15149298 0.12163627 0.13187609 0.14188461\n", + " 0.11849658 0.1912544 0.12295395 0.16791384 0.16485884 0.16367117\n", + " 0.19418568 0.12809467 0.19039847 0.08397739 0.13168879 0.07751311\n", + " 0.18488557 0.14629888 0.14864885 0.09208947 0.15926318 0.1481686\n", + " 0.1528102 0.20774806 0.14646004 0.12798614 0.11162776 0.09333624\n", + " 0.15736335 0.15160006 0.14688373 0.12354459 0.1056778 0.16094178\n", + " 0.08872422 0.16601335 0.16335997 0.11639472 0.08528807 0.12994309\n", + " 0.1787022 0.16750493 0.15858929 0.16146801 0.11883934 0.17731331\n", + " 0.1017936 0.16756136 0.17025127 0.10080344 0.11038031 0.11202349\n", + " 0.10400799 0.11586304 0.11478402 0.103487 0.1441356 0.09877421\n", + " 0.11658555 0.12048134 0.12728891 0.13855749 0.11184019 0.12455317\n", + " 0.11014508 0.09877301 0.12048464 0.09450232 0.10859748 0.13658568\n", + " 0.08206561 0.10297034 0.14163527 0.09670097 0.0828804 0.11411406\n", + " 0.10530234 0.11962397 0.11118944 0.09570904 0.09316501 0.08247491\n", + " 0.13725772 0.09328402 0.10813783 0.1054955 0.09863445 0.12126109\n", + " 0.07683497 0.1230234 0.09965356 0.08300049 0.09057839 0.06486102\n", + " 0.09237685 0.10880456 0.07536213 0.09910248 0.11390867 0.12114133\n", + " 0.13135206 0.11898628 0.09539656 0.07716468 0.11203112 0.11085351\n", + " 0.06855003 0.08322042 0.06629175 0.11139433 0.08916176 0.09730246\n", + " 0.04573674 0.10462004 0.1039188 0.10223585 0.09087662 0.07745381\n", + " 0.07992557 0.07063628 0.08160766 0.08747338 0.08652499 0.08047762\n", + " 0.07248412 0.06046589 0.09637276 0.09486968 0.06044758 0.09681456\n", + " 0.09013573 0.0697879 0.09431376 0.08712534 0.08568985 0.07818021\n", + " 0.08394492 0.08884556 0.07001691 0.08791231 0.06283723 0.07172767\n", + " 0.07870283 0.06365503 0.06780927 0.05146621 0.05389296 0.07611799\n", + " 0.0881995 0.07118621 0.08219562 0.04143611 0.07698686 0.07094164\n", + " 0.05340964 0.08028647 0.07777439 0.07022081 0.04998748 0.08082805\n", + " 0.07966655 0.05848425 0.06579435 0.08222389 0.06064832 0.06956484\n", + " 0.06438981 0.04858499 0.05954675 0.08677043 0.07028887 0.06278704\n", + " 0.0637738 0.05318376 0.05160562 0.03522411 0.03835095 0.05039851\n", + " 0.05977831 0.0574864 0.04916415 0.05872324 0.04175034 0.06183115\n", + " 0.0314742 0.05373084 0.03143355 0.04570845 0.04159614 0.05049678\n", + " 0.04255133 0.02979028 0.04215304 0.03941879 0.04819666 0.03936482\n", + " 0.02143645 0.04340395 0.0477597 0.04337677 0.03714704 0.0267654\n", + " 0.02766563 0.03618362 0.03856688 0.03444501 0.03604569 0.02750404\n", + " 0.02722625 0.03156114 0.03288378 0.03162399 0.03677413 0.0252794\n", + " 0.02851775 0.03170035 0.01898705 0.02155805 0.03033238 0.03175147\n", + " 0.02570288 0.01995876 0.01821526 0.02125357 0.02394908 0.01835626\n", + " 0.02932881 0.02031618 0.02209903 0.02802877 0.02689228 0.02752586\n", + " 0.024422 0.02585882 0.02804595 0.01774791 0.01625897 0.01641527\n", + " 0.01764849 0.0141256 0.01806682 0.0211881 0.01489747 0.01534379\n", + " 0.01881593 0.01567713 0.01391472 0.01942991 0.00926461 0.02037508\n", + " 0.01326585 0.01333529 0.01697402 0.01313462 0.00796651 0.00899021\n", + " 0.01345362 0.01441229 0.01420017 0.01440912 0.01150357 0.01425772\n", + " 0.0113467 0.00880243 0.00801116 0.00902487 0.00722425 0.00736783\n", + " 0.00544564 0.00581654 0.00584187 0.00682445 0.00545508 0.00524607\n", + " 0.00545983 0.00477358 0.00609707 0.00504779 0.00386095 0.00473937\n", + " 0.00506991 0.00423976]\n", + "[3.12312886e-01 1.84129795e-01 8.80167713e-02 7.58358271e-02\n", + " 1.75365498e-01 7.84144109e-02 2.54607878e-02 7.02531024e-04\n", + " 2.11147829e-02 1.15440046e-01 1.09250554e-01 8.45396763e-02\n", + " 8.86666021e-02 1.63703991e-01 4.10654292e-02 4.17689769e-02\n", + " 1.64472398e-02 1.18848310e-01 1.64931149e-01 3.84302288e-02\n", + " 1.37223724e-01 1.33000746e-01 1.24028992e-01 1.04891475e-01\n", + " 4.43577441e-02 2.70237629e-01 7.17676267e-03 3.65778570e-01\n", + " 2.90213823e-02 2.21592718e-01 1.82762146e-02 2.75293024e-01\n", + " 1.91328336e-01 5.07728414e-02 3.90740040e-02 1.35596500e-01\n", + " 1.79949706e-01 2.28853770e-01 1.07939448e-02 4.27957055e-01\n", + " 2.23724414e-01 1.38591691e-02 1.81522603e-01 2.60872746e-01\n", + " 1.48758215e-01 4.95327047e-02 1.38535720e-01 1.34685424e-01\n", + " 3.91958063e-03 1.24602608e-01 4.27099966e-01 3.14170473e-02\n", + " 1.95118382e-01 2.99649170e-02 3.85990293e-01 5.70013939e-02\n", + " 7.92727707e-02 3.26486848e-01 2.04391349e-01 3.52107950e-02\n", + " 1.54867422e-01 1.50241468e-01 4.96738324e-01 7.03945049e-02\n", + " 4.27720328e-01 1.71909288e-01 4.46342743e-02 4.09199459e-01\n", + " 9.06905824e-02 2.94561506e-01 9.64350128e-02 9.64190532e-02\n", + " 7.87799088e-02 6.26724900e-02 4.23121872e-01 1.45661450e-01\n", + " 2.28256827e-01 4.32664020e-01 9.53476385e-02 2.25057986e-01\n", + " 1.61956235e-01 2.73507855e-01 5.88447676e-02 2.87356597e-01\n", + " 1.10675104e-01 3.06693608e-01 2.06629181e-01 1.49463577e-01\n", + " 1.86427420e-01 1.98042167e-01 2.66424527e-02 1.08885543e-01\n", + " 1.03139436e-01 1.44739634e-01 1.58408710e-01 2.53425976e-01\n", + " 1.33025812e-01 3.63896597e-01 3.44272792e-02 3.14620460e-01\n", + " 4.93046521e-01 8.69872787e-03 1.39204220e-01 1.55804236e-01\n", + " 1.93605401e-01 2.29368390e-01 2.45632890e-01 2.26767938e-01\n", + " 2.47817342e-01 2.26514016e-01 2.58730071e-01 3.65998127e-01\n", + " 3.26595758e-01 2.12546617e-01 5.44204530e-01 2.24907040e-01\n", + " 2.64493321e-01 1.27446161e-01 2.30431091e-02 1.82512870e-01\n", + " 6.92965731e-02 5.72726049e-01 3.98404297e-01 2.91322057e-01\n", + " 9.13709974e-02 3.74433979e-01 3.29577862e-01 9.98716464e-02\n", + " 4.67470072e-01 3.99730482e-01 5.88704152e-01 2.06028234e-01\n", + " 3.74782850e-01 2.16777953e-01 7.46281734e-02 2.06138481e-01\n", + " 2.78454244e-01 1.35930418e-01 1.55262553e-01 1.69507354e-01\n", + " 9.47621402e-02 7.45024064e-02 5.62159469e-01 2.28619846e-01\n", + " 5.14843154e-01 3.06743866e-01 4.76046570e-01 1.34418932e-01\n", + " 2.73482993e-01 3.80272301e-01 1.74452140e-01 1.98929928e-01\n", + " 5.08412884e-01 1.59181682e-01 4.34023484e-01 2.53960436e-01\n", + " 8.48828605e-02 2.39579316e-01 1.38725539e-01 1.88728747e-02\n", + " 2.14809961e-03 3.43109703e-01 2.14478897e-01 2.12762957e-01\n", + " 5.50939290e-02 4.07357812e-01 3.42788641e-01 2.39075778e-01\n", + " 1.42482101e-01 1.34534306e-01 3.03611977e-01 3.27394442e-01\n", + " 2.70213117e-01 1.19056900e-01 9.00219230e-02 1.47354218e-01\n", + " 2.86025888e-01 4.87192151e-01 1.59068256e-01 2.72442560e-02\n", + " 2.06427411e-01 1.58864859e-01 1.86166106e-01 2.62211293e-01\n", + " 3.14869927e-01 3.01050303e-01 2.75702760e-01 9.57599347e-02\n", + " 2.99125368e-01 1.33430911e-01 2.66716135e-01 2.24063962e-01\n", + " 2.16624818e-01 2.77224563e-01 3.70140531e-03 4.28030348e-01\n", + " 9.94658160e-02 7.02080908e-02 3.80540094e-01 1.22902692e-01\n", + " 3.31986709e-01 3.53862102e-01 1.56459073e-01 5.77649996e-01\n", + " 1.87522061e-01 5.11688168e-01 4.48533327e-01 3.61840443e-01\n", + " 1.49777457e-01 3.25099061e-01 3.72245390e-01 6.01654227e-01\n", + " 2.17445016e-01 2.21053216e-01 3.05340111e-01 2.41238105e-01\n", + " 3.78478378e-01 2.86705606e-01 2.98727563e-01 1.76817400e-01\n", + " 9.14166466e-02 2.63857331e-01 8.37280263e-02 3.50294249e-01\n", + " 2.15663021e-01 3.99385276e-01 3.72427111e-01 3.31719000e-01\n", + " 1.96480946e-01 2.72326199e-01 3.05350682e-01 1.75284026e-01\n", + " 3.39973180e-01 2.11775767e-01 4.50788995e-01 3.38004011e-01\n", + " 2.81339611e-01 2.14823702e-01 4.34843641e-01 1.64705835e-01\n", + " 3.70723846e-01 4.63066830e-01 2.53357995e-01 1.04683419e-01\n", + " 2.11358489e-01 6.69560996e-01 2.11498185e-01 7.54404792e-02\n", + " 1.82789684e-01 5.15962799e-01 6.19764225e-01 1.18595611e-01\n", + " 3.53690341e-01 5.64178565e-01 3.84783323e-01 5.40865132e-01\n", + " 3.20566070e-01 5.85781311e-01 6.33075070e-01 2.69080810e-01\n", + " 3.53637255e-01 4.07404245e-01 2.38973177e-01 4.89766271e-01\n", + " 2.26269164e-01 4.55955793e-01 8.76441352e-02 6.34756486e-01\n", + " 4.18490812e-01 3.98275345e-01 6.39476264e-01 3.63487457e-01\n", + " 4.16332906e-01 3.60104985e-01 2.30816148e-01 5.28783369e-01\n", + " 5.14200873e-01 4.99850566e-01 6.01429710e-01 3.04691926e-01\n", + " 3.90488469e-01 3.33191941e-01 4.05923832e-01 4.14092682e-01\n", + " 5.73391815e-01 4.01874017e-01 5.12390949e-01 5.92906415e-01\n", + " 1.55366882e-01 7.03687334e-01 3.12116177e-01 3.70056204e-01\n", + " 5.03365039e-01 1.89315318e-01 4.43203090e-01 6.05442713e-01\n", + " 4.33142384e-01 4.47704262e-01 3.77567035e-01 4.73989923e-01\n", + " 2.78311444e-01 3.91679886e-01 4.47517801e-01 4.96074888e-01\n", + " 5.59064606e-01 6.65817597e-01 2.82192896e-01 3.25495809e-01\n", + " 3.62975439e-01 3.68667000e-01 4.88673889e-01 4.17419690e-01\n", + " 5.36393270e-01 6.84282739e-01 4.22199257e-01 4.72608621e-01\n", + " 6.64309420e-01 6.29371687e-01 5.37176000e-01 4.39821257e-01\n", + " 5.46614636e-01 4.06388253e-01 3.40210355e-01 3.86997646e-01\n", + " 5.01586388e-01 4.01789921e-01 5.59470385e-01 4.71530045e-01\n", + " 5.71370993e-01 6.38720484e-01 4.92382445e-01 5.81977640e-01\n", + " 7.21786279e-01 6.91445533e-01 4.98938850e-01 4.48746191e-01\n", + " 4.18615953e-01 6.01064786e-01 5.52867512e-01 3.91591640e-01\n", + " 5.34044159e-01 5.91983515e-01 5.62838557e-01 5.07887439e-01\n", + " 5.30378997e-01 2.74292561e-01 4.41136124e-01 6.79975009e-01\n", + " 4.81877803e-01 5.75382398e-01 3.23351289e-01 4.65162161e-01\n", + " 6.32279805e-01 6.04185439e-01 4.71401770e-01 5.43049332e-01\n", + " 4.61265534e-01 6.43681162e-01 5.58161086e-01 5.84727317e-01\n", + " 6.11945480e-01 5.18104369e-01 6.01152206e-01 6.65545460e-01\n", + " 4.40121257e-01 3.96499109e-01 5.98332806e-01 5.36649434e-01\n", + " 5.44350113e-01 6.59312088e-01 5.61606028e-01 6.49884020e-01\n", + " 5.89164463e-01 7.29270224e-01 5.66144544e-01 5.77079428e-01\n", + " 6.86378446e-01 6.13236547e-01 5.81672397e-01 5.71479907e-01\n", + " 6.80870907e-01 4.75757344e-01 5.97967944e-01 7.00872639e-01\n", + " 6.59004771e-01 6.89215943e-01 5.71662061e-01 6.78273429e-01\n", + " 5.30537247e-01 6.72465068e-01 5.75403719e-01 6.59325862e-01\n", + " 6.21267547e-01 6.95909326e-01 6.70309764e-01 6.45288476e-01\n", + " 7.03758543e-01 5.21864000e-01 6.92615136e-01 5.80215398e-01\n", + " 5.87852899e-01 5.90822075e-01 5.14535792e-01 6.79763337e-01\n", + " 5.24003831e-01 7.90056537e-01 6.70778024e-01 8.06217233e-01\n", + " 5.37786078e-01 6.34252811e-01 6.28377875e-01 7.69776331e-01\n", + " 6.01842049e-01 6.29578506e-01 6.17974504e-01 4.80629852e-01\n", + " 6.33849891e-01 6.80034643e-01 7.20930589e-01 7.66659395e-01\n", + " 6.06591629e-01 6.20999850e-01 6.32790668e-01 6.91138533e-01\n", + " 7.35805493e-01 5.97645562e-01 7.78189461e-01 5.84966623e-01\n", + " 5.91600079e-01 7.09013196e-01 7.86779835e-01 6.75142287e-01\n", + " 5.53244488e-01 5.81237668e-01 6.03526774e-01 5.96329978e-01\n", + " 7.02901661e-01 5.56716724e-01 7.45516005e-01 5.81096610e-01\n", + " 5.74371814e-01 7.47991399e-01 7.24049217e-01 7.19941266e-01\n", + " 7.39980026e-01 7.10342397e-01 7.13039959e-01 7.41282510e-01\n", + " 6.39661009e-01 7.53064465e-01 7.08536133e-01 6.98796647e-01\n", + " 6.81777736e-01 6.53606279e-01 7.20399527e-01 6.88617078e-01\n", + " 7.24637304e-01 7.53067484e-01 6.98788396e-01 7.63744192e-01\n", + " 7.28506298e-01 6.58535795e-01 7.94835963e-01 7.42574138e-01\n", + " 6.45911817e-01 7.58247570e-01 7.92798988e-01 7.14714851e-01\n", + " 7.36744149e-01 7.00940065e-01 7.22026388e-01 7.60727388e-01\n", + " 7.67087464e-01 7.93812728e-01 6.56855692e-01 7.66789954e-01\n", + " 7.29655423e-01 7.36261257e-01 7.53413887e-01 6.96847272e-01\n", + " 8.07912586e-01 6.92441497e-01 7.50866089e-01 7.92498766e-01\n", + " 7.73554033e-01 8.37847461e-01 7.69057880e-01 7.27988600e-01\n", + " 8.11594668e-01 7.52243797e-01 7.15228320e-01 6.97146668e-01\n", + " 6.71619840e-01 7.02534299e-01 7.61508611e-01 8.07088288e-01\n", + " 7.19922191e-01 7.22866236e-01 8.28624930e-01 7.91948955e-01\n", + " 8.34270620e-01 7.21514185e-01 7.77095594e-01 7.56743852e-01\n", + " 8.85658141e-01 7.38449899e-01 7.40203002e-01 7.44410369e-01\n", + " 7.72808449e-01 8.06365472e-01 8.00186069e-01 8.23409308e-01\n", + " 7.95980841e-01 7.81316553e-01 7.83687521e-01 7.98805960e-01\n", + " 8.18789711e-01 8.48835268e-01 7.59068101e-01 7.62825800e-01\n", + " 8.48881054e-01 7.57963612e-01 7.74660682e-01 8.25530240e-01\n", + " 7.64215602e-01 7.82186646e-01 7.85775380e-01 8.04549472e-01\n", + " 7.90137705e-01 7.77886100e-01 8.24957730e-01 7.80219236e-01\n", + " 8.42906933e-01 8.20680813e-01 8.03242930e-01 8.40862428e-01\n", + " 8.30476813e-01 8.71334464e-01 8.65267596e-01 8.09705016e-01\n", + " 7.79501252e-01 8.22034486e-01 7.94510945e-01 8.96409729e-01\n", + " 8.07532841e-01 8.22645893e-01 8.66475888e-01 7.99283822e-01\n", + " 8.05564036e-01 8.24447972e-01 8.75031289e-01 7.97929867e-01\n", + " 8.00833614e-01 8.53789383e-01 8.35514119e-01 7.94440273e-01\n", + " 8.48379210e-01 8.26087907e-01 8.39025485e-01 8.78537523e-01\n", + " 8.51133120e-01 7.83073925e-01 8.24277834e-01 8.43032392e-01\n", + " 8.40565489e-01 8.67040612e-01 8.70985956e-01 9.11939714e-01\n", + " 9.04122632e-01 8.74003727e-01 8.50554235e-01 8.56284012e-01\n", + " 8.77089622e-01 8.53191904e-01 8.95624156e-01 8.45422126e-01\n", + " 9.21314493e-01 8.65672906e-01 9.21416117e-01 8.85728882e-01\n", + " 8.96009661e-01 8.73758050e-01 8.93621686e-01 9.25524309e-01\n", + " 8.94617400e-01 9.01453013e-01 8.79508346e-01 9.01587941e-01\n", + " 9.46408867e-01 8.91490127e-01 8.80600748e-01 8.91558080e-01\n", + " 9.07132395e-01 9.33086500e-01 9.30835923e-01 9.09540958e-01\n", + " 9.03582805e-01 9.13887477e-01 9.09885764e-01 9.31239892e-01\n", + " 9.31934379e-01 9.21097143e-01 9.17790549e-01 9.20940018e-01\n", + " 9.08064673e-01 9.36801489e-01 9.28705628e-01 9.20749119e-01\n", + " 9.52532377e-01 9.46104882e-01 9.24169059e-01 9.20621328e-01\n", + " 9.35742798e-01 9.50103090e-01 9.54461843e-01 9.46866064e-01\n", + " 9.40127301e-01 9.54109348e-01 9.26677975e-01 9.49209544e-01\n", + " 9.44752432e-01 9.29928086e-01 9.32769294e-01 9.31185354e-01\n", + " 9.38945007e-01 9.35352960e-01 9.29885128e-01 9.55630226e-01\n", + " 9.59352574e-01 9.58961836e-01 9.55878779e-01 9.64685992e-01\n", + " 9.54832941e-01 9.47029745e-01 9.62756333e-01 9.61640515e-01\n", + " 9.52960179e-01 9.60807185e-01 9.65213205e-01 9.51425233e-01\n", + " 9.76838465e-01 9.49062309e-01 9.66835363e-01 9.66661785e-01\n", + " 9.57564942e-01 9.67163455e-01 9.80083730e-01 9.77524471e-01\n", + " 9.66365951e-01 9.63969268e-01 9.64499582e-01 9.63977189e-01\n", + " 9.71241072e-01 9.64355711e-01 9.71633251e-01 9.77993928e-01\n", + " 9.79972100e-01 9.77437835e-01 9.81939380e-01 9.81580420e-01\n", + " 9.86385900e-01 9.85458640e-01 9.85395334e-01 9.82938877e-01\n", + " 9.86362289e-01 9.86884824e-01 9.86350419e-01 9.88066060e-01\n", + " 9.84757327e-01 9.87380532e-01 9.90347617e-01 9.88151573e-01\n", + " 9.87325214e-01 9.89400589e-01]\n", + "0.9903476166323606\n" + ] + } + ], + "source": [ + "print(properties['age'])\n", + "print(len(properties['age'])) # ages of all cells: dead & alive\n", + "print(properties['zposn']) # nuclei position for all cells\n", + "zt = properties['zposn']\n", + "z0 = np.zeros_like(zt) # Return an array of zeros with the same shape and type as the nucl position array (all cells).\n", + "# G1\n", + "t_G1 = 0.4\n", + "G1_cells = np.where(properties['age'] <= t_G1)[0] # array with indices of G1 cells\n", + "print(G1_cells)\n", + "print(type(G1_cells))\n", + "print(len(G1_cells)) # 674 cells are in G1\n", + "G1_cells_ages = properties['age'][G1_cells]\n", + "print(G1_cells_ages)\n", + "z0[G1_cells] = 1-1.0/t_G1*G1_cells_ages\n", + "print((z0[G1_cells]))\n", + "print(max((z0[G1_cells])))\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 327, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 615 767 794 797 823 825 836 840 843 850 862 873 881 885\n", + " 888 891 897 899 926 935 936 950 956 969 970 972 973 975\n", + " 978 998 1003 1004 1009 1010 1014 1016 1025 1033 1036 1041 1047 1050\n", + " 1052 1056 1057 1059 1060 1066 1067 1070 1071 1073 1075 1077 1081 1082\n", + " 1087 1089 1090 1097 1102 1107 1108 1109 1114 1115 1116 1118 1126 1127\n", + " 1128 1129 1130 1132 1133 1134 1136 1141 1145 1146 1147 1149 1153 1155\n", + " 1160 1161 1162 1166 1167 1174 1177 1178 1179 1182 1184 1185 1188 1189\n", + " 1190 1191 1192 1193 1196 1198 1200 1201 1203 1204 1206 1207 1208 1209\n", + " 1212 1213 1214 1215 1216 1217 1218 1219 1220 1222 1223 1224 1225 1229\n", + " 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1241 1242 1243 1244\n", + " 1245 1248 1249 1250 1251 1252 1253 1255 1256 1257 1258 1259 1260 1261\n", + " 1262 1265 1266 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278\n", + " 1280 1281 1282 1283 1284 1285 1288 1289 1290 1291 1292 1295 1296 1297\n", + " 1298 1300 1301 1302 1304 1305 1306 1308 1310 1311 1312 1313 1314 1315\n", + " 1316 1317 1318 1319 1320 1321 1322 1323 1324 1326 1327 1328 1330 1331\n", + " 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1346\n", + " 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1361\n", + " 1362 1363 1364 1365 1367 1368 1369 1370 1371 1372 1373 1374 1375 1377\n", + " 1378 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392\n", + " 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406\n", + " 1407 1408 1410 1411 1412 1414 1415 1417 1418 1419 1420 1421 1422 1424\n", + " 1425 1426 1427 1428 1429 1430 1431 1432 1433 1435 1436 1438 1441 1442\n", + " 1443 1444 1446 1447 1448 1449 1451 1452 1453 1454 1455 1456 1457 1458\n", + " 1459 1461 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474\n", + " 1475 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1490 1491\n", + " 1492 1493 1494 1495 1497 1498 1499 1500 1501 1503 1504 1505 1506 1507\n", + " 1509 1510 1511 1512 1513 1514 1518 1519 1520 1521 1522 1523 1524 1525\n", + " 1526 1527 1528 1531 1534 1535 1536 1537 1538 1540 1541 1543 1546 1547\n", + " 1548 1550 1551 1552 1553 1554 1555 1556 1557 1560 1561 1562 1563 1564\n", + " 1568 1570 1571 1573 1574 1576 1577 1578 1580 1582 1583 1584 1585 1586\n", + " 1587 1588 1589 1591 1592 1594 1596 1597 1598 1601 1603 1604 1607 1608\n", + " 1610 1612 1616 1617 1618 1619 1621 1622 1624 1625 1627 1628 1630 1631\n", + " 1632 1633 1636 1638 1640 1641 1642 1643 1647 1648 1651 1652 1653 1655\n", + " 1656 1660 1667 1668 1674 1675 1676 1683 1685 1687 1688 1689 1699 1701\n", + " 1704 1707 1710 1713 1714 1717 1718 1730 1733 1740 1746 1787 1796]\n", + "\n", + "489\n", + "[0.64157361 0.65491811 0.41801418 0.68959252 0.49639229 0.63936217\n", + " 0.55910522 0.586693 0.63933327 0.70388555 0.52106527 0.67126684\n", + " 0.61647237 0.70463219 0.69183245 0.68445778 0.6489377 0.65001309\n", + " 0.70632512 0.71323456 0.51008442 0.56062304 0.69724646 0.61254586\n", + " 0.67811768 0.63970152 0.62671322 0.48118841 0.61081102 0.72464076\n", + " 0.65372371 0.66248867 0.52704712 0.7081486 0.61067973 0.60044476\n", + " 0.73327949 0.58065592 0.65710186 0.69311208 0.64471483 0.65104744\n", + " 0.5504001 0.6910737 0.65535844 0.7312306 0.63916483 0.54037477\n", + " 0.73155877 0.71348703 0.59106339 0.67204563 0.72476224 0.62877579\n", + " 0.66659493 0.67802069 0.62054771 0.66375947 0.70290508 0.68545518\n", + " 0.65099407 0.40843607 0.51289796 0.68052596 0.57412916 0.65625465\n", + " 0.63386932 0.64972225 0.70223209 0.71383394 0.63374535 0.6441953\n", + " 0.52224674 0.70655674 0.73241971 0.6239582 0.70625914 0.57104005\n", + " 0.59361139 0.62922427 0.5694332 0.71948007 0.73030373 0.54530872\n", + " 0.52988486 0.60884503 0.48105886 0.70733541 0.61750601 0.71624355\n", + " 0.73279592 0.71338867 0.73053115 0.40279438 0.71245826 0.55081207\n", + " 0.48135141 0.64958218 0.62262795 0.40727384 0.53841003 0.6023118\n", + " 0.59789139 0.57982195 0.57157939 0.64499238 0.73200756 0.61563812\n", + " 0.72897554 0.59165066 0.63724701 0.70879992 0.47534123 0.62395296\n", + " 0.66851555 0.64996851 0.61472163 0.52251732 0.50611525 0.54538742\n", + " 0.60330192 0.68909017 0.56559467 0.45736694 0.54429134 0.6198984\n", + " 0.65870911 0.72598965 0.6711842 0.64589289 0.64251744 0.67157181\n", + " 0.72798859 0.66419558 0.46610816 0.64296526 0.5429461 0.65793378\n", + " 0.71046293 0.67316972 0.68842301 0.59619167 0.68572971 0.72846281\n", + " 0.71034881 0.67846015 0.66298242 0.64656092 0.5809042 0.63017954\n", + " 0.58109001 0.42165972 0.4811979 0.64885034 0.61928588 0.70004535\n", + " 0.63830708 0.60702527 0.69093695 0.71630033 0.59546581 0.65786177\n", + " 0.70728129 0.5805037 0.6223076 0.55602069 0.59202277 0.52543244\n", + " 0.59085546 0.63829755 0.59283289 0.54557557 0.68209082 0.65163608\n", + " 0.71607632 0.57171332 0.59849291 0.66462129 0.61557157 0.56217237\n", + " 0.6307263 0.63675021 0.64142258 0.57818462 0.56239586 0.61674848\n", + " 0.4977424 0.61359711 0.64817978 0.53066583 0.71020324 0.60904467\n", + " 0.52680677 0.58291482 0.53026002 0.58787992 0.62962954 0.66990019\n", + " 0.69245025 0.71999744 0.620965 0.71701571 0.57700372 0.60952981\n", + " 0.62009741 0.53029047 0.56652652 0.6773378 0.55996372 0.64656006\n", + " 0.63206428 0.6540212 0.56641032 0.66312805 0.50737934 0.68638448\n", + " 0.57321374 0.43854311 0.72545405 0.45094224 0.53781127 0.42090587\n", + " 0.66409626 0.48948869 0.54036662 0.68751399 0.59109035 0.5165423\n", + " 0.46335106 0.53945223 0.59943671 0.47012878 0.40117567 0.6091697\n", + " 0.61452748 0.53673484 0.70828835 0.6432291 0.5847587 0.54050628\n", + " 0.50567587 0.60216736 0.59904018 0.57671619 0.72557384 0.7019895\n", + " 0.68039466 0.49238469 0.48038667 0.60270654 0.60491563 0.66526348\n", + " 0.49780421 0.57333072 0.54312235 0.69134596 0.61139929 0.69364436\n", + " 0.62437134 0.49149508 0.53378429 0.60015689 0.60240739 0.55366172\n", + " 0.56929644 0.54385027 0.62290503 0.53933917 0.52347534 0.51962715\n", + " 0.71407567 0.5718649 0.66161948 0.59806726 0.66818359 0.56516576\n", + " 0.51264332 0.57661897 0.54974964 0.5833369 0.48550926 0.47839636\n", + " 0.62578715 0.48432571 0.41791854 0.45120535 0.72305495 0.64317898\n", + " 0.61921408 0.54009816 0.50405943 0.61031122 0.51428604 0.65107774\n", + " 0.45634068 0.51491099 0.54363172 0.50979736 0.53561169 0.41093875\n", + " 0.51086893 0.64822512 0.65222833 0.58386474 0.44818663 0.72712454\n", + " 0.64013684 0.55948713 0.49525375 0.56889011 0.45707875 0.60572589\n", + " 0.52112289 0.50860086 0.66021002 0.54403257 0.59089118 0.5025572\n", + " 0.64220697 0.51990217 0.5277887 0.47586873 0.53154907 0.66718594\n", + " 0.61461014 0.57194755 0.52621507 0.43894311 0.6735714 0.50237919\n", + " 0.60579838 0.55898339 0.54221184 0.54332144 0.43564715 0.48317643\n", + " 0.59151559 0.49717159 0.42539352 0.47672573 0.44020729 0.44133066\n", + " 0.59327228 0.59425881 0.5604871 0.40771564 0.4540139 0.61698284\n", + " 0.51225501 0.59011075 0.51258955 0.67690058 0.48352239 0.50049437\n", + " 0.52133525 0.55635466 0.50675487 0.46092059 0.4368103 0.57280962\n", + " 0.51077845 0.65543689 0.5741646 0.40612087 0.41957489 0.59570865\n", + " 0.53787294 0.46327724 0.56371404 0.4786888 0.50440314 0.47434323\n", + " 0.73211992 0.56363612 0.4349859 0.48328523 0.41816252 0.40493663\n", + " 0.56606117 0.44578127 0.44743403 0.41574492 0.50876731 0.61999593\n", + " 0.42712775 0.57460968 0.46366478 0.55830078 0.45453358 0.49267633\n", + " 0.43392311 0.47926951 0.40830024 0.46884177 0.56097121 0.49402874\n", + " 0.44756177 0.43830587 0.49432922 0.48203058 0.69960473 0.59031056\n", + " 0.40262995 0.46208044 0.42624395 0.40440125 0.44861967 0.48370675\n", + " 0.49687656 0.47137563 0.4208225 0.46431989 0.40338142 0.45137471\n", + " 0.40528925 0.48654929 0.52594616 0.42752294 0.46608097 0.49982583\n", + " 0.47474779 0.59867938 0.64487241 0.43300995 0.41248015 0.44662595\n", + " 0.4083111 0.46890053 0.43326265 0.48760209 0.47161883 0.43644639\n", + " 0.40688056 0.48265327 0.57705047 0.42594954 0.4287506 0.44853951\n", + " 0.51840912 0.47042074 0.46208992 0.46558858 0.4337064 0.50226599\n", + " 0.45104209 0.4470574 0.42291391 0.49383839 0.46781948 0.47615685\n", + " 0.43879399 0.54647011 0.51160176 0.49771417 0.43074936 0.52318615\n", + " 0.43716879 0.42828944 0.41026915 0.44857098 0.44639464 0.47814469\n", + " 0.53687999 0.53628365 0.49038061 0.43217923 0.47035978 0.47336243\n", + " 0.4329382 0.4097164 0.47372478 0.47661498 0.52997761 0.41356427\n", + " 0.43043039 0.46092853 0.42734881 0.40780353 0.41206249 0.41103665\n", + " 0.40475425 0.44149503 0.50805282 0.40657365 0.43051399 0.48507318\n", + " 0.4231975 0.40301852 0.41184107]\n" + ] + } + ], + "source": [ + "# S\n", + "S_cells = np.where((t_G1 < properties['age']) & (properties['age'] <= t_G1+t_S))[0] # array with indices of S cells\n", + "print(S_cells)\n", + "print(type(S_cells))\n", + "print(len(S_cells)) # 489 cells are in S\n", + "S_cells_ages = properties['age'][S_cells]\n", + "print(S_cells_ages)\n", + "z0[S_cells] = 0.0 # positions of S cells\n" + ] + }, + { + "cell_type": "code", + "execution_count": 330, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 485 503 531 547 644 657 705 724 757 765 771 777 778 781\n", + " 799 801 812 821 824 834 841 845 847 863 865 871 874 876\n", + " 878 880 882 883 886 894 898 901 907 912 914 916 927 929\n", + " 931 934 938 939 942 943 947 948 951 954 957 961 962 964\n", + " 966 974 980 981 983 987 989 990 992 993 994 995 996 1001\n", + " 1005 1006 1011 1012 1017 1018 1019 1020 1023 1024 1027 1031 1032 1035\n", + " 1037 1038 1039 1040 1044 1045 1046 1048 1051 1053 1055 1058 1061 1063\n", + " 1064 1068 1069 1072 1076 1079 1080 1084 1085 1086 1088 1091 1092 1093\n", + " 1099 1100 1103 1104 1106 1110 1112 1113 1119 1121 1122 1125 1131 1137\n", + " 1139 1142 1143 1148 1150 1151 1154 1156 1157 1158 1159 1164 1165 1168\n", + " 1170 1172 1173 1175 1180 1181 1187 1194 1199 1202 1205 1210 1211 1221\n", + " 1226 1227 1228 1240 1246 1247 1254 1263 1264 1267 1279 1286 1287 1293\n", + " 1294 1303 1307 1309 1325 1329 1345 1360 1366 1376 1379 1423 1440 1476]\n", + "\n", + "182\n", + "[0.82901339 0.89161993 0.82629799 0.87000095 0.89248013 0.73728592\n", + " 0.79415605 0.86828026 0.86508464 0.75459108 0.82149574 0.74572376\n", + " 0.76388786 0.84371072 0.88855764 0.86559633 0.87365401 0.78905901\n", + " 0.7445525 0.89782485 0.83650063 0.83031165 0.82605319 0.86961583\n", + " 0.85720151 0.8360214 0.89737405 0.88232912 0.88616699 0.83453145\n", + " 0.84885615 0.77293974 0.86927832 0.75456081 0.87775318 0.84261326\n", + " 0.80765903 0.77504581 0.83460928 0.88540981 0.80079319 0.82498291\n", + " 0.8242084 0.8090536 0.86464023 0.76233723 0.85784392 0.75242994\n", + " 0.86284909 0.89237556 0.87045416 0.86889381 0.88377943 0.73919557\n", + " 0.8718014 0.82622778 0.78397213 0.79761281 0.86328453 0.89823878\n", + " 0.76793363 0.82432058 0.76505399 0.76905209 0.8635099 0.82372687\n", + " 0.80116299 0.7959263 0.83553813 0.7871669 0.87999738 0.79396342\n", + " 0.85011634 0.87275604 0.82588273 0.8650302 0.84973194 0.87647789\n", + " 0.79801604 0.82143478 0.77185079 0.82558209 0.78214264 0.75728689\n", + " 0.86254607 0.7624457 0.75326466 0.88954745 0.88577562 0.86987876\n", + " 0.8365247 0.89883435 0.8077233 0.89247586 0.80559534 0.84385428\n", + " 0.81841414 0.78006178 0.82297827 0.88471836 0.76267324 0.74420216\n", + " 0.8346765 0.84488461 0.8891258 0.84742891 0.76383173 0.73719951\n", + " 0.81500546 0.88111505 0.89567196 0.7460369 0.88110483 0.78749294\n", + " 0.85297279 0.85659824 0.83517785 0.78808273 0.82355308 0.81794391\n", + " 0.76973913 0.75176593 0.81296508 0.78303833 0.75889729 0.75518761\n", + " 0.7496409 0.84745271 0.81928656 0.76189649 0.88925804 0.77406102\n", + " 0.84532186 0.7568031 0.87896916 0.8858597 0.84459528 0.85816321\n", + " 0.89871947 0.73558088 0.79870787 0.75505686 0.76128689 0.85374951\n", + " 0.82751112 0.85731753 0.84919586 0.83540719 0.80246903 0.84050576\n", + " 0.85795994 0.75272696 0.78461014 0.86769768 0.77289034 0.76632912\n", + " 0.7808672 0.79881748 0.75423576 0.77803525 0.75006416 0.73533747\n", + " 0.74915373 0.73541664 0.77642663 0.81729561 0.77295319 0.79197296\n", + " 0.81813976 0.79021949 0.79803653 0.82510471 0.77254396 0.7607412\n", + " 0.76087598 0.7356409 0.73787185 0.79057345 0.82968253 0.73552341\n", + " 0.75572487 0.74522678]\n", + "[0.57408034 0.94971957 0.55778791 0.82000569 0.95488081 0.0237155\n", + " 0.36493627 0.80968153 0.79050784 0.1275465 0.52897446 0.07434258\n", + " 0.18332718 0.66226435 0.93134583 0.79357796 0.84192408 0.33435407\n", + " 0.06731501 0.98694912 0.6190038 0.5818699 0.55631916 0.81769495\n", + " 0.74320907 0.61612839 0.98424428 0.89397473 0.91700195 0.60718873\n", + " 0.6931369 0.23763841 0.81566989 0.12736489 0.86651909 0.65567956\n", + " 0.44595421 0.25027487 0.60765571 0.91245887 0.40475911 0.54989745\n", + " 0.54525041 0.45432158 0.78784137 0.1740234 0.74706352 0.11457967\n", + " 0.77709455 0.95425337 0.82272497 0.81336289 0.9026766 0.03517344\n", + " 0.8308084 0.55736666 0.3038328 0.38567684 0.77970721 0.98943268\n", + " 0.20760177 0.54592348 0.19032391 0.21431256 0.78105937 0.54236125\n", + " 0.40697797 0.37555778 0.61322877 0.32300141 0.87998426 0.36378051\n", + " 0.70069802 0.83653621 0.55529638 0.79018117 0.69839166 0.85886732\n", + " 0.38809626 0.52860866 0.23110471 0.55349252 0.29285585 0.14372137\n", + " 0.77527644 0.17467421 0.11958795 0.93728473 0.91465374 0.81927255\n", + " 0.61914819 0.99300609 0.44633977 0.95485515 0.43357205 0.66312565\n", + " 0.51048484 0.28037069 0.53786964 0.90831013 0.17603947 0.06521297\n", + " 0.60805902 0.66930767 0.93475483 0.68457343 0.18299036 0.02319708\n", + " 0.49003273 0.8866903 0.97403178 0.0762214 0.88662896 0.32495761\n", + " 0.71783676 0.73958947 0.61106707 0.32849636 0.54131849 0.50766348\n", + " 0.21843475 0.11059558 0.47779045 0.29822998 0.15338377 0.13112565\n", + " 0.09784537 0.68471628 0.51571938 0.17137892 0.93554821 0.2443661\n", + " 0.67193115 0.1408186 0.87381495 0.91515819 0.66757165 0.74897923\n", + " 0.99231684 0.0134853 0.39224724 0.13034116 0.16772135 0.72249705\n", + " 0.56506675 0.74390516 0.69517513 0.61244315 0.41481416 0.64303458\n", + " 0.74775964 0.11636175 0.30766085 0.80618609 0.23734202 0.19797471\n", + " 0.28520319 0.39290487 0.12541453 0.26821147 0.10038494 0.01202485\n", + " 0.09492236 0.01249985 0.25855976 0.50377367 0.23771913 0.35183775\n", + " 0.50883857 0.34131695 0.3882192 0.55062825 0.23526373 0.16444723\n", + " 0.16525591 0.01384541 0.02723113 0.34344073 0.57809517 0.01314044\n", + " 0.13434922 0.07136066]\n" + ] + } + ], + "source": [ + "# G2\n", + "G2_cells = np.where((t_G1+t_S < properties['age']) & (properties['age'] <= t_G1+t_S+t_G2))[0] # array with indices of G2 cells\n", + "print(G2_cells)\n", + "print(type(G2_cells))\n", + "print(len(G2_cells)) # 182 cells are in G2\n", + "G2_cells_ages = properties['age'][G2_cells]\n", + "print(G2_cells_ages)\n", + "z0[G2_cells] = 1.0/(t_G2)*(G2_cells_ages-(t_G1+t_S)) # positions of G2 cells\n", + "print((z0[G2_cells]))" + ] + }, + { + "cell_type": "code", + "execution_count": 331, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n", + " 14 15 16 17 18 19 20 21 22 23 24 25 26 27\n", + " 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n", + " 42 43 44 45 46 47 48 49 50 51 52 53 54 55\n", + " 56 57 58 59 60 61 62 63 64 65 66 67 68 69\n", + " 70 71 72 73 74 75 76 77 78 79 80 81 82 83\n", + " 84 85 86 87 88 89 90 91 92 93 94 95 96 97\n", + " 98 99 100 101 102 103 104 105 106 107 108 109 110 111\n", + " 112 113 114 115 116 117 118 119 120 121 122 123 124 125\n", + " 126 127 128 129 130 131 132 133 134 135 136 137 138 139\n", + " 140 141 142 143 144 145 146 147 148 149 150 151 152 153\n", + " 154 155 156 157 158 159 160 161 162 163 164 165 166 167\n", + " 168 169 170 171 172 173 174 175 176 177 178 179 180 181\n", + " 182 183 184 185 186 187 188 189 190 191 192 193 194 195\n", + " 196 197 198 199 200 201 202 203 204 205 206 207 208 209\n", + " 210 211 212 213 214 215 216 217 218 219 220 221 222 223\n", + " 224 225 226 227 228 229 230 231 232 233 234 235 236 237\n", + " 238 239 240 241 242 243 244 245 246 247 248 249 250 251\n", + " 252 253 254 255 256 257 258 259 260 261 262 263 264 265\n", + " 266 267 268 269 270 271 272 273 274 275 276 277 278 279\n", + " 280 281 282 283 284 285 286 287 288 289 290 291 292 293\n", + " 294 295 296 297 298 299 300 301 302 303 304 305 306 307\n", + " 308 309 310 311 312 313 314 315 316 317 318 319 320 321\n", + " 322 323 324 325 326 327 328 329 330 331 332 333 334 335\n", + " 336 337 338 339 340 341 342 343 344 345 346 347 348 349\n", + " 350 351 352 353 354 355 356 357 358 359 360 361 362 363\n", + " 364 365 366 367 368 369 370 371 372 373 374 375 376 377\n", + " 378 379 380 381 382 383 384 385 386 387 388 389 390 391\n", + " 392 393 394 395 396 397 398 399 400 401 402 403 404 405\n", + " 406 407 408 409 410 411 412 413 414 415 416 417 418 419\n", + " 420 421 422 423 424 425 426 427 428 429 430 431 432 433\n", + " 434 435 436 437 438 439 440 441 442 443 444 445 446 447\n", + " 448 449 450 451 452 453 454 455 456 457 458 459 460 461\n", + " 462 463 464 465 466 467 468 469 470 471 472 473 474 475\n", + " 476 477 478 479 480 481 482 483 484 486 487 488 489 490\n", + " 491 492 493 494 495 496 497 498 499 500 501 502 504 505\n", + " 506 507 508 509 510 511 512 513 514 515 516 517 518 519\n", + " 520 521 522 523 524 525 526 527 528 529 530 532 533 534\n", + " 535 536 537 538 539 540 541 542 543 544 545 546 548 549\n", + " 550 551 552 553 554 555 556 557 558 559 560 561 562 563\n", + " 564 565 566 567 568 569 570 571 572 573 574 575 576 577\n", + " 578 579 580 581 582 583 584 585 586 587 588 589 590 591\n", + " 592 593 594 595 596 597 598 599 600 601 602 603 604 605\n", + " 606 607 608 610 611 612 613 614 616 617 618 619 620 621\n", + " 622 623 624 625 626 627 628 629 630 631 632 633 634 635\n", + " 636 637 638 639 640 641 642 643 645 646 647 648 649 650\n", + " 651 652 653 654 655 656 658 659 660 661 662 663 664 665\n", + " 666 667 668 669 670 671 672 673 674 675 676 677 678 679\n", + " 680 681 682 683 684 685 686 687 688 689 690 691 692 693\n", + " 694 695 696 697 698 699 700 701 702 703 704 706 707 708\n", + " 709 710 711 712 713 714 715 716 717 718 719 720 721 722\n", + " 723 725 726 727 728 729 730 731 732 733 734 735 736 737\n", + " 738 739 740 741 742 743 744 745 746 747 748 749 750 751\n", + " 752 753 754 755 756 758 759 760 761 762 763 764 766 768\n", + " 769 770 772 773 774 775 776 779 780 782 783 784 785 786\n", + " 787 788 789 790 791 792 793 795 796 798 800 802 803 804\n", + " 805 806 807 808 809 810 811 813 814 815 816 817 818 819\n", + " 820 822 826 827 828 829 830 831 832 833 835 837 838 839\n", + " 842 844 846 848 849 851 852 853 854 855 856 857 858 859\n", + " 860 861 864 866 867 868 869 870 872 875 877 879 884 887\n", + " 889 890 892 893 895 896 900 902 903 904 905 906 908 909\n", + " 910 911 913 915 917 918 919 920 921 922 923 924 925 928\n", + " 930 932 933 937 940 941 944 945 946 949 952 953 955 958\n", + " 959 960 963 965 967 968 971 976 977 979 982 984 985 986\n", + " 988 991 997 999 1000 1002 1007 1008 1013 1015 1021 1022 1026 1028\n", + " 1029 1030 1034 1042 1043 1049 1054 1062 1065 1074 1078 1083 1094 1095\n", + " 1096 1098 1105 1111 1117 1120 1123 1124 1135 1138 1140 1144 1152 1163\n", + " 1169 1176 1183 1195 1197 1299 1445]\n", + "\n", + "945\n", + "[1.1860919 1.14153715 2.16681666 2.04981878 1.73184128 1.71648175\n", + " 1.50167215 2.6257762 1.78875474 2.49558978 2.1001639 1.39980438\n", + " 1.66180575 1.89060653 2.39091449 2.10535272 1.79147374 2.43390018\n", + " 1.73070771 2.03201491 2.26548838 2.61873933 2.54661718 1.69873762\n", + " 1.41202377 2.26943045 2.73825392 1.2024061 2.35055735 1.91767891\n", + " 2.85451523 1.94810853 1.84681487 2.28062055 1.65560539 1.88714669\n", + " 1.58812765 2.75033481 1.46055128 2.46241812 2.35820753 1.89079988\n", + " 1.38033135 1.73025007 2.1683106 1.94144102 2.14868164 1.7546208\n", + " 2.83022029 2.19019055 2.64832962 2.60988708 1.96742181 2.50929591\n", + " 2.44276459 1.44777203 1.58449774 1.42211135 2.64793283 2.03108876\n", + " 2.14039025 1.99870178 1.77205857 2.46957391 1.6056836 1.65161524\n", + " 2.34945239 1.78149224 1.55097222 1.89772837 1.38193979 1.92752593\n", + " 1.9496499 2.20218036 1.64671502 2.0007799 1.52892913 2.19744656\n", + " 2.61206394 2.34455743 1.47286999 1.83169469 1.46252587 2.02457902\n", + " 1.8620471 1.8253994 1.582726 1.75436161 2.30615504 2.00669061\n", + " 1.95551723 1.4202963 1.73214109 2.52638438 1.96773163 2.30399182\n", + " 2.27887358 2.10079124 1.15792855 2.20304317 1.48273198 1.44223388\n", + " 2.56945754 1.52573175 1.97033494 2.58819743 2.46802509 2.87813033\n", + " 2.27688659 1.75692723 2.44524467 2.03239835 2.76539667 1.85986457\n", + " 1.84935003 2.48020792 2.21324274 1.66316883 2.48841102 1.95944786\n", + " 1.28908892 1.50698772 1.47950752 2.7961051 2.47636943 1.95498582\n", + " 2.28809671 1.84988158 2.23950794 2.06337441 1.57092449 3.13993562\n", + " 1.25003528 1.59857181 1.71027938 1.52813841 1.93607395 1.9627457\n", + " 1.75212635 2.70208141 2.15117672 2.31784446 2.38773604 2.04701505\n", + " 2.22614629 2.31742681 2.87828218 1.89468008 1.16303267 1.77636721\n", + " 1.81555714 2.20229112 1.68402748 2.73393018 1.90909466 2.24802724\n", + " 2.12085259 1.90006919 2.1103341 1.54232477 1.70735272 2.27475905\n", + " 1.43052086 1.13438576 1.94548022 1.87850025 2.39840514 1.6584663\n", + " 2.02853165 1.37121454 2.01069196 1.90362203 2.4856732 1.90845442\n", + " 2.60632574 1.58434169 2.18708109 1.81582762 2.2409878 2.20410457\n", + " 2.57701211 2.09912609 1.3626399 2.01873346 2.13658829 1.69588286\n", + " 1.92827177 1.56986945 2.40079096 2.53094951 1.52786351 1.73667635\n", + " 1.41377018 1.73604147 1.9128042 2.25798521 1.43179372 2.816934\n", + " 1.23494014 1.65277584 2.51143012 1.67848049 2.04757327 2.51707142\n", + " 2.44285806 2.43778503 1.63190658 1.15384123 1.28156811 1.59673761\n", + " 1.943903 2.31906668 2.06186536 1.84167138 2.03191474 1.77285651\n", + " 1.85121974 1.30412195 1.80181497 2.40345528 1.57627711 2.63996699\n", + " 2.07379917 2.22905073 1.61129584 2.33137491 1.91887529 1.62476858\n", + " 2.2609948 1.82861366 1.67416319 1.6795694 1.37507265 2.49278783\n", + " 2.26413599 1.95213694 1.76892932 1.44724093 2.08216618 2.69362321\n", + " 1.97775958 2.23485813 2.05605517 1.43010576 1.31465011 2.10953258\n", + " 2.03003777 2.1048712 2.1138801 1.98642388 1.73468465 2.07326402\n", + " 1.94583318 2.06978691 2.09596708 1.28166667 1.95556484 2.15399468\n", + " 2.69910054 1.84589021 1.96761425 2.12719999 1.46685626 1.42935403\n", + " 2.42931481 1.86578215 1.39804228 1.81078058 2.58028305 2.1371919\n", + " 1.58847452 2.3157295 1.97810574 1.84416887 2.24642593 1.16107008\n", + " 1.97255963 1.26412457 1.87098558 2.04187154 2.34966816 2.21308496\n", + " 2.26537876 1.88831557 1.96971706 1.49083686 1.97428327 1.76259275\n", + " 1.57511615 2.16269352 2.13600817 2.07307108 2.05193429 2.22076104\n", + " 1.82903336 1.53733329 2.51573092 2.27041129 2.42669729 1.79702617\n", + " 1.80702633 1.81473518 1.55505629 1.73681302 1.78894981 2.32807191\n", + " 2.27932594 1.37347297 2.40388893 2.26493945 1.55583796 1.65404898\n", + " 2.13131701 2.43692315 1.71346482 1.83497374 1.90509019 1.35465267\n", + " 2.65079309 1.87606407 1.38114378 2.40013052 1.96584846 1.36475883\n", + " 1.90857261 1.15306087 2.80559327 2.25927992 1.81552566 1.96581043\n", + " 2.26954834 1.34181298 2.24874535 1.69600101 2.44724501 1.55184548\n", + " 1.92297046 1.6911278 2.55820172 1.23879968 1.81470213 1.51498996\n", + " 1.6756158 2.24344343 1.636981 2.31946721 1.98156391 2.32105374\n", + " 1.64928784 2.60316383 1.36809438 1.61309519 2.00668847 1.54593591\n", + " 2.4372853 2.27164856 1.46168226 2.11473571 1.99120447 1.65633632\n", + " 2.40451839 2.40561996 1.71934674 2.34346792 1.81573068 1.60574714\n", + " 2.20320333 2.24437363 2.01160845 2.26553105 1.90706038 2.52761598\n", + " 0.93016147 1.803196 1.89594201 2.33924274 2.03257129 1.76625114\n", + " 2.25424956 2.7689652 1.65634663 1.39642528 1.98180579 2.54732936\n", + " 1.49403075 2.61095011 1.42539065 2.45429654 1.49340851 1.86324302\n", + " 2.2867585 1.88230478 2.10870437 1.35782941 1.91206648 2.51374964\n", + " 2.24712435 2.48650584 1.79356697 1.47914613 1.73105511 1.59860578\n", + " 1.59086575 2.04881236 1.37538451 1.81242976 1.36754184 1.23302371\n", + " 1.64487959 1.51442275 1.09169769 2.14597292 1.95627451 1.52024039\n", + " 1.40617327 1.75754404 1.78834192 1.60822777 1.68294557 1.26239883\n", + " 1.96020044 1.36470406 2.17031135 1.86741201 1.58002837 1.29337349\n", + " 1.955406 1.30078544 1.72774581 1.24873299 1.8367559 1.26640066\n", + " 2.20019571 1.17826552 1.6040806 1.28537016 1.45749361 1.76188824\n", + " 1.39735499 1.1078894 1.82287559 1.62050377 1.58912414 1.23788237\n", + " 1.3986484 1.71773441 1.80236385 1.3844363 1.65228656 0.96991435\n", + " 1.32582386 2.23983889 1.04305609 1.61074629 1.29203517 1.15919079\n", + " 1.54914037 1.22853044 1.01782859 1.85174935 1.7007828 0.93225312\n", + " 1.87665319 1.36547542 1.79881452 1.49885169 0.97695938 0.95791659\n", + " 1.47891118 1.54684848 1.06754586 1.35427479 1.78109928 1.48154687\n", + " 1.59334904 1.64438949 1.67573965 1.78408837 1.62662183 1.78008379\n", + " 1.56613633 1.45058783 1.74454496 1.22016079 1.38015025 1.71450396\n", + " 1.78975896 1.53361345 1.45094243 1.17646099 1.22687719 1.19203994\n", + " 2.34777764 1.72694682 1.68680342 1.87510411 1.44142194 1.05859432\n", + " 1.50493591 1.06921335 1.93497548 1.77644766 1.14979663 0.99810168\n", + " 1.90328121 1.39345314 1.32155159 1.53170175 1.69291344 1.75672662\n", + " 1.45978407 1.19809784 1.43733194 1.30298952 1.50926773 1.55632312\n", + " 1.35610828 1.35093249 1.482962 1.44547834 1.63420462 1.37700902\n", + " 1.72794108 1.88730706 1.45275449 1.19732295 1.15473918 1.75273807\n", + " 1.43891946 1.41044979 1.9051418 1.32622926 1.63989795 1.29345294\n", + " 1.71226483 1.56979227 1.29458118 1.37871868 1.48746015 1.56185905\n", + " 1.72015066 1.39721176 1.12701494 1.59491491 1.32773643 1.78918838\n", + " 1.54571671 1.55923361 1.75824852 1.29650204 1.12444587 1.63938108\n", + " 1.41896396 1.12468865 1.1933233 1.3970692 1.32661388 1.53130444\n", + " 1.55276687 1.73790978 2.08672053 1.53635892 0.92512458 1.14521857\n", + " 1.58067255 1.62697736 1.789677 1.37587812 1.39003339 1.24769417\n", + " 1.59850451 1.18494768 1.18053315 1.26812934 1.16146694 1.37128347\n", + " 1.93987792 0.98933931 1.67013322 1.64984817 1.30749502 1.41473172\n", + " 1.44635384 1.68008251 1.67507403 1.03354909 1.59503824 1.38519162\n", + " 1.62273039 1.03458671 1.48165155 1.83032065 1.39228245 1.44869008\n", + " 1.76824713 1.58752747 1.2571288 1.40508977 1.39888823 1.34607523\n", + " 1.30359927 1.502199 1.67821655 1.34724476 1.48655908 1.29326725\n", + " 1.04264632 1.05042666 1.29392628 0.95263259 1.75111197 1.51163044\n", + " 1.33893688 1.96532681 1.2149457 1.25220936 1.27588907 1.22806968\n", + " 1.65162757 0.95686464 1.34832144 1.45697748 1.38006519 1.21725685\n", + " 1.50920798 1.37854552 1.21146265 1.64885998 1.67624561 1.26975152\n", + " 1.33895962 0.93928113 1.52409211 1.60046147 1.00499127 1.00929712\n", + " 1.52868807 1.39518587 1.31297673 1.33355074 1.71395356 1.04254141\n", + " 1.35020322 1.19616177 0.95899741 1.27963139 1.02090287 0.99185789\n", + " 1.40611803 1.32081946 1.20347984 1.11810126 1.164127 1.17436267\n", + " 1.39617651 0.95239548 1.06140652 1.22410584 1.12783031 1.17447911\n", + " 1.30843965 1.38838227 1.13014213 1.01027531 1.17864122 0.91797286\n", + " 1.60432165 1.08842403 0.9778952 0.93883238 1.58407296 0.90388142\n", + " 1.56749408 1.40724067 1.2199559 0.90470574 1.36007748 1.56217047\n", + " 1.03223305 1.28694358 1.34585291 1.793469 1.29900582 1.38688588\n", + " 1.11069406 1.24763128 1.22320278 1.17205197 1.0225747 1.6751018\n", + " 1.19661177 1.13511606 1.1019887 1.40088483 1.00974372 1.55531378\n", + " 1.23415472 1.22016291 1.5960633 1.13789636 1.56216882 1.22685925\n", + " 1.2926533 1.03897539 1.18367816 1.3760799 1.32453062 1.31293193\n", + " 1.23193527 1.02655689 1.25868014 1.01948978 1.17932332 1.24435627\n", + " 1.0166485 1.12050482 1.35865182 1.47095345 1.15019096 1.30194275\n", + " 1.19318665 1.70101754 1.12434756 1.16144536 1.37691047 0.98470929\n", + " 1.08409664 1.27132128 0.93987782 1.19263396 1.21982002 1.24265058\n", + " 1.03782543 1.54549977 1.18371288 1.28184627 1.56565221 1.41175843\n", + " 1.00392297 1.33461392 1.47467681 1.28817901 1.10090858 1.04606496\n", + " 1.18211829 1.586033 1.16710554 1.26004347 1.17812255 1.2924456\n", + " 1.33815624 1.12422508 1.22977921 1.10869474 1.34574822 1.12346628\n", + " 1.37436683 0.99020364 1.17206077 1.28110731 1.62113993 1.08110723\n", + " 1.23083834 1.25481872 1.3539839 1.39736346 1.18840727 1.27725926\n", + " 1.00912096 1.27388851 1.27125251 1.00810059 1.28572167 1.57717028\n", + " 1.52978721 1.28995802 1.2505387 1.46394334 1.0854736 0.96149988\n", + " 1.18877854 0.94582302 1.01944969 0.98545656 1.23013408 1.18806152\n", + " 1.3059518 1.36020526 1.03724257 1.11526838 0.99048185 1.1645997\n", + " 1.17532249 0.93692764 1.16326594 1.09377019 1.11187516 1.0708349\n", + " 1.13677877 0.96951207 0.91289917 1.24778409 1.20741262 1.12859191\n", + " 1.19211667 1.23099541 1.23915858 1.4394739 1.06131466 1.08137445\n", + " 0.91855719 1.00127962 1.53388937 1.17789723 0.93270232 1.13274631\n", + " 1.00299986 0.92167498 1.2106213 1.23789056 1.17665218 1.39933916\n", + " 1.11341429 1.29632787 1.03864046 1.17011022 0.99847583 1.2498586\n", + " 1.10075178 1.07711087 1.02706495 1.15517094 1.27100986 0.90428115\n", + " 1.25343505 1.32911957 1.42282041 1.14872872 0.99799331 0.99977644\n", + " 1.11194166 1.00393357 0.92846366 1.10775539 0.97992403 1.13265052\n", + " 1.05343769 1.33729094 1.47603725 0.93585522 1.16586984 1.34869159\n", + " 1.16319627 0.96822923 1.02670024 1.13206704 1.14838447 1.05920801\n", + " 0.97073265 1.11975561 0.98943654 0.91780637 1.16890762 1.09469601\n", + " 0.91149094 1.02323664 1.25444034 1.06830607 0.9685538 1.06880242\n", + " 1.06648679 0.97393984 0.97951401 1.14207976 1.0960185 0.91940946\n", + " 0.99839281 1.14986697 1.07255103 1.00220374 0.91197208 1.00310017\n", + " 0.91258214 1.01168928 0.95000432 0.93411367 1.10872442 0.91199046\n", + " 1.07541065 0.91524212 1.09662369 1.00130604 1.02966338 1.0379946\n", + " 0.96970324 1.17831638 1.16385011 1.06809679 0.90703774 0.92106144\n", + " 1.04375155 0.90438278 0.94190914 0.9420395 0.93615391 1.26805752\n", + " 0.97802556 1.01487766 0.99996733 0.93121446 0.90786988 0.9298889\n", + " 1.1000198 0.93840834 1.02629978 1.03989848 1.00252848 0.9230886\n", + " 0.91010948 0.91455221 1.02439499 0.9770818 0.97191525 0.91966414\n", + " 1.02702306 0.94856066 1.01641001 0.96678212 0.91803703 0.92865841\n", + " 0.9417082 0.92937497 1.01520805 0.92071509 0.90534758 0.92992541\n", + " 0.92961539 1.08649236 0.97715827 0.9590542 1.00617838 1.03207672\n", + " 0.95926328 0.90643078 0.9458933 ]\n" + ] + } + ], + "source": [ + "# M\n", + "M_cells = np.where(properties['age'] > t_G1+t_S+t_G2)[0] # array with indices of M cells\n", + "print(M_cells)\n", + "print(type(M_cells))\n", + "print(len(M_cells)) # 945 cells are in M\n", + "M_cells_ages = properties['age'][M_cells]\n", + "print(M_cells_ages)\n", + "z0[M_cells] = 1.0 # position of M cells\n", + "\n" + ] + }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "HTML(anim.to_html5_video())" + "# All cell cycle phases - target positions calculations\n", + "\n", + "zt = properties['zposn']\n", + "z0 = np.zeros_like(zt) # Return an array of zeros with the same shape and type as the nucl position array (all cells).\n", + "\n", + "# G1\n", + "G1_cells = np.where(properties['age'] <= t_G1)[0] # array with indices of G1 cells\n", + "print(len(G1_cells)) # 674 cells are in G1\n", + "G1_cells_ages = properties['age'][G1_cells]\n", + "z0[G1_cells] = 1-1.0/t_G1*G1_cells_ages\n", + "\n", + "\n", + "# S\n", + "S_cells = np.where((t_G1 < properties['age']) & (properties['age'] <= t_G1+t_S))[0] # array with indices of S cells\n", + "print(len(S_cells)) # 489 cells are in S\n", + "S_cells_ages = properties['age'][S_cells]\n", + "z0[S_cells] = 0.0 # positions of S cells\n", + "\n", + "\n", + "# G2\n", + "G2_cells = np.where((t_G1+t_S < properties['age']) & (properties['age'] <= t_G1+t_S+t_G2))[0] # array with indices of G2 cells\n", + "print(len(G2_cells)) # 182 cells are in G2\n", + "G2_cells_ages = properties['age'][G2_cells]\n", + "z0[G2_cells] = 1.0/(t_G2)*(G2_cells_ages-(t_G1+t_S)) # positions of G2 cells\n", + "\n", + "# M\n", + "M_cells = np.where(properties['age'] > t_G1+t_S+t_G2)[0] # array with indices of M cells\n", + "print(len(M_cells)) # 945 cells are in M\n", + "M_cells_ages = properties['age'][M_cells]\n", + "z0[M_cells] = 1.0 # position of M cells\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 339, + "metadata": {}, + "outputs": [], + "source": [ + "# Calculate zt = current position of the nucleus by adding noise to target position\n", + "zt = properties['zposn']\n", + "D=0.15\n", + "k = 0.015 # a constant\n", + "timend=300 # length of simulation\n", + "\n", + "dt = 0.001\n", + "for t in np.arange(0, timend, dt):\n", + " zt = zt + k*(z0 - zt)*dt + np.sqrt(2*D*dt)*np.random.randn(len(zt))\n", + "\n", + "# Define mean position neighbors:\n", + "# cell has min 3 neighbors\n", + "# Define neighbors: neighbors = cells whose 2 of their vertices coincide with 2 of the cell's. store in a list, neighbors.\n", + "# n = number of neighbors: n = len(neighbors)\n", + "# Position of neighbors (nuclei) = zj: repeat np.where statements for each neighbor to find out \n", + "sum = 0\n", + "for neighbor in np.arange(3, n+1, 1): # do this under for t in np.arange(0, timend, dt)\n", + " zt = zt + k*(z0 - zt)*dt + np.sqrt(2*D*dt)*np.random.randn(len(zt))\n", + " sum = sum + zt\n", + "zj = sum/n #calculate mean neighbor position\n", + " \n", + " \n", + " \n", + "# Adding crowding\n", + "def force_on_cell(zi): #force on cell at position zi\n", + " force = 0\n", + " for zj in neighbors(zi): \n", + " if zi-zj < 0:\n", + " f(zi-zj) = -f(zj-zi)\n", + " elif zi-zj > 0.2: # if the nuclei do not overlap - say nucl length along AB axis = 0.1\n", + " # nuclei do not overlap if zi-zj > 2 x nucl length\n", + " f(zi-zj) = 1/m*f(zi-zj) # make the force vanishing\n", + " else :\n", + " f(zi-zj) = f(zi-zj)\n", + " \n", + " force += f(zi-zj)\n", + " \n", + " return force" + ] + }, + { + "cell_type": "code", + "execution_count": 348, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[]\n" + ] + } + ], + "source": [ + "print(ready)" + ] + }, + { + "cell_type": "code", + "execution_count": 269, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.5622115244563757 0.8864373671362452 0.44292649985797733\n" + ] + } + ], + "source": [ + "# Fit line to histogram\n", + "import matplotlib.mlab as mlab\n", + "from scipy.stats import gamma\n", + "from scipy.stats import erlang\n", + "x = np.linspace(0,3.2,945)\n", + "\n", + "# Gamma\n", + "shape, loc, scale = erlang.fit(cell_cycle_lengths) # loc = position of cutoff\n", + "print(shape, loc, scale)\n", + "y = erlang.pdf(x, shape, loc, scale) # inverse of scale = rate\n", + "h = plt.hist(cell_cycle_lengths, bins = 40)\n", + "plt.plot(x, y*60, lw=2)\n", + "plt.show()\n", + "\n", + "\n", + "\n", + "# Cell cycle length distribution - influenced by correlated samples?\n" + ] + }, + { + "cell_type": "code", + "execution_count": 273, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "KstestResult(statistic=0.509154783907775, pvalue=1.1710738031941171e-227)" + ] + }, + "execution_count": 273, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Perform Kolmogorov-Smirnov test to test whether or not or not cells.properties['age'] comes from Erlang distribution.\n", + "\n", + "from scipy.stats import kstest\n", + "kstest(cell_cycle_lengths, 'gamma', args=(1.5622115244563757, 0, 0.7119333243592108)) # it is gamma.\n", + "# modify shape to 1 to check for Erlang (not general gamma) => p-value = 0" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# IKNM dynamics 1 -> drift = velocity from current model\n", + "\n", + "#G1. if 0 <= properties['age'] <= t_G1:\n", + "v1 = -1/t_G1\n", + "#elif t_G1 < properties['age'] <= t_G1 + t_S :\n", + "v1 = 0\n", + "# elif t_G1 + t_S < properties['age'] <= t_G1 + t_S + t_G2:\n", + "v1 = 1/t_G2\n", + "# else: (t_G1 + t_S + t_G2 < properties['age'])\n", + "v1 = 0\n", + "\n", + "# v2 = A*(properties['zposn'] - mean_neigh_pos)\n", + "# cell has min 3 neighbors\n", + "# Define neighbors: neighbors = cells whose 2 of their vertices coincide with 2 of the cell's. store in a list, neighbors.\n", + "# n = number of neighbors: len(neighbors)\n", + "# Position of neighbors (nuclei) = neigh_pos: repeat if statements for each neighbor to find out v1\n", + " sum = 0\n", + "for i in range(3, n+1, 1):\n", + "sum = sum + neigh_pos\n", + "# mean neigh position: \n", + "mean_neigh_pos = sum/n\n", + "\n", + "# A = ct; value?\n", + "\n", + "v = v1 + v2\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "# Euler–Maruyama method - Wikipedia code - Potentially add noise dependence on the current position -> if cell is in\n", + "# G1 or S => higher noise. But this might be counteracted by the low position of the nuclei, which are pushed further\n", + "# down by neighbors above -> this noise might be counteracted in this way so probs not worth adding dependence on pos.\n", + "\n", + "num_sims = 5 # Display five runs\n", + "\n", + "t_init = 3\n", + "t_end = 7\n", + "N = 1000 # Compute 1000 grid points\n", + "dt = float(t_end - t_init) / N\n", + "y_init = 0\n", + "\n", + "c_theta = 0.7\n", + "c_mu = 1.5\n", + "c_sigma = 0.06\n", + "\n", + "def mu(y, t):\n", + " \"\"\"Implement the Ornstein–Uhlenbeck mu.\"\"\" # = \\theta (\\mu-Y_t)\n", + " # replace with v\n", + " return c_theta * (c_mu - y)\n", + "\n", + "def sigma(y, t):\n", + " \"\"\"Implement the Ornstein–Uhlenbeck sigma.\"\"\" # = \\sigma\n", + " # Diffusion coefficient\n", + " return c_sigma\n", + "\n", + "def dW(delta_t):\n", + " \"\"\"Sample a random number at each call.\"\"\"\n", + " # White Gaussian noise\n", + " return np.random.normal(loc=0.0, scale=np.sqrt(delta_t))\n", + "\n", + "ts = np.arange(t_init, t_end + dt, dt)\n", + "ys = np.zeros(N + 1)\n", + "\n", + "ys[0] = y_init\n", + "\n", + "for _ in range(num_sims):\n", + " for i in range(1, ts.size):\n", + " t = t_init + (i - 1) * dt\n", + " y = ys[i - 1]\n", + " ys[i] = y + mu(y, t) * dt + sigma(y, t) * dW(dt)\n", + " plt.plot(ts, ys)\n", + "\n", + "plt.xlabel(\"time (s)\")\n", + "h = plt.ylabel(\"y\")\n", + "h.set_rotation(0)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ True True True ... False False False]\n", + "[False False False ... True True True]\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(~cells.empty()) # Turns Trues into Falses and viceversa." + ] + }, + { + "cell_type": "code", + "execution_count": 240, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[ 0.34678344 0.09469718 1.41721669 1.67473528 -0.33489884]\n", + "\n", + "\n" + ] + } + ], + "source": [ + "a = np.random.normal(size=5)\n", + "print(a)\n", + "print(type(np.where(a>0)))\n", + "print(type(np.where(a>0)[0]))" + ] + }, + { + "cell_type": "code", + "execution_count": 219, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 1.217858 -1.07929465 -0.64485792]\n", + " [ 0.94932936 0.97203389 0.25382137]\n", + " [ 1.46529953 0.4708984 0.64353754]\n", + " [-0.00430902 0.84851356 -0.42626672]\n", + " [ 0.71115515 -1.30060859 -1.01177399]]\n", + "(array([0, 1, 1, 1, 2, 2, 2, 3, 4]), array([0, 0, 1, 2, 0, 1, 2, 1, 0]))\n", + "[0 1 1 1 2 2 2 3 4]\n" + ] + } + ], + "source": [ + "a = np.random.normal(size=(5,3))\n", + "print(a)\n", + "print(np.where(a>0)) # first array gives rows where a>0; second array gives columns where a>0, for each row\n", + "print(np.where(a>0)[0]) # returns only the first dimension = the rows of the array where a>0, repeated for as many..\n", + "# ..times a number a>0 exists" + ] + }, + { + "cell_type": "code", + "execution_count": 347, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m print(type(np.where(cells.empty())[0])) # indices in array of T and F where there are T vals\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "print(cells.empty())\n", + "print(type(np.where(cells.empty()))\n", + "print(type(np.where(cells.empty())[0])) # indices in array of T and F where there are T vals" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -124,7 +2015,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.9" + "version": "3.8.5" } }, "nbformat": 4, diff --git a/examples/test_M1.py b/examples/test_M1.py new file mode 100644 index 0000000..fab3e96 --- /dev/null +++ b/examples/test_M1.py @@ -0,0 +1,63 @@ +import itertools +# get_ipython().magic(u'matplotlib inline') +import numpy as np +import matplotlib +# %matplotlib qt5 +import matplotlib.pyplot as plt +from matplotlib import animation, rc +# from IPython.display import HTML +import vertex_model as model +from vertex_model.run_select import run_simulation_INM, definecolors +import vertex_model.initialisation as init +import sys + +import time +import dill + + +type_=4 + +# parameters of the vertex model +G=0.075 +L=0.04 +K=1.0 + +# parameters of the nucleus A-B stochastic dynamics +# sys.argv to pass from command line +# call as, e.g.: python test_M1.py 100 0.15 +try: + k=float(sys.argv[1]) # 100 + D=float(sys.argv[2]) # 0.15 + r=float(sys.argv[3]) +except: + print("Missing command line parameters. Execute as\n") + print(" python test_M1.py \n") + exit() + +# parameters of the crowding force +s=0.2 +a=r*k + +# adding the nuclear movement parameters to 'params' +params = [K,G,L,k,D,s,a] + +def run_sim (run_id): + timestart = time.time() + history = run_simulation_INM(params,1,rand,type_) # timend = 1 for test + timeend = time.time() + + with open (f"model_1_k{k}_D{D}_run_{run_id}.pkl", "wb") as file: + dill.dump(history, file) + + return timeend - timestart + +np.random.seed(1999) +rand = np.random.RandomState(1999) +no_simulations = 5 + +for run in range(1,no_simulations+1): + run_sim(run) + + + + diff --git a/examples/test_M1_analysis.py b/examples/test_M1_analysis.py new file mode 100644 index 0000000..a7d216c --- /dev/null +++ b/examples/test_M1_analysis.py @@ -0,0 +1,44 @@ +import itertools +import numpy as np +import matplotlib.pyplot as plt +import vertex_model as model +import vertex_model.initialisation as init +from vertex_model.forces import TargetArea, Tension, Perimeter, Pressure + +import dill +with open("history_model_1.pkl", "rb") as file: + history = dill.load(file) + +last = history[-1] + +# Cell cycle length +""" +deadcells = np.where(last.empty())[0] +cell_cycle_lengths = last.properties['age'][deadcells] +plt.hist(cell_cycle_lengths, bins = 50, density=True) +plt.title('Cell cycle length distribution Model 1') +plt.show() +""" + + +""" +plt.hist(last.properties['nucl_pos'], bins = 50) +plt.xlim(0,1) +plt.title("Nucleus position Model 1") +plt.show() +""" + +alivecells = np.where(~last.empty())[0] + + +plt.hist(last.mesh.area[alivecells], bins = 50) +plt.title('Last Area Distribution Model 1') +plt.show() + + + +print(len(alivecells)) +print(len(last.mesh.area)) +print(len(last.mesh.area[alivecells])) + + diff --git a/examples/test_M2.py b/examples/test_M2.py new file mode 100644 index 0000000..fe287f2 --- /dev/null +++ b/examples/test_M2.py @@ -0,0 +1,82 @@ +import itertools +# get_ipython().magic(u'matplotlib inline') +import numpy as np +import matplotlib +# %matplotlib qt5 +import matplotlib.pyplot as plt +from matplotlib import animation, rc +# from IPython.display import HTML +import vertex_model as model +from vertex_model.run_select import run_simulation_INM, definecolors +import vertex_model.initialisation as init +import sys + +import time +timestart = time.time() + +type_=5 + +# parameters of the vertex model +G=0.075 +L=0.04 +K=1.0 + +# parameters of the nucleus A-B stochastic dynamics +# sys.argv to pass from command line +# call as, e.g.: python test_M1.py 100 0.15 +k=float(sys.argv[1]) # 100 +D=float(sys.argv[2]) # 0.15 + +# parameters of the crowding force +s=0.2 +a=1. + +# adding the nuclear movement parameters to 'params' +params = [K,G,L,k,D,s,a] + +np.random.seed(1999) +rand = np.random.RandomState(1999) + +no_simulations = 1 +#Cell_cycle_lengths_progenitors = [] +#Cell_cycle_lengths_pois = [] +#final_history = [] +for i in range(no_simulations): + history = run_simulation_INM(params,1,rand,type_) # timend = 1 for test + # Rows 32-49 -> copy in ANALYSIS + """ + last = history[-1] # get state of the cells object from the previous step -> this + following rows -> analysis + gone = last.empty() + divided = gone + diffntd = gone + if 'poisoned' in last.properties: + pois = last.properties['poisoned']==1 + healty = last.properties['poisoned']==0 + divided = gone & healty + diffntd = gone & pois + progenitor_deadcells_last = np.where(divided)[0] + differentiated_last = np.where(diffntd)[0] + correct_cell_cycle_lengths = last.properties['age'][progenitor_deadcells_last] + pois_cell_cycle_lengths = last.properties['age'][differentiated_last] + + #new_cell_cycle_lengths = last.properties['age'][deadcells_last] # cell cycle lengths = age of deadcells + Cell_cycle_lengths_progenitors = np.append(Cell_cycle_lengths_progenitors, correct_cell_cycle_lengths) + Cell_cycle_lengths_pois = np.append(Cell_cycle_lengths_pois, pois_cell_cycle_lengths) + final_history = np.append(final_history, history) # get a final history array + + print(last.properties['nucl_pos']) + print(min(last.properties['nucl_pos'])) + print(max(last.properties['nucl_pos'])) + print(last.properties['A0_final']) + print(len(last.properties['final_nucl_pos'])) + """ + +timeend = time.time() +print(timeend - timestart) + +import dill +with open ("history_model_2.pkl", "wb") as file: + dill.dump(history, file) + + + diff --git a/examples/test_M2_analysis.py b/examples/test_M2_analysis.py new file mode 100644 index 0000000..b1bf78b --- /dev/null +++ b/examples/test_M2_analysis.py @@ -0,0 +1,37 @@ +import itertools +import numpy as np +import matplotlib.pyplot as plt +import vertex_model as model +import vertex_model.initialisation as init +from vertex_model.forces import TargetArea, Tension, Perimeter, Pressure + +import dill +with open("history_model_2.pkl", "rb") as file: + history = dill.load(file) + +last = history[-1] + +# Cell cycle length +""" +deadcells = np.where(last.empty())[0] +cell_cycle_lengths = last.properties['age'][deadcells] +plt.hist(cell_cycle_lengths, bins = 50, density=True) +plt.title('Cell cycle length distribution Model 2') +plt.show() +""" + + +""" +plt.hist(last.properties['nucl_pos'], bins = 50) +plt.xlim(0,1) +plt.title("Nucleus position Model 2") +plt.show() +""" + +#alivecells = np.where(~last.empty())[0] +plt.hist(last.mesh.area, bins = 50) +plt.title('Last Area Distribution Model 2') +plt.show() + + + diff --git a/examples/test_short_simulations.ipynb b/examples/test_short_simulations.ipynb new file mode 100644 index 0000000..fddf511 --- /dev/null +++ b/examples/test_short_simulations.ipynb @@ -0,0 +1,227 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0, 5, 7]\n", + "\n", + "\n", + "0\n", + "[ 5 0 -2]\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "a = [0, 5, 7]\n", + "print(a)\n", + "print(type(a))\n", + "\n", + "b = np.array(a)\n", + "print(type(b))\n", + "\n", + "\n", + "forces = np.zeros_like(a)\n", + "print(forces[2])\n", + "\n", + "print(5-b)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "(1, 4)\n", + "(2, 5)\n", + "(3, 6)\n" + ] + } + ], + "source": [ + "x = [1, 2, 3]\n", + "y = [4, 5, 6]\n", + "zipped = zip(x, y)\n", + "\n", + "print(zipped)\n", + "\n", + "for i in zipped:\n", + " print(i)\n", + " \n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "import itertools\n", + "get_ipython().magic(u'matplotlib inline')\n", + "import numpy as np\n", + "import matplotlib\n", + "%matplotlib qt5\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib import animation, rc\n", + "from IPython.display import HTML\n", + "import vertex_model as model\n", + "from vertex_model.run_select import run_simulation_INM, definecolors\n", + "import vertex_model.initialisation as init" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.001\n" + ] + }, + { + "ename": "UnboundLocalError", + "evalue": "local variable 'history' referenced before assignment", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mUnboundLocalError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0mfinal_history\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mno_simulations\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 35\u001b[0;31m \u001b[0mhistory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrun_simulation_INM\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m40\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mrand\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mtype_\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 36\u001b[0m \u001b[0mlast\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhistory\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;31m# get state of the cells object from the previous step\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 37\u001b[0m \u001b[0mprogenitor_deadcells_last\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwhere\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlast\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m&\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mlast\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mproperties\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'poisoned'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/Desktop/vertex_model/vertex_model/run_select.py\u001b[0m in \u001b[0;36mrun_simulation_INM\u001b[0;34m(x, timend, rand, sim_type)\u001b[0m\n\u001b[1;32m 701\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 702\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 703\u001b[0;31m \u001b[0;34m\"\"\"Target area function depending age and z nuclei position\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 704\u001b[0m \u001b[0mproperties\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'A0'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mproperties\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'age'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m0.5\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mproperties\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'zposn'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0mcells\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mproperties\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'poisoned'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 705\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mUnboundLocalError\u001b[0m: local variable 'history' referenced before assignment" + ] + } + ], + "source": [ + "# Run type 2\n", + "\n", + "\n", + "#### Parameter used in the simulation are picked up form Gobal_Constant.py file\n", + "\n", + "### Choose simulation to run\n", + "# def run_simulation_INM(x, timend,rand, type):\n", + "# sim_type 0 simulation_with_division_clone (no differentiation rate)\n", + "# sim_type 1 simulation_with_division_clone_differentiation (all differentiation rate)\n", + "# sim_type 2 simulation_with_division_clone_differenciation_3stripes (2 population with and without diffentiation rate)\n", + "# sim_type 3 simulation_with_division_clone_whole_tissue_differenciation (differentiation rate everywhere)\n", + "\n", + "#use type 2 and parameter i=4 for floor plate\n", + "import numpy as np\n", + "type_=4\n", + "L_point = [-.4, -0.2,-0.3, -0.05, 0.075, 0.15]\n", + "G_point = [0.14, 0.12, 0.1, 0.065, 0.04, 0.02]\n", + "i=4\n", + "G=G_point[i]\n", + "L=L_point[i]\n", + "K=1.0\n", + "#run simulation with the choosen parameters ; line 521 in run_select.py\n", + "rand = np.random.RandomState() #random number to choose Lambda\n", + "params = [K,G,L] # K=x[0],G=x[1],L=x[2]\n", + "# Commented by Rebeca:\n", + "#history = run_simulation_INM(params,300,rand,type_) #return history = a list of length 300; simulation time = 300\n", + "# history = a list of cells objects at all timepoints in the simulation\n", + "\n", + "# Run simulation multiple times - (20/04)\n", + "no_simulations = 1\n", + "Cell_cycle_lengths_progenitors = []\n", + "Cell_cycle_lengths_pois = []\n", + "final_history = []\n", + "for i in range(no_simulations):\n", + " history = run_simulation_INM(params,40,rand,type_) \n", + " last = history[-1] # get state of the cells object from the previous step\n", + " progenitor_deadcells_last = np.where((last.empty()) & (last.properties['poisoned']==0))[0]\n", + " differentiated_last = np.where((last.empty()) & (last.properties['poisoned']==1))[0]\n", + " correct_cell_cycle_lengths = last.properties['age'][progenitor_deadcells_last]\n", + " pois_cell_cycle_lengths = last.properties['age'][differentiated_last]\n", + " \n", + "\n", + " #new_cell_cycle_lengths = last.properties['age'][deadcells_last] # cell cycle lengths = age of deadcells\n", + " Cell_cycle_lengths_progenitors = np.append(Cell_cycle_lengths_progenitors, correct_cell_cycle_lengths)\n", + " Cell_cycle_lengths_pois = np.append(Cell_cycle_lengths_pois, pois_cell_cycle_lengths)\n", + " final_history = np.append(final_history, history) # get a final history array\n", + " \n" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "40\n", + "[0. 0. 0. ... 0.99322569 0.99986978 0.99980213]\n", + "3204\n" + ] + } + ], + "source": [ + "print(len(final_history))\n", + "print(last.properties['zposn'])\n", + "print(len(last.properties['zposn']))\n", + "\n", + "plt.hist(last.properties['zposn'], bins = 70)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_keys(['K', 'Gamma', 'P', 'boundary_P', 'Lambda', 'Lambda_boundary', 'age', 'parent_group', 'parent', 'ageingrate', 'ids_division', 'force_x', 'force_y', 'T1_angle_pD', 'Division_angle_pD', 'zposn', 'A0', 'ids_division_1', 'ids_division_02', 'poisoned', 'T1_angle_pMN', 'Division_angle_pMN', 'deleted_edges', 'edges_division', 'T1_edge', 'differentiation_rate'])\n" + ] + } + ], + "source": [ + "\n", + "\n", + "print((last.properties.keys()))\n", + "\n", + "\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/examples/test_short_simulations.py b/examples/test_short_simulations.py new file mode 100644 index 0000000..c5ae451 --- /dev/null +++ b/examples/test_short_simulations.py @@ -0,0 +1,51 @@ +import itertools +# get_ipython().magic(u'matplotlib inline') +import numpy as np +import matplotlib +# %matplotlib qt5 +import matplotlib.pyplot as plt +from matplotlib import animation, rc +# from IPython.display import HTML +import vertex_model as model +from vertex_model.run_select import run_simulation_INM, definecolors +import vertex_model.initialisation as init + + +type_=4 +# L_point = [-.4, -0.2,-0.3, -0.05, 0.075, 0.15] +# G_point = [0.14, 0.12, 0.1, 0.065, 0.04, 0.02] +# i=4 +G=0.075 # G_point[i] +L=0.04 # L_point[i] +K=1.0 + +rand = np.random.RandomState() #random number to choose Lambda +params = [K,G,L] # K=x[0],G=x[1],L=x[2] + +no_simulations = 1 +Cell_cycle_lengths_progenitors = [] +Cell_cycle_lengths_pois = [] +final_history = [] +for i in range(no_simulations): + history = run_simulation_INM(params,1,rand,type_) + last = history[-1] # get state of the cells object from the previous step + gone = last.empty() + divided = gone + diffntd = gone + if 'poisoned' in last.properties: + pois = last.properties['poisoned']==1 + healty = last.properties['poisoned']==0 + divided = gone & healty + diffntd = gone & pois + else: + diffntd = np.zeros(len(gone)).astype(bool) + progenitor_deadcells_last = np.where(divided)[0] + differentiated_last = np.where(diffntd)[0] + correct_cell_cycle_lengths = last.properties['age'][progenitor_deadcells_last] + pois_cell_cycle_lengths = last.properties['age'][differentiated_last] + + #new_cell_cycle_lengths = last.properties['age'][deadcells_last] # cell cycle lengths = age of deadcells + Cell_cycle_lengths_progenitors = np.append(Cell_cycle_lengths_progenitors, correct_cell_cycle_lengths) + Cell_cycle_lengths_pois = np.append(Cell_cycle_lengths_pois, pois_cell_cycle_lengths) + final_history = np.append(final_history, history) # get a final history array + diff --git a/vertex_model/cells.py b/vertex_model/cells.py index 2c18340..8b9c9e2 100644 --- a/vertex_model/cells.py +++ b/vertex_model/cells.py @@ -5,6 +5,12 @@ import numpy as np +# Add test function + +def RebecaFunction(): + print("Boop boop") + + class Cells(object): def __init__(self, mesh, properties=None): diff --git a/vertex_model/mesh.py b/vertex_model/mesh.py index 4130fa3..b54c828 100644 --- a/vertex_model/mesh.py +++ b/vertex_model/mesh.py @@ -349,7 +349,7 @@ def _transition(mesh, eps): #print to_del, ids_removed # if ~(ids_t1==np.delete(ids_t1,ids_removed)): # print 'Ids T1 to remove:', ids_t1, ids_removed, np.delete(ids_t1,ids_removed) - print(ids_removed, to_del) + # print(ids_removed, to_del) mesh = mesh.copy() mesh.edges = Edges(reverse) mesh.vertices = vertices diff --git a/vertex_model/run_select.py b/vertex_model/run_select.py index ddd5398..f61b7b7 100644 --- a/vertex_model/run_select.py +++ b/vertex_model/run_select.py @@ -32,9 +32,9 @@ def check_estage(): print("T1_eps =%s"%T1_eps) -# run simulation +# run simulation - input is a generator = simulation => returns array def run(simulation,N_step,skip): - return [cells.copy() for cells in itertools.islice(simulation,0,int(N_step),int(skip))] + return [cells.copy() for cells in itertools.islice(simulation,0,int(N_step),int(skip))] # itertools.islice looks through the generator's elements. => list of cell objects = the history @@ -55,23 +55,25 @@ def division_axis(mesh,face_id,rand): def bin_by_xpos(cells,percentiles): vx = cells.mesh.vertices[0] #simple 'midpoint' as mean of vertex positions + # np.bincount = Count number of occurrences of each value in array of non-negative ints. + # 1.0, 0.5; mid_x / width? mid_x = np.bincount(cells.mesh.face_id_by_edge,weights=vx) counts = np.maximum(np.bincount(cells.mesh.face_id_by_edge),1.0) mid_x = mid_x / counts width = cells.mesh.geometry.width return np.searchsorted(percentiles,(mid_x/width + 0.5) % 1.0) -#simulation without division -def basic_simulation(cells,force,dt=dt,T1_eps=0.04): +#simulation without division - thermalisation without ages of cells and INM - evolves a mesh +def basic_simulation(cells,force,dt=dt,T1_eps=0.04): # a generator while True: cells.mesh , number_T1 = cells.mesh.transition(T1_eps) F = force(cells)/viscosity expansion = 0.05*np.average(F*cells.mesh.vertices,1)*dt dv = dt*model.sum_vertices(cells.mesh.edges,F) cells.mesh = cells.mesh.moved(dv).scaled(1.0+ expansion) - yield cells + yield cells # outputs the cells object but continues to run (unlike return)! -# simulation with division and INM (no differentiation rate domain) +# simulation with division and INM (no differentiation rate domain) # type 100 def simulation_with_division(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non properties = cells.properties properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers @@ -86,6 +88,7 @@ def simulation_with_division(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)))[0] if len(ready): #these are the cells ready to undergo division at the current timestep + # print(ready) properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready)))) properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids @@ -98,19 +101,329 @@ def simulation_with_division(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate - """Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell""" - N_G1=1-1.0/t_G1*properties['age'] #nuclei position in G1 phase + #Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell + N_G1=1-1.0/t_G1*properties['age'] + N_S=0 + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + + """Target area function depending age and z nuclei position""" + properties['A0'] = (properties['age']+1.0)*0.5*(1.0+properties['zposn']**2) + + #############BAETTI VID + + #ath BAETTI D VID + cells.mesh , number_T1, d= cells.mesh.transition(T1_eps) #check edges verifing T1 transition + if len(number_T1)>0: + for ii in number_T1: + index = cells.mesh.face_id_by_edge[ii] + properties['T1_angle_pD'] =np.append(properties['T1_angle_pD'],cells.mesh.edge_angle[ii]) + F = force(cells)/viscosity #force per each cell force= targetarea+Tension+perimeter+pressure_boundary + + #EG BAETTI VID + len_modified=np.matrix.copy(cells.mesh.length) + #len_modified[np.where((properties['parent_group'][cells.mesh.face_id_by_edge]==1) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==0))]*=0.12 + + tens = (0.5*cells.by_edge('Lambda', 'Lambda_boundary')/len_modified)*cells.mesh.edge_vect + tens= tens - tens.take(cells.mesh.edges.prev, 1) + F+=tens + + dv = dt*model.sum_vertices(cells.mesh.edges,F) #movement of the vertices using eq: viscosity*dv/dt = F + properties['force_x'] = F[0]*viscosity + properties['force_y'] = F[1]*viscosity + + if hasattr(cells.mesh.geometry,'width'): + expansion[0] = expansion_constant*np.average(F[0]*cells.mesh.vertices[0])*dt/(cells.mesh.geometry.width**2) + if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument + expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) + cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) + yield cells + + +def pairwise_crowding_force (delta_z, a=1.0, s=0.1): + ''' + Calculates the pairwise contributions for the crowding force as a + function of the difference in AB nuclear position between neighbouring + cells. + It accepts as input an array (and the function is applied element-wise) + ''' + y = delta_z/s + return a * np.exp(-y**2/2.)*y + +def crowding_force (cells, a=1.0, s=0.1): + ''' + For every cell calculate the total crowding force + as the sum over its neighbours of the pairwise crowding force + + ''' + + # Get the positions of all the nuclei. + nucl_pos = cells.properties['nucl_pos'] + + # Get the ids of cells by their edges + cell_ids = cells.mesh.face_id_by_edge # ids of faces/cells + neig_ids = cell_ids[cells.mesh.reverse] # ids of their neighbours + + # position of nuclei in cells and their neighbours. + z = np.take(nucl_pos, cell_ids) # cells of interest + zn = np.take(nucl_pos, neig_ids) # their neighbours + + # calculate the difference in nucl_pos between neighbouring cells. + delta_z = z - zn # the difference in z for all pairs + f_pairs = pairwise_crowding_force(delta_z, a=a, s=s) # the corresponding pairwise forces + + # calculate the sum of the pairwise contributions for each cell of interest + force = np.bincount(cell_ids, f_pairs, cells.mesh.n_face) + + return force + + +# simulation with division and INM (no differentiation rate domain) # type 0 Rebeca model 1 -> type 4: delayed drift + noise +def simulation_with_division_model_1(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): + properties = cells.properties + properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers + properties['ageingrate'] = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) #degradation rate per each cell + #dummy = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) + #properties['ageingrate'] = 1.0/lifespan*np.ones(len(cells)) #degradation rate per each cell + properties['ids_division'] = [] #save ids of the cell os the division when it's ready per each time step + properties['force_x'] = [] + properties['force_y'] = [] + properties['T1_angle_pD'] = [] + properties['Division_angle_pD'] = [] + properties['nucl_pos'] = properties['zposn'].copy() + + expansion = np.array([0.0,0.0]) + + + while True: + #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis + ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)))[0] # divides if nucleus pos > 0.75 + properties['ageingrate'][ready] = 0 + if len(ready): #these are the cells ready to undergo division at the current timestep + # print("cells dividing --> ", ready) + properties['ageingrate'] = np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready)))) + #dummy = np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready))) + #properties['ageingrate'] =np.append(properties['ageingrate'], 1.0/lifespan*np.ones(2*len(ready))) + properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) + properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids + + ''' + 2 possibilities for nucl_pos of daughter cells: + - nucleus at z = 1 + - nucleus at same z as the parent (more realistic) + ''' + # properties['nucl_pos'] = np.append(properties['nucl_pos'], np.ones(2*len(ready))) + properties['nucl_pos'] = np.append(properties['nucl_pos'], np.repeat(properties['nucl_pos'][ready],2)) + + properties['ids_division'] = ready + edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + for i in range(len(ready)): + commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) + division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) + properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate + + + #Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell + N_G1=1-1.0/t_G1*properties['age'] N_S=0 - N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) #nuclei position in G2 and S phase + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + properties['nucl_pos'] += properties['k']*(properties['zposn'] - properties['nucl_pos'])*dt \ + + np.sqrt(2*properties['D']*dt)*np.random.randn(len(properties['nucl_pos'])) + """Target area function depending age and z nuclei position""" + properties['A0'] = (properties['age']+1.0)*0.5*(1.0+properties['nucl_pos']**2) # target area now depends on nucl_pos + properties['A0_initial'] = (properties['age']+1.0)*0.5*(1.0+properties['zposn']**2) # initial + + + #############BAETTI VID + + #ath BAETTI D VID + cells.mesh , number_T1, d = cells.mesh.transition(T1_eps) # check edges verifing T1 transition + if len(number_T1)>0: + for ii in number_T1: + index = cells.mesh.face_id_by_edge[ii] + properties['T1_angle_pD'] =np.append(properties['T1_angle_pD'],cells.mesh.edge_angle[ii]) + F = force(cells)/viscosity #force per each cell force= targetarea+Tension+perimeter+pressure_boundary + + #EG BAETTI VID + len_modified=np.matrix.copy(cells.mesh.length) + #len_modified[np.where((properties['parent_group'][cells.mesh.face_id_by_edge]==1) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==0))]*=0.12 + + tens = (0.5*cells.by_edge('Lambda', 'Lambda_boundary')/len_modified)*cells.mesh.edge_vect + tens= tens - tens.take(cells.mesh.edges.prev, 1) + F+=tens + + dv = dt*model.sum_vertices(cells.mesh.edges,F) #movement of the vertices using eq: viscosity*dv/dt = F + properties['force_x'] = F[0]*viscosity + properties['force_y'] = F[1]*viscosity + + if hasattr(cells.mesh.geometry,'width'): + expansion[0] = expansion_constant*np.average(F[0]*cells.mesh.vertices[0])*dt/(cells.mesh.geometry.width**2) + if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument + expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) + cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) + yield cells + +# simulation with division and INM (no differentiation rate domain) # type 0 Rebeca model 1 -> type 5: drift = v0 & noise +def simulation_with_division_model_2(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non + properties = cells.properties + properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers + properties['ageingrate'] = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) #degradation rate per each cell + properties['ids_division'] = [] #save ids of the cell os the division when it's ready per each time step + properties['force_x'] = [] + properties['force_y'] = [] + properties['T1_angle_pD'] = [] + properties['Division_angle_pD'] = [] + + properties['nucl_pos'] = properties['zposn'].copy() # nucleus pos with drift = v0 and noise + + expansion = np.array([0.0,0.0]) + + + while True: + #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis + ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)))[0] # divides if nucleus pos > 0.75 + properties['ageingrate'][ready] = 0 + if len(ready): #these are the cells ready to undergo division at the current timestep + # print("cells dividing --> ", ready) + properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready)))) + properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) + properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids + + ''' + 2 possibilities for nucl_pos of daughter cells: + - nucleus at z = 1 + - nucleus at same z as the parent (more realistic) + ''' + # properties['nucl_pos'] = np.append(properties['nucl_pos'], np.ones(2*len(ready))) + properties['nucl_pos'] = np.append(properties['nucl_pos'], np.repeat(properties['nucl_pos'][ready],2)) + + properties['ids_division'] = ready + edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + for i in range(len(ready)): + commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) + division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) + properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate + + #Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell + N_G1=1-1.0/t_G1*properties['age'] + N_S=0 + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + v0 = np.zeros_like(properties['age']) # array for velocities + G1_cells = np.where((0<=properties['age']) & (properties['age']<=t_G1))[0] + v0[G1_cells] = -1.0/t_G1 + #S_cells = np.where(t_G1 < properties['age'] <= t_G1 + t_S)[0] + #v0[S_cells] = 0 + G2_cells = np.where((t_G1+t_S0: + for ii in number_T1: # + index = cells.mesh.face_id_by_edge[ii] + properties['T1_angle_pD'] =np.append(properties['T1_angle_pD'],cells.mesh.edge_angle[ii]) + F = force(cells)/viscosity #force per each cell force= targetarea+Tension+perimeter+pressure_boundary + + #EG BAETTI VID + len_modified=np.matrix.copy(cells.mesh.length) + #len_modified[np.where((properties['parent_group'][cells.mesh.face_id_by_edge]==1) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==0))]*=0.12 + + tens = (0.5*cells.by_edge('Lambda', 'Lambda_boundary')/len_modified)*cells.mesh.edge_vect + tens= tens - tens.take(cells.mesh.edges.prev, 1) + F+=tens + + dv = dt*model.sum_vertices(cells.mesh.edges,F) #movement of the vertices using eq: viscosity*dv/dt = F + properties['force_x'] = F[0]*viscosity + properties['force_y'] = F[1]*viscosity + + if hasattr(cells.mesh.geometry,'width'): + expansion[0] = expansion_constant*np.average(F[0]*cells.mesh.vertices[0])*dt/(cells.mesh.geometry.width**2) + if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument + expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) + cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) + yield cells + +# simulation with division and INM (no differentiation rate domain) # type 0 Rebeca model 3 -> type 6: delayed drift + noise + force +def simulation_with_division_model_3(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non + properties = cells.properties + properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers + properties['ageingrate'] = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) #degradation rate per each cell + properties['ids_division'] = [] #save ids of the cell os the division when it's ready per each time step + properties['force_x'] = [] + properties['force_y'] = [] + properties['T1_angle_pD'] = [] + properties['Division_angle_pD'] = [] + properties['nucl_pos'] = properties['zposn'].copy() + + properties['force_z'] = [] + + expansion = np.array([0.0,0.0]) + + while True: + #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis + ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)))[0] # divides if nucleus pos > 0.75 + if len(ready): #these are the cells ready to undergo division at the current timestep + properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready)))) + properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) + properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids + # daughter cells = same positions as parents - do this NEXT + properties['nucl_pos'] = np.append(properties['nucl_pos'], np.ones(2*len(ready))) + + properties['ids_division'] = ready + edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + for i in range(len(ready)): + commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) + division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) + #properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate + + # IMPORTANT: add age ingrate only for alive cells + alivecells = np.where(~cells.empty())[0] + properties['age'][alivecells] += dt*properties['ageingrate'][alivecells] #add time step depending of the degradation rate + + #Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell + N_G1=1-1.0/t_G1*properties['age'] + N_S=0 + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + properties['nucl_pos'] += properties['k']*(properties['zposn'] - properties['nucl_pos'])*dt \ + + crowding_force(cells, a=properties['a'], s=properties['s'])*dt \ + + np.sqrt(2*properties['D']*dt)*np.random.randn(len(properties['zposn'])) + + + + """Target area function depending age and z nuclei position""" + properties['A0'] = (properties['age']+1.0)*0.5*(1.0+properties['nucl_pos']**2) # target area now depends on nucl_pos + properties['A0_initial'] = (properties['age']+1.0)*0.5*(1.0+properties['zposn']**2) # initial + + + #############BAETTI VID + #ath BAETTI D VID cells.mesh , number_T1, d= cells.mesh.transition(T1_eps) #check edges verifing T1 transition if len(number_T1)>0: @@ -136,10 +449,104 @@ def simulation_with_division(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) - yield cells + yield cells + +# simulation with division and INM (no differentiation rate domain) # type 0 Rebeca model 4 -> type 7: drift = v0 & noise & force +def simulation_with_division_model_4(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non + properties = cells.properties + properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers + properties['ageingrate'] = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) #degradation rate per each cell + properties['ids_division'] = [] #save ids of the cell os the division when it's ready per each time step + properties['force_x'] = [] + properties['force_y'] = [] + properties['T1_angle_pD'] = [] + properties['Division_angle_pD'] = [] + properties['nucl_pos'] = properties['zposn'].copy() + + properties['force_z'] = [] + + expansion = np.array([0.0,0.0]) + + while True: + #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis + ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)) & (cells.properties['nucl_pos']>=0.75))[0] # divides if nucleus pos > 0.75 + if len(ready): #these are the cells ready to undergo division at the current timestep + properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2*len(ready)))) + properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) + properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids + + # daughter cells = same positions as parents - do this NEXT + properties['nucl_pos'] = np.append(properties['nucl_pos'], np.ones(2*len(ready))) + + properties['ids_division'] = ready + edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + for i in range(len(ready)): + commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) + division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) + #properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the#properties['age_ready'] = properties['age'][ready] # get age of cells which are READY to divide + + # IMPORTANT: add age ingrate only for alive cells + alivecells = np.where(~cells.empty())[0] + properties['age'][alivecells] += dt*properties['ageingrate'][alivecells] #add time step depending of the degradation rate + + #Calculate z nuclei position (Apical-Basal movement), depending of the cell cycle phase time and age of the cell + N_G1=1-1.0/t_G1*properties['age'] + N_S=0 + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + v0 = np.zeros_like(properties['age']) # array for velocities + G1_cells = np.where(0 <= properties['age'] <= t_G1)[0] + v0[G1_cells] = -1.0/t_G1 + #S_cells = np.where(t_G1 < properties['age'] <= t_G1 + t_S)[0] + #v0[S_cells] = 0 + G2_cells = np.where(t_G1+t_S < properties['age'] <= t_G1+t_S+t_G2)[0] + v0[G2_cells] = 1.0/t_G2 + #M_cells = np.where(t_G1+t_S+t_G2 < properties['age']) + #v0[M_cells] = 0 + + properties['nucl_pos'] += v0*dt \ + + crowding_force(cells, a=properties['a'], s=properties['s'])*dt \ + + np.sqrt(2*properties['D']*dt)*np.random.randn(len(properties['zposn'])) + + + """Target area function depending age and z nuclei position""" + properties['A0'] = (properties['age']+1.0)*0.5*(1.0+properties['nucl_pos']**2) # target area now depends on nucl_pos + properties['A0_initial'] = (properties['age']+1.0)*0.5*(1.0+properties['zposn']**2) # initial + + #############BAETTI VID + + #ath BAETTI D VID + cells.mesh , number_T1, d= cells.mesh.transition(T1_eps) #check edges verifing T1 transition + if len(number_T1)>0: + for ii in number_T1: + index = cells.mesh.face_id_by_edge[ii] + properties['T1_angle_pD'] =np.append(properties['T1_angle_pD'],cells.mesh.edge_angle[ii]) + F = force(cells)/viscosity #force per each cell force= targetarea+Tension+perimeter+pressure_boundary + + #EG BAETTI VID + len_modified=np.matrix.copy(cells.mesh.length) + #len_modified[np.where((properties['parent_group'][cells.mesh.face_id_by_edge]==1) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==0))]*=0.12 + + tens = (0.5*cells.by_edge('Lambda', 'Lambda_boundary')/len_modified)*cells.mesh.edge_vect + tens= tens - tens.take(cells.mesh.edges.prev, 1) + F+=tens + + dv = dt*model.sum_vertices(cells.mesh.edges,F) #movement of the vertices using eq: viscosity*dv/dt = F + properties['force_x'] = F[0]*viscosity + properties['force_y'] = F[1]*viscosity + + if hasattr(cells.mesh.geometry,'width'): + expansion[0] = expansion_constant*np.average(F[0]*cells.mesh.vertices[0])*dt/(cells.mesh.geometry.width**2) + if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument + expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) + cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) + yield cells -# simulation with division, INM and no differentiation rate +# simulation with division, INM and no differentiation rate - type 0 with both pD and pMN def simulation_with_division_clone(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non properties = cells.properties properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers @@ -213,7 +620,7 @@ def simulation_with_division_clone(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100. yield cells -# simulation with division and all the cell are differentated as pNM diff_rate_hours (1/h) +# simulation with division and all the cells are differentated as pNM diff_rate_hours (1/h) - type 1 def simulation_with_division_clone_differentiation(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non properties = cells.properties properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers @@ -260,7 +667,7 @@ def simulation_with_division_clone_differentiation(cells,force,dt=dt,T1_eps=T1_e yield cells -# simulation with division with INM and 2 diferent populations (with and without differentiation rate) +# simulation with division with INM and 2 diferent populations (with and without differentiation rate) - type 2 def simulation_with_division_clone_differenciation_3stripes(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non @@ -285,10 +692,20 @@ def simulation_with_division_clone_differenciation_3stripes(cells,force,dt=dt,T1 properties['deleted_edges']=[] properties['edges_division']=[] properties['T1_edge']=[] + properties['nucl_pos'] = [] expansion = np.array([0.0,0.0]) + + # added by Rebeca: + D = 0.15 + k = 100 # a constant + a=0.2 # a constant controlling the size of force + s=0.2 + + while True: #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis - ready = np.where((~cells.empty() &(cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2))) | (~cells.empty() & (cells.properties['parent_group']==3) &(cells.mesh.area>=0.4) & (cells.properties['age']>=(t_G1+t_S+t_G2))))[0] + + ready = np.where((~cells.empty() &(cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)) & (cells.properties['zposn']>=0.75)) | (~cells.empty() & (cells.properties['parent_group']==3) &(cells.mesh.area>=0.4) & (cells.properties['age']>=(t_G1+t_S+t_G2)) & (cells.properties['zposn']>=0.75)))[0] if len(ready): #these are the cells ready to undergo division at the current timestep #properties['ageingrate'] =np.append(properties['ageingrate'], np.repeat(properties['ageingrate'][ready],2)) @@ -300,11 +717,16 @@ def simulation_with_division_clone_differenciation_3stripes(cells,force,dt=dt,T1 properties['poisoned'] = np.append(properties['poisoned'], np.zeros(2*len(ready))) ### to add diferenciation rate in PMN edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division properties['edges_division'].append(edge_pairs) - cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + + + for i in range(len(ready)): commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + + if properties['parent_group'][ready[i]]==3: properties['ageingrate'] = np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2))) else: @@ -322,13 +744,21 @@ def simulation_with_division_clone_differenciation_3stripes(cells,force,dt=dt,T1 ###### Differentiation rate properties['differentiation_rate'] = time_hours*dt*(np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))[properties['parent_group']] #Used 0.02, 0.0002 & 1/13 properties['poisoned'] = properties['poisoned'] - (properties['poisoned']-1) * (~(cells.empty()) & (rand.rand(len(cells)) < properties['differentiation_rate'])) - properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate + + # add age ingrate only for alive cells + alivecells = np.where(~cells.empty())[0] + properties['age'][alivecells] += dt*properties['ageingrate'][alivecells] #add time step depending of the degradation rate + N_G1=1-1.0/t_G1*properties['age'] #nuclei position in G1 phase N_S=0 N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) #nuclei position in G2 and S phase + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + + properties['zposn'][np.where(properties['parent_group']==3)]=0 + """Target area function depending age and z nuclei position""" @@ -373,7 +803,7 @@ def simulation_with_division_clone_differenciation_3stripes(cells,force,dt=dt,T1 yield cells -# simulation with division with INM and all the cells high without differentiation rate +# simulation with division with INM and all the cells high without differentiation rate - type 3 ?? def simulation_with_division_clone_whole_tissue_differenciation(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=None properties = cells.properties properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers @@ -395,7 +825,7 @@ def simulation_with_division_clone_whole_tissue_differenciation(cells,force,dt=d #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis ready = np.where(~cells.empty() & (cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)))[0] if len(ready): #these are the cells ready to undergo division at the current timestep - properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2.0*len(ready)))) + properties['ageingrate'] =np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2.0*len(ready)))) # use only for alive cells at current timestep properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids properties['ids_division'] = ready @@ -419,7 +849,10 @@ def simulation_with_division_clone_whole_tissue_differenciation(cells,force,dt=d ###### Defferentiation rate properties['differentiation_rate'] = time_hours*dt*(np.array([0.0,diff_rate_hours,0.0,0.0,0.0,diff_rate_hours, 0.0]))[properties['parent_group']] #Used 0.02, 0.0002 & 1/13 properties['poisoned'] = properties['poisoned'] - (properties['poisoned']-1) * (~(cells.empty()) & (rand.rand(len(cells)) < properties['differentiation_rate'])) - properties['age'] = properties['age']+dt*properties['ageingrate'] #add time step depending of the degradation rate + + # add age ingrate only for alive cells + alivecells = np.where(~cells.empty())[0] + properties['age'][alivecells] += dt*properties['ageingrate'][alivecells] #add time step depending of the degradation rate N_G1=1-1.0/t_G1*properties['age'] #nuclei position in G1 phase N_S=0 @@ -452,6 +885,159 @@ def simulation_with_division_clone_whole_tissue_differenciation(cells,force,dt=d expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) yield cells + + +# simulation with division with INM and 2 diferent populations (with and without differentiation rate) - type 4 PREVIOUS (type 2 modified by Rebeca) +def simulation_with_division_clone_differenciation_3stripes_model_1(cells,force,dt=dt,T1_eps=T1_eps,lifespan=100.0,rand=None): #(cells,force,dt=0.001,T1_eps=0.04,lifespan=100.0,rand=Non + + + properties = cells.properties + properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers + properties['ageingrate'] = np.random.normal(1.0/lifespan,0.2/lifespan,len(cells)) #degradation rate per each cell + #floor plate cells + no=len(properties['ageingrate'][np.where(properties['parent_group']==3)]) + properties['ageingrate'][np.where(properties['parent_group']==3)]=np.random.normal(0.5/lifespan,0.1/lifespan,no) + + properties['ids_division'] = [] #save ids of the cell os the division when it's ready per each time step + properties['ids_division_1'] = [] #save ids of the cell os the division when it's ready per each time step and region + properties['ids_division_02'] = [] #save ids of the cell os the division when it's ready per each time step and region + properties['poisoned'] = np.zeros(len(cells)) ### to add diferenciation rate in PMN + # properties['differentiation_rate']= np.zeros(len(cells),dtype=int) + properties['force_x'] = [] + properties['force_y'] = [] + properties['T1_angle_pMN'] = [] + properties['T1_angle_pD'] = [] + properties['Division_angle_pMN'] = [] + properties['Division_angle_pD'] = [] + properties['deleted_edges']=[] + properties['edges_division']=[] + properties['T1_edge']=[] + properties['nucl_pos']=[] + expansion = np.array([0.0,0.0]) + + # added by Rebeca: + D = 0.15 + k = 100 # a constant + a=0.2 # a constant controlling the size of force + s=0.2 + + + + while True: + #cells id where is true the division conditions: living cells & area greater than 2 & age cell in mitosis + + # added by Rebeca: properties['zposn'] >= 0.75 + ready = np.where((~cells.empty() &(cells.mesh.area>=A_c) & (cells.properties['age']>=(t_G1+t_S+t_G2)) & (cells.properties['nucl_pos']>=0.75)) | (~cells.empty() & (cells.properties['parent_group']==3) &(cells.mesh.area>=0.4) & (cells.properties['age']>=(t_G1+t_S+t_G2)) & (cells.properties['nucl_pos']>=0.75)))[0] + + if len(ready): #these are the cells ready to undergo division at the current timestep + #properties['ageingrate'] =np.append(properties['ageingrate'], np.repeat(properties['ageingrate'][ready],2)) + properties['age'] = np.append(properties['age'],np.zeros(2*len(ready))) + properties['parent'] = np.append(properties['parent'],np.repeat(properties['parent'][ready],2)) # Daugthers and parent have the same ids + properties['ids_division'] = ready + properties['parent_group'] = np.append(properties['parent_group'],np.repeat(properties['parent_group'][ready],2)) #use to draw clones + + properties['poisoned'] = np.append(properties['poisoned'], np.zeros(2*len(ready))) ### to add diferenciation rate in PMN + edge_pairs = [division_axis(cells.mesh,cell_id,rand) for cell_id in ready] #New edges after division + properties['edges_division'].append(edge_pairs) + cells.mesh = cells.mesh.add_edges(edge_pairs) #Add new edges in the mesh + + + + for i in range(len(ready)): + commun_edges = np.intersect1d(cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-2*(i+1)))[0]],cells.mesh.length[np.where(cells.mesh.face_id_by_edge==(cells.mesh.n_face-1-2*i))[0]]) + division_new_edge=np.where(cells.mesh.length==np.max(commun_edges))[0] + + + + + if properties['parent_group'][ready[i]]==3: + properties['ageingrate'] = np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2))) + else: + properties['ageingrate'] = np.append(properties['ageingrate'], np.abs(np.random.normal(1.0/lifespan,0.2/lifespan,2))) + # print len(properties['ageingrate']) + #if properties['parent_group'][cells.mesh.n_face-2*(i+1)]==1: + # properties['Division_angle_pMN']= np.append(properties['Division_angle_pMN'],cells.mesh.edge_angle[division_new_edge][0]) + #else: + # properties['Division_angle_pD']= np.append(properties['Division_angle_pD'],cells.mesh.edge_angle[division_new_edge][0]) + #for ids in ready: + # if properties['parent_group'][ids]==1: + # properties['ids_division_1'] = np.append(properties['ids_division_1'], ids) + # else: + # properties['ids_division_02'] = np.append(properties['ids_division_02'], ids) + ###### Differentiation rate + properties['differentiation_rate'] = time_hours*dt*(np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))[properties['parent_group']] #Used 0.02, 0.0002 & 1/13 + properties['poisoned'] = properties['poisoned'] - (properties['poisoned']-1) * (~(cells.empty()) & (rand.rand(len(cells)) < properties['differentiation_rate'])) + + # add age ingrate only for alive cells -> not necessarily needed as all cells are alive in type 2 + alivecells = np.where(~cells.empty())[0] + properties['age'][alivecells] += dt*properties['ageingrate'][alivecells] #add time step depending of the degradation rate + + + N_G1_new = np.ones_like(properties['age']) # vector with ones for as many cells (ages) as they are at the current timestep + N_S_new = np.zeros_like(properties['age']) + N_G2_new = np.zeros_like(properties['age']) + N_M_new = np.ones_like(properties['age']) + + N_G1=1-1.0/t_G1*properties['age'] + N_G1_new = N_G1_new + k*(N_G1 - N_G1_new)*dt + np.sqrt(2*D*dt)*np.random.randn(len(properties['age'])) #nuclei position in G1 phase + + N_S=0 + N_S_new = N_S_new + k*(N_S - N_S_new)*dt + np.sqrt(2*D*dt)*np.random.randn(len(properties['age'])) + + N_G2=1.0/(t_G2)*(properties['age']-(t_G1+t_S)) #nuclei position in G2 and S phase + N_G2_new = N_G2_new + k*(N_G2 - N_G2_new)*dt + np.sqrt(2*D*dt)*np.random.randn(len(properties['age'])) + + N_M = 1 + N_M_new = N_M_new + k*(N_M - N_M_new)*dt + np.sqrt(2*D*dt)*np.random.randn(len(properties['age'])) + properties['zposn'] = np.minimum(1.0,np.maximum(N_G1,np.maximum(N_S,N_G2))) + properties['nucl_pos'] = np.minimum(1.0,np.maximum(N_G1_new,np.maximum(N_S_new,N_G2_new))) + + + properties['zposn'][np.where(properties['parent_group']==3)]=0 + + + """Target area function depending age and z nuclei position""" + properties['A0'] = (properties['age']+1.0)*0.5*(1.0+properties['zposn']**2)*(1.0-cells.properties['poisoned']) + + + cells.mesh , number_T1, del_edges= cells.mesh.transition(T1_eps) + + properties['deleted_edges'].append(del_edges) + #if len(number_T1)>0: + # for ii in number_T1: + # properties['T1_edge']=np.append(properties['T1_edge'], ii) + # index = cells.mesh.face_id_by_edge[ii] + #if properties['parent_group'][index]==1: + # properties['T1_angle_pMN'] =np.append(properties['T1_angle_pMN'],cells.mesh.edge_angle[ii]) + #else: + # properties['T1_angle_pD'] =np.append(properties['T1_angle_pD'],cells.mesh.edge_angle[ii]) + F = force(cells)/viscosity #force per each cell force= targetarea+Tension+perimeter+pressure_boundary + + #ADDING THE FLOOR PLATE + len_modified=np.matrix.copy(cells.mesh.length) + #this next line can be use for modifying all edges at the boundary + #len_modified[np.where( ((properties['parent_group'][cells.mesh.face_id_by_edge]==3) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==3)) | ((properties['parent_group'][cells.mesh.face_id_by_edge]==2) & (properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==3)) | ((properties['parent_group'][cells.mesh.face_id_by_edge]==4) & (properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==3)) )]*=0.004 + + #modifying tension w.r.t. area + for n in np.where( ((properties['parent_group'][cells.mesh.face_id_by_edge]==3) & np.logical_not(properties['parent_group'][cells.mesh.face_id_by_edge[cells.mesh.edges.reverse]]==3)))[0]: + if abs(cells.mesh.area[cells.mesh.face_id_by_edge[n]]-cells.mesh.area[cells.mesh.face_id_by_edge[cells.mesh.edges.reverse[n]]])>0.4: + len_modified[n]*=0.002 + + tens = (0.5*cells.by_edge('Lambda', 'Lambda_boundary')/len_modified)*cells.mesh.edge_vect + tens= tens - tens.take(cells.mesh.edges.prev, 1) + F+=tens + + dv = dt*model.sum_vertices(cells.mesh.edges,F) #movement of the vertices using eq: viscosity*dv/dt = F + #properties['force_x'] = F[0]*viscosity + #properties['force_y'] = F[1]*viscosity + if hasattr(cells.mesh.geometry,'width'): + expansion[0] = expansion_constant*np.average(F[0]*cells.mesh.vertices[0])*dt/(cells.mesh.geometry.width**2) + if hasattr(cells.mesh.geometry,'height'): #Cylinder mesh doesn't have 'height' argument + expansion[1] = np.average(F[1]*cells.mesh.vertices[1])*dt/(cells.mesh.geometry.height**2) + cells.mesh = cells.mesh.moved(dv).scaled(1.0+expansion) + + yield cells + #_clones @@ -472,6 +1058,7 @@ def definecolors(cells): return palette[colors] """Run simulation and save data functions""" +""" def run_simulation(x): K=x[0] G=x[1] @@ -484,30 +1071,45 @@ def run_simulation(x): history = run(simulation_with_division(cells,force,rand=rand),500.0/dt,1.0/dt) # model.animate_video_mpg(history) return history - +""" def run_simulation_INM(x, timend,rand, sim_type): global dt #sim_type 0 simulation_with_division_clone (no differentiation rate) #sim_type 1 simulation_with_division_clone_differentiation (all differentiation rate) #sim_type 2 simulation_with_division_clone_differenciation_3stripes (2 population with and without diffentiation rate) #sim_type 3 simulation_with_division_clone_whole_tissue_differenciation (differentiation rate everywhere) - print(dt) + # print(dt) + + # parameters of the vertex model K=x[0] G=x[1] L=x[2] + + # parameters of the nucleus A-B stochastic dynamics + k=x[3] + D=x[4] + + # parameters of the crowding force + s=x[5] + a=x[6] + rand1 = np.random.RandomState(123456) #I have modified the random function because RamdomState takes always the same numbers #mesh = init.cylindrical_hex_mesh(2,2,noise=0.2,rand=rand1) mesh = init.toroidal_hex_mesh(20,20,noise=0.2,rand=rand1) cells = model.Cells(mesh,properties={'K':K,'Gamma':G,'P':0.0,'boundary_P':P,'Lambda':L, 'Lambda_boundary':0.5}) cells.properties['age'] = np.random.rand(len(cells)) + force = TargetArea() + Perimeter() + Pressure() + + ####eg er ad baeta thessu vid cells.properties['parent_group'] = np.zeros(len(cells),dtype=int) #use to draw clone cells.properties['parent_group'] = bin_by_xpos(cells,np.cumsum([0.475,0.5,0.475])) - + + print("Start thermalization...") history1 = run(simulation_with_division(cells,force,rand=rand1),200/dt,50.0/dt) - cells = history1[-1].copy() + cells = history1[-1].copy() #last timestep in the 'thermalization' phase -> use this as the initial condition for the actual run below # sampleset = np.random.choice(cells.mesh.face_ids,20, replace=False) #take 7 different ramdon cells to follow clones @@ -515,9 +1117,12 @@ def run_simulation_INM(x, timend,rand, sim_type): cells.properties['parent'] = cells.mesh.face_ids #save the ids to control division parents-daugthers cells.properties['parent_group'] = bin_by_xpos(cells,np.cumsum([0.225, 0.15, 0.075, 0.1, 0.075, 0.15, 0.225])) + print(f"Start simulation of type {sim_type}...") # sampleset = np.random.choice(cells.mesh.face_ids[cells.properties['parent_group']==1],10, replace=False) #take 10 different ramdon cells to follow clones + if sim_type == 100: + history = run(simulation_with_division(cells,force,rand=rand),(timend)/dt,1.0/dt) if sim_type == 0: - history = run(simulation_with_division_clone(cells,force,rand=rand),(timend),1.0) + history = run(simulation_with_division_clone(cells,force,rand=rand),(timend)/dt,1.0/dt) history[-1].properties['parent_group'] = np.zeros(len(history[-1].properties['parent_group']),dtype=int) if sim_type == 1: history = run(simulation_with_division_clone_differentiation(cells,force,rand=rand),(timend)/dt,1.0/dt) @@ -529,7 +1134,32 @@ def run_simulation_INM(x, timend,rand, sim_type): if sim_type == 3: history = run(simulation_with_division_clone_whole_tissue_differenciation(cells,force,rand=rand),(timend)/dt,1.0/dt) history[-1].properties['parent_group'] = np.zeros(len(history[-1].properties['parent_group']),dtype=int) + # added by Rebeca: + if sim_type == 4: + cells.properties['k']=k + cells.properties['D']=D + history = run(simulation_with_division_model_1(cells,force,rand=rand),(timend)/dt,1.0/dt) + if sim_type == 5: + cells.properties['k']=k + cells.properties['D']=D + history = run(simulation_with_division_model_2(cells,force,rand=rand),(timend)/dt,1.0/dt) + if sim_type == 6: + cells.properties['k']=k + cells.properties['D']=D + cells.properties['s']=s + cells.properties['a']=a + history = run(simulation_with_division_model_3(cells,force,rand=rand),(timend)/dt,1.0/dt) + if sim_type == 7: + cells.properties['k']=k + cells.properties['D']=D + cells.properties['s']=s + cells.properties['a']=a + history = run(simulation_with_division_model_4(cells,force,rand=rand),(timend)/dt,1.0/dt) + + + return history + @@ -542,10 +1172,15 @@ def save_data(I,history,outputdir): # os.makedirs(outputdir) """Information of Area, Perimeter, Neigbours: time_mean and end. And force in time and final age distribution""" force = TargetArea() + Perimeter() + Pressure() - generation_a=[cells.mesh.area for cells in history] + generation_a=[cells.mesh.area for cells in history] # collects a list of arrays each of which contains area of each cell at any given time generation_p=[cells.mesh.perimeter for cells in history] - generation_n=[np.bincount(cells.mesh.face_id_by_edge) for cells in history] + generation_n=[np.bincount(cells.mesh.face_id_by_edge) for cells in history] # takes a vector of faces ids -> how many edges of a particular id are = count the neighbors generation_f=[force(cells) for cells in history] + # added by Rebeca: + generation_nucl_pos = [cells.properties['nucl_pos'] for cells in history] + generation_nucl_pos_2 = [cells.properties['nucl_pos_2'] for cells in history] + generation_final_nucl_pos = [cells.properties['final_nucl_pos'] for cells in history] + generation_final_nucl_pos_2 = [cells.properties['final_nucl_pos_2'] for cells in history] death=[cells.empty() for cells in history] #mean variables in time area_mean=[] @@ -557,7 +1192,7 @@ def save_data(I,history,outputdir): number_cells = [] ids_face_by_edge = [] for i in range(0,len(history)-1): - valid=np.where(~death[i] & (generation_a[i]>0))[0] + valid=np.where(~death[i] & (generation_a[i]>0))[0] # -> valid checks which cells haven't died number_cells = np.append(number_cells, len(valid)) area_mean=np.append(area_mean,np.mean(generation_a[i][valid])) area_total=np.append(area_total,np.sum(generation_a[i][valid])) @@ -570,7 +1205,7 @@ def save_data(I,history,outputdir): #end value of Area, Perimeter and Neighbour of the tissue """Define files per different values of area division condition""" outputdirname=outputdir+'/' - outfile_a=outputdirname+"area_mean_%0.3f"%I + outfile_a=outputdirname+"area_mean_%0.3f"%I # Is I meant to be area_mean[i] ??? outfile_a_total=outputdirname+"area_total_%0.3f"%I outfile_p=outputdirname+"perimeter_mean_%0.3f"%I outfile_n=outputdirname+"neigh_mean_%0.3f"%I