Skip to main content

Python interface for data on refractiveindex.info

Project description

PyPI - Version PyPI - Python Version GitHub Actions Workflow Status GitHub Actions Workflow Status Coverage Status

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.5.tar.gz (14.1 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.5-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyindexrepo-0.1.5.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyindexrepo-0.1.5.tar.gz
Algorithm Hash digest
SHA256 99f5384cd8e3c589d8d71f076289d98d1352efe50e33353455028054254422c8
MD5 a66480da52858549403b2e42974157a5
BLAKE2b-256 0264417b80e7cbadd1c0f58304b0b0a07be50d0d934e1b37aa064b04e9ef9316

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyindexrepo-0.1.5.tar.gz:

Publisher: release.yaml on Stuermer/PyIndexRepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pyindexrepo-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyindexrepo-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 01009d574b0bb2ae547ceaea887814b3ec15742198e74b1f3b72906f3f0c51b7
MD5 229422a9d4364e2d20e3decb5489d2dc
BLAKE2b-256 aab59cf03df3547a93301198b048c9f18b3fd2d5b3c36b1dbbe11aaf8e933781

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyindexrepo-0.1.5-py3-none-any.whl:

Publisher: release.yaml on Stuermer/PyIndexRepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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