import numpy as np
import pandas as pd
import sys
sys.path.append("..")
import matplotlib.pyplot as plt
import Thermobar as pt
import sympy as sym
pd.options.display.max_columns = None
LiqT=pd.DataFrame(data={"SiO2_Liq": 51,
"TiO2_Liq": 0.48,
"Al2O3_Liq": 19,
"FeOt_Liq": 5.3,
"MnO_Liq": 0.1,
"MgO_Liq": 4.5,
"CaO_Liq": 9,
"Na2O_Liq": 4.2,
"K2O_Liq": 0.1,
"Cr2O3_Liq": 0.11,
"P2O5_Liq": 0.11,
"H2O_Liq": 5,
"Fe3Fet_Liq":0.1,
}, index=[0])
OpxT=pd.DataFrame(data={"SiO2_Opx": 55,
"TiO2_Opx": 0.34,
"Al2O3_Opx": 1.5,
"FeOt_Opx": 11.3,
"MnO_Opx": 0.24,
"MgO_Opx": 30.7,
"CaO_Opx": 0.9,
"Na2O_Opx": 0.01,
"K2O_Opx": 0,
"Cr2O3_Opx": 0.19}, index=[0])
pt.calculate_opx_only_press(opx_comps=OpxT, equationP="P_Put2008_eq29c",
T=1300)
0 0.631893 dtype: float64
pt.calculate_opx_liq_temp(opx_comps=OpxT, liq_comps=LiqT,
equationT="T_Put2008_eq28b_opx_sat", P=5)
0 1344.331255 dtype: float64
pt.calculate_opx_liq_press(opx_comps=OpxT, liq_comps=LiqT, equationP="P_Put2008_eq29b", T=800)
0 -21.129189 dtype: float64
pt.calculate_opx_liq_press(opx_comps=OpxT, liq_comps=LiqT, equationP="P_Put2008_eq29b", T=800, H2O_Liq=0)
0 -25.049189 dtype: float64
pt.calculate_opx_liq_press(opx_comps=OpxT, liq_comps=LiqT, equationP="P_Put_Global_Opx", T=1300)
Youve selected a T-independent function Youve selected a T-independent function
0 1.810153 dtype: float64
pt.calculate_opx_liq_press(opx_comps=OpxT, liq_comps=LiqT, equationP="P_Put_Global_Opx", T=1300, eq_tests=True)
Youve selected a T-independent function Youve selected a T-independent function
SiO2_Liq | P_kbar_calc | eq_tests_Kd_Fe_Mg_Fet | eq_tests_Kd_Fe_Mg_Fe2 | Kd Eq (Put2008+-0.06) | TiO2_Liq | Al2O3_Liq | FeOt_Liq | MnO_Liq | MgO_Liq | CaO_Liq | Na2O_Liq | K2O_Liq | Cr2O3_Liq | P2O5_Liq | H2O_Liq | Fe3Fet_Liq | SiO2_Liq_mol_frac | MgO_Liq_mol_frac | MnO_Liq_mol_frac | FeOt_Liq_mol_frac | CaO_Liq_mol_frac | Al2O3_Liq_mol_frac | Na2O_Liq_mol_frac | K2O_Liq_mol_frac | TiO2_Liq_mol_frac | P2O5_Liq_mol_frac | Cr2O3_Liq_mol_frac | Si_Liq_cat_frac | Mg_Liq_cat_frac | Mn_Liq_cat_frac | Fet_Liq_cat_frac | Ca_Liq_cat_frac | Al_Liq_cat_frac | Na_Liq_cat_frac | K_Liq_cat_frac | Ti_Liq_cat_frac | P_Liq_cat_frac | Cr_Liq_cat_frac | Mg_Number_Liq_NoFe3 | Mg_Number_Liq_Fe3 | SiO2_Opx | TiO2_Opx | Al2O3_Opx | FeOt_Opx | MnO_Opx | MgO_Opx | CaO_Opx | Na2O_Opx | K2O_Opx | Cr2O3_Opx | Si_Opx_cat_6ox | Mg_Opx_cat_6ox | Fet_Opx_cat_6ox | Ca_Opx_cat_6ox | Al_Opx_cat_6ox | Na_Opx_cat_6ox | K_Opx_cat_6ox | Mn_Opx_cat_6ox | Ti_Opx_cat_6ox | Cr_Opx_cat_6ox | oxy_renorm_factor_opx | Al_IV_Opx_cat_6ox | Al_VI_Opx_cat_6ox | Si_Ti_Opx_cat_6ox | En_Simple_MgFeCa_Opx | Fs_Simple_MgFeCa_Opx | Wo_Simple_MgFeCa_Opx | Cation_Sum_Opx | Ca_CaMgFe | NaAlSi2O6 | FmTiAlSiO6 | CrAl2SiO6 | FmAl2SiO6 | CaFmSi2O6 | Fm2Si2O6 | En_Opx | Di_Opx | Mgno_OPX | ln_Fm2Si2O6_liq | ln_FmAl2SiO6_liq | Kd_Fe_Mg_Fet | Kd_Fe_Mg_Fe2 | Ideal_Kd | Delta_Kd_Fe_Mg_Fe2 | Mgno_Liq_noFe3 | Mgno_Liq_Fe2 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51 | 1.810153 | 0.312519 | 0.347244 | Y | 0.48 | 19 | 5.3 | 0.1 | 4.5 | 9 | 4.2 | 0.1 | 0.11 | 0.11 | 5 | 0.1 | 0.58185 | 0.076535 | 0.000966 | 0.050568 | 0.110016 | 0.127738 | 0.046452 | 0.000728 | 0.004119 | 0.000531 | 0.000496 | 0.494793 | 0.065084 | 0.000822 | 0.043002 | 0.093555 | 0.217252 | 0.079004 | 0.001238 | 0.003503 | 0.000904 | 0.000844 | 0.602144 | 0.627093 | 55 | 0.34 | 1.5 | 11.3 | 0.24 | 30.7 | 0.9 | 0.01 | 0 | 0.19 | 1.943665 | 1.617356 | 0.333959 | 0.034078 | 0.062475 | 0.000685 | 0.0 | 0.007184 | 0.009038 | 0.005308 | 0.0 | 0.056335 | 0.00614 | 1.952703 | 0.814628 | 0.168208 | 0.017164 | 4.013748 | 0.017164 | 0.000685 | 0.009038 | 0.005308 | 0.000146 | 0.034078 | 0.957618 | 0.790815 | 0.028142 | 0.82885 | 5.798439 | -2.855529 | 0.312519 | 0.347244 | 0.295794 | 0.05145 | 0.602144 | 0.627093 |
pt.calculate_opx_liq_press(opx_comps=OpxT, liq_comps=LiqT,
equationP="P_Put_Global_Opx", T=1300, eq_tests=True, Fe3Fet_Liq=0.6)
Youve selected a T-independent function Youve selected a T-independent function
SiO2_Liq | P_kbar_calc | eq_tests_Kd_Fe_Mg_Fet | eq_tests_Kd_Fe_Mg_Fe2 | Kd Eq (Put2008+-0.06) | TiO2_Liq | Al2O3_Liq | FeOt_Liq | MnO_Liq | MgO_Liq | CaO_Liq | Na2O_Liq | K2O_Liq | Cr2O3_Liq | P2O5_Liq | H2O_Liq | Fe3Fet_Liq | SiO2_Liq_mol_frac | MgO_Liq_mol_frac | MnO_Liq_mol_frac | FeOt_Liq_mol_frac | CaO_Liq_mol_frac | Al2O3_Liq_mol_frac | Na2O_Liq_mol_frac | K2O_Liq_mol_frac | TiO2_Liq_mol_frac | P2O5_Liq_mol_frac | Cr2O3_Liq_mol_frac | Si_Liq_cat_frac | Mg_Liq_cat_frac | Mn_Liq_cat_frac | Fet_Liq_cat_frac | Ca_Liq_cat_frac | Al_Liq_cat_frac | Na_Liq_cat_frac | K_Liq_cat_frac | Ti_Liq_cat_frac | P_Liq_cat_frac | Cr_Liq_cat_frac | Mg_Number_Liq_NoFe3 | Mg_Number_Liq_Fe3 | SiO2_Opx | TiO2_Opx | Al2O3_Opx | FeOt_Opx | MnO_Opx | MgO_Opx | CaO_Opx | Na2O_Opx | K2O_Opx | Cr2O3_Opx | Si_Opx_cat_6ox | Mg_Opx_cat_6ox | Fet_Opx_cat_6ox | Ca_Opx_cat_6ox | Al_Opx_cat_6ox | Na_Opx_cat_6ox | K_Opx_cat_6ox | Mn_Opx_cat_6ox | Ti_Opx_cat_6ox | Cr_Opx_cat_6ox | oxy_renorm_factor_opx | Al_IV_Opx_cat_6ox | Al_VI_Opx_cat_6ox | Si_Ti_Opx_cat_6ox | En_Simple_MgFeCa_Opx | Fs_Simple_MgFeCa_Opx | Wo_Simple_MgFeCa_Opx | Cation_Sum_Opx | Ca_CaMgFe | NaAlSi2O6 | FmTiAlSiO6 | CrAl2SiO6 | FmAl2SiO6 | CaFmSi2O6 | Fm2Si2O6 | En_Opx | Di_Opx | Mgno_OPX | ln_Fm2Si2O6_liq | ln_FmAl2SiO6_liq | Kd_Fe_Mg_Fet | Kd_Fe_Mg_Fe2 | Ideal_Kd | Delta_Kd_Fe_Mg_Fe2 | Mgno_Liq_noFe3 | Mgno_Liq_Fe2 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51 | 1.810153 | 0.312519 | 0.781298 | N | 0.48 | 19 | 5.3 | 0.1 | 4.5 | 9 | 4.2 | 0.1 | 0.11 | 0.11 | 5 | 0.6 | 0.58185 | 0.076535 | 0.000966 | 0.050568 | 0.110016 | 0.127738 | 0.046452 | 0.000728 | 0.004119 | 0.000531 | 0.000496 | 0.494793 | 0.065084 | 0.000822 | 0.043002 | 0.093555 | 0.217252 | 0.079004 | 0.001238 | 0.003503 | 0.000904 | 0.000844 | 0.602144 | 0.790956 | 55 | 0.34 | 1.5 | 11.3 | 0.24 | 30.7 | 0.9 | 0.01 | 0 | 0.19 | 1.943665 | 1.617356 | 0.333959 | 0.034078 | 0.062475 | 0.000685 | 0.0 | 0.007184 | 0.009038 | 0.005308 | 0.0 | 0.056335 | 0.00614 | 1.952703 | 0.814628 | 0.168208 | 0.017164 | 4.013748 | 0.017164 | 0.000685 | 0.009038 | 0.005308 | 0.000146 | 0.034078 | 0.957618 | 0.790815 | 0.028142 | 0.82885 | 5.798439 | -2.855529 | 0.312519 | 0.781298 | 0.295794 | 0.485504 | 0.602144 | 0.790956 |
pt.calculate_opx_liq_press_temp(opx_comps=OpxT,
liq_comps=LiqT, equationP="P_Put_Global_Opx", equationT="T_Put2008_eq28a")
Youve selected a T-independent function Youve selected a T-independent function
P_kbar_calc | T_K_calc | |
---|---|---|
0 | 1.810153 | 1305.385773 |
pt.calculate_opx_liq_press_temp(opx_comps=OpxT,
liq_comps=LiqT, equationP="P_Put2008_eq29a", equationT="T_Put2008_eq28a")
P_kbar_calc | T_K_calc | |
---|---|---|
0 | 2.568279 | 1308.050269 |
pt.calculate_opx_liq_press_temp(opx_comps=OpxT,
liq_comps=LiqT, equationP="P_Put2008_eq29a", equationT="T_Put2008_eq28a", H2O_Liq=0)
P_kbar_calc | T_K_calc | |
---|---|---|
0 | -0.593182 | 1364.045732 |
Liq2=pd.DataFrame(data={"Sample_ID_Liq": 'test',
"SiO2_Liq": 51.1,
"TiO2_Liq": 0.93,
"Al2O3_Liq": 17.5,
"FeOt_Liq": 8.91,
"MnO_Liq": 0.18,
"MgO_Liq": 6.09,
"CaO_Liq": 11.50,
"Na2O_Liq": 3.53,
"K2O_Liq": 0.17,
"Cr2O3_Liq": 0,
"P2O5_Liq": 0.15,
"H2O_Liq": 3.8,
"Fe3Fet_Liq":0}, index=[0])
Opx2=pd.DataFrame(data={"Sample_ID_Opx": 'test',
"SiO2_Opx": 55.00,
"TiO2_Opx": 0.34,
"Al2O3_Opx": 1.50,
"FeOt_Opx": 11.30,
"MnO_Opx": 0.24,
"MgO_Opx": 30.70,
"CaO_Opx": 0.90,
"Na2O_Opx": 0.01,
"K2O_Opx": 0,
"Cr2O3_Opx": 0.19}, index=[0])
a=pt.calculate_opx_liq_press_temp_matching(liq_comps=Liq2, opx_comps=Opx2,
equationP="P_Put2008_eq29a",
equationT="T_Put2008_eq28a", return_all_pairs=False)
test=a.get("All_PTs")
Considering 1 Liq-Opx pairs, be patient if this is >>1 million! got here 1 got here 2 P_kbar_calc T_K_calc 0 3.327589 1384.287957 Finished calculating Ps and Ts, now just averaging the results. Almost there! Finished!
pt.calculate_opx_rhodes_diagram_lines(Min_Mgno=0.4, Max_Mgno=0.7, liq_comps=Liq2)
Mg#_Liq | Eq_Opx_Mg# (Kd=0.23) | Eq_Opx_Mg# (Kd=0.29) | Eq_Opx_Mg# (Kd=0.35) | Kd_XSi_P2008 | Eq_Opx_Mg# (Kd_XSi_P2008) | Eq_Opx_Mg# (Kd_XSi_P2008)+0.06 | Eq_Opx_Mg# (Kd_XSi_P2008)-0.06 | |
---|---|---|---|---|---|---|---|---|
0 | 0.400000 | 0.743494 | 0.696864 | 0.655738 | 0.304877 | 0.686193 | 0.646281 | 0.731360 |
1 | 0.403030 | 0.745892 | 0.699521 | 0.658579 | 0.304877 | 0.688902 | 0.649158 | 0.733831 |
2 | 0.406061 | 0.748269 | 0.702159 | 0.661402 | 0.304877 | 0.691592 | 0.652018 | 0.736280 |
3 | 0.409091 | 0.750626 | 0.704777 | 0.664207 | 0.304877 | 0.694262 | 0.654860 | 0.738710 |
4 | 0.412121 | 0.752962 | 0.707375 | 0.666994 | 0.304877 | 0.696914 | 0.657684 | 0.741120 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
95 | 0.687879 | 0.905501 | 0.883715 | 0.862954 | 0.304877 | 0.878475 | 0.857956 | 0.900000 |
96 | 0.690909 | 0.906705 | 0.885162 | 0.864619 | 0.304877 | 0.879978 | 0.859672 | 0.901266 |
97 | 0.693939 | 0.907902 | 0.886600 | 0.866276 | 0.304877 | 0.881472 | 0.861380 | 0.902525 |
98 | 0.696970 | 0.909091 | 0.888031 | 0.867925 | 0.304877 | 0.882959 | 0.863079 | 0.903777 |
99 | 0.700000 | 0.910273 | 0.889454 | 0.869565 | 0.304877 | 0.884438 | 0.864771 | 0.905021 |
100 rows × 8 columns