Newer
Older
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from fem_sol import frap_solver\n",
"from matplotlib import cm, rc, rcParams\n",
"from matplotlib.ticker import MaxNLocator\n",
"import fem_utils\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"fol = '/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/'\n",
"# sns.set_style(\"ticks\")\n",
"rcParams['axes.linewidth'] = 0.75\n",
"rcParams['xtick.major.width'] = 0.75\n",
"rcParams['ytick.major.width'] = 0.75\n",
"# rcParams['text.usetex']=True"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Define colors\n",
"pa = sns.color_palette(\"Set2\")\n",
"sns.set_palette(pa)\n",
"grey = (0.6, 0.6, 0.6)\n",
"dark_grey = (0.2, 0.2, 0.2)\n",
"green = pa[0]\n",
"blue = pa[2]\n",
"red = pa[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pylab as pl\n",
"params = {'legend.fontsize': 9,\n",
" 'legend.handlelength': 1}\n",
"pl.rcParams.update(params)\n",
"\n",
"def nice_fig(xla, yla, xli, yli, size, fs=12): \n",
" rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})\n",
"# rc('font',**{'family':'serif','serif':['Palatino']})\n",
" plt.gcf().set_size_inches(size[0], size[1])\n",
" plt.xlabel(xla,fontsize=fs) \n",
" plt.ylabel(yla,fontsize=fs)\n",
" plt.xlim(xli)\n",
" plt.ylim(yli)\n",
" plt.tick_params(axis='both', which='major', labelsize=fs)\n",
"\n",
"def save_nice_fig(name):\n",
" plt.savefig(name, format='pdf', dpi=300, bbox_inches='tight',\n",
" transparent=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### FRAP geometries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# For radial average: define angles and radial spacing\n",
"alphas = np.linspace(0,2*np.pi, 20)\n",
"ns = np.c_[np.cos(alphas), np.sin(alphas), np.zeros(len(alphas))]\n",
"eps = np.linspace(0, 0.23, 100)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"me = ['Meshes/multi_drop_gauss.xml', 'Meshes/multi_drop_gauss_med.xml',\n",
" 'Meshes/multi_drop_gauss_far.xml', 'Meshes/multi_drop_gauss.xml',\n",
" 'Meshes/multi_drop_gauss_med.xml', 'Meshes/multi_drop_gauss_far.xml']\n",
"point_lists = [[[4, 4.5, 0.5], [4, 3.5, 0.5], [3.5, 4, 0.5], [4.5, 4, 0.5]],\n",
" [[4, 5, 0.5], [4, 3, 0.5], [3, 4, 0.5], [5, 4, 0.5]],\n",
" [[4, 5.5, 0.5], [4, 2.5, 0.5], [2.5, 4, 0.5], [5.5, 4, 0.5]],\n",
" [[4, 4.5, 0.5], [4, 3.5, 0.5], [3.5, 4, 0.5], [4.5, 4, 0.5]],\n",
" [[4, 5, 0.5], [4, 3, 0.5], [3, 4, 0.5], [5, 4, 0.5]],\n",
" [[4, 5.5, 0.5], [4, 2.5, 0.5], [2.5, 4, 0.5], [5.5, 4, 0.5]]]\n",
"phi_tot_int = [.99, .99, .99, .9, .9, .9]\n",
"phi_tot_ext = [.01, .01, .01, .1, .1, .1]\n",
"G_in = [1, 1, 1, .1, .1, .1]\n",
"G_out = [1, 1, 1, 0.99/0.9, 0.99/0.9, 0.99/0.9]\n",
"\n",
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
"\n",
"for p, m, p_i, p_e, G_i, G_o in zip(point_lists, me, phi_tot_int,\n",
" phi_tot_ext, G_in, G_out):\n",
" f = frap_solver([4, 4, 0.5], m, name='FRAP_multi_'+m[:-4]+str(G_i), point_list=p,\n",
" T=50, phi_tot_int=p_i, phi_tot_ext=p_e, G_in=G_i, G_out=G_o)\n",
" f.solve_frap()\n",
" f_i.append(f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"profs = []\n",
"for i in range(len(f_i)):\n",
"# if i>2:\n",
" profs.append([])\n",
" for j in range(50):\n",
" values=[]\n",
" fs = fem_utils.load_time_point(f_i[i].name+'t_p_'+str(j)+'.h5',\n",
" f_i[i].mesh)\n",
" for n in ns:\n",
" values.append([fs([4, 4, 0.5]+e*n) for e in eps])\n",
" profs[i].append(np.mean(np.transpose(values), 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"np.savetxt('t_p.csv', profs, delimiter=',')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ft = f_i[1]\n",
"meta_data = np.r_[ft.dt, ft.T, eps]\n",
"np.savetxt('meta_data.csv', meta_data, delimiter=',')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(eps,np.transpose(profs)[:,:])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', 'intensity (a.u)', [0,50], [0,1.1], [1.5,2])\n",
"plt.plot([np.mean(x)/f_i[0].phi_tot_int for x in profs[0]],\n",
" lw=2, label='d=0.5', ls='-')\n",
"plt.plot([np.mean(x)/f_i[1].phi_tot_int for x in profs[1]],\n",
" lw=2, label='d=1', ls='--')\n",
"plt.plot([np.mean(x)/f_i[2].phi_tot_int for x in profs[2]],\n",
" lw=2, label='d=1.5', ls=':')\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"plt.title('$P=99}$', size=12)\n",
"plt.gca().get_yaxis().set_visible(False)\n",
"save_nice_fig(fol+'Fig3/tot_recov_neighbours_bad.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', r'av. volume fraction $\\bar{\\phi}_\\mathrm{u}$', [0,30], [0,1.1], [1.5,2])\n",
"plt.plot([np.mean(x)/f_i[3].phi_tot_int for x in profs[3]],\n",
" lw=2, label='$d=0.5 \\,\\mathrm{\\mu m}$', ls='-')\n",
"plt.plot([np.mean(x)/f_i[4].phi_tot_int for x in profs[4]],\n",
" lw=2, label='$d=1 \\,\\mathrm{\\mu m}$', ls='--')\n",
"plt.plot([np.mean(x)/f_i[5].phi_tot_int for x in profs[5]],\n",
" lw=2, label='$d=1.5 \\,\\mathrm{\\mu m}$', ls=':')\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"plt.title('$P=9$', size=12)\n",
"plt.legend(prop={'size': 9}, frameon=False, loc=(0.22, 0.025),\n",
" handletextpad=0.4, labelspacing=0.2)\n",
"save_nice_fig(fol+'Fig3/tot_recov_neighbours_good.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ml = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit.csv',\n",
" delimiter=',')\n",
"nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'volume fraction $\\phi_\\mathrm{u}$', [0,0.25], [0,1.1], [3.8,2])\n",
"l_sim = plt.plot(eps, np.transpose(profs[0])[:,::8]/f_i[0].phi_tot_int, c=green,\n",
" lw=4.5, alpha=0.7)\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"l_fit = plt.plot(np.linspace(0, 0.23, 100), np.transpose(ml)[:,::8], c='k', lw=1.5)\n",
"plt.legend([l_sim[0], l_fit[0]], ['Model, eq. (6)', 'Fit, eq. (1)'], prop={'size': 9}, frameon=False)\n",
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
"save_nice_fig(fol+'Fig3/spat_recov_neighbours.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Define parameters for all simulations\n",
"point_list = [[4, 4, 0.5], [4, 4, 1.5], [4, 4, 4],\n",
" [4, 4, 0.5], [4, 4, 1.5], [4, 4, 4]]\n",
"me = ['coverslip.xml', '1_5.xml', 'symmetric.xml',\n",
" 'coverslip.xml', '1_5.xml', 'symmetric.xml']\n",
"phi_tot_int = [.99, .99, .99, .9, .9, .9]\n",
"phi_tot_ext = [.01, .01, .01, .1, .1, .1]\n",
"G_in = [1, 1, 1, .1, .1, .1]\n",
"G_out = [1, 1, 1, 0.99/0.9, 0.99/0.9, 0.99/0.9]\n",
"f_cs = []\n",
"\n",
"# Zip all parameters, iterate\n",
"for p, m, p_i, p_e, G_i, G_o in zip(point_list, me, phi_tot_int,\n",
" phi_tot_ext, G_in, G_out):\n",
" f_cs.append(frap_solver(p, 'Meshes/single_drop_'+m,\n",
" name='FRAP_'+m[:-4]+str(G_i), T=60, phi_tot_int=p_i,\n",
" phi_tot_ext=p_e, G_in=G_i, G_out=G_o))\n",
" f_cs[-1].solve_frap()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"z = [0.5, 1.5, 4, 0.5, 1.5, 4]\n",
"profs_cs = []\n",
"for i, z_i in enumerate(z):\n",
" profs_cs.append([])\n",
" for j in range(50):\n",
" values=[]\n",
" fs = fem_utils.load_time_point(f_cs[i].name+'t_p_'+str(j)+'.h5',\n",
" f_cs[i].mesh)\n",
" for n in ns:\n",
" values.append([fs([4, 4, z_i]+e*n) for e in eps])\n",
" profs_cs[i].append(np.mean(np.transpose(values), 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', '', [0,50], [0,1.1], [1.5,2])\n",
"ls = ['-', '--', '-.']\n",
"for i, f in enumerate(f_cs[0:3]):\n",
" plt.plot([np.mean(x)/f.phi_tot_int for x in profs_cs[i]],\n",
" label='d='+str(z[i]), ls=ls[i], lw=2)\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"plt.title('$P=99$', size=12)\n",
"plt.gca().get_yaxis().set_visible(False)\n",
"save_nice_fig(fol+'Fig3/tot_recov_cs_bad.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', r'av. volume fraction $\\bar{\\phi}_\\mathrm{u}$', [0,30], [0,1.1], [1.5,2])\n",
"ls = ['-', '--', '-.']\n",
"for i, f in enumerate(f_cs[3:]):\n",
" plt.plot([np.mean(x)/f.phi_tot_int for x in profs_cs[i+3]],\n",
" label='$h=$'+str(z[i])+'$\\,\\mathrm{\\mu m}$', lw=2, ls=ls[i])\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"plt.title('$P=9$', size=12)\n",
"plt.legend(prop={'size': 9}, frameon=False, loc=(0.22, 0.025),\n",
" handletextpad=0.4, labelspacing=0.2)\n",
"save_nice_fig(fol+'Fig3/tot_recov_cs_good.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ml_neigh = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit_neigh.csv',\n",
" delimiter=',')\n",
"nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'volume fraction $\\phi_\\mathrm{u}$', [0,0.25], [0,1.1], [3.8,2])\n",
"l_sim = plt.plot(eps, np.transpose(profs_cs[0])[:,::8]/f_cs[0].phi_tot_int, c=green,\n",
" lw=4.5, alpha=0.7)\n",
"plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
"l_fit = plt.plot(np.linspace(0, 0.23, 100), np.transpose(ml_neigh)[:,::8],\n",
" ls='-', c='k', lw=1)\n",
"plt.legend([l_sim[0], l_fit[0]], ['Model, eq. (6)', 'Fit, eq. (1)'], frameon=False, loc=(0.63, 0.0))\n",
"save_nice_fig(fol+'Fig3/spat_recov_coverslip.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Figure 1: Fitting $D_{in}$ and data analysis."
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: comparison PGL-3 diffusivity with Louise's viscosity**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"louise = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig1/Louise.csv')\n",
"lars = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig1/Lars.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax1 = plt.subplots()\n",
"ax2 = ax1.twinx()\n",
"plt.sca(ax1)\n",
"sns.lineplot(x=\"conc\", y=\"D\", data=lars, color=sns.color_palette()[1])\n",
"sns.scatterplot(x=\"conc\", y=\"D\", data=lars, color=sns.color_palette()[1], alpha=0.7)\n",
"plt.xlabel('$c_\\mathrm{salt}\\; [\\mathrm{mM}]$')\n",
"plt.ylabel('$D_{\\mathrm{in}} \\;[\\mathrm{\\mu m^2\\cdot s^{-1}}]$', color=red)\n",
"plt.yticks([0, 0.05, 0.1], rotation=90, color = pa[1])\n",
"plt.ylim(0, 0.1)\n",
"ax1.set_zorder(1) \n",
"ax1.patch.set_visible(False)\n",
"plt.sca(ax2)\n",
"sns.lineplot(x=\"conc\", y=\"vis\", data=louise, color=grey, label='data from Jawerth \\net al. 2018')\n",
"nice_fig('c_\\mathrm{salt} [\\mathrm{mM}]', '$\\eta^{-1} \\;[Pa\\cdot s]^{-1}$', [40,190], [0,7.24], [3*2.3,3*2])\n",
"plt.yticks(color = grey)\n",
"plt.ylabel('$\\eta^{-1} \\;[\\mathrm{Pa\\cdot s}]^{-1}$ ', color = grey)\n",
"plt.legend(frameon=False, fontsize=9)\n",
"# save_nice_fig(fol+'Fig1/Lars_vs_Louise.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Ratio between $D_{out}$ for maximum and minimum salt concentrations for PGL-3**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lars[lars.conc==180].mean()/lars[lars.conc==50].mean()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel:coacervates PLYS/ATP, CMD/PLYS**m"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"coacervates = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig1/Coacervates.csv')\n",
"sns.stripplot(data=coacervates, palette=[green, blue], jitter=0.35,**{'marker': '.', 'size': 10})\n",
"ax = sns.barplot(data=coacervates, palette=pa, facecolor=(1, 1, 1, 0), edgecolor=[pa[0], pa[2]], capsize=.15, ci='sd', errwidth=1.5)\n",
"nice_fig(None, '$D_\\mathrm{in} \\;[\\mathrm{\\mu m^2\\cdot s^{-1}}]$', [None, None], [0,6], [2.3,2])\n",
"plt.xticks([0,1], ('CMD/PLYS', 'PLYS/ATP'), rotation=20)\n",
"ax.get_xticklabels()[0].set_color(green)\n",
"ax.get_xticklabels()[1].set_color(blue)\n",
"# save_nice_fig(fol+'Fig1/Coacervates.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: time course CMD**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"CMD = np.loadtxt(fol+'/Fig1/CMD_timecourse.csv', delimiter=',')\n",
"CMD_fit = np.loadtxt(fol+'/Fig1/CMD_fit_timecourse.csv', delimiter=',')\n",
"l_sim = plt.plot(CMD[:, 0], CMD[:, 1::2], '.', c=green)\n",
"l_fit = plt.plot(CMD_fit[:, 0], CMD_fit[:, 1::2], '-', lw=1, c='k')\n",
"plt.plot(range(0, 10), np.ones(10)*np.min(CMD_fit[:, 1]), linestyle='--', color=grey, lw=1.5)\n",
"plt.legend([l_sim[0], l_fit[0]], ['data', 'fit'], ncol=2, loc=(0, 0.85), frameon=False)\n",
"nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'intensity (a.u)', [0,np.max(CMD_fit[:, 0])], [0,0.6], [2.3,2])\n",
"save_nice_fig(fol+'Fig1/CMD_spat_recov.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: time course PGL-3**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PGL = np.loadtxt(fol+'/Fig1/PGL_timecourse.csv', delimiter=',')\n",
"PGL_fit = np.loadtxt(fol+'/Fig1/PGL_fit_timecourse.csv', delimiter=',')\n",
"l_sim = plt.plot(PGL[:, 0], PGL[:, 1::2], '.', c=red)\n",
"l_fit = plt.plot(PGL_fit[:, 0], PGL_fit[:, 1::2], '-', lw=1, c='k')\n",
"plt.plot(range(0, 10), np.ones(10)*np.min(PGL_fit[:, 1]), linestyle='--', color=grey, lw=1.5)\n",
"plt.legend([l_sim[0], l_fit[0]], ['data', 'fit'], ncol=2, loc=(0.015, 0.865), frameon=False)\n",
"nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'intensity (a.u)', [0,np.max(PGL_fit[:, 0])], [0, 0.6], [2.3,2])\n",
"save_nice_fig(fol+'Fig1/PGL_spat_recov.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: time course total intensity**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PGL = np.loadtxt(fol+'/Fig1/PGL_tot.csv', delimiter=',')\n",
"ATP = np.loadtxt(fol+'/Fig1/ATP_tot.csv', delimiter=',')\n",
"CMD = np.loadtxt(fol+'/Fig1/CMD_tot.csv', delimiter=',')\n",
"# fig, ax1 = plt.subplots()\n",
"# ax2 = ax1.twiny()\n",
"# plt.sca(ax1)\n",
"nice_fig('$t/T_\\mathrm{max}$', 'intensity (a.u)', [0,200], [0,0.62], [2.3,2])\n",
"# plt.sca(ax2)\n",
"# ax2.tick_params(axis=\"x\",direction=\"in\")\n",
"plt.plot(PGL[::10, 0]/np.max(PGL[1:-1:2, 0]), PGL[::10,1], '.', label='PGL-3', c='#CC406E', markersize=3, alpha=0.7, lw=2)\n",
"plt.plot(ATP[::1, 0]/np.max(ATP[:, 0]), ATP[::1,1], '.', label='PLYS/ATP', c='#FF508A', markersize=3, alpha=0.7, lw=2)\n",
"plt.plot(CMD[::5, 0]/np.max(CMD[:, 0]), CMD[::5,1], '.', label='CMD/PLYS', c='#7F2845', markersize=3, alpha=0.7, lw=2)\n",
"plt.legend(frameon=False, fontsize=9)\n",
"plt.xlim(0, 1)\n",
"save_nice_fig(fol+'Fig1/tot_recov.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', 'intensity (a.u)', [0,200], [0,0.62], [1,2])\n",
"# plt.sca(ax2)\n",
"# ax2.tick_params(axis=\"x\",direction=\"in\")\n",
"plt.plot(PGL[::10, 0], PGL[::10,1], '.', label='PGL-3', c='#CC406E', markersize=3, alpha=0.7, lw=2)\n",
"plt.legend(frameon=False, fontsize=9, handletextpad=0.4)\n",
"save_nice_fig(fol+'Fig1/tot_recov_PGL.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"nice_fig('time $t$ [s]', 'intensity (a.u)', [0,10], [0,0.62], [1,2])\n",
"plt.plot(ATP[::1, 0], ATP[::1,1], '.', label='PLYS/ATP', c='#FF508A', markersize=3, alpha=0.7, lw=2)\n",
"plt.plot(CMD[::5, 0], CMD[::5,1], '.', label='CMD/PLYS', c='#7F2845', markersize=3, alpha=0.7, lw=2)\n",
"plt.legend(frameon=False, fontsize=9, loc=(-0.08, 0), handletextpad=0)\n",
"plt.yticks([]); plt.ylabel('')\n",
"save_nice_fig(fol+'Fig1/tot_recov_coac.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Figure 2: model sketches"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model = np.loadtxt(fol+'Fig2/model_timecourse.csv', delimiter=',')\n",
"l_fit = plt.plot(model[:, 0], model[:, 1:], '-', lw=1,\n",
" c=green, label='Simulation')\n",
"nice_fig('radial distance $r/R$', 'volume fraction $\\phi_\\mathrm{u}$', [0, 2],\n",
" [0,1], [2.3,2])\n",
"plt.plot(model[:, 0], model[:, -1], c=green, lw=2)\n",
"plt.plot(model[:, 0], model[:, -1], 'k', lw=2)\n",
"# plt.annotate('$t \\longrightarrow \\infty$', (0.97, 0.89), (1.3,0.85), fontsize=12)\n",
"# plt.annotate('$t \\longrightarrow \\infty$', (0.97, 0.89), (1.3,0.85), fontsize=12)\n",
"plt.annotate('$\\phi_\\mathrm{tot}$', (1, 0.5), (1.5,0.5), fontsize=10)\n",
"save_nice_fig(fol+'Fig2/full_time_course.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"l_fit = plt.plot(model[:, 0], model[:, 2], '-', lw=1,\n",
" c=dark_grey, label='Simulation')\n",
"plt.plot(model[:, 0], model[:, -1], 'k', lw=2)\n",
"nice_fig('radial distance $r/R$', 'volume fraction $\\phi_\\mathrm{u}$', [0, 2],\n",
"plt.title('$t=0.22 \\;R^2/D_\\mathrm{in}$')\n",
"plt.text(0.75, 0.18, '$\\phi_\\mathrm{u}$', fontsize=10)\n",
"plt.gca().fill_between(model[:, 0], 0, model[:, 2], color=green)\n",
"plt.gca().fill_between(model[:, 0], model[:, -1], model[:, 2], color=grey)\n",
"plt.annotate('$\\phi_\\mathrm{tot}$', (1, 0.5), (1.5,0.5), fontsize=10)\n",
"save_nice_fig(fol+'Fig2/snap_shot.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Figure 4: Obtaining info about outside: experiments."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: data time course with full model.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PLYS = np.loadtxt(fol+'Fig4/PLYS_timecourse.csv', delimiter=',')\n",
"PLYS_fit = np.loadtxt(fol+'Fig4/PLYS_fit_timecourse.csv', delimiter=',')\n",
"l_data = plt.plot(PLYS[:, 0], PLYS[:, 1:], c=blue, lw=2,\n",
" label='Experiment')\n",
"l_fit = plt.plot(PLYS_fit[:, 0], PLYS_fit[:, 1:], '-', lw=1,\n",
" c=dark_grey, label='Simulation')\n",
"nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'intensity (a.u)', [0, 2.4*np.max(PLYS[:, 0])],\n",
"plt.legend([l_data[0], l_fit[0]], ['ATP/PLYS', 'Full model'], frameon=False,\n",
" fontsize=9, handletextpad=0.4, handlelength=0.8)\n",
"save_nice_fig(fol+'Fig4/PLYS_spat_recov_new.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Experimental Partition coefficient vs $D_{out}$ for CMD**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PLYS = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PLYS.csv')\n",
"CMD = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/CMD.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax1 = plt.subplots()\n",
"plt.sca(ax1)\n",
"sns.lineplot(x=\"P\", y=\"D_out\", data=CMD, color=green, ci='sd')\n",
"sns.lineplot(x=\"P\", y=\"D_out\", data=PLYS, color=blue, ci='sd')\n",
"plt.plot(np.logspace(1, 2, 10), 2*np.logspace(1, 2, 10), '--', c='grey')\n",
"ax1.set_yscale('log')\n",
"ax1.set_xscale('log')\n",
"nice_fig('Partition coefficient $P$', '$D_\\mathrm{out} \\;[\\mathrm{\\mu m^2s^{-1}}]$', [1,100], [0.1,100], [2.3,2])\n",
"plt.legend(['CMD/PLYS', 'PLYS/ATP'], frameon=False, fontsize=9, loc=(0.48,0.))\n",
"plt.text(1.02, 1.7, '$D_\\mathrm{in, PLYS}$')\n",
"plt.text(1.02, 6, '$D_\\mathrm{in, CMD}$')\n",
"plt.xticks([1, 10, 100]);\n",
"save_nice_fig(fol+'Fig4/PLYS_CMD.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Experimental Partition coefficient vs $D_out$ for PGL-3**"
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PGL_50 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_50.csv')\n",
"PGL_60 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_60.csv')\n",
"PGL_75 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_75.csv')\n",
"PGL_90 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_90.csv')\n",
"PGL_100 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_100.csv')\n",
"PGL_120 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_120.csv')\n",
"PGL_150 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_150.csv')\n",
"PGL_180 = pd.read_csv('/Users/hubatsch/Desktop/DropletFRAP/Latex/Figures/Fig4/PGL_180.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax1 = plt.subplots()\n",
"plt.sca(ax1)\n",
"temp = sns.color_palette()\n",
"sns.set_palette(sns.color_palette(\"Oranges\", 9))\n",
"l50 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_50, color=sns.color_palette()[1], ci=None)\n",
"l60 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_60, color=sns.color_palette()[2], ci=None)\n",
"l75 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_75, color=sns.color_palette()[3], ci=None)\n",
"l90 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_90, color=sns.color_palette()[4], ci=None)\n",
"leg1 = plt.legend(['50 mM', '60 mM', '75 mM', '90 mM'], labelspacing=0.3,\n",
" loc=(0.65, 0.0), handletextpad=0.4, handlelength=0.5, frameon=0)\n",
"l100 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_100, color=sns.color_palette()[5], ci=None)\n",
"l120 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_120, color=sns.color_palette()[6], ci=None)\n",
"l150 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_150, color=sns.color_palette()[7], ci=None)\n",
"l180 = sns.lineplot(x=\"P\", y=\"D_out\", data=PGL_180, color=sns.color_palette()[8], ci=None)\n",
"plt.plot(np.logspace(0, 3, 10), 0.07*np.logspace(0, 3, 10), '--', c='grey')\n",
"# plt.plot(np.logspace(2, 3, 10), 30*np.ones(10), '--', c='m', lw=2)\n",
"ax1.set_yscale('log')\n",
"ax1.set_xscale('log')\n",
"nice_fig('Partition coefficient $P$', '$D_\\mathrm{out} \\;[\\mathrm{\\mu m^2 s^{-1}}]$', [1,1000], [0.0003,200], [2.3,2])\n",
"plt.xticks([1, 10, 100, 1000]);\n",
"plt.legend(loc=1)\n",
"plt.legend(['50 mM', '60 mM', '75 mM', '90 mM', '100 mM', '120 mM', '150 mM', '180 mM'], labelspacing=0.3,\n",
" loc=(0, 0.56), handletextpad=0.4, handlelength=0.5, frameon=0)\n",
"plt.gca().add_artist(leg1)\n",
"save_nice_fig(fol+'Fig4/PGL-3.pdf')\n",
"sns.set_palette(temp)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Figure 5: Obtaining info about outside: theory."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Partition coefficient vs. $D_{out}$, showcasing four different simulation start cases.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"P_Do = np.loadtxt(fol+'/Fig4/Part_vs_Do.csv', delimiter=',')\n",
"P = [5, 150, 5, 150]\n",
"D_o = [0.1, 0.1, 1, 1]\n",
"plt.gca().set_prop_cycle(None)\n",
"nice_fig('Partition coefficient $P$', '$D_\\mathrm{out}$ [$\\mathrm{\\mu m^2/s}$]', [0.9,320], [0.000001,340], [2.3,2])\n",
"lines = plt.loglog(P_Do[0, :], P_Do[1:, :].transpose())\n",
"plt.plot(P_Do[0, :], P_Do[0, :], '--', c='grey')\n",
"plt.legend([lines[2], lines[0], lines[3], lines[1]],\n",
" ['0.2', '0.02', '0.0067', '0.00067'], ncol=2, frameon=False,\n",
" title=r'$D_\\mathrm{out}$/P [$\\mathrm{\\mu m^2/s}$]:', columnspacing=0.5, labelspacing=0.3,\n",
" loc=(0.4, 0), handletextpad=0.4, handlelength=0.5)\n",
"plt.gca().set_prop_cycle(None)\n",
"plt.plot(P[0], D_o[0], 'd')\n",
"plt.plot(P[1], D_o[1], 'd')\n",
"plt.plot(P[2], D_o[2], 'd')\n",
"plt.plot(P[3], D_o[3], 'd')\n",
"plt.annotate('$D_{out}$/P = 1 $\\mathrm{\\mu m^2/s}$', [1,40], c='grey')\n",
"plt.xticks([1, 10, 100]);\n",
"save_nice_fig(fol+'Fig4/D_vs_P.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Cost function**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"P_Cost = np.loadtxt(fol+'/Fig4/Part_vs_Cost.csv', delimiter=',')\n",
"nice_fig('Partition coefficient $P$', 'Cost function [a.u.]', [0.9,320], [0.000000001,0.01], [2.3,2])\n",
"lines = plt.loglog(P_Cost[0, :], P_Cost[1:, :].transpose())\n",
"plt.legend([lines[2], lines[0], lines[3], lines[1]],\n",
" ['0.2', '0.02', '0.0067', '0.00067'], ncol=2, frameon=False,\n",
" title=r'$D_\\mathrm{out}$/P set to:', columnspacing=0.5, labelspacing=0.3,\n",
" loc=(0.081, 0), handletextpad=0.4, handlelength=0.5)\n",
"plt.xticks([1, 10, 100]);\n",
"save_nice_fig(fol+'Fig4/D_vs_Cost.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Valley in parameter space**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"con = np.loadtxt(fol+'Fig4/Valley.csv', delimiter=',')\n",
"levels = MaxNLocator(nbins=15).tick_values(np.log10(con[:, 2:].min()), np.log10(con[:, 2:].max()))\n",
"nice_fig('Partition coefficient $P$', '$D_\\mathrm{out} \\;[\\mu m^2 s^{-1}]$', [1, 3], [-2,1], [2.3,2])\n",
"CS = plt.contourf(np.log10(con[:, 0]), np.log10(con[:, 1]), np.log10(con[:, 2:]), levels=levels, cmap=cm.coolwarm)\n",
"plt.plot(np.log10(150), np.log10(10**-1), 'y*', label='Initial Simul.', markersize=6)\n",
"le = plt.legend(loc=(0, 0.83), frameon=False, handletextpad=0.4)\n",
"le.get_texts()[0].set_color('white')\n",
"plt.xticks([1, 2, 3], ['$10^1$', '$10^2$', '$10^3$'])\n",
"plt.yticks([-2, -1, 0, 1], ['$10^{-2}$', '$10^{-1}$', '$10^0$', '$10^1$'])\n",
"plt.tick_params('x', pad=5)\n",
"fig1 = plt.gcf()\n",
"clb = fig1.colorbar(CS, ticks=[0, -2, -4, -6])\n",
"clb.ax.set_title('Cost')\n",
"save_nice_fig(fol+'Fig4/Sim_D_out_P.pdf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Panel: Zoom in for valley in parameter space**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"levels = MaxNLocator(nbins=15).tick_values(np.log10(con[:, 2:].min()), np.log10(con[:, 2:].max()))\n",
"nice_fig('Partition coefficient $P$', '', [1.9, 2.4], [-1.5,-0.5], [2.3,2])\n",
"CS = plt.contourf(np.log10(con[16:-27, 0]), np.log10(con[16:-27, 1]),\n",
" np.log10(con[16:-27, 2+16:-27]), levels=levels,\n",
" cmap=cm.coolwarm, vmax=-1.5)\n",
"plt.plot(np.log10(150), np.log10(10**-1), 'y*', label='Initial Simul.', markersize=6)\n",
"le = plt.legend(loc=(0, 0.83), frameon=False, handletextpad=0.4)\n",
"le.get_texts()[0].set_color('white')\n",
"plt.xticks([2, 2.25], ['$10^2$', '$10^{2.25}$'])\n",
"plt.yticks([-1.5, -1, -0.5], ['$10^{-1.5}$', '$10^{-1}$', '$10^{-0.5}$'])\n",
"plt.tick_params('x', pad=5)\n",
"fig1 = plt.gcf()\n",
"clb = fig1.colorbar(CS, ticks=[-2, -4, -6])\n",
"clb.ax.set_title('Cost')\n",
"save_nice_fig(fol+'Fig4/Sim_D_out_P_inset.pdf')"
]
},
{
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}