{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# RF Example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An example of using LayerLumos to simulate the Shielding Effectiveness(SE), demo here is a single Ag layer" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "from scipy.constants import c\n", "from layerlumos.utils import load_material, interpolate_material, load_material_RF\n", "from layerlumos.layerlumos import stackrt, stackrt0\n", "import matplotlib.pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "frequencies = np.linspace(8e9, 18e9, 100) # Convert wavelengths to frequencies\n", "\n", "# Interpolate n and k values for SiO2 over the specified frequency range\n", "n_k_Ag = load_material_RF('Ag', frequencies)\n", "n_Ag = n_k_Ag[:, 1] + 1j*n_k_Ag[:, 2] # Combine n and k into a complex refractive index\n", "\n", "# Define stack configuration\n", "n_air = np.ones_like(frequencies) # Refractive index of air\n", "d_air = np.array([0])\n", "d_Ag = np.array([2e-8]) # Thickness of SiO2 layer in meters (e.g., 2 microns)\n", "\n", "# Stack refractive indices and thicknesses for air-SiO2-air\n", "n_stack = np.vstack([n_air, n_Ag, n_air]).T # Transpose to match expected shape (Nlayers x Nfreq)\n", "d_stack = np.vstack([d_air, d_Ag, d_air]) # No frequency dependence on thickness\n", "\n", "# Calculate R and T over the frequency (wavelength) range\n", "R_TE, T_TE, R_TM, T_TM = stackrt0(n_stack, d_stack, frequencies)\n", "\n", "# Calculate average R and T\n", "SE_TE = -10 * np.log10(T_TE)\n", "SE_TM = -10 * np.log10(T_TM)\n", "SE = (SE_TE + SE_TM) / 2\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "47.49071678079014\n" ] } ], "source": [ "# Get the Sheilding Efficiency\n", "print(np.mean(SE))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can try multiple metal layer in the structure, considering Fabry–Pérot effect" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "# Interpolate n and k values for SiO2 over the specified frequency range\n", "n_k_Ag = load_material_RF('Ag', frequencies)\n", "n_Ag = n_k_Ag[:, 1] + 1j*n_k_Ag[:, 2] # Combine n and k into a complex refractive index\n", "\n", "n_k_SiO2 = load_material_RF('SiO2', frequencies)\n", "n_SiO2 = n_k_SiO2[:, 1] + 1j*n_k_SiO2[:, 2] # Combine n and k into a complex refractive index\n", "\n", "\n", "# Define stack configuration\n", "n_air = np.ones_like(frequencies) # Refractive index of air\n", "d_air = np.array([0])\n", "d_SiO2 = np.array([2e-4])\n", "d_Ag = np.array([1e-8]) # Thickness of SiO2 layer in meters (e.g., 2 microns)\n", "\n", "# Stack refractive indices and thicknesses for air-SiO2-air\n", "n_stack = np.vstack([n_air, n_Ag, n_SiO2, n_Ag, n_air]).T # Transpose to match expected shape (Nlayers x Nfreq)\n", "d_stack = np.vstack([d_air, d_Ag, d_SiO2, d_Ag, d_air]) # No frequency dependence on thickness\n", "\n", "# Calculate R and T over the frequency (wavelength) range\n", "R_TE, T_TE, R_TM, T_TM = stackrt0(n_stack, d_stack, frequencies)\n", "\n", "# Calculate average R and T\n", "SE_TE = -10 * np.log10(T_TE)\n", "SE_TM = -10 * np.log10(T_TM)\n", "SE = (SE_TE + SE_TM) / 2" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "63.574706852860174\n" ] } ], "source": [ "# Get the Sheilding Efficiency\n", "print(np.mean(SE))" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.11.5" } }, "nbformat": 4, "nbformat_minor": 2 }