Environment#
This section covers Optiland’s environment subpackage, which calculates the refractive index of air. This is used to account for the effect of ambient temperature, pressure, humidity, and CO2 concentration on an optical system’s performance, as opposed to the fixed reference-air assumption used elsewhere in the package.
The main entry point is refractive_index_air(),
which dispatches to one of several well-established empirical models based on an
EnvironmentalConditions instance. Each
model - Ciddor, Edlén, Birch & Downs, and Kohlrausch - is implemented in its own
module under environment.models and can also be called directly.
from optiland.environment import EnvironmentalConditions, refractive_index_air
conditions = EnvironmentalConditions(
temperature=15.0,
pressure=101325.0,
relative_humidity=0.0,
co2_ppm=400.0,
)
n = refractive_index_air(0.55, conditions, model="ciddor")
The Kohlrausch model uses the OpticStudio dry-air convention. Its pressure input is in pascals; the evaluator converts it to atmospheres before applying the reference-temperature scaling. Humidity and CO2 do not enter this model. At 0.55 µm it reproduces 1.00027308 at 20 °C / 101325 Pa and 1.00052810 at 30 °C / 202650 Pa, to the precision published in the Ansys worked example. The evaluator accepts NumPy/Torch wavelength and temperature arrays and preserves their gradients; other environmental models retain their own input contracts. It rejects non-finite or non-positive wavelengths consistently for scalar and array inputs, and rejects a non-positive temperature scaling denominator. Changing this formula does not switch the dispatcher’s default model or connect global environment settings to material evaluation automatically.
Unified Interface for Air Refractive Index Models. |
|
Dataclass for Environmental Conditions. |
Ciddor (1996) Air Refractive Index Model. |
|
Edlén (1966) Air Refractive Index Model (with NIST Modification). |
|
Birch and Downs Air Refractive Index Model (with NIST Modification) |
|
Kohlrausch Air Refractive Index Model (Zemax Implementation). |