optmat.solid.models.tabulated#
Stitched tables of optical constants as models: a metal’s complex index.
A metal has no single model from the ultraviolet to the far infrared: its optical
constants are measured piecewise, each range by a different technique (electron
energy-loss spectra, ellipsometry, reflectance with Kramers-Kronig analysis,
far-infrared reflectance). A table model joins curated datasets, one per wavelength
range, as its configuration data/solid/tables/<material>.toml chooses them, each
range with its reason (TC-544):
material = "Ag"
[[segments]]
real = "babar_2015/eps1_Ag" # refractive_index or permittivity_real
imaginary = "babar_2015/eps2_Ag" # extinction_coefficient or ...imaginary
range_nm = [207.0, 12400.0]
reason = "..."
The model takes the wavelengths the two datasets of a segment share (an x-ray table may
print n only to some energy and 1 - n above it, as refractive_index_decrement,
while its k runs on). In the extreme
ultraviolet and x-ray range a segment may instead be Henke et al.’s atomic scattering
factors (henke = "<element>", CXRO’s file in data/external/henke/) with a
curated atom_density dataset: n + ik = 1 - r_e lambda^2 N (f1 - i f2) / (2 pi)
(Henke et al. 1993, Eq. 3; their n = 1 - delta - i beta is this package’s n + ik with
k = beta), the independent-atom limit, which holds well above the valence excitations
and away from absorption edges (TC-645):
[[segments]]
henke = "ag"
atom_density = "<source>/<atom_density dataset>"
range_nm = [1.0, 12.0]
reason = "..."
The model
interpolates log n and log k against log omega with a monotone piecewise-cubic Hermite
interpolant (PCHIP), which neither overshoots between points nor rings at a join
between sources (a natural cubic spline does both); its first derivative is continuous
and exact for the interpolant, so epsilon and d epsilon / d omega are consistent.
Outside the tabulated range the constants are held at the end points, with a
ModelRangeWarning.
Module Attributes
The table models' configurations, one per material. |
|
CXRO's tables of Henke et al.'s atomic scattering factors, |
Functions
|
Build a table model from its configuration. |
Return every configured table model, named |
Classes
|
One range of a table model and the datasets that supply it. |
|
A complex index interpolated from curated tables, joined by range. |
- optmat.solid.models.tabulated.HENKE_DIRECTORY = PosixPath('/home/docs/checkouts/optmat/checkouts/7/src/optmat/data/external/henke')#
CXRO’s tables of Henke et al.’s atomic scattering factors,
<element>.nff.
- class optmat.solid.models.tabulated.Segment(real, imaginary, range_nm, reason, henke='', atom_density='')[source]#
Bases:
objectOne range of a table model and the datasets that supply it.
- Attributes:
- realstr
The key of the dataset of n or epsilon_1 (empty for a Henke segment).
- imaginarystr
The key of the dataset of k or epsilon_2, on the same abscissae (empty for a Henke segment).
- range_nmtuple of float
The vacuum wavelengths taken from these datasets, nm.
- reasonstr
Why these datasets supply this range.
- henkestr
The element of a Henke segment (CXRO’s file name), or empty.
- atom_densitystr
The key of the
atom_densitydataset of a Henke segment, or empty.
- property cited: tuple[str, ...]#
Return the sources the segment rests on.
- Returns:
- tuple of str
The source ids.
- optmat.solid.models.tabulated.TABLES_DIRECTORY = PosixPath('/home/docs/checkouts/optmat/checkouts/7/src/optmat/data/solid/tables')#
The table models’ configurations, one per material.
- class optmat.solid.models.tabulated.TabulatedModel(material, name, citation, wavelength_range, kind, axis='', segments=(), knots=<factory>, index=<factory>, *, status='user', status_reason='', modified=(), base='', intervals=(), out_of_range='hold')[source]#
Bases:
ModelA complex index interpolated from curated tables, joined by range.
- Attributes:
- segmentstuple of Segment
The ranges, in increasing wavelength.
- knotsnumpy.ndarray
The tabulated vacuum wavelengths, m, increasing.
- indexnumpy.ndarray
The complex index n + ik at the knots.
- out_of_range{“hold”, “raise”}
Outside the knots the table holds its end values, with a
ModelRangeWarning("hold", the default), or refuses withStateError("raise";with_out_of_range()).
- DERIVED: ClassVar[tuple[str, ...]] = ('segments', 'wavelength_range')#
Fields derived from the inputs, which an override may not name.
- INPUTS: ClassVar[tuple[str, ...]] = ('index', 'intervals', 'knots')#
The parameters
with_parameters()may change.
- classmethod from_arrays(material, wavelength, n, k, *, citation='', name='')[source]#
Return a table model from a caller’s arrays.
- Parameters:
- materialstr
The material, the identity’s (a curated id or a caller’s name).
- wavelengthnumpy.ndarray
Vacuum wavelengths, m, increasing; the range is their span.
- nnumpy.ndarray
The real index at them, > 0.
- knumpy.ndarray
The extinction coefficient, > 0 (the interpolation is in log k).
- citationstr, optional
Where the table comes from.
- namestr, optional
The model’s name;
user/<material>by default.
- Returns:
- TabulatedModel
The model, status
user.
- Raises:
- ValueError
If the arrays differ in length, the wavelengths do not increase, or n or k is not positive.
Examples
>>> import numpy as np >>> table = TabulatedModel.from_arrays( ... "Au", np.array([500e-9, 600e-9, 700e-9]), np.array([0.9, 0.25, 0.16]), ... np.array([1.9, 3.0, 3.9])) >>> table.wavelength_range, table.identity.status ((5e-07, 7e-07), 'user')
- index: Complex[ndarray, 'n']#
- knots: Float[ndarray, 'n']#
- with_out_of_range(mode)[source]#
Return the table with another rule outside its knots, its status kept.
Not an override: within the table the numbers are the same.
- Parameters:
- mode{“hold”, “raise”}
Hold the end values (with a warning), or refuse.
- Returns:
- TabulatedModel
The model with that rule.
Examples
>>> from optmat.solid.models.registry import model >>> strict = model("table/Ag").with_out_of_range("raise") >>> strict.out_of_range, strict.status ('raise', 'validated')
- optmat.solid.models.tabulated.load_table(path)[source]#
Build a table model from its configuration.
- Parameters:
- pathpathlib.Path
The configuration,
data/solid/tables/<material>.toml.
- Returns:
- TabulatedModel
The model, named
table/<material>.
- Raises:
- DataError
If the configuration is malformed, the ranges overlap or a dataset is unusable.