https://github.com/mfschubert/refractiveindex2
https://github.com/mfschubert/refractiveindex2
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mfschubert/refractiveindex2
- Owner: mfschubert
- License: mit
- Created: 2025-01-13T18:18:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-22T00:49:47.000Z (over 1 year ago)
- Last Synced: 2025-02-24T01:41:00.243Z (over 1 year ago)
- Language: Python
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A python interface to refractiveindex.info


This repo is based on the [refractiveindex repo](https://github.com/toftul/refractiveindex) by [Ivan Toftul](https://github.com/toftul), which itself is based on the `refractiveindex.py` module from the [PyTMM project](https://github.com/kitchenknif/PyTMM) by [Pavel Dmitriev](https://github.com/kitchenknif). It provides a python interface to the [refractiveindex.info database](https://github.com/polyanskiy/refractiveindex.info-database) by [Mikhail Polyanskiy](https://github.com/polyanskiy).
Compared to other interfaces to the database, `refractiveindex2` implements additional formulas required by some materials in the database and is rewritten to have a simpler class structure. It also includes extensive tests for all materials in the database.
## Installation
```
pip install refractiveindex2
```
## Usage
```python
import refractiveindex2 as ri
SiO = ri.RefractiveIndexMaterial(shelf="main", book="SiO", page="Hass")
wavelength_um = 0.6 # [microns]
SiO.get_epsilon(wavelength_um=wavelength_um)
# (3.8633404437869827 + 0.003931076923076923j)
SiO.get_refractive_index(wavelength_um=wavelength_um)
# (1.96553846)
SiO.get_extinction_coefficient(wavelength_um=wavelength_um)
# (0.001)
```
Notes:
- here the time dependence is assumed to be $\mathrm{e}^{-\mathrm{i} \omega t}$, so $\mathrm{Im}(\varepsilon) > 0$ is responsible for the losses.
- if there is a space in the name, one should write underscore instead of it, i.e. not `page='Rodriguez-de Marcos'` but `page='Rodriguez-de_Marcos'`.
## How to get material page names
You can find the proper “page” name by hovering your cursor on the link in the Data section

Or you can look up folders in this repository
https://github.com/polyanskiy/refractiveindex.info-database
## Known issues
For unknown reasons, download of the database can be slow on some systems. You can avoid this by manually downloading the zip file with the `SHA` hard-coded in the `refractiveindex.py` module, e.g.
```
https://github.com/polyanskiy/refractiveindex.info-database/archive/{SHA}.zip
```
which will be a file named
```
refractiveindex.info-database-{SHA}.zip
```
Then, manually add this file to the `src/refractiveindex2/database/{SHA}` directory, creating the directory if needed. This ensures that the automatic download of the database on first module import is avoided.
## Related projects
- https://github.com/stillyslalom/RefractiveIndex.jl
- https://github.com/kitchenknif/PyTMM
- https://github.com/toftul/refractiveindex
- https://github.com/polyanskiy/refractiveindex.info-database