Name | PyIndexRepo JSON |
Version |
0.1.7
JSON |
| download |
home_page | None |
Summary | Python interface for data on refractiveindex.info |
upload_time | 2024-12-22 09:14:12 |
maintainer | None |
docs_url | None |
author | stuermer |
requires_python | <3.13,>=3.10 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![PyPI - Version](https://img.shields.io/pypi/v/PyIndexRepo)](https://pypi.org/project/PyIndexRepo/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PyIndexRepo)](https://pypi.org/project/PyIndexRepo/)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Stuermer/PyIndexRepo/tests.yaml?label=pytest)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Stuermer/PyIndexRepo/docs.yaml?label=mkdocs&link=https%3A%2F%2Fstuermer.github.io%2FPyIndexRepo%2F)](https://stuermer.github.io/PyIndexRepo/)
[![Coverage Status](https://coveralls.io/repos/github/Stuermer/PyIndexRepo/badge.svg?branch=master)](https://coveralls.io/github/Stuermer/PyIndexRepo?branch=master)
# 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
```python
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](https://github.com/polyanskiy/refractiveindex.info-database) 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:
```python
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
```bash
pip install pyindexrepo
```
Raw data
{
"_id": null,
"home_page": null,
"name": "PyIndexRepo",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "stuermer",
"author_email": "stuermer@lsw.uni-heidelberg.de",
"download_url": "https://files.pythonhosted.org/packages/ad/30/d585e6da2c911c27b8ba13c450459c1917c808d148c32e0cbd1bbab11918/pyindexrepo-0.1.7.tar.gz",
"platform": null,
"description": "[![PyPI - Version](https://img.shields.io/pypi/v/PyIndexRepo)](https://pypi.org/project/PyIndexRepo/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PyIndexRepo)](https://pypi.org/project/PyIndexRepo/)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Stuermer/PyIndexRepo/tests.yaml?label=pytest)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Stuermer/PyIndexRepo/docs.yaml?label=mkdocs&link=https%3A%2F%2Fstuermer.github.io%2FPyIndexRepo%2F)](https://stuermer.github.io/PyIndexRepo/)\n[![Coverage Status](https://coveralls.io/repos/github/Stuermer/PyIndexRepo/badge.svg?branch=master)](https://coveralls.io/github/Stuermer/PyIndexRepo?branch=master)\n\n\n# PyIndexRepo\n\nThis package gives access to the refractive index data from [RefractiveIndex.info]().\n\nThe focus of this package is to provide a convenient interface to the data, and be\nefficient in the calculation of (temperature-dependent) refractive indices.\n\n## Usage\n\n#### Basics\n\n```python\nfrom pyindexrepo import RefractiveIndexLibrary\n\ndb = RefractiveIndexLibrary(auto_upgrade=True)\nbk7 = db.search_material_by_page_name('N-BK7')[0] # returns a list of different BK7 glasses\nprint(bk7.get_n(0.5875618))\n```\n\nWhen executed for the first time, the database from the\nRefractiveIndex [Github Repo](https://github.com/polyanskiy/refractiveindex.info-database) will be downloaded and\nconverted to a python object. This process takes a few minutes. Consecutive calls will load the database object\nfrom a local file (almost instantaneously).\n\nAuto-upgrade of the library is supported, but switched off by default.\n\nThere are two main classes that allow interacting with the data: the RefractiveIndexLibrary class\nand the Material class.\n\n#### Temperature data\n\nWhen temperature data is available, the refractive index of a material can be queried at any temperature\nwithin the valid temperature range:\n\n```python\nimport numpy as np\nfrom pyindexrepo import RefractiveIndexLibrary\n\ndb = RefractiveIndexLibrary(auto_upgrade=True)\nbk7 = db.search_material_by_page_name('N-BK7')[0] # returns a list of different BK7 glasses\nwl = np.linspace(0.4, 0.7, 10000)\nprint(bk7.get_n_at_temperature(wl, temperature=30))\n```\n\n``` \n[1.53088657 1.53088257 1.53087857 ... 1.51309187 1.51309107 1.51309027]\n```\n\n## Installation\n\n```bash\npip install pyindexrepo\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Python interface for data on refractiveindex.info",
"version": "0.1.7",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "22e282c7a3f454078b441a33177a27536319e3a68ff93068de54883748701c98",
"md5": "7bb54519719cf6163da012c0c0be671f",
"sha256": "88a150f3b52fddd4c51f203e98880596b9ac5fcfb5ee68c52da0cc638ba6e5b8"
},
"downloads": -1,
"filename": "pyindexrepo-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7bb54519719cf6163da012c0c0be671f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 15158,
"upload_time": "2024-12-22T09:14:10",
"upload_time_iso_8601": "2024-12-22T09:14:10.499688Z",
"url": "https://files.pythonhosted.org/packages/22/e2/82c7a3f454078b441a33177a27536319e3a68ff93068de54883748701c98/pyindexrepo-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ad30d585e6da2c911c27b8ba13c450459c1917c808d148c32e0cbd1bbab11918",
"md5": "efe14f2dbdbf8da77a090df5468aa306",
"sha256": "311fa30c042aa880e6d8cc8bf366b81669307b9e4f49e05250bafd8168c3493b"
},
"downloads": -1,
"filename": "pyindexrepo-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "efe14f2dbdbf8da77a090df5468aa306",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 14996,
"upload_time": "2024-12-22T09:14:12",
"upload_time_iso_8601": "2024-12-22T09:14:12.609517Z",
"url": "https://files.pythonhosted.org/packages/ad/30/d585e6da2c911c27b8ba13c450459c1917c808d148c32e0cbd1bbab11918/pyindexrepo-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 09:14:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyindexrepo"
}