Layer#
- class optika.materials.Layer(chemical=None, thickness=None, interface=None, kwargs_plot=None, x_label=None)[source]#
Bases:
AbstractLayerAn 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()
Attributes
The chemical formula of the layer medium.
The interface profile on the left side of this layer.
Keyword arguments to be used in
plot()for styling of the layer.This object interpreted as an instance of
LayerSequence.The array shape of this object.
The thickness of this layer
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.Rectanglepatch.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

- Parameters:
chemical (None | str | AbstractChemical)
thickness (None | Quantity | AbstractScalar)
interface (None | AbstractInterfaceProfile)
kwargs_plot (None | dict)
x_label (None | Quantity)
- n(wavelength)[source]#
The complex index of refraction of this entire layer.
- Parameters:
wavelength (Quantity | AbstractScalar)
- Return type:
- plot(x=<Quantity 0. nm>, z=<Quantity 0. nm>, width=<Quantity 1. nm>, ax=None, **kwargs)[source]#
Plot this layer using a
matplotlib.patches.Rectanglepatch.- 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:
- 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.
- 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. IfFalse, 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.
Truewhere 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.
- property layer_sequence: LayerSequence#
This object interpreted as an instance of
LayerSequence.
- thickness: None | Quantity | AbstractScalar = None#
The thickness of this layer