{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# TiO2/SiO2 Bragg mirror\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Example of a TiO2/SiO2 Bragg mirror with 8.5 periods\n\nAuthors: O. Castany, M.M\u00fcller\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import elli\nimport elli.plot as elliplot\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nnp.set_printoptions(suppress=True, precision=3)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Material definition\nWe define air as incidence material and glass as exit material.\nSiO2 and TiO2 are defined by simplified dispersion relations.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "air = elli.AIR\nglass = elli.ConstantRefractiveIndex(1.5).get_mat()\n\nn_SiO2 = 1.47\nn_TiO2 = 2.23 + 1j * 5.2e-4\n\nSiO2 = elli.ConstantRefractiveIndex(n_SiO2).get_mat()\nTiO2 = elli.ConstantRefractiveIndex(n_TiO2).get_mat()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Create layers and structure\nThe SiO2 and TiO2 layers are set to the thickness of an\nquarterwaveplate of the respective material at 1550 nm.\n\nThe layers are then stacked alternatingly and put into the\ncomplete structure with air and the glass substrate.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "lbda0 = 1550\n\nd_SiO2 = elli.get_qwp_thickness(SiO2, lbda0)\nd_TiO2 = elli.get_qwp_thickness(TiO2, lbda0)\n\nprint(\"Thickness of the SiO2 QWP: {} nm\".format(d_SiO2))\nprint(\"Thickness of the TiO2 QWP: {} nm\".format(d_TiO2))\n\nL_SiO2 = elli.Layer(SiO2, d_SiO2)\nL_TiO2 = elli.Layer(TiO2, d_TiO2)\n\n# Repeated layers: 8.5 periods\nlayerstack = elli.RepeatedLayers([L_TiO2, L_SiO2], 8, 0, 1)\n\ns = elli.Structure(air, [layerstack], glass)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Calculation\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "(lbda1, lbda2) = (1100, 2500)\nlbda_list = np.linspace(lbda1, lbda2, 200)\n\ndata = s.evaluate(lbda_list, 0)\n\nR = data.R\nT = data.T"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Structure Graph\nSchema of the variation of the refractive index in z-direction.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "elliplot.draw_structure(s)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Reflection and Transmission Graph\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure()\nax = fig.add_subplot(1, 1, 1)\nax.plot(lbda_list, T, label=\"$T$\")\nax.plot(lbda_list, R, label=\"$R$\")\nax.legend(loc=\"center right\")\nax.set_xlabel(r\"Wavelength $\\lambda$ (nm)\")\nax.set_ylabel(r\"Power reflection $R$ or transmission $T$\")\nax.set_title(r\"Bragg mirror: Air/{TiO$_2$/SiO$_2$}x8/TiO$_2$/Glass\")\nplt.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.8.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}