optmat.materials#

The materials the curated records name.

Every dataset belongs to one material: a gas, a glass or a crystal. The core knows only what a material is (its id, name, kind, formula and optical symmetry), read from data/materials.toml; what a medium needs beyond that (a gas’s electron count and equation of state, a solid’s models) lives in that medium’s subpackage (TC-318).

A material’s id is the directory of its extracted files, data/values/<family>/<id>/. An anisotropic crystal lists the axes a dataset’s parameters.axis may take (o and e for a uniaxial crystal).

Module Attributes

MATERIALS_FILE

The registry of materials.

KINDS

The kinds of material.

Functions

as_material(name)

Return the id of the material name names.

material(name)

Return the registered material name names.

materials()

Return every registered material, by id.

Classes

Material(id, name, kind, formula, optics, ...)

What a material is.

optmat.materials.KINDS: Final[tuple[str, ...]] = ('gas', 'ion', 'glass', 'crystal', 'metal')#

The kinds of material.

optmat.materials.MATERIALS_FILE: Final = PosixPath('/home/docs/checkouts/optmat/checkouts/7/src/optmat/data/materials.toml')#

The registry of materials.

class optmat.materials.Material(id, name, kind, formula, optics, axes, aliases)[source]#

Bases: object

What a material is.

Attributes:
idstr

The id records use, and the directory of the material’s files.

namestr

A descriptive name.

kind{“gas”, “ion”, “glass”, “crystal”, “metal”}

The kind of medium; an ion is a gas-phase ion, whose data (its polarizability, for the ionisation rates) never enter a gas’s models. A metal is a solid whose index is complex throughout (TC-543).

formulastr

The chemical formula, or an empty string (a multicomponent glass).

optics{“isotropic”, “uniaxial”, “biaxial”}

The optical symmetry.

axestuple of str

The axes a dataset’s parameters.axis may name; empty when isotropic.

aliasestuple of str

Other names that as_material() accepts.

aliases: tuple[str, ...]#
axes: tuple[str, ...]#
formula: str#
id: str#
property is_solid: bool#

Whether the material is a glass, a crystal or a metal.

Returns:
bool

True for a glass, a crystal or a metal.

kind: Literal['gas', 'ion', 'glass', 'crystal', 'metal']#
name: str#
optics: Literal['isotropic', 'uniaxial', 'biaxial']#
optmat.materials.as_material(name)[source]#

Return the id of the material name names.

Parameters:
namestr

An id or an alias, e.g. "SiO2" or "fused silica".

Returns:
str

The material’s id.

Raises:
OptmatError

If name names no registered material.

Examples

>>> as_material("fused silica")
'SiO2'
optmat.materials.material(name)[source]#

Return the registered material name names.

Parameters:
namestr

An id or an alias.

Returns:
Material

The material.

Examples

>>> material("sapphire").axes
('o', 'e')
optmat.materials.materials()[source]#

Return every registered material, by id.

Returns:
dict of str to Material

The materials, in registry order.

Examples

>>> materials()["SiO2"].kind
'glass'