Layer#

class optika.materials.Layer(chemical=None, thickness=None, interface=None, kwargs_plot=None, x_label=None)[source]#

Bases: AbstractLayer

An isotropic, homogenous layer of optical material.

Examples

Plot a 10-nm-thick layer of silicon.

import matplotlib.pyplot as plt
import astropy.units as u
import astropy.visualization
import optika

# Create a layer of silicon
layer = optika.materials.Layer(
    chemical="Si",
    thickness=10 * u.nm,
    kwargs_plot=dict(
        color="tab:blue",
        alpha=0.5,
    ),
)

# Plot the layer
with astropy.visualization.quantity_support():
    fig, ax = plt.subplots(constrained_layout=True)
    layer.plot(ax=ax)
    ax.set_axis_off()
    ax.autoscale_view()
../_images/optika.materials.Layer_0_0.png

Attributes

chemical

The chemical formula of the layer medium.

interface

The interface profile on the left side of this layer.

kwargs_plot

Keyword arguments to be used in plot() for styling of the layer.

layer_sequence

This object interpreted as an instance of LayerSequence.

shape

The array shape of this object.

thickness

The thickness of this layer

x_label

The horizontal coordinate of the label.

Methods

__init__([chemical, thickness, interface, ...])

n(wavelength)

The complex index of refraction of this entire layer.

plot([x, z, width, ax])

Plot this layer using a matplotlib.patches.Rectangle patch.

to_string([prefix])

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

transfer(wavelength, direction, polarized_s, n)

Compute the index of refraction, internal propagation direction, transfer matrix, and where the transfer matrix is valid for this layer, which propagates the electric field from the left side of the layer to the right side.

Inheritance Diagram

Inheritance diagram of optika.materials.Layer
Parameters:
n(wavelength)[source]#

The complex index of refraction of this entire layer.

Parameters:

wavelength (Quantity | AbstractScalar)

Return type:

float | AbstractScalar

plot(x=<Quantity 0. nm>, z=<Quantity 0. nm>, width=<Quantity 1. nm>, ax=None, **kwargs)[source]#

Plot this layer using a matplotlib.patches.Rectangle patch.

Parameters:
  • x (Quantity) – The horizontal offset of the plotted layer

  • z (Quantity) – The vertical offset of the plotted layer.

  • width (Quantity) – The horizontal width of the plotted layer.

  • ax (None | Axes) – The matplotlib axes instance on which to plot the layer.

  • kwargs – Additional keyword arguments to pass into matplotlib.patches.Rectangle.

Return type:

list[Polygon]

to_string(prefix=None)#

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Parameters:

prefix (None | str) – an optional string, the length of which is used to calculate how much whitespace to add to the result.

Return type:

str

transfer(wavelength, direction, polarized_s, n, where=True)[source]#

Compute the index of refraction, internal propagation direction, transfer matrix, and where the transfer matrix is valid for this layer, which propagates the electric field from the left side of the layer to the right side.

Parameters:
  • wavelength (Quantity | AbstractScalar) – The wavelength of the incident light in vacuum.

  • direction (float | AbstractScalar) – The component of the incident light’s propagation direction in the medium before this layer antiparallel to the surface normal.

  • polarized_s (bool | AbstractScalar) – If True, the incident light is \(s\)-polarized. If False, the incident light is \(p\)-polarized.

  • n (float | AbstractScalar) – The complex index of refraction of the medium before this layer.

  • where (bool | AbstractScalar) – The boolean mask that should be applied to the transfer matrix. True where the transfer matrix is invertible.

Return type:

tuple[AbstractScalar, AbstractScalar, Cartesian2dMatrixArray, AbstractScalar]

chemical: None | str | AbstractChemical = None#

The chemical formula of the layer medium. If None (default), vacuum is assumed.

interface: None | AbstractInterfaceProfile = None#

The interface profile on the left side of this layer.

kwargs_plot: None | dict = None#

Keyword arguments to be used in plot() for styling of the layer.

property layer_sequence: LayerSequence#

This object interpreted as an instance of LayerSequence.

property shape: dict[str, int]#

The array shape of this object.

thickness: None | Quantity | AbstractScalar = None#

The thickness of this layer

x_label: None | Quantity = None#

The horizontal coordinate of the label. If None, the label is plotted in the center of the layer