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.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyindexrepo-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 32d2852625b2f58619dbfe27b86bda2448b88cc1c535aebf0f7efbee9f88ebff
MD5 d6714135bea32f43736eaf049a474532
BLAKE2b-256 37fd81b3ed197696ccfc7f34d778e11e586ba71b751048fd7317260651808a91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyindexrepo-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42d337dd749a3ab02d9bf83b6f137ee5b61827889c6e649e72ffb0dcf8e7ac7c
MD5 cee197a1aca6964b151e132a6fa92708
BLAKE2b-256 f45345920f852ddabc5f21602bd3249480397fc7d11288cee2d132b4b115b94a

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