Skip to main content

Python interface to RefractiveIndex database

Tests

Python interface to the refractiveindex.info database. The database (~15 MB) is bundled. Install with

pip install refractiveindex

Usage

import refractiveindex as ri

# load a material by shelf, book and page
SiO = ri.RefractiveIndexMaterial(shelf='main', book='SiO', page='Hass')
# or from the address-bar URL of a refractiveindex.info page
SiO2 = ri.RefractiveIndexMaterial.from_url(
    'https://refractiveindex.info/?shelf=main&book=SiO2&page=Malitson'
)

# find names, best match first
ri.search('SiO2')
#  0  main/SiO2/Malitson                       Malitson 1965: n 0.21–6.7 µm [Fused silica]
#  1  main/SiO2/Nyakuchena                     Nyakuchena et al. 2023: n 1.10–1.65 µm [Fused silica]
#  ...
# only pages with k data that covers 1550 nm
ri.search('SiO2', quantity='k', wavelength=1550)
SiO2 = ri.search('SiO2')[0].material()

# wavelength in nm by default
SiO.get_refractive_index(600)        # 1.9655

# unit= accepts 'nm', 'um', 'mm', 'm', 'A', 'cm-1', 'THz', 'eV'; arrays work too
SiO.get_extinction_coefficient([0.6, 0.7], unit='um')  # array([0.001, 0.00075])

# permittivity for exp(-iωt) (default) or exp(+iωt) time dependence
SiO.get_epsilon(600)                        # (3.8633+0.0039j)
SiO.get_epsilon(600, exp_type='exp(+iwt)')  # (3.8633-0.0039j)

# valid wavelength range
SiO.get_wl_range(unit='nm')          # (240.0, 14000.0)

Documentation

See DOCUMENTATION.md for unit conversions, separate n and k ranges, values outside the range, and other copies of the database.

How to cite

If you use this package in published work, please cite the database paper and this package, and state the database version.

Database:

Polyanskiy, M. N. Refractiveindex.info database of optical constants.
Scientific Data 11, 94 (2024).
https://doi.org/10.1038/s41597-023-02898-2

BibTeX:

@article{polyanskiy2024,
  title   = {Refractiveindex.info database of optical constants},
  author  = {Polyanskiy, Mikhail N.},
  journal = {Scientific Data},
  volume  = {11},
  pages   = {94},
  year    = {2024},
  doi     = {10.1038/s41597-023-02898-2}
}

This package:

Toftul, I. and refractiveindex contributors. refractiveindex: Python interface to the refractiveindex.info database.
https://github.com/toftul/refractiveindex

@software{toftul_refractiveindex,
  author = {Toftul, Ivan and {refractiveindex contributors}},
  title  = {refractiveindex: Python interface to the refractiveindex.info database},
  url    = {https://github.com/toftul/refractiveindex}
}

The "Cite this repository" button on GitHub gives the same entry in APA and BibTeX, from CITATION.cff.

For reproducibility, add the package version and the database version. The database is CC0.

from importlib.metadata import version
print(version('refractiveindex'))
print(ri.DATABASE_VERSION)
print(ri.DATABASE_COMMIT)

See also

Metadata

Release files for refractiveindex 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for refractiveindex 1.3.1
File Size Uploaded Provenance Actions
refractiveindex-1.3.1.tar.gz 12.3 MB With provenance Details for refractiveindex-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for refractiveindex 1.3.1
File Interpreter ABI Platform Actions
refractiveindex-1.3.1-py3-none-any.whl Python 3 none any Details for refractiveindex-1.3.1-py3-none-any.whl

Total release size: 27.3 MB

Release files / refractiveindex-1.3.1.tar.gz

Download URL refractiveindex-1.3.1.tar.gz
Size 12.3 MB
Tags Source
SHA-256 checksum
How to use checksums
6059aa2430fe73fb803db13c6cfafbde83ee67b47c24090f466b38c39e46d2a1
BLAKE2b-256 checksum
How to use checksums
9812b666262349404ee373246abfa7d5fe91efd44b2b1facb63f25b2167ed3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / refractiveindex-1.3.1-py3-none-any.whl

Download URL refractiveindex-1.3.1-py3-none-any.whl
Size 15.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
36cf8aafb58c620985193fd0ec6b05089e4a4bf9f745c89c979bf4ea7cdfd743
BLAKE2b-256 checksum
How to use checksums
e8a1954679e904763afda8b2c510aefddada3fa061ae43e931959bdc96a2f10f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for refractiveindex 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for refractiveindex-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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