This page was generated from docs/examples/ftir_functions/PyIRoGlass_Functions.ipynb. Interactive online version: Binder badge.

Python Notebook Download

Useful FTIR Functions for Density and Molar Absorptivity

  • This Jupyter notebook demonstrates the use of useful Python functions for calculating density and molar absorptivity.

  • The Jupyter notebook and data can be accessed here: https://github.com/SarahShi/PyIRoGlass/blob/main/docs/examples/ftir_functions/.

  • You need to have the PyIRoGlass PyPi package on your machine once. If you have not done this, please uncomment (remove the #) symbol and run the cell below.

[1]:
#!pip install PyIRoGlass

Load Python Packages and Data

Load Python Packages

[2]:
# Import packages

import os
import sys
import glob
import numpy as np
import pandas as pd

import PyIRoGlass as pig

from IPython.display import Image

import matplotlib
from matplotlib import pyplot as plt
from matplotlib import rc, cm

%matplotlib inline
%config InlineBackend.figure_format = 'retina'

pig.__version__
[2]:
'0.6.1'

Set paths to data

[3]:
# Change paths to direct to folder with transmission FTIR spectra

CHEMTHICK_PATH = 'ChemThick.csv'
print(CHEMTHICK_PATH)
ChemThick.csv

Load composition and thickness data

The file names from the spectra (what comes before the .CSV) are important when we load in melt compositions and thicknesses. Unique identifiers identify the same samples. Make sure that this ChemThick.CSV file has the same sample names as the spectra you load in.

[4]:
loader = pig.SampleDataLoader(chemistry_thickness_path=CHEMTHICK_PATH)
chemistry, thickness = loader.load_chemistry_thickness()

Display the dataframe of glass compositions

[5]:
chemistry
[5]:
SiO2 TiO2 Al2O3 Fe2O3 FeO MnO MgO CaO Na2O K2O P2O5
Sample
AC4_OL49_021920_30x30_H2O_a 52.34 1.04 17.92 1.93 7.03 0.20 3.63 7.72 4.25 0.78 0.14
AC4_OL53_101220_256s_30x30_a 47.95 1.00 18.88 2.04 7.45 0.19 4.34 9.84 3.47 0.67 0.11
STD_D1010_012821_256s_100x100_a 51.41 1.26 16.58 0.00 7.58 0.00 7.57 10.98 3.01 0.37 0.18

We’re ready to use the Density_Calculation function now. We input the arguments:

  • chemistry: Glass composition loaded from ChemThick

  • T_ROOM: Room temperature at time of FTIR analysis, given the sensitivity of density to T.

  • P_ROOM: Room pressure at time of FTIR analysis, given the sensitivity of density to P.

and output:

  • mol - dataframe of moles of oxide

  • density - dataframe of densities

[6]:
T_ROOM = 25 # C
P_ROOM = 1 # Bar
mol, density = pig.calculate_density(chemistry, T_ROOM, P_ROOM)
[7]:
mol
[7]:
SiO2 TiO2 Al2O3 Fe2O3 FeO MnO MgO CaO Na2O K2O P2O5
Sample
AC4_OL49_021920_30x30_H2O_a 0.871172 0.013022 0.175755 0.012086 0.097851 0.002819 0.090065 0.137667 0.068572 0.008280 0.000986
AC4_OL53_101220_256s_30x30_a 0.798103 0.012521 0.185171 0.012775 0.103697 0.002678 0.107681 0.175472 0.055987 0.007113 0.000775
STD_D1010_012821_256s_100x100_a 0.855692 0.015776 0.162613 0.000000 0.105506 0.000000 0.187821 0.195801 0.048565 0.003928 0.001268
[8]:
density
[8]:
Sample
AC4_OL49_021920_30x30_H2O_a        2748.987195
AC4_OL53_101220_256s_30x30_a       2820.556711
STD_D1010_012821_256s_100x100_a    2831.885143
dtype: float64

We’re ready to use the Epsilon_Calculation function now. We input the arguments:

  • chemistry: Glass composition loaded from ChemThick.

  • T_ROOM: Room temperature at time of FTIR analysis, given the sensitivity of density to T.

  • P_ROOM: Room pressure at time of FTIR analysis, given the sensitivity of density to P.

and output:

  • epsilon - dataframe of molar absorptivities with their uncertainties.

[9]:
T_ROOM = 25 # C
P_ROOM = 1 # Bar
epsilon = pig.calculate_epsilon(chemistry, T_ROOM, P_ROOM)
epsilon
[9]:
Tau Eta epsilon_H2Ot_3550 sigma_epsilon_H2Ot_3550 epsilon_H2Om_1635 sigma_epsilon_H2Om_1635 epsilon_CO2 sigma_epsilon_CO2 epsilon_H2Om_5200 sigma_epsilon_H2Om_5200 epsilon_OH_4500 sigma_epsilon_OH_4500
AC4_OL49_021920_30x30_H2O_a 0.705990 0.499048 66.142594 7.503769 37.322108 8.645060 258.429949 18.362798 1.009458 0.300803 0.861196 0.279571
AC4_OL53_101220_256s_30x30_a 0.682895 0.389547 64.493655 7.380834 34.452486 8.504269 293.261300 16.287120 0.901474 0.295829 0.779611 0.274924
STD_D1010_012821_256s_100x100_a 0.658501 0.331580 62.751984 7.251813 31.421482 8.354348 311.700491 15.127604 0.787418 0.290510 0.693438 0.270004

There are a few things to note. Tau references the \(\mathrm{(Si^{4+}+Al^{3+})/Total Cations}\) value and eta references the \(\mathrm{(Na^{+}/(Na^{+}+Ca^{2+}))}\) value. Each column with the prefix epsilon represents the mean molar absorptivity, sigma_epsilon represents the uncertainty on the molar absorptivity.