RiiDataFrame¶
Here, a little bit more detail about RiiDataFrame class will be given.
[1]:
import riip
ri = riip.RiiDataFrame()
RiiDataFrame has an attribute named catalog that is a Pandas DataFrame provinding the catalog of experimental data as shown below. The columns formula and tabulated indicate the type of data. If n or k is included in the column tamulated, the experimentally observed refractive index n or extinction coefficient k is given in tabulated form, respectively. If tabulated is f, only coefficients of formula are given. On the other hand, the number written in the column formula indicates the number of dispetsion formula that fits the experimental data. If the number is 0, only the tabulated data are given.
[2]:
ri.catalog.head(3)
[2]:
| shelf | shelf_name | division | book | book_name | section | page | path | formula | tabulated | num_n | num_k | wl_n_min | wl_n_max | wl_k_min | wl_k_max | wl_min | wl_max | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||
| 0 | main | MAIN - simple inorganic materials | Ag - Silver | Ag | Ag (Silver) | Experimental data: bulk, thick film | Johnson | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 0 | nk | 49 | 49 | 0.1879 | 1.937 | 0.1879 | 1.937 | 0.1879 | 1.937 |
| 1 | main | MAIN - simple inorganic materials | Ag - Silver | Ag | Ag (Silver) | Experimental data: bulk, thick film | Choi | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 0 | nk | 84 | 84 | 1.2310 | 6.988 | 1.2310 | 6.988 | 1.2310 | 6.988 |
| 2 | main | MAIN - simple inorganic materials | Ag - Silver | Ag | Ag (Silver) | Experimental data: bulk, thick film | Jiang | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 0 | nk | 1701 | 1701 | 0.3000 | 2.000 | 0.3000 | 2.000 | 0.3000 | 2.000 |
The experimental data are given by raw_data:
[3]:
ri.raw_data.loc[3].head(5) # first 5 rows for the material whose id is 3
[3]:
| c | wl_n | n | wl_k | k | |
|---|---|---|---|---|---|
| id | |||||
| 3 | 0.0 | 0.27 | 1.364 | 0.27 | 1.3180 |
| 3 | 0.0 | 0.28 | 1.477 | 0.28 | 1.2400 |
| 3 | 0.0 | 0.29 | 1.531 | 0.29 | 1.1680 |
| 3 | 0.0 | 0.30 | 1.609 | 0.30 | 0.9126 |
| 3 | 0.0 | 0.31 | 1.373 | 0.31 | 0.5192 |
where n is the refractive index and k is the extinction coefficient at the vacuum wavelength wl_n (wl_k) in the unit of μm. The column c gives the coefficients for the dielectric function model.
In the above example, no coefficient is given because only the tabulated data are given (formula number in catalog is 0). On the other hand, if formula number is not 0, some coefficeints are given in the column c as shown below. In this case, formula 21 means Drude-Lorentz model, which is explained in Dispersion formulas.
[4]:
ri.catalog.tail(3)
[4]:
| shelf | shelf_name | division | book | book_name | section | page | path | formula | tabulated | num_n | num_k | wl_n_min | wl_n_max | wl_k_min | wl_k_max | wl_min | wl_max | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | ||||||||||||||||||
| 2909 | BB-f22 | BB - formula 22: Brendel-Bormann model | Pt - Platinum | Pt | Pt (Platinum) | Rakic-BBF | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 22 | f | 0 | 0 | 0.2066 | 12.4 | 0.2066 | 12.4 | 0.2066 | 12.4 | |
| 2910 | BB-f22 | BB - formula 22: Brendel-Bormann model | Ti - Titanium | Ti | Ti (Titanium) | Rakic-BBF | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 22 | f | 0 | 0 | 0.2066 | 12.4 | 0.2066 | 12.4 | 0.2066 | 12.4 | |
| 2911 | BB-f22 | BB - formula 22: Brendel-Bormann model | W - Tungsten | W | W (Tungsten) | Rakic-BBF | /home/mnishida/anaconda3/envs/pymwm/lib/python... | 22 | f | 0 | 0 | 0.2066 | 12.4 | 0.2066 | 12.4 | 0.2066 | 12.4 |
[5]:
ri.raw_data.loc[2911].head(5) # first 5 rows for the material whose id is 2912
[5]:
| c | wl_n | n | wl_k | k | |
|---|---|---|---|---|---|
| id | |||||
| 2911 | 1.000 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2911 | 0.197 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2911 | 0.057 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2911 | 13.220 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2911 | 0.006 | 0.0 | 0.0 | 0.0 | 0.0 |
Using the method load_grid_data(), you can get grid data calculated at 200 wavelength values in the range [wl_min, wl_max], which is the intersection between the domain of n [wl_n_min, wl_n_max] and the domain of k [wl_k_min, wl_k_max]. These values are shown in catalog.
[6]:
grid_data = ri.load_grid_data(3)
grid_data
[6]:
| wl | n | k | |
|---|---|---|---|
| id | |||
| 3 | 0.270000 | 1.364000 | 1.318000 |
| 3 | 0.393869 | 0.059405 | 2.019307 |
| 3 | 0.517739 | 0.052095 | 3.214604 |
| 3 | 0.641608 | 0.059819 | 4.218402 |
| 3 | 0.765477 | 0.074195 | 5.168274 |
| ... | ... | ... | ... |
| 3 | 24.424523 | 48.244988 | 149.066993 |
| 3 | 24.548392 | 48.628523 | 149.645128 |
| 3 | 24.672261 | 49.013717 | 150.226267 |
| 3 | 24.796131 | 49.400800 | 150.811020 |
| 3 | 24.920000 | 49.790000 | 151.400000 |
200 rows × 3 columns
Helper Methods¶
By using the functionality of Pandas, you may find what you want, easily. But, here some simple helper methods are implemented.
plot¶
plot(id: int, comp: str = "n", fmt1: Optional[str] = "-", fmt2: Optional[str] = "--", **kwargs)
id (int): ID number.
comp (str): ‘n’, ‘k’ or ‘eps’.
fmt1 (Union[str, None]): Plot format for n and Re(eps).
fmt2 (Union[str, None]): Plot format for k and Im(eps).
Plot refractive index (if set comp=”n”), extinction coefficient (comp=”k”) or permittivity (comp=”eps”).
[7]:
import matplotlib.pyplot as plt
ri.plot(3, "n")
plt.show()
ri.plot(3, "k")
plt.show()
ri.plot(3, "eps")
plt.show()
search¶
search(name: str) -> DataFrame
This method searches data whose book or book_name contain given name and return a simplified catalog for them.
[8]:
ri.search("NaCl")
[8]:
| book | section | page | formula | tabulated | wl_min | wl_max | |
|---|---|---|---|---|---|---|---|
| id | |||||||
| 182 | NaCl | Li | 1 | f | 0.20 | 30.0000 | |
| 183 | NaCl | Querry | 0 | nk | 0.22 | 166.6667 |
[9]:
ri.search("sodium") # upper or lower case is not significant
[9]:
| book | section | page | formula | tabulated | wl_min | wl_max | |
|---|---|---|---|---|---|---|---|
| id | |||||||
| 127 | NaBr | Li | 1 | f | 0.210000 | 34.000000 | |
| 182 | NaCl | Li | 1 | f | 0.200000 | 30.000000 | |
| 183 | NaCl | Querry | 0 | nk | 0.220000 | 166.666700 | |
| 229 | NaF | Li | 1 | f | 0.150000 | 17.000000 | |
| 295 | NaI | Jellison | 1 | f | 0.436000 | 0.633000 | |
| 296 | NaI | Li | 1 | f | 0.250000 | 40.000000 | |
| 376 | Na | Solid | Smith | 0 | nk | 0.312539 | 2.237982 |
| 377 | Na | Solid | Inagaki | 0 | nk | 0.326000 | 2.066000 |
| 378 | Na | Solid | Monin | 0 | nk | 0.253600 | 0.620000 |
| 379 | Na | Solid | Yamaguchi | 0 | nk | 0.200000 | 0.600000 |
| 380 | Na | Solid | Althoff | 0 | nk | 2.250000 | 10.150000 |
| 381 | Na | Solid | Ives | 0 | nk | 0.253600 | 0.578000 |
| 382 | Na | Liquid | Inagaki-liquid | 0 | nk | 0.335000 | 2.000000 |
select¶
select(condition: str) -> DataFrame
This method make a query with the given condition and return a simplified catalog. It will pick up materials whose experimental data contains some data that fulfill given condition.
[10]:
ri.select("2.5 < n < 3 and 0.4 < wl < 0.8").head(10)
[10]:
| book | section | page | formula | tabulated | wl_min | wl_max | |
|---|---|---|---|---|---|---|---|
| id | |||||||
| 23 | Al | Experimental data | Mathewson | 0 | nk | 0.495940 | 1.771200 |
| 118 | Bi | Experimental data | Hagemann | 0 | nk | 0.000002 | 6.199000 |
| 129 | TlBr | Palik | 1 | f | 0.570000 | 39.400000 | |
| 135 | C | Amorphous thin film | Larruquert | 0 | nk | 0.019656 | 10.079189 |
| 137 | C | Graphite | Djurisic-o | 0 | nk | 0.030996 | 10.332000 |
| 146 | C | Highly oriented pyrolytic graphite (HOPG) | Song-cHOPG-o | 0 | nk | 0.193000 | 1.690000 |
| 150 | C | Graphene | Weber | 0 | nk | 0.210873 | 0.999007 |
| 151 | C | Graphene | El-Sayed | 0 | nk | 0.240000 | 1.000000 |
| 152 | C | Graphene | Song | 0 | nk | 0.193000 | 1.690000 |
| 157 | SiC | 6H-SiC (α-SiC) crystal | Singh-o | 2 | f | 0.488000 | 1.064000 |
[11]:
ri.plot(157)
show¶
show(id: int | Sequence[int]) -> DataFrame
This method shows a simplified catalog for given id.
[12]:
ri.show(1)
[12]:
book Ag
section Experimental data: bulk, thick film
page Choi
formula 0
tabulated nk
wl_min 1.231
wl_max 6.988
Name: 1, dtype: object
read¶
read(id, as_dict=False)
This method returns the contants of a page associated with the id. If you want the page contents as a python dict, give True for argument as_dict.
[13]:
print(ri.read(0))
# this file is part of refractiveindex.info database
# refractiveindex.info database is in the public domain
# copyright and related rights waived via CC0 1.0
REFERENCES: "P. B. Johnson and R. W. Christy. Optical constants of the noble metals, <a href=\"https://doi.org/10.1103/PhysRevB.6.4370\"><i>Phys. Rev. B</i> <b>6</b>, 4370-4379 (1972)</a>"
COMMENTS: "Room temperature"
DATA:
- type: tabulated nk
data: |
0.1879 1.07 1.212
0.1916 1.10 1.232
0.1953 1.12 1.255
0.1993 1.14 1.277
0.2033 1.15 1.296
0.2073 1.18 1.312
0.2119 1.20 1.325
0.2164 1.22 1.336
0.2214 1.25 1.342
0.2262 1.26 1.344
0.2313 1.28 1.357
0.2371 1.28 1.367
0.2426 1.30 1.378
0.2490 1.31 1.389
0.2551 1.33 1.393
0.2616 1.35 1.387
0.2689 1.38 1.372
0.2761 1.41 1.331
0.2844 1.41 1.264
0.2924 1.39 1.161
0.3009 1.34 0.964
0.3107 1.13 0.616
0.3204 0.81 0.392
0.3315 0.17 0.829
0.3425 0.14 1.142
0.3542 0.10 1.419
0.3679 0.07 1.657
0.3815 0.05 1.864
0.3974 0.05 2.070
0.4133 0.05 2.275
0.4305 0.04 2.462
0.4509 0.04 2.657
0.4714 0.05 2.869
0.4959 0.05 3.093
0.5209 0.05 3.324
0.5486 0.06 3.586
0.5821 0.05 3.858
0.6168 0.06 4.152
0.6595 0.05 4.483
0.7045 0.04 4.838
0.7560 0.03 5.242
0.8211 0.04 5.727
0.8920 0.04 6.312
0.9840 0.04 6.992
1.0880 0.04 7.795
1.2160 0.09 8.828
1.3930 0.13 10.10
1.6100 0.15 11.85
1.9370 0.24 14.08
[14]:
ri.read(0, as_dict=True)
[14]:
{'REFERENCES': 'P. B. Johnson and R. W. Christy. Optical constants of the noble metals, <a href="https://doi.org/10.1103/PhysRevB.6.4370"><i>Phys. Rev. B</i> <b>6</b>, 4370-4379 (1972)</a>',
'COMMENTS': 'Room temperature',
'DATA': [{'type': 'tabulated nk',
'data': '0.1879 1.07 1.212\n0.1916 1.10 1.232\n0.1953 1.12 1.255\n0.1993 1.14 1.277\n0.2033 1.15 1.296\n0.2073 1.18 1.312\n0.2119 1.20 1.325\n0.2164 1.22 1.336\n0.2214 1.25 1.342\n0.2262 1.26 1.344\n0.2313 1.28 1.357\n0.2371 1.28 1.367\n0.2426 1.30 1.378\n0.2490 1.31 1.389\n0.2551 1.33 1.393\n0.2616 1.35 1.387\n0.2689 1.38 1.372\n0.2761 1.41 1.331\n0.2844 1.41 1.264\n0.2924 1.39 1.161\n0.3009 1.34 0.964\n0.3107 1.13 0.616\n0.3204 0.81 0.392\n0.3315 0.17 0.829\n0.3425 0.14 1.142\n0.3542 0.10 1.419\n0.3679 0.07 1.657\n0.3815 0.05 1.864\n0.3974 0.05 2.070\n0.4133 0.05 2.275\n0.4305 0.04 2.462\n0.4509 0.04 2.657\n0.4714 0.05 2.869\n0.4959 0.05 3.093\n0.5209 0.05 3.324\n0.5486 0.06 3.586\n0.5821 0.05 3.858\n0.6168 0.06 4.152\n0.6595 0.05 4.483\n0.7045 0.04 4.838\n0.7560 0.03 5.242\n0.8211 0.04 5.727\n0.8920 0.04 6.312\n0.9840 0.04 6.992\n1.0880 0.04 7.795\n1.2160 0.09 8.828\n1.3930 0.13 10.10\n1.6100 0.15 11.85\n1.9370 0.24 14.08\n'}]}
references¶
references(id: int)
This method returns the REFERENCES of a page associated with the id.
[15]:
ri.references(20)
[15]:
2) J. I. Larruquert, J. A. Méndez, J. A. Aznárez. Far-ultraviolet reflectance measurements and optical constants of unoxidized aluminum films, Appl. Opt. 34, 4892-4899 (1995)
material¶
material(params: dict) -> Material
Create Material-class instance for given parameter dict params.
params can includes the following parameters, * ‘id’: ID number. (int) * ‘book’: book value in catalog of RiiDataFrame. (str) * ‘page’: page value in catalog of RiiDataFrame. (str) * ‘RI’: Constant refractive index. (complex) * ‘e’: Constant permittivity. (complex) * ‘bound_check’: True if bound check should be done. Defaults to True. (bool) * ‘im_factor’: A magnification factor multiplied to the imaginary part of permittivity. Defaults to 1.0. (float)
[16]:
water = ri.material({'id': 428})
water.catalog
[16]:
shelf main
shelf_name MAIN - simple inorganic materials
division O - Oxygen and oxides
book H2O
book_name H<sub>2</sub>O, D<sub>2</sub>O (Water, heavy w...
section Liquid water, H2O
page Kedenburg
path /home/mnishida/anaconda3/envs/pymwm/lib/python...
formula 2
tabulated k
num_n 0
num_k 1131
wl_n_min 0.5
wl_n_max 1.6
wl_k_min 0.5
wl_k_max 1.6
wl_min 0.5
wl_max 1.6
Name: 428, dtype: object
[ ]: