{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from scipy.interpolate import InterpolatedUnivariateSpline\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from solcore.absorption_calculator import calculate_ellipsometry\n",
"from solcore.structure import Structure\n",
"from solcore.data_analysis_tools.ellipsometry_analysis import EllipsometryData\n",
"from solcore.graphing.Custom_Colours import colours\n",
"from solcore.absorption_calculator.cppm import Custom_CPPB as cppb\n",
"from solcore.absorption_calculator.dielectric_constant_models import Oscillator"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"E_eV = np.linspace(0.7, 4.2, 1000)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Load in ellipsomery data from file..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Exp_Data = EllipsometryData(\"../data/ge_ellipsometry_data.dat\")\n",
"Exp_Angles = Exp_Data.angles"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Load in some experimental Ge n-k to compare fit with this..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ge_nk_Exp = np.loadtxt(\"../data/Ge_nk.csv\", delimiter=\",\", unpack=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Smooth the data with spline fitting..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"n_spline = InterpolatedUnivariateSpline(x=Ge_nk_Exp[::5, 0], y=Ge_nk_Exp[::5, 1], k=3)(E_eV)\n",
"k_spline = InterpolatedUnivariateSpline(x=Ge_nk_Exp[::5, 2], y=Ge_nk_Exp[::5, 3], k=3)(E_eV)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Step 1 :: n and k modelling...
\n",
"First model the Ge02 layer with the Sellmeier model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define Oscillator Structure"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"GeO2 = Structure([\n",
" Oscillator(oscillator_type=\"Sellmeier\", material_parameters=None,\n",
" A1=0.80686642, L1=0.68972606E-1,\n",
" A2=0.71815848, L2=0.15396605,\n",
" A3=0.85416831, L3=0.11841931E2)\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"GeO2_nk = cppb().nk_calc(oscillator_structure=GeO2, energy_array=E_eV)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Step 2 :: use this modelled n and k to calculate the ellipsometry data...
\n",
"Define a structure for the optical stack..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"stack = Structure([\n",
" [4.4, 1240 / E_eV, GeO2_nk[\"n\"], GeO2_nk[\"k\"]], # Layer 1 :: GeO2 native oxide layer\n",
" [350000, 1240 / E_eV, n_spline, k_spline] # Layer 2/ Substrate :: Bulk Ge\n",
"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calculate Ellipsometry data..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Out = calculate_ellipsometry(stack, 1240 / E_eV, angle=Exp_Angles)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define functions for the quick conversion of data
\n",
"We show this with the angle = 79ยบ, which is the third one (i = 2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"i = 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rho = lambda psi, delta: np.tan(psi) * np.exp(1j * delta)\n",
"eps = lambda r, theta: np.sin(theta) ** 2 * (1 + np.tan(theta) ** 2 * ((1 - r) / (1 + r)) ** 2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Experimental data..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Exp_rho = rho(np.radians(Exp_Data.data[Exp_Angles[i]][1]), np.radians((Exp_Data.data[Exp_Angles[i]][3])))\n",
"Exp_eps = eps(Exp_rho, np.radians(Exp_Angles[i]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Modelled data..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Mod_rho = rho(np.radians(Out[\"psi\"][:, i]), np.radians(Out[\"Delta\"][:, i]))\n",
"Mod_eps = eps(Mod_rho, np.radians(Exp_Angles[i]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Step 3 :: Data Plotting..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax1 = plt.subplots(1, 1)\n",
"ax1b = ax1.twinx()\n",
"ax1.set_xlim([400, 1500])\n",
"\n",
"ax1.plot(Exp_Data.data[Exp_Angles[i]][0] * 1000, Exp_eps.real, lw=2, marker=\"o\", ls='none', color=colours(\"Orange Red\"),\n",
" label=\"$\\epsilon_1 (\\lambda)$ :: $ %3.1f^{\\circ}$\" % Exp_Angles[i])\n",
"ax1b.plot(Exp_Data.data[Exp_Angles[i]][0] * 1000, abs(Exp_eps.imag), lw=2, marker=\"s\", ls='none',\n",
" color=colours(\"Dodger Blue\"),\n",
" label=\"$\\epsilon_2 (\\lambda)$ :: $ %3.1f^{\\circ}$\" % Exp_Angles[i])\n",
"\n",
"ax1.plot(1240 / E_eV, Mod_eps.real, label=\"Model $\\epsilon_1 (\\lambda)$ :: $ %3.1f^{\\circ}$\" % Exp_Angles[i],\n",
" color=colours(\"Maroon\"))\n",
"ax1b.plot(1240 / E_eV, abs(Mod_eps.imag), label=\"Model $\\epsilon_2 (\\lambda)$ :: $ %3.1f^{\\circ}$\" % Exp_Angles[i],\n",
" color=colours(\"Navy\"))\n",
"\n",
"ax1.set_xlabel(\"Wavelength (nm)\")\n",
"ax1.set_ylabel('$\\epsilon_1 (\\lambda)$')\n",
"ax1b.set_ylabel('$\\epsilon_2 (\\lambda)$')\n",
"ax1.text(0.05, 0.9, '(b)', transform=ax1.transAxes, fontsize=12)\n",
"\n",
"ax1.legend(loc=\"lower left\")\n",
"ax1b.legend(loc=\"upper right\")\n",
"\n",
"plt.show()"
]
}
],
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}