# 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.

## Transfer Matrix Functions

TransferMatrix.angle_resolvedMethod
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.

source
TransferMatrix.calculate_trFunction
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.

source
TransferMatrix.dielectric_constantMethod
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ε''.
source
TransferMatrix.dielectric_tensorMethod
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}$$$
source
TransferMatrix.electric_fieldFunction
electric_field(s::Structure, λ, θ; numpoints)

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

source
TransferMatrix.find_layerboundsMethod
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.)

source
TransferMatrix.initializeMethod
initialize(structure::Structure, λs)

Initializing a Structure interpolates the wavelength-dependent refractive index data using the given λs Vector for all Layers in the Structure, returning a new structure with the interpolated data.

source
TransferMatrix.printstructFunction
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.

source

## Types

TransferMatrix.LayerType
Layer(material::String, thickness::Float64, λ::Vector{Float64}, n::Vector{Float64}, κ::Vector{Float64})

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.

source
TransferMatrix.StructureType
Structure

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.

source

TransferMatrix.read_refractiveMethod
read_refractive(f::String, material::String, thickness; div=1.0, freq=false)

Reads a csv file from the database website refractiveindex.info containing a wavelength column in units of micrometers, and two refractive index columns: one for the real part and the other for the imaginary part.

Note that if you put a file in the refractive_index_data folder, then this function can automatically find it if you simply put the file name (with .csv extension) in the refractive_filename field in the yaml file. If you put the file somewhere else, you must provide the full path to that file (or relative path).
For some reason, the wavelength column cannot be normalized (so as to be a valid Julia identifier) using normalizednames = true in CSV.File, so the header is skipped.