From abcb1fcd4a4998f2312ddd42a913d8cba6c66769 Mon Sep 17 00:00:00 2001 From: Lars Hubatsch <hubatsch@pks.mpg.de> Date: Sat, 13 Feb 2021 23:18:43 +0100 Subject: [PATCH] Update figure: influence of coverslip and neighbours. --- Plots_Droplet_FRAP.ipynb | 84 +++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/Plots_Droplet_FRAP.ipynb b/Plots_Droplet_FRAP.ipynb index 988644b..165f579 100644 --- a/Plots_Droplet_FRAP.ipynb +++ b/Plots_Droplet_FRAP.ipynb @@ -117,7 +117,7 @@ " phi_tot_ext, G_in, G_out):\n", " f = frap_solver([4, 4, 0.25], m, name='FRAP_multi/FRAP_multi_'+m[:-4]+str(G_i), point_list=p,\n", " T=240, dt=0.02, phi_tot_int=p_i, phi_tot_ext=p_e, G_in=G_i, G_out=G_o)\n", - " f.solve_frap()\n", + "# f.solve_frap()\n", " f_i.append(f)" ] }, @@ -131,12 +131,13 @@ "for i in range(len(f_i)):\n", "# if i>2:\n", " profs.append([])\n", - " for j in range(50):\n", + " for j in range(240):\n", " values=[]\n", " fs = fem_utils.load_time_point(f_i[i].name+'t_p_'+str(j)+'.h5',\n", " f_i[i].mesh)\n", + " print('Reading time point ' + str(j) + ' of simulation ' + str(i))\n", " for n in ns:\n", - " values.append([fs([4, 4, 0.5]+e*n) for e in eps])\n", + " values.append([fs([4, 4, 0.25]+e*n) for e in eps])\n", " profs[i].append(np.mean(np.transpose(values), 1))" ] }, @@ -146,7 +147,15 @@ "metadata": {}, "outputs": [], "source": [ - "np.savetxt('t_p.csv', profs, delimiter=',')" + "# Write out profiles to .csv\n", + "for i in [0, 1, 2, 3, 4, 5]:\n", + " dist = str(point_lists[i][0][1]-4)\n", + " P = str(f_i[i].phi_tot_int/f_i[i].phi_tot_ext)\n", + " np.savetxt('eps_multi_'+str(i)+'.csv', eps, delimiter=',')\n", + " np.savetxt('t_p_multi_' + P + '_' + dist +'.csv',\n", + " profs[i][1:], delimiter=',')\n", + " meta_data = np.r_[f_i[i].dt, f_i[i].T-1, eps, 0.25] # last param: droplet radius\n", + " np.savetxt('meta_data_multi_' + P + '_' + dist + '.csv', meta_data, delimiter=',')" ] }, { @@ -175,12 +184,15 @@ "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", + "nice_fig('time $t$ [s]', 'intensity (a.u)', [0,4], [0,1.05], [1.5,2])\n", + "plt.plot(np.linspace(0, (f_i[0].T-1)*f_i[0].dt, f_i[0].T), \n", + " [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", + "plt.plot(np.linspace(0, (f_i[1].T-1)*f_i[1].dt, f_i[1].T),\n", + " [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", + "plt.plot(np.linspace(0, (f_i[2].T-1)*f_i[2].dt, f_i[2].T),\n", + " [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", @@ -194,16 +206,19 @@ "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", + "nice_fig('time $t$ [s]', r'av. volume fraction $\\bar{\\phi}_\\mathrm{u}$', [0,4.], [0,1.05], [1.5,2])\n", + "plt.plot(np.linspace(0, (f_i[3].T-1)*f_i[3].dt, f_i[3].T),\n", + " [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", + "plt.plot(np.linspace(0, (f_i[4].T-1)*f_i[4].dt, f_i[4].T),\n", + " [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", + "plt.plot(np.linspace(0, (f_i[5].T-1)*f_i[5].dt, f_i[5].T),\n", + " [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", + "plt.legend(prop={'size': 9}, frameon=False, loc=(0.2, 0.025),\n", " handletextpad=0.4, labelspacing=0.2)\n", "save_nice_fig(fol+'Fig3/tot_recov_neighbours_good.pdf')" ] @@ -214,14 +229,15 @@ "metadata": {}, "outputs": [], "source": [ - "ml = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit.csv',\n", + "ml = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit_multi.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", + "nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'volume fraction $\\phi_\\mathrm{u}$', [0,0.23], [0,1.05], [3.8,2])\n", + "l_sim = plt.plot(eps, np.transpose(profs[0])[:,1:181:22]/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", + "l_fit = plt.plot(np.linspace(0, 0.23, 100), np.transpose(ml)[:,:180:22], c='k', lw=1.5)\n", + "plt.legend([l_sim[0], l_fit[0]], ['Model, eq. (6)', 'Fit, eq. (1)'], loc=(0.1, 0.77),\n", + " prop={'size': 9}, frameon=False, labelspacing=0.1, handlelength=0.1, ncol=2)\n", "save_nice_fig(fol+'Fig3/spat_recov_neighbours.pdf')" ] }, @@ -269,7 +285,8 @@ "z = [0.25, 1.5, 4, 0.25, 1.5, 4]\n", "\n", "# eps = np.linspace(0, 3.5, 100) # for full profile\n", - "eps = np.r_[np.linspace(0, 0.4, 100), np.linspace(0.41, 2, 20)]\n", + "# eps = np.r_[np.linspace(0, 0.4, 100), np.linspace(0.41, 2, 20)]\n", + "eps = np.linspace(0, 0.23, 100)\n", "profs_cs = []\n", "for i, z_i in enumerate(z):\n", " profs_cs.append([])\n", @@ -290,13 +307,13 @@ "source": [ "# Write out profiles to .csv\n", "for i in [0, 1, 2, 3, 4, 5]:\n", - " z = str(f_cs[i].cent_poin[-1])\n", + " z_str = str(f_cs[i].cent_poin[-1])\n", " P = str(f_cs[i].phi_tot_int/f_cs[i].phi_tot_ext)\n", " np.savetxt('eps_'+str(i)+'.csv', eps, delimiter=',')\n", - " np.savetxt('t_p_long_coverslip_' + P + '_' + z +'.csv',\n", + " np.savetxt('t_p_long_coverslip_' + P + '_' + z_str +'.csv',\n", " profs_cs[i][1:], delimiter=',')\n", " meta_data = np.r_[f_cs[i].dt, f_cs[i].T-1, eps, 0.25] # last param: droplet radius\n", - " np.savetxt('meta_data_long_coverslip_' + P + '_' + z + '.csv', meta_data, delimiter=',')" + " np.savetxt('meta_data_long_coverslip_' + P + '_' + z_str + '.csv', meta_data, delimiter=',')" ] }, { @@ -305,10 +322,12 @@ "metadata": {}, "outputs": [], "source": [ - "nice_fig('time $t$ [s]', '', [0,50], [0,1.1], [1.5,2])\n", + "nice_fig('time $t$ [s]', '', [0,4], [0,1.05], [1.5,2])\n", "ls = ['-', '--', '-.']\n", + " \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", + " plt.plot(np.linspace(0, (f.T-1)*f.dt, f.T),\n", + " [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", @@ -322,14 +341,15 @@ "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", + "nice_fig('time $t$ [s]', r'av. volume fraction $\\bar{\\phi}_\\mathrm{u}$', [0,4], [0,1.05], [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", + " plt.plot(np.linspace(0, (f.T-1)*f.dt, f.T),\n", + " [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", + "plt.legend(prop={'size': 9}, frameon=False, loc=(0.18, 0.025),\n", " handletextpad=0.4, labelspacing=0.2)\n", "save_nice_fig(fol+'Fig3/tot_recov_cs_good.pdf')" ] @@ -340,15 +360,15 @@ "metadata": {}, "outputs": [], "source": [ - "ml_neigh = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit_neigh.csv',\n", + "ml_neigh = np.loadtxt('/Users/hubatsch/Desktop/DropletFRAP/matlab_fit_coverslip.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", + "nice_fig('radial distance $r$ [$\\mathrm{\\mu m}$]', 'volume fraction $\\phi_\\mathrm{u}$', [0,0.23], [0,1.05], [3.8,2])\n", + "l_sim = plt.plot(eps, np.transpose(profs_cs[0])[:,1::22]/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", + "l_fit = plt.plot(np.linspace(0, 0.23, 100), np.transpose(ml_neigh)[:,::22],\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", + "plt.legend([l_sim[0], l_fit[0]], ['Model, eq. (6)', 'Fit, eq. (1)'], frameon=False, loc=(0.1, 0.77), ncol=2)\n", "save_nice_fig(fol+'Fig3/spat_recov_coverslip.pdf')" ] }, -- GitLab