Skip to main content

A python interface to the refractiveindex.info database.

Project description

Python interface to RefractiveIndex database

Tests

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([2.15092857, 1.999, 1.96553846, 1.942])

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.

TODO

  1. Include EODG data

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.1.tar.gz (5.5 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.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file refractiveindex-1.0.1.tar.gz.

File metadata

  • Download URL: refractiveindex-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Linux/6.18.12-200.fc43.x86_64

File hashes

Hashes for refractiveindex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e223d53733dd11266d38aa9ad58c436701b88bb4f53a96590e5591c3227cfcc4
MD5 8df39dbb6fdccde4da835d8f0f783c57
BLAKE2b-256 3bdacabe614d1252ce612a27185ccf4b00f867e9176e0e4d28770f25e372f58b

See more details on using hashes here.

File details

Details for the file refractiveindex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: refractiveindex-1.0.1-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.12-200.fc43.x86_64

File hashes

Hashes for refractiveindex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73f5db204c564d90e2d825ebfd424f512567b10deddf14a27773e7e8fb5e2d8d
MD5 f4b155b45345177f7fe66f55b068b9a1
BLAKE2b-256 99c700aea96f4a527f98328c3c2846b1979d57e63cd59dbf3d2d0f7f9df23763

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