Chemical#
- class optika.chemicals.Chemical(formula, is_amorphous=False, table=None)[source]#
Bases:
AbstractChemicalAn object that represents the optical properties of a chemical.
Uses the tabulated optical constants from Windt [1998].
Examples
Plot the indices of refractions of silicon and silicon dioxide.
import matplotlib.pyplot as plt import astropy.units as u import named_arrays as na import optika si = optika.chemicals.Chemical("Si") sio2 = optika.chemicals.Chemical("SiO2") wavelength = na.geomspace(10, 10000, axis="wavelength", num=1001) * u.AA n_si = si.index_refraction(wavelength) n_sio2 = sio2.index_refraction(wavelength) fig, ax = plt.subplots(constrained_layout=True) na.plt.plot(wavelength, n_si, label="silicon"); na.plt.plot(wavelength, n_sio2, label="silicon dioxide"); ax.set_xscale("log"); ax.set_xlabel(f"wavelength ({wavelength.unit:latex_inline})"); ax.set_ylabel("index of refraction"); ax.legend();
Plot the wavenumbers of silicon and silicon dioxide
k_si = si.wavenumber(wavelength) k_sio2 = sio2.wavenumber(wavelength) fig, ax = plt.subplots(constrained_layout=True) na.plt.plot(wavelength, k_si, label="silicon"); na.plt.plot(wavelength, k_sio2, label="silicon dioxide"); ax.set_xscale("log"); ax.set_xlabel(f"wavelength ({wavelength.unit:latex_inline})"); ax.set_ylabel("wavenumber"); ax.legend();
Attributes
The path to the Windt [1998] file containing the index of refaction, \(n\), and the wavenumber, \(k\).
the empirical formula of the chemical compound.
LaTeX representation of the chemical formula, with appropriate subscripts.
Boolean flag controlling whether the chemical is amorphous or crystalline.
The array shape of this object.
Name of the table of chemical constants.
Methods
__init__(formula[, is_amorphous, table])absorption(wavelength)The absorption coefficient of this chemical for the given wavelength.
index_refraction(wavelength)The index of refraction of this chemical for the given wavelength.
n(wavelength)The complex index of refaction of this chemical for a given wavelength
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.wavenumber(wavelength)The wavenumber of this chemical for the given wavelength.
Inheritance Diagram

- Parameters:
formula (str | AbstractScalar)
is_amorphous (bool)
table (None | str)
- absorption(wavelength)#
The absorption coefficient of this chemical for the given wavelength.
- Parameters:
wavelength (Quantity | AbstractScalar) – The wavelength of light in vacuum for which to compute the absorption coefficient.
- index_refraction(wavelength)#
The index of refraction of this chemical for the given wavelength.
- Parameters:
wavelength (Quantity | AbstractScalar)
- Return type:
- n(wavelength)#
The complex index of refaction of this chemical for a given wavelength
- Parameters:
wavelength (Quantity | AbstractScalar)
- 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.
- wavenumber(wavelength)#
The wavenumber of this chemical for the given wavelength.
- Parameters:
wavelength (Quantity | AbstractScalar)
- Return type:
- property file_nk: ScalarArray#
The path to the Windt [1998] file containing the index of refaction, \(n\), and the wavenumber, \(k\).
- formula: str | AbstractScalar = <dataclasses._MISSING_TYPE object>#
the empirical formula of the chemical compound.
For example, water would be expressed as
"H2O"and hydrogen peroxide would be expressed as"H2O2".
- property formula_latex: str#
LaTeX representation of the chemical formula, with appropriate subscripts.