Newer
Older
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### FRAP geometries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from fem_sol import frap_solver\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"

Lars Hubatsch
committed
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"font = {'family' : 'normal',\n",
" 'weight' : 'normal',\n",
" 'size' : 12}\n",
"import matplotlib\n",
"matplotlib.rc('font', **font)\n",
"\n",
"def make_graph_pretty(xlab, ylab, loc=0, markerfirst=True, handlelength=None):\n",
" color1 = 'black'#'darkorange'\n",
" color2 = (0, 0, 0)\n",
" color2 = (1, 1, 1)\n",
" ax = plt.gca()\n",
" ax.tick_params(axis='x', colors=color1, which='both')\n",
" ax.tick_params(axis='y', colors=color1, which='both')\n",
" plt.xlabel(xlab, color=color1)\n",
" plt.ylabel(ylab, color=color1)\n",
" ax.spines['left'].set_color(color1)\n",
" ax.spines['bottom'].set_color(color1)\n",
" # Hide the right and top spines\n",
" ax.spines['right'].set_visible(False)\n",
" ax.spines['top'].set_visible(False)\n",
" ax.set_facecolor(color2)\n",
" plt.gcf().subplots_adjust(bottom=0.17, left=0.15)\n",
" plt.legend(frameon=False, loc=loc, labelspacing=0.1,\n",
" markerfirst=markerfirst, handlelength=handlelength)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = ['Meshes/multi_drop_gauss.xml', 'Meshes/multi_drop_gauss_med.xml',\n",
" '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",
"f_i = []\n",
"for j in range(len(m)):\n",
" f = frap_solver([4, 4, 0.5], m[j], name=str(j), point_list=point_lists[j],\n",
" T=50, phi_tot_int=0.99, phi_tot_ext=0.01)\n",
" f.solve_frap()\n",
" f_i.append(f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import fem_utils\n",
"alphas = np.linspace(0,2*np.pi, 100)\n",
"ns = np.c_[np.cos(alphas), np.sin(alphas), np.zeros(len(alphas))]\n",
"eps = np.linspace(0, 0.25, 100)\n",
"profs = []\n",
"for i in range(5):\n",
" values=[]\n",
" fs = fem_utils.load_time_point(f_i[0].name+'t_p_'+str(i)+'.h5',\n",
" f_i[0].mesh)\n",
" for n in ns:\n",
"# values.append([f_i[0].fs[i]([4, 4, 0.5]+e*n) for e in eps])\n",
" values.append([fs([4, 4, 0.5]+e*n) for e in eps])\n",
" profs.append(np.mean(np.transpose(values), 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(np.transpose(profs))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for i in range(len(cs[0])):\n",
" plt.plot([np.mean(x[1:49])/0.8 for x in cs[0][0:i]], label='dist=0.5')\n",
" plt.plot([np.mean(x[1:49])/0.8 for x in cs[1][0:i]], label='dist=1')\n",
" plt.plot([np.mean(x[1:49])/0.8 for x in cs[2][0:i]], label='dist=1.5')\n",
" plt.plot(range(0, 100), np.ones(100), linestyle='--', color='k')\n",
" plt.ylim((0, 1.1))\n",
" plt.xlim((0, 100))\n",
" make_graph_pretty('t (a.u.)', 'intensity (a.u)', loc=4)\n",
"# plt.savefig('img_'+str(i)+'.png', dpi=300)\n",

Lars Hubatsch
committed
]
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_0 = frap_solver([4, 4, 0.5], 'Meshes/single_drop_coverslip.xml',\n",
" name='FRAP_coverslip', T=50, phi_tot_int=0.99,\n",
" phi_tot_ext=0.01)\n",
"f_0.solve_frap()\n",
"\n",
"f_1 = frap_solver([4, 4, 1.5], 'Meshes/single_drop_1_5.xml',\n",
" name='FRAP_symmetric', T=50, phi_tot_int=0.99,\n",
" phi_tot_ext=0.01)\n",
"f_1.solve_frap()\n",
"\n",
"f_2 = frap_solver([4, 4, 4], 'Meshes/single_drop_symmetric.xml',\n",
" name='FRAP_symmetric', T=50, phi_tot_int=0.99,\n",
" phi_tot_ext=0.01)\n",
"f_2.solve_frap()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_3 = frap_solver([4, 4, 0.5], 'Meshes/single_drop_coverslip.xml',\n",
" name='FRAP_symmetric', T=50, G_in=0.1, G_out=0.99/0.9,\n",
" phi_tot_int=0.9, phi_tot_ext=0.1)\n",
"f_3.solve_frap()\n",
"\n",
"f_4 = frap_solver([4, 4, 1.5], 'Meshes/single_drop_1_5.xml',\n",
" name='FRAP_symmetric', T=50, G_in=0.1, G_out=0.99/0.9,\n",
" phi_tot_int=0.9, phi_tot_ext=0.1)\n",
"f_4.solve_frap()\n",
"\n",
"f_5 = frap_solver([4, 4, 4], 'Meshes/single_drop_symmetric.xml',\n",
" name='FRAP_symmetric', T=50, G_in=0.1, G_out=0.99/0.9,\n",
" phi_tot_int=0.9, phi_tot_ext=0.1)\n",
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot([np.mean(x[1:49])/0.99 for x in f_0.cs], label='dist=0.5')\n",
"plt.plot([np.mean(x[1:49])/0.99 for x in f_1.cs], label='dist=1.5')\n",
"plt.plot([np.mean(x[1:49])/0.99 for x in f_2.cs], label='dist=4')\n",
"plt.plot([np.mean(x[1:49])/0.9 for x in f_3.cs], label='dist=0.5, G_out=10')\n",
"plt.plot([np.mean(x[1:49])/0.9 for x in f_4.cs], label='dist=1.5, G_out=10')\n",
"plt.plot([np.mean(x[1:49])/0.9 for x in f_5.cs], label='dist=4, G_out=10')\n",
"plt.plot(range(0, 50), np.ones(50), linestyle='--', color='k')\n",
"plt.xlim((0, 50))\n",
"make_graph_pretty('t (a.u.)', 'intensity (a.u)', loc=4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(np.transpose(f_3.cs))"
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
{
"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
}