qpms/examples/rectangular/scattering/04_scattering_cut_compare.i...

201 lines
48 KiB
Plaintext
Raw Permalink Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"inputlist_finite=[\n",
" 'cyl_r30nm_h30nm_p375nmx375nm_40x40_mAg_bg1.52_φ0π_θ(-0.025_0.025)π_ψ0.5π_χ0π_f2.15eV_L2.npz',\n",
" 'cyl_r30nm_h30nm_p375nmx375nm_50x50_mAg_bg1.52_φ0π_θ(-0.025_0.025)π_ψ0.5π_χ0π_f2.15eV_L2.npz',\n",
" 'cyl_r30nm_h30nm_p375nmx375nm_70x70_mAg_bg1.52_φ0π_θ(-0.025_0.025)π_ψ0.5π_χ0π_f2.15eV_L2.npz',\n",
" '100x100.npz'\n",
" \n",
"]\n",
"input_infinite = 'cyl_r30nm_h30nm_p375nmx375nm_mAg_bg1.52_φ0_θ(-0.025_0.025)π_ψ0.5π_χ0π_f2.15eV_L3.npz'"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from matplotlib import pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAboAAAEGCAYAAAAT/1CLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOzdeXxU1d348c/3zj7Z95CELCxhB4GIVnFB69JWREULilq1Ptaqrdbfo4+2aq21fapPrY+t1ZanVoUK1FKriDsCVlBRkH0JhJCQSYDs++xzfn/MJAQIykBCIJz363Vfd+695557ZjLJN+eec+4RpRSapmma1l8ZfV0ATdM0TetNOtBpmqZp/ZoOdJqmaVq/pgOdpmma1q/pQKdpmqb1a+a+LkBfSk1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cl0sDtN2J7ipcyop7q9Gn/I35neJCYyYzLJi8+jIKGA/Ph8CuLzybcmkN7egjSWQX3p/qVuJ7jr919PDLzOLBodA6kyZVEaymCzJ5U1zUls8yZ3BkGAAQn2/bXBSI1wYOR1SowVEd1x5mQnImuUUkV9XY5o6ECnA90JzRsIsrfJQ1Wjh6pGN1WN7nB7WWO43ayq0Y0/GP4OWwiQJXWMjWthpLOJQmstA6kmLbCHOLcLs7v2wMxj0iFlcDiQpQwOB7aUwbTHZVLuqaW0qZRdTbvY1bSL0qZSdjfvxtflNmWCLYH8+Hzy4vPIic2moD2W7PJW4rbvheKdeHfsINTS0pnenJmJJTsbS2YmkpFFg2MgDSoJd8CK12/g8YHXCx53EBHB4TC
"text/plain": [
"<Figure size 432x288 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"f, ax = plt.subplots(3,1)\n",
"u = 1e-12 # inverse micrometer\n",
"for i, fil in enumerate(inputlist_finite):\n",
" dat = np.load(inputlist_finite[i], allow_pickle=True)\n",
" meta = dat['meta'][()]\n",
" theta = meta['theta']\n",
" sz = meta['size']\n",
" N = sz[0]*sz[1]\n",
" scat_n = dat['σ_scat'][0,:] / N / u\n",
" abs_n = dat['σ_abs'][0,:] / N / u\n",
" ext_n = dat['σ_ext'][0,:] / N / u \n",
" ax[0].plot(theta, scat_n, label='$%d \\\\times %d$' % (sz[0], sz[1]))\n",
" ax[1].plot(theta, abs_n)\n",
" ax[2].plot(theta,ext_n)\n",
"dat = np.load(input_infinite, allow_pickle=True)\n",
"meta = dat['meta'][()]\n",
"N = 1\n",
"scat_n = dat['σ_scat'][0,:] / N / u\n",
"abs_n = dat['σ_abs'][0,:] / N / u\n",
"ext_n = dat['σ_ext'][0,:] / N / u\n",
"ax[0].plot(theta, scat_n, label='$\\\\infty \\\\times \\\\infty$')\n",
"ax[1].plot(theta, abs_n)\n",
"ax[2].plot(theta,ext_n)\n",
"for l in range(3):\n",
" ax[l].set_xlim([-.05,.05])\n",
" ax[l].set_ylim([0,0.065])\n",
"for l in range(2):\n",
" ax[l].xaxis.set_ticklabels([])\n",
"ax[1].set_ylabel('$\\\\sigma / \\\\mathrm{\\\\mu m}^{2}$ per particle')\n",
"ax[2].set_xlabel('incident angle / rad')#('$\\\\theta/\\mathrm{rad}$')\n",
"for l, txt in enumerate(['$\\\\sigma_\\\\mathrm{scat}$','$\\\\sigma_\\\\mathrm{abs}$','$\\\\sigma_\\\\mathrm{ext}$']):\n",
" ax[l].text(0.02, 0.95,txt,\n",
" horizontalalignment='left',\n",
" verticalalignment='top',\n",
" transform = ax[l].transAxes)\n",
"f.legend(title=\"Array size\", loc=\"center right\")\n",
"plt.savefig('04_scattering_cuts.pdf')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['meta',\n",
" 'k_sph',\n",
" 'k_cart',\n",
" 'E_cart',\n",
" 'E_sph',\n",
" 'σ_ext',\n",
" 'σ_abs',\n",
" 'σ_scat',\n",
" 'σ_ext_ir',\n",
" 'σ_abs_ir',\n",
" 'σ_scat_ir',\n",
" 'omega',\n",
" 'wavenumbers']"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dat = np.load(inputlist_finite[0], allow_pickle=True)\n",
"[k for k in dat.keys()]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'period': (3.75e-07, 3.75e-07),\n",
" 'size': [40, 40],\n",
" 'background': 1.52,\n",
" 'material': 'Ag',\n",
" 'radius': 3e-08,\n",
" 'height': 3e-08,\n",
" 'lMax_extend': 6,\n",
" 'lMax': 2,\n",
" 'eV': [[2.15]],\n",
" 'phi': 0.0,\n",
" 'theta': array([-0.07853982, -0.07696902, -0.07539822, -0.07382743, -0.07225663,\n",
" -0.07068583, -0.06911504, -0.06754424, -0.06597345, -0.06440265,\n",
" -0.06283185, -0.06126106, -0.05969026, -0.05811946, -0.05654867,\n",
" -0.05497787, -0.05340708, -0.05183628, -0.05026548, -0.04869469,\n",
" -0.04712389, -0.04555309, -0.0439823 , -0.0424115 , -0.0408407 ,\n",
" -0.03926991, -0.03769911, -0.03612832, -0.03455752, -0.03298672,\n",
" -0.03141593, -0.02984513, -0.02827433, -0.02670354, -0.02513274,\n",
" -0.02356194, -0.02199115, -0.02042035, -0.01884956, -0.01727876,\n",
" -0.01570796, -0.01413717, -0.01256637, -0.01099557, -0.00942478,\n",
" -0.00785398, -0.00628319, -0.00471239, -0.00314159, -0.0015708 ,\n",
" 0. , 0.0015708 , 0.00314159, 0.00471239, 0.00628319,\n",
" 0.00785398, 0.00942478, 0.01099557, 0.01256637, 0.01413717,\n",
" 0.01570796, 0.01727876, 0.01884956, 0.02042035, 0.02199115,\n",
" 0.02356194, 0.02513274, 0.02670354, 0.02827433, 0.02984513,\n",
" 0.03141593, 0.03298672, 0.03455752, 0.03612832, 0.03769911,\n",
" 0.03926991, 0.0408407 , 0.0424115 , 0.0439823 , 0.04555309,\n",
" 0.04712389, 0.04869469, 0.05026548, 0.05183628, 0.05340708,\n",
" 0.05497787, 0.05654867, 0.05811946, 0.05969026, 0.06126106,\n",
" 0.06283185, 0.06440265, 0.06597345, 0.06754424, 0.06911504,\n",
" 0.07068583, 0.07225663, 0.07382743, 0.07539822, 0.07696902,\n",
" 0.07853982]),\n",
" 'psi': 1.5707963267948966,\n",
" 'chi': 0.0,\n",
" 'output': None,\n",
" 'plot_out': None,\n",
" 'plot': True,\n",
" 'save_gradually': False,\n",
" 'basis_vectors': [(3.75e-07, 0.0), (0.0, 3.75e-07)]}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dat['meta'][()]"
]
}
],
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}