# Public Documentation

These functions and types are to be used for transfer matrix calculation based on the sources used. If you wish to modify any of the steps in the calculation, refer to the private API.

## Index

`TransferMatrix.Layer`

`TransferMatrix.Structure`

`TransferMatrix.angle_resolved`

`TransferMatrix.calculate_tr`

`TransferMatrix.dbr_reflectivity`

`TransferMatrix.dielectric_constant`

`TransferMatrix.dielectric_constant`

`TransferMatrix.dielectric_constant`

`TransferMatrix.dielectric_tensor`

`TransferMatrix.electric_field`

`TransferMatrix.find_layerbounds`

`TransferMatrix.fresnel`

`TransferMatrix.initialize`

`TransferMatrix.load_refractive_data`

`TransferMatrix.printstruct`

`TransferMatrix.propagation_matrix`

`TransferMatrix.stopband`

## Transfer Matrix Functions

`TransferMatrix.angle_resolved`

— Method`angle_resolved(s::Structure)`

Iterate through each angle provided in the structure to find the reflectance and transmittance spectra from the calculated transfer matrices and Poynting vectors.

`TransferMatrix.calculate_tr`

— Function`calculate_tr(s::Structure, θ=0.0)`

Calculate the transmittance and reflectance spectrum of the structure at a single incidence angle θ. Accurate transmittance must be calculated via the Poynting vector. Reflectance is calculated directly from the transfer matrix elements.

`TransferMatrix.electric_field`

— Function`electric_field(s::Structure, λ, θ; numpoints)`

Calculate the electric field profile for the entire structure as a function of z for a given incidence angle θ.

`TransferMatrix.find_layerbounds`

— Method`find_layerbounds(s::Structure)`

Find the unitful z coordinate for all layer-layer interfaces in the structure, with the first interface starting at z = 0. (negative z corresponds to positions inside the first layer.)

`TransferMatrix.initialize`

— Method`initialize(structure::Structure, λs)`

Initializing a `Structure`

interpolates the wavelength-dependent refractive index data using the given `λs`

Vector for all `Layer`

s in the `Structure`

, returning a new structure with the interpolated data.

`TransferMatrix.propagation_matrix`

— Method`propagation_matrix(ω, q)`

Returns a function that propagates the electromagnetic field a distance z through a material for a frequency ω and wavevector $q$.

`TransferMatrix.dielectric_constant`

— Method`dielectric_constant(n::Complex)`

Return the complex dielectric function from the complex index of refraction.

`TransferMatrix.dielectric_constant`

— Method`dielectric_constant(layer::Layer)`

Return a complex dielectric function from the index of refraction in a `Layer`

` type.

`TransferMatrix.dielectric_constant`

— Method`dielectric_constant(n::Real, κ::Real)`

Return the complex dielectric function from the real and imaginary parts of the index of refraction.

The complex index of refraction, given by

` n' = n + iκ`

(in terms of n and κ), can be used to obtain the frequency-dependent complex dielectric function

` ε_r(ω) = ε' + iε''`

via the relation

` (n + iκ)^2 = ε' + iε''.`

`TransferMatrix.dielectric_tensor`

— Method`dielectric_tensor(ε1, ε2, ε3)`

Return the diagonal complex dielectric tensor

\[\varepsilon = \begin{pmatrix} \varepsilon_1 & 0 & 0 \\0 & \varepsilon_2 & 0 \\0 & 0 & \varepsilon_3 \end{pmatrix}\]

## Types

`TransferMatrix.Layer`

— Type`Layer(material, thickness, λ, n, κ)`

A `Layer`

stores information about a single layer, including its material name, thickness, a list of electric field wavelengths, and the real and imaginary parts of the refractive index associated with these wavelengths.

Initializing a `Layer`

with no arguments makes a 1 μm thick layer of Air.

`TransferMatrix.Structure`

— Type`Structure(layers, λs, θs)`

The `Structure`

is a mutable type that stores a Vector of `Layer`

types, along with a list of field wavelengths and incident angles to calculate on.

## Data Read/Write Functions

`TransferMatrix.load_refractive_data`

— Function`load_refractivedata(material::RefractiveMaterial, thickness, wavelength_unit=1e-6)`

Retrieves refractive index data from refractiveindex.info database via the RefractiveIndex.jl interface. Wavelengths are in units of micrometers by default. and two refractive index columns: one for the real part and the other for the imaginary part.

`TransferMatrix.printstruct`

— Function`printstruct(s::Structure, unit=1e9)`

Print each layer and its thickness in a somewhat visually useful way. Change the default unit multiplier to switch from nanometers to micrometers. This does not affect any calculations, only what is printed to the command line when using `printstruct`

.

## Miscellaneous Optics Functions

`TransferMatrix.dbr_reflectivity`

— Method`dbr_reflectivity(no, n2, n1, n2, N)`

Approximate the reflectivity of a DBR structure with originating medium with refractive index `no`

, substrate with index `ns`

, and alternating materials with indices `n1`

and `n2`

and number of repetitions `N`

. The repeated pair of materials are assumed to have quarter-wave thickness $nd = \lambda / 4$, where $n$ is the refractive index, $d$ is the layer thickness, and $\lambda$ is the wavelength of the light.

`TransferMatrix.fresnel`

— Method`fresnel(θ, n1, n2)`

Calculate the reflectance for s-polarized and p-polarized light given the incidence angle `θ`

and indices of refraction of two media `n1`

and `n2`

at a plane interface.

`TransferMatrix.stopband`

— Method`stopband(n1, n2)`

Calculate the frequency bandwidth Δf of the photonic stopband for a distributed bragg reflector (DBR) with two alternating materials of refractive indices `n1`

and `n2`

.

\[ \frac{\Delta f_0}{f_0} = \frac{4}{\pi} \arcsin \left( \frac{n_2 - n_1}{n_2 + n_1} \right)\]