Skip to main content

Lightweight interface to the refractiveindex.info database with refellips support

Project description

refidxdb

CI PyPI Python License: MIT

A lightweight Python interface to the refractiveindex.info database, with built-in conversion to refellips RI objects for spectroscopic ellipsometry workflows.

Features

  • Search the full refractiveindex.info catalog by material name (case-insensitive, partial matching).
  • Load any material entry directly into a refellips.RI object — no manual file management.
  • Wavelength ranges are automatically clipped to the material's valid range.
  • Catalog fetched from GitHub and cached in-process — only one network request per session.

Installation

pip install refidxdb

Or from source:

git clone https://github.com/agauer/refidxdb.git
cd refidxdb
pip install -e ".[dev]"

Quick start

import numpy as np
import refidxdb
from refellips.reflect_modelSE import ReflectModelSE
from refellips.dispersion import RI, load_material

# 1. Explore available entries
refidxdb.print_material_options("SiO2")
# 4 entries matching 'SiO2':
#   option   shelf        book                      page                                description
#   -------- ------------ ------------------------- ----------------------------------- ---------------------------------------------
#   0        main         SiO2                      Malitson                            Malitson 1965: n 0.21–6.7 µm
#   1        main         SiO2                      ...

# 2. Pick one by index
shelf, book, page = refidxdb.return_material_option("SiO2", idx=0)

# 3. Load into refellips
wavelengths = np.linspace(400, 900, 200)   # nm
ri = refidxdb.rim_to_refellips(shelf, book, page, wavelengths)

# 4. Create a model
si = load_material("silicon")
air = RI("/path/to/refellips/materials/air.csv")

est_thickness = 20  # Å
min_thickness = 1
max_thickness = 50

sio2 = ri(est_thickness)
sio2.thick.setp(vary=True, bounds=(min_thickness, max_thickness))

stack = air() | sio2 | si()
model = ReflectModelSE(stack)

# 5. Continue with refellips analysis

API reference

search_material(book: str) -> list[dict]

Returns all catalog entries whose book name contains book (case-insensitive). Each dict has keys shelf, book, page, name.

return_material_option(book: str, idx: int = 0) -> tuple[str, str, str]

Returns (shelf, book, page) for the idx-th match. Raises ValueError if no matches exist or idx is out of range.

print_material_options(book: str) -> None

Pretty-prints a numbered table of all matches — handy for interactive use.

rim_to_refellips(shelf, book, page, wavelengths_nm) -> refellips.RI

Fetches the material from refractiveindex.info, clips the requested wavelength array to the material's valid range, and returns a refellips.RI object. Missing k data is silently replaced with zeros.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refidx2se-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file refidx2se-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: refidx2se-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for refidx2se-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0fbae8ae756603c27936a8e2d87a33a5256a4e72830210f9c76288b52333a5b
MD5 1020d4530ff3546d290b4a6e3a090c80
BLAKE2b-256 fc43895f46f168b5001c0b9682cfdab9f05bb0c99ef8b50f02e4ba97206c8603

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page