materials.agf#
AGF Material
This module reads glass catalogs in the AGF format used by OpticStudio and evaluates their glasses with the catalog’s own dispersion formula and coefficients. No catalog data ship with Optiland: the reader works on AGF files the user already has.
An AGF file is a list of records, one per line, keyed by their first token. The reader uses these:
NM name formula MIL nd vd ...: starts a glass and names its formula.CD c1 c2 ...: the dispersion coefficients, for wavelengths in µm.LD min max: the wavelength range of the data, in µm.
The other records (thermal, transmission, comments) are skipped. Indices are
relative to air, as in the catalogs, and are evaluated at the catalog’s
reference temperature; the thermal coefficients on the TD line are not
applied.
Functions
|
The folders to search for AGF catalogs. |
|
Refractive index from an OpticStudio dispersion formula. |
|
The AGF file of a catalog, matching the file name ignoring case. |
|
Read the glasses of an AGF catalog. |
Classes
|
One glass record of an AGF catalog. |
|
A glass evaluated from its AGF catalog entry. |
- class AGFGlass(name: str, formula: int, coefficients: list[float], nd: float | None = None, vd: float | None = None, wavelength_range: tuple[float, float] | None = None, catalog: str | None = None, comment: str = '')[source]#
One glass record of an AGF catalog.
- class AGFMaterial(name: str, formula: int, coefficients, catalog: str | None = None, wavelength_range: tuple[float, float] | None = None, propagation_model: BasePropagationModel | None = None)[source]#
A glass evaluated from its AGF catalog entry.
The index comes from the catalog’s own dispersion formula and coefficients, as OpticStudio evaluates it, relative to air at the catalog’s reference temperature. The extinction coefficient is zero.
- Parameters:
name – The glass name.
formula – The OpticStudio formula code, 1 to 13.
coefficients – The coefficients of the AGF
CDline.catalog – The catalog the glass came from, if known.
wavelength_range – The (min, max) wavelength of the data in µm.
propagation_model – The propagation model; homogeneous if None.
- abbe() float#
Calculate the Abbe number (Vd) of the material.
The Abbe number is a measure of the material’s dispersion, defined as Vd = (n_d - 1) / (n_F - n_C), where n_d, n_F, and n_C are the refractive indices at the Fraunhofer d (587.5618 nm), F (486.1327 nm), and C (656.2725 nm) spectral lines, respectively.
- Returns:
The Abbe number of the material.
- Return type:
- classmethod from_dict(data)[source]#
Create a material from a dictionary representation.
This factory method first delegates to the appropriate subclass to create the material instance, then handles the deserialization of the propagation model.
- Parameters:
data (dict) – The dictionary representation of the material.
- Returns:
An instance of a specific material subclass created from the dictionary data.
- Return type:
- classmethod from_file(path: str, name: str) AGFMaterial[source]#
Create the material for glass
namein the AGF filepath.The name must match exactly, ignoring case.
- classmethod from_glass(glass: AGFGlass) AGFMaterial[source]#
Create the material from a record returned by
read_agf.
- k(wavelength: float | be.ndarray, **kwargs) float | be.ndarray#
Calculates the extinction coefficient at a given wavelength with caching.
- n(wavelength: float | be.ndarray, **kwargs) float | be.ndarray#
Calculates the refractive index at a given wavelength with caching.
- agf_search_dirs(agf_dirs=None) list[str][source]#
The folders to search for AGF catalogs.
- Parameters:
agf_dirs – A folder or a list of folders. If None, the folders in the
OPTILAND_AGF_PATHenvironment variable, separated byos.pathsep, are used; if that is unset too, there are none.- Returns:
The folders, in search order.
- evaluate_agf_formula(formula: int, c, wavelength)[source]#
Refractive index from an OpticStudio dispersion formula.
- Parameters:
formula – The formula code, 1 to 13 (see
FORMULA_NAMES).c – The coefficients, in the order of the AGF
CDline.wavelength – Wavelength(s) in µm.
- Returns:
The refractive index relative to air.