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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyindexrepo-0.1.3.tar.gz.
File metadata
- Download URL: pyindexrepo-0.1.3.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efc9c6c1116602a67fdfe44273986921025f98e4faa2dfbde728121ecdfc5d7c
|
|
| MD5 |
2fccc140282f8d5b2f17c0cc278e3bc7
|
|
| BLAKE2b-256 |
7a8b219f5d9b106978c7730596e49c06f27bba13ac2ed18f6e4a916896229302
|
Provenance
The following attestation bundles were made for pyindexrepo-0.1.3.tar.gz:
Publisher:
release.yaml on Stuermer/PyIndexRepo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyindexrepo-0.1.3.tar.gz -
Subject digest:
efc9c6c1116602a67fdfe44273986921025f98e4faa2dfbde728121ecdfc5d7c - Sigstore transparency entry: 152248022
- Sigstore integration time:
-
Permalink:
Stuermer/PyIndexRepo@aec57fef2c5df9d35174bf546cafbc5d24532787 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/Stuermer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@aec57fef2c5df9d35174bf546cafbc5d24532787 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyindexrepo-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pyindexrepo-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a97a170ccd407b621086069f15bc57b2c24dc3301a1014a4383bfc1e0267f4d8
|
|
| MD5 |
cda4ffefc4b2e9481a34b4987c17bae7
|
|
| BLAKE2b-256 |
36df187011fc977e1e3e0401a2aef8daf38be87cfe9c10b94950b53c560f5ded
|
Provenance
The following attestation bundles were made for pyindexrepo-0.1.3-py3-none-any.whl:
Publisher:
release.yaml on Stuermer/PyIndexRepo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyindexrepo-0.1.3-py3-none-any.whl -
Subject digest:
a97a170ccd407b621086069f15bc57b2c24dc3301a1014a4383bfc1e0267f4d8 - Sigstore transparency entry: 152248023
- Sigstore integration time:
-
Permalink:
Stuermer/PyIndexRepo@aec57fef2c5df9d35174bf546cafbc5d24532787 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/Stuermer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@aec57fef2c5df9d35174bf546cafbc5d24532787 -
Trigger Event:
push
-
Statement type: