Skip to main content

Python interface for data on refractiveindex.info

Project description

PyIndexRepo

This package gives access to the refractive index data from RefractiveIndex.info.

The focus of this package is to provide a convenient interface to the data, and be efficient in the calculation of (temperature-dependent) refractive indices.

Usage

Basics

from pyindexrepo import RefractiveIndexLibrary

db = RefractiveIndexLibrary(auto_upgrade=True)
bk7 = db.search_material_by_page_name('N-BK7')[0]  # returns a list of different BK7 glasses
print(bk7.get_n(0.5875618))

When executed for the first time, the database from the RefractiveIndex Github Repo will be downloaded and converted to a python object. This process takes a few minutes. Consecutive calls will load the database object from a local file (almost instantaneously).

Auto-upgrade of the library is supported, but switched off by default.

There are two main classes that allow interacting with the data: the RefractiveIndexLibrary class and the Material class.

Temperature data

When temperature data is available, the refractive index of a material can be queried at any temperature within the valid temperature range:

import numpy as np
from pyindexrepo import RefractiveIndexLibrary

db = RefractiveIndexLibrary(auto_upgrade=True)
bk7 = db.search_material_by_page_name('N-BK7')[0]  # returns a list of different BK7 glasses
wl = np.linspace(0.4, 0.7, 10000)
print(bk7.get_n_at_temperature(wl, temperature=30))
[1.53088657 1.53088257 1.53087857 ... 1.51309187 1.51309107 1.51309027]

Installation

pip install pyindexrepo

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

pyindexrepo-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

pyindexrepo-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pyindexrepo-0.1.1.tar.gz.

File metadata

  • Download URL: pyindexrepo-0.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.13 Linux/5.15.0-125-generic

File hashes

Hashes for pyindexrepo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 97546e9ca7c6f981e99deecb85ed68aa8aed26ae4ab97eb31dbfe7a69b0bad55
MD5 6ce6f45e0d1686aa40c73978816f5241
BLAKE2b-256 88057aaf84f851b4d005cfbff15d2236461fb38c36eb62e59ae919b5bae705dd

See more details on using hashes here.

File details

Details for the file pyindexrepo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyindexrepo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.13 Linux/5.15.0-125-generic

File hashes

Hashes for pyindexrepo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b28af2824e479c04a45ed3d78ca7523acf3e66126052b0cd51d113e93069dd63
MD5 03deed01dfea4dd87589dd386ddc1d6f
BLAKE2b-256 797c3d4e87cddb91519af67488ca89c60a3c8eba257dc184e317b62c2ceaa3c5

See more details on using hashes here.

Supported by

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