:orphan: Tutorials ----------- Basic Example ================ This basic example demonstrates key features of nannos. .. thebe-button:: Click me to execute code! First import the package. .. jupyter-execute:: import nannos as nn Create the lattice. .. jupyter-execute:: lattice = nn.Lattice(basis_vectors = [[1.0, 0], [0, 1.0]], discretization=2**9) Define the layers. The thickness for the semi infinite input and output media is irrelevant. .. jupyter-execute:: sup = lattice.Layer("Superstrate", epsilon=1) ms = lattice.Layer("Metasurface", thickness=0.5) sub = lattice.Layer("Substrate", epsilon=2) Create the permittivity pattern for the structured layer. .. jupyter-execute:: ms.epsilon = lattice.ones() * 12.0 circ = lattice.circle(center=(0.5, 0.5), radius=0.2) ms.epsilon[circ] = 1 Define the layer stack as a list from input medium to output medium. .. jupyter-execute:: stack = [sup, ms, sub] Define the incident plane wave. .. jupyter-execute:: pw = nn.PlaneWave(wavelength=0.9, angles=(0, 0, 0)) Create the simulation. .. jupyter-execute:: sim = nn.Simulation(stack, pw, nh=200) Plot the unit cell. .. The pythreejs backend seems to have issues for building the doc so we use panel instead here .. jupyter-execute:: p = sim.plot_structure() p.show_axes() p.show(jupyter_backend='panel') Compute the reflection and transmission: .. jupyter-execute:: R,T = sim.diffraction_efficiencies() print("reflection: ", R) print("transmission: ", T) print("sum :", R + T) .. raw:: html

Other Tutorials ================ .. raw:: html
.. thumbnail-parent-div-open .. raw:: html
.. only:: html .. image:: /tutorials/images/thumb/sphx_glr_plot_layer_thumb.png :alt: :ref:`sphx_glr_tutorials_plot_layer.py` .. raw:: html
Plotting layers
.. raw:: html
.. only:: html .. image:: /tutorials/images/thumb/sphx_glr_plot_permittivity_fft_thumb.png :alt: :ref:`sphx_glr_tutorials_plot_permittivity_fft.py` .. raw:: html
Permittivity approximation
.. raw:: html
.. only:: html .. image:: /tutorials/images/thumb/sphx_glr_plot_gradient_thumb.png :alt: :ref:`sphx_glr_tutorials_plot_gradient.py` .. raw:: html
Computing gradients
.. raw:: html
.. only:: html .. image:: /tutorials/images/thumb/sphx_glr_plot_shapely_thumb.png :alt: :ref:`sphx_glr_tutorials_plot_shapely.py` .. raw:: html
Geometry tools
.. thumbnail-parent-div-close .. raw:: html
.. toctree:: :hidden: /tutorials/plot_layer /tutorials/plot_permittivity_fft /tutorials/plot_gradient /tutorials/plot_shapely .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-gallery .. container:: sphx-glr-download sphx-glr-download-python :download:`Download all examples in Python source code: tutorials_python.zip ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download all examples in Jupyter notebooks: tutorials_jupyter.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_