Skip to main content

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' but page='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

How to get page name

Or you can look up folders in this repository
https://github.com/polyanskiy/refractiveindex.info-database

Similar projects

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


Download files

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

Source Distribution

refractiveindex-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

refractiveindex-1.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

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

Hashes for refractiveindex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0ff5be0320794ea050dedf6795b0eb0238530d3a92460231ab631690c0c1b1db
MD5 8989e0ca976b38e3417d9920cc51271a
BLAKE2b-256 2fb643e5a560a70116087633b1b5d03509e7424f0dc96a779512f3c633437477

See more details on using hashes here.

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

Hashes for refractiveindex-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47d1d167e3a97431fd4969521136d80bb3d3fd0202f151579f24d88254523054
MD5 8d193ca7ec4f2cb284cab9a6ecc28660
BLAKE2b-256 de7236c927c3953f6275a39b382ef767ed0d148a8e99676f73bf2894a1d7228b

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