RefractiveIndex.Info interface
Access to the RefractiveIndex.INFO database is provided by the rindexinfo module. A major function of this module is to create glass instances (RIIMedium or InterpolatedMedium) for use in optical models.
from opticalglass.glassfactory import create_glass
from opticalglass.rindexinfo import summary_plots
Typical use scenario - Polycarbonate
Ofttimes, a Google search of a “refractive index for Polycarbonate” will include a RefractiveIndex.Info link in the query. Follow the link to the page on RefractiveIndex.INFO for Polycarbonate.
The data is below this on the web page.
To get a link to the data for this material, scroll further down the webpage to the Data section:
Right mouse click on the Full database record link and choose the Copy Link Address menu item:
We can now define a variable for the polycarbonate data url and paste the link we obtained above into the right hand side of the definition.
polycarb_url = 'https://refractiveindex.info/database/data/organic/(C16H14O3)n%20-%20polycarbonate/nk/Zhang.yml'
The function create_glass() takes the URL of the material in the and the names and returns a glass instance.
polycarb = create_glass(polycarb_url, "rindexinfo")
The summary_plots() function can be used in a scripting environment to plot the (complex) refractive index data of a material.
summary_plots(polycarb)
['tabulated nk']
There is additional information available for each database entry, beyond refractive index and absorption. It is easiest to work directly with the imported yaml data. The rindexinfo materials returned from create_glass() all have a yaml_data attribute, i.e. the complete database record.
polycarb.yaml_data.keys()
dict_keys(['REFERENCES', 'COMMENTS', 'DATA'])
The ‘DATA’ key contains the raw index data. The ‘REFERENCES’ key is always present and documents the source of the data.
polycarb.yaml_data['REFERENCES']
'1) X. Zhang, J. Qiu, X. Li, J. Zhao, L. Liu.nComplex refractive indices measurements of polymers in visible and near-infrared bands.n<a href="https://doi.org/10.1364/AO.383831"><i>Appl. Opt.</i> <b>59</b>, 2337-2344 (2020)</a>n(0.4-2 µm)<br>n2) X. Zhang, J. Qiu, J. Zhao, X. Li, L. Liu.nComplex refractive indices measurements of polymers in infrared bands.n<a href="https://doi.org/10.1016/j.jqsrt.2020.107063"><i>J. Quant. Spectrosc. Radiat. Transf.</i> <b>252</b>, 107063 (2020)</a>n(2-20 µm)n'
The ‘COMMENTS’ key is often present with additional information. Other common keys include ‘CONDITIONS’ and ‘PROPERTIES’.
polycarb.yaml_data['COMMENTS']
'Normal temperature and pressure. Manufacturer: Dedicated Plastic, China.n'
Material file examples
Below are a sampling of different material files of common interest.
SiO2
sio2_url = 'https://refractiveindex.info/database/data/main/SiO2/nk/Malitson.yml'
sio2 = create_glass(sio2_url, "rindexinfo")
summary_plots(sio2)
['formula 1']
CaF2
caf2_url = 'https://refractiveindex.info/database/data/main/CaF2/nk/Daimon-20.yml'
caf2 = create_glass(caf2_url, "rindexinfo")
summary_plots(caf2)
['formula 2']
Germanium
ge_url = 'https://refractiveindex.info/database/data/main/Ge/nk/Amotchkina.yml'
ge = create_glass(ge_url, "rindexinfo")
summary_plots(ge)
['tabulated nk']
PEDOT
pedot_url = 'https://refractiveindex.info/database/data/other/mixed%20organic/PEDOT-PSS/nk/Chen.yml'
pedot = create_glass(pedot_url, "rindexinfo")
summary_plots(pedot)
['tabulated n', 'tabulated k']
F1 LZOS
url = 'https://refractiveindex.info/database/data/specs/lzos/optical/F1.yml'
F1 = create_glass(url, "rindexinfo")
summary_plots(F1)
['tabulated n']
MgF2
url_root = 'https://refractiveindex.info/database/data/'
url = url_root + 'main/MgF2/nk/Li-e.yml'
MgF2 = create_glass(url, "rindexinfo")
summary_plots(MgF2)
['formula 1']
KNbO3
url = url_root + 'main/KNbO3/nk/Umemura-alpha.yml'
KNbO3 = create_glass(url, "rindexinfo")
summary_plots(KNbO3)
['formula 4']
KNbO3.data_range
array([0.4, 5.3])
KNbO3.yaml_data
{'REFERENCES': 'N. Umemura, K. Yoshida, and K. Kato. Phase-matching properties of KNbO<sub>3</sub> in the mid-infrared, <a href=" https://doi.org/10.1364/AO.38.000991"><i>Appl Opt.</i> <b>38</b>, 991-994 (1999)</a>n',
'COMMENTS': 'n<sub>α</sub>; 22 °C.n',
'DATA': [{'type': 'formula 4',
'wavelength_range': '0.40 5.3',
'coefficients': '4.4222 0.09972 0 0.05496 1 0 0 0 1 -0.01976 2'}]}
KNbO3.coefs
array([ 4.4222 , 0.09972, 0. , 0.05496, 1. , 0. ,
1. , 0. , 1. , -0.01976, 2. ])
len(KNbO3.coefs)
11