{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from solcore import material\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "# Initiate some variables...\n", "wl = np.linspace(300, 1800, 1000)\n", "Al_fraction = np.linspace(10, 100, 10)\n", "\n", "# Load GaAs n and k data from the Sopra database...\n", "GaAs = material(\"GaAs\", sopra=True)(T=300)\n", "GaAs_n = GaAs.n(wl*1e-9)\n", "GaAs_k = GaAs.k(wl*1e-9)\n", "\n", "# Load Ge n and k data from Sopra database...\n", "Ge = material(\"Ge\", sopra=True)(T=300)\n", "Ge_n = Ge.n(wl*1e-9)\n", "Ge_k = Ge.k(wl*1e-9)\n", "\n", "# Load AlGaAs k data for a range of compositions...\n", "AlGaAs = material(\"AlGaAs\", sopra=True)\n", "\n", "AlGaAs_k = [GaAs_k]\n", "\n", "for comp in Al_fraction:\n", " AlGaAs_k.append(AlGaAs(T=300, Al=comp/100).k(wl*1e-9))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Plot the data...\n", "colors = plt.cm.jet(np.linspace(0,1,len(Al_fraction)+1))\n", "\n", "f, (ax1, ax2) = plt.subplots(1, 2, figsize=(11.25,4))\n", "ax1b = ax1.twinx()\n", "\n", "lns1 = ax1.plot(wl, GaAs_n, 'b', label='n, GaAs')\n", "lns2 = ax1b.plot(wl, GaAs_k, 'r', label='k, GaAs')\n", "\n", "lns3 = ax1.plot(wl, Ge_n, ls=\"--\", color='blue', label='n, Ge')\n", "lns4 = ax1b.plot(wl, Ge_k,ls=\"--\", color='red', label='k, Ge')\n", "\n", "ax1.set_xlim([300,1800])\n", "ax1b.set_xlim([300,1800])\n", "ax1b.set_ylim([0, 3.8])\n", "\n", "# added these three lines\n", "lns = lns1+lns2+lns3+lns4\n", "labs = [l.get_label() for l in lns]\n", "ax1.legend(lns, labs, loc=\"upper right\", frameon=False)\n", "ax1.text(0.05, 0.9, '(a)', transform=ax1.transAxes, fontsize=12)\n", "\n", "ax1.set_xlabel(\"Wavelength (nm)\")\n", "ax1.set_ylabel(\"Refractive Index, n\")\n", "ax1b.set_ylabel(\"Extinction Coefficient, k\")\n", "\n", "for i, k in enumerate(Al_fraction):\n", " ax2.plot(wl, AlGaAs_k[i], color=colors[i+1], label='{}%'.format(int(Al_fraction[i])))\n", "\n", "ax2.set_xlim([300, 900])\n", "ax2.set_ylim([0, 2.8])\n", "\n", "ax2.set_xlabel(\"Wavelength (nm)\")\n", "ax2.set_ylabel(\"Extinction Coefficient, k\")\n", "ax2.legend(loc=\"upper right\", frameon=False)\n", "ax2.text(0.05, 0.9, '(b)', transform=ax2.transAxes, fontsize=12)\n", "plt.tight_layout(w_pad=4)\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 }