Skip to main content

indicio

PyPI - Version Python Version from PEP 621 TOML PyPI - License

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:

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)

Source distribution for indicio 1.1.0
File Size Uploaded
indicio-1.1.0.tar.gz 13.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for indicio 1.1.0
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page