A python interface to the refractiveindex.info database.
Project description
Easy Python interface to RefractiveIndex database
The original database
https://github.com/polyanskiy/refractiveindex.info-database
Installation
pip install refractiveindex
Usage
import numpy as np
from refractiveindex import RefractiveIndexMaterial
# Tabulated nk material
SiO = RefractiveIndexMaterial(shelf='main', book='SiO', page='Hass')
wavelength_nm = 600 # [nm]
SiO.get_refractive_index(wavelength_nm)
# 1.96553846
SiO.get_extinction_coefficient(wavelength_nm)
# 0.001
SiO.get_epsilon(wavelength_nm)
# (3.8633404437869827+0.003931076923076923j)
# Formula-based material
bk7 = RefractiveIndexMaterial(shelf='specs', book='SCHOTT-optical', page='N-BK7')
bk7.get_refractive_index(589.3)
# 1.5168...
# Array input
wavelengths = np.array([400, 500, 600, 700])
SiO.get_refractive_index(wavelengths)
# array([1.9892, 1.9728, 1.9655, 1.9617])
Notes:
- Here the time dependence is assumed to be $\mathrm{e}^{-\mathrm{i} \omega t}$, so $\mathrm{Im}(\varepsilon) > 0$ is responsible for the losses.
- If there is a space in the name, write underscore instead, i.e. not
page='Rodriguez-de Marcos'butpage='Rodriguez-de_Marcos'. - All 9 dispersion formula types used by the refractiveindex.info database are supported: Sellmeier (1), Sellmeier-2 (2), Polynomial (3), RefractiveIndex.INFO (4), Cauchy (5), Gases (6), Herzberger (7), Retro (8), and Exotic (9).
- The database is automatically downloaded on first use to
~/.refractiveindex.info-database.
How to get material page names
You can find the proper "page" name by hovering your cursor on the link in the Data section
Or you can look up folders in this repository
https://github.com/polyanskiy/refractiveindex.info-database
Similar projects
- PyTMM by Pavel Dmitriev — the original database parsing code this project was based on
- RefractiveIndex.jl — Julia interface to refractiveindex.info database
Possible problems
If the upstream database has changed its structure, upgrade the package
pip install --upgrade refractiveindex
and remove the database folder at ~/.refractiveindex.info-database.
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 refractiveindex-1.0.0.tar.gz.
File metadata
- Download URL: refractiveindex-1.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.2 Linux/6.18.9-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ff5be0320794ea050dedf6795b0eb0238530d3a92460231ab631690c0c1b1db
|
|
| MD5 |
8989e0ca976b38e3417d9920cc51271a
|
|
| BLAKE2b-256 |
2fb643e5a560a70116087633b1b5d03509e7424f0dc96a779512f3c633437477
|
File details
Details for the file refractiveindex-1.0.0-py3-none-any.whl.
File metadata
- Download URL: refractiveindex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.2 Linux/6.18.9-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47d1d167e3a97431fd4969521136d80bb3d3fd0202f151579f24d88254523054
|
|
| MD5 |
8d193ca7ec4f2cb284cab9a6ecc28660
|
|
| BLAKE2b-256 |
de7236c927c3953f6275a39b382ef767ed0d148a8e99676f73bf2894a1d7228b
|