indicio
indicio is a python package that provides offline access to the
refractiveindex.info database of optical
constants. Contrary to other similar packages, the full upstream database ships
inside the package, so there is no need to download it separately: just pip install indicio and you are ready to go.
indicio has zero runtime dependency, not even YAML because the database is
stored internally in a custom sqlite format that python can decode natively.
This also reduces the size of the database to ~16MB.
The API returns structured descriptions of dispersion models. It does
not implement formulas to compute n(λ) or k(λ). That job is left to the
consumer, who can pick whatever numerical stack suits the use case (numpy, jax,
torch, etc.).
indicio exists primarily for integration in Torch Lens
Maker, but you are welcome to
use it for anything else!
Installation
pip install indicio
Quickstart
import indicio
SiO2 = indicio.get_material("main", "SiO2", "Malitson")
print(SiO2.n)
>>> Sellmeier(c1=0.0, coefficients=((0.6961662769317627, 0.06840430200099945), (0.40794259309768677, 0.11624140292406082), (0.8974794149398804, 9.896161079406738)), wavelength_range=(0.21, 6.7))
API
indicio.get_material(shelf: str, book: str, page: str) -> MaterialEntry
indicio.has_material(shelf: str, book: str, page: str) -> bool
indicio.shelves() -> tuple[str, ...]
indicio.books(shelf: str) -> tuple[str, ...]
indicio.pages(shelf: str, book: str) -> tuple[str, ...]
indicio.iter_materials() -> Iterator[MaterialEntry]
indicio.search(query: str) -> tuple[tuple[str, str, str], ...]
indicio.__version__ # library version, e.g. "1.0.0"
indicio.__database_version__ # upstream commit hash baked into the data
The data model
@dataclass(frozen=True)
class MaterialEntry:
shelf: str
book: str
page: str
name: str | None
references: str | None
comments: str | None
n: NModel | None # real part — None if upstream has only k
k: KModel | None # imaginary part — None if upstream has only n
-
For the dispersion model n, there are 10 possible cases: 9 closed-form formulas (following the upstream dispersion-formula doc), or tabulated data.
-
For the extinction coefficient k, the data is always tabulated.
For detailed data description of each model see src/indicio/models.py.
Examples
The examples/ directory contains complete evaluation scripts covering every
formula type:
examples/example_evaluation_stdlib.py: uses only the standard library (math,array,bisect).examples/example_evaluation_numpy.py: uses numpy; evaluators are vectorized over a wavelength array.examples/example_plot.py: uses numpy + matplotlib to plot n(λ) and k(λ) over the validity range.
python examples/example_evaluation_stdlib.py main SiO2 Malitson
python examples/example_evaluation_numpy.py main Au Johnson
python examples/example_plot.py main BaF2 Bosomworth-300K
Conventions
- Wavelengths are micrometers everywhere, matching the convention of refractiveindex.info.
- Tabulated arrays are raw bytes, packed as little-endian IEEE 754 float32. See examples above for decoding.
Licensing and attribution
The refractiveindex.info database is distributed under CC0
1.0 (public domain). When
publishing results that rely on a particular material entry, please cite the
original authors. Their citation strings are preserved verbatim in
MaterialEntry.references.
print(indicio.get_material("main", "SiO2", "Malitson").references)
The indicio library code itself is distributed under its own LICENSE in
the source tree.
Metadata
Release files for indicio 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| indicio-1.1.0.tar.gz | 13.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| indicio-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 MB
Release files / indicio-1.1.0.tar.gz
| Download URL | indicio-1.1.0.tar.gz |
|---|---|
| Size | 13.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50796072929056506287674923f73c88b747e6d54e32cd7a83fc14cec5f89964
|
|
BLAKE2b-256 checksum How to use checksums |
90b43a8b157f76c0c65d11689aba02a1d61c85d64547aa795d1617a0b405fa65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / indicio-1.1.0-py3-none-any.whl
| Download URL | indicio-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebe869f7576cde06239141d2749c3580780fc3de86df3044a6d13765bfe4b120
|
|
BLAKE2b-256 checksum How to use checksums |
384cc60fb5ca92101cc4c11ff4be8ed4eaaedcd1a5447c65e36dc5e6340742f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|