Lightweight interface to the refractiveindex.info database with refellips support
Project description
refidx2se
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.RIobject — 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 refidx2se
Or from source:
git clone https://github.com/agauer/refidx2se.git
cd refidx2se
pip install -e ".[dev]"
Quick start
import numpy as np
import refidx2se
from refellips.reflect_modelSE import ReflectModelSE
from refellips.dispersion import RI, load_material
# 1. Explore available entries
refidx2se.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 = refidx2se.return_material_option("SiO2", idx=0)
# 3. Load into refellips
wavelengths = np.linspace(400, 900, 200) # nm
ri = refidx2se.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file refidx2se-0.1.1.tar.gz.
File metadata
- Download URL: refidx2se-0.1.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae7e9a550f3b6a70f6b7a3787f45638f2b60e883d70b16e7e560c23544be5db5
|
|
| MD5 |
a30f24e08ad1303ec3f2a39f16c0d881
|
|
| BLAKE2b-256 |
639c014bf5eb9931945d0e052a1203c010c7df8169f25882debc059d6e6f6c30
|
File details
Details for the file refidx2se-0.1.1-py3-none-any.whl.
File metadata
- Download URL: refidx2se-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37cba1774b7428b66d2323b452eb5e05362e0b2d77d3ad140835263c07b20fe9
|
|
| MD5 |
1bf1fa043441f49bd7d17a8ea670ef0a
|
|
| BLAKE2b-256 |
60de9601e7b7086716bc30b887dd955ca41ca8b41da4cce111d7bfa258f57217
|