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])
AmpT=pd.DataFrame(data={"SiO2_Amp": 40.57,
"TiO2_Amp": 2.45,
"Al2O3_Amp": 12.82,
"FeOt_Amp": 13.110,
"MnO_Amp": 0.26,
"MgO_Amp": 13.02,
"CaO_Amp": 11.63,
"Na2O_Amp": 2.20,
"K2O_Amp": 0.92,
"Cr2O3_Amp": 0.01,
'F_Amp': 0,
'Cl_Amp': 0}, index=[0])
df_ideal_amp = pd.DataFrame(columns=['SiO2_Amp', 'TiO2_Amp', 'Al2O3_Amp',
'FeOt_Amp', 'MnO_Amp', 'MgO_Amp', 'CaO_Amp', 'Na2O_Amp', 'K2O_Amp',
'Cr2O3_Amp', 'F_Amp', 'Cl_Amp'])
pt.calculate_amp_only_press(amp_comps=AmpT, equationP="P_Ridolfi2021")
P_kbar_calc | Input_Check | Fail Msg | classification | equation | H2O_calc | Fe2O3_calc | FeO_calc | Total_recalc | Sum_input | SiO2_Amp_cat_prop | MgO_Amp_cat_prop | FeOt_Amp_cat_prop | CaO_Amp_cat_prop | Al2O3_Amp_cat_prop | Na2O_Amp_cat_prop | K2O_Amp_cat_prop | MnO_Amp_cat_prop | TiO2_Amp_cat_prop | Cr2O3_Amp_cat_prop | F_Amp_cat_prop | Cl_Amp_cat_prop | Si_Amp_13_cat | Mg_Amp_13_cat | Fet_Amp_13_cat | Ca_Amp_13_cat | Al_Amp_13_cat | Na_Amp_13_cat | K_Amp_13_cat | Mn_Amp_13_cat | Ti_Amp_13_cat | Cr_Amp_13_cat | F_Amp_13_cat | Cl_Amp_13_cat | cation_sum_Si_Mg | Si_T | Al_IV_T | Ti_T | Cr_C | Fe3_C | Mg_C | Fe2_C | Mn_C | Ca_B | Na_B | Na_A | K_A | Al_VI_C | Ti_C | Charge | Fe3_calc | Fe2_calc | O=F,Cl | Total | Mgno_Fe2 | Mgno_FeT | Na_calc | B_Sum | A_Sum | class | APE | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 4.589114 | True | Mg-hastingsite | (1b+1c)/2 | 1.917952 | 7.00609 | 6.80583 | 99.609873 | 96.99 | 0.675221 | 0.323045 | 0.182474 | 0.207386 | 0.251469 | 0.070992 | 0.019534 | 0.003665 | 0.030664 | 0.000132 | 0.0 | 0.0 | 5.984905 | 2.863347 | 1.617377 | 1.838191 | 2.228923 | 0.629244 | 0.173141 | 0.032487 | 0.271795 | 0.001166 | 0.0 | 0.0 | 1.466669 | 5.984905 | 2.015095 | 0 | 0.001166 | 0.777744 | 2.863347 | 0.839633 | 0.032487 | 1.838191 | 0.161809 | 0.467435 | 0.173141 | 0.213828 | 0.271795 | 45.222256 | 0.777744 | 0.839633 | -0.0 | NaN | 0.773255 | 0.639037 | 0.161809 | 2.0 | 0.640576 | N/A | 29.021213 |
pt.calculate_amp_only_press(amp_comps=AmpT,
equationP="P_Mutch2016").P_kbar_calc[0]
6.251692054556109
pt.calculate_amp_only_press(amp_comps=AmpT,
equationP="P_Anderson1995", T=1100)[0]
4.199270205779337
pt.calculate_amp_only_temp(amp_comps=AmpT,
equationT="T_Put2016_eq5")[0]
1229.1534012312634
pt.calculate_amp_only_temp(amp_comps=AmpT,
equationT="T_Put2016_eq8", P=6)[0]
1227.6548856789914
pt.calculate_amp_only_press_temp(amp_comps=AmpT,
equationP="P_Anderson1995", equationT="T_Put2016_eq8").P_kbar_calc[0]
0.10279462682872165
pt.calculate_amp_only_press_temp(amp_comps=AmpT,
equationP="P_Anderson1995", equationT="T_Put2016_eq8")
P_kbar_calc | T_K_calc | Delta_P_kbar_Iter | Delta_T_K_Iter | SiO2_Amp | TiO2_Amp | Al2O3_Amp | FeOt_Amp | MnO_Amp | MgO_Amp | CaO_Amp | Na2O_Amp | K2O_Amp | Cr2O3_Amp | F_Amp | Cl_Amp | Sample_ID_Amp | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0.102795 | 1203.682746 | 0.0 | 0.0 | 40.57 | 2.45 | 12.82 | 13.11 | 0.26 | 13.02 | 11.63 | 2.2 | 0.92 | 0.01 | 0 | 0 | 0 |
pt.calculate_amp_only_press_temp(amp_comps=AmpT,
equationP="P_Anderson1995", equationT="T_Put2016_eq8").T_K_calc[0]
1203.68274583705
pt.calculate_amp_only_press_temp(amp_comps=AmpT,
equationP="P_Ridolfi2021", equationT="T_Put2016_eq8").T_K_calc[0]
1221.9196325167923
pt.calculate_amp_only_press_temp(amp_comps=AmpT,
equationP="P_Ridolfi2021", equationT="T_Put2016_eq8").P_kbar_calc[0]
4.589113613235159
pt.calculate_amp_liq_temp(liq_comps=LiqT, amp_comps=AmpT, equationT="T_Put2016_eq4a_amp_sat")
0 1247.384143 dtype: float64
pt.calculate_amp_liq_temp(liq_comps=LiqT, amp_comps=AmpT, equationT="T_Put2016_eq4b")
0 1234.702307 dtype: float64
pt.calculate_amp_liq_temp(liq_comps=LiqT, amp_comps=AmpT, equationT="T_Put2016_eq4b", H2O_Liq=0)
0 1220.480674 dtype: float64
pt.calculate_amp_liq_press(liq_comps=LiqT, amp_comps=AmpT, equationP="P_Put2016_eq7a", H2O_Liq=0)
Note - Putirka 2016 spreadsheet calculates H2O using a H2O-solubility law of uncertian origin based on the pressure calculated for 7a, and iterates H2O and P. We dont do this, as we dont believe a pure h2o model is necessarily valid as you may be mixed fluid saturated or undersaturated. We recomend instead you choose a reasonable H2O content based on your system.
0 2.701862 dtype: float64
pt.calculate_amp_liq_press(liq_comps=LiqT, amp_comps=AmpT, equationP="P_Put2016_eq7b", H2O_Liq=0)
0 0.495501 dtype: float64
pt.calculate_amp_liq_press(liq_comps=LiqT, amp_comps=AmpT, equationP="P_Put2016_eq7b", eq_tests=True)
P_kbar_calc | Kd-Fe-Mg | Eq Putirka 2016? | |
---|---|---|---|
0 | 4.359844 | 0.854897 | N |
LiqT
SiO2_Liq | TiO2_Liq | Al2O3_Liq | FeOt_Liq | MnO_Liq | MgO_Liq | CaO_Liq | Na2O_Liq | K2O_Liq | Cr2O3_Liq | P2O5_Liq | H2O_Liq | Fe3Fet_Liq | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 51 | 0.48 | 19 | 5.3 | 0.1 | 4.5 | 9 | 4.2 | 0.1 | 0.11 | 0.11 | 5 | 0.1 |
pt.calculate_amp_liq_press_temp(liq_comps=LiqT, amp_comps=AmpT,
equationP="P_Put2016_eq7a", equationT="T_Put2016_eq4b")
Youve selected a P-independent function Note - Putirka 2016 spreadsheet calculates H2O using a H2O-solubility law of uncertian origin based on the pressure calculated for 7a, and iterates H2O and P. We dont do this, as we dont believe a pure h2o model is necessarily valid as you may be mixed fluid saturated or undersaturated. We recomend instead you choose a reasonable H2O content based on your system. Youve selected a T-independent function
P_kbar_calc | T_K_calc | Delta_P_kbar_Iter | Delta_T_K_Iter | |
---|---|---|---|---|
0 | 5.264159 | 1234.702307 | 0.0 | 0.0 |
P_func = pt.calculate_amp_only_press(amp_comps=AmpT, equationP="P_Kraw2012", T="Solve", deltaNNO=1)
Youve selected a T-independent function
g:\my drive\postdoc\pymme\mybarometers\thermobar_outer\src\Thermobar\amphibole.py:453: UserWarning: This barometer gives the PH2O for the first appearance of amphibole. It should only be applied to the highest Mg# in each sample suite. Note, if there is CO2 in the system P=/ PH2O w.warn('This barometer gives the PH2O for the first appearance of'
P_func
PH2O_kbar_calc | Mg#_Amp | |
---|---|---|
0 | 0.154678 | 63.902798 |
pt.calculate_amp_only_press_temp( amp_comps=AmpT,
equationP="P_Kraw2012", equationT="T_Put2016_eq5", deltaNNO=1)
Youve selected a P-independent function Youve selected a T-independent function
g:\my drive\postdoc\pymme\mybarometers\thermobar_outer\src\Thermobar\amphibole.py:453: UserWarning: This barometer gives the PH2O for the first appearance of amphibole. It should only be applied to the highest Mg# in each sample suite. Note, if there is CO2 in the system P=/ PH2O w.warn('This barometer gives the PH2O for the first appearance of'
P_kbar_calc | T_K_calc | Delta_P_kbar_Iter | Delta_T_K_Iter | SiO2_Amp | TiO2_Amp | Al2O3_Amp | FeOt_Amp | MnO_Amp | MgO_Amp | CaO_Amp | Na2O_Amp | K2O_Amp | Cr2O3_Amp | F_Amp | Cl_Amp | Sample_ID_Amp | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0.154678 | 1229.153401 | 0 | 0 | 40.57 | 2.45 | 12.82 | 13.11 | 0.26 | 13.02 | 11.63 | 2.2 | 0.92 | 0.01 | 0 | 0 | 0 |
pt.calculate_amp_only_press( amp_comps=AmpT,
equationP="P_Kraw2012", deltaNNO=1)
PH2O_kbar_calc | Mg#_Amp | |
---|---|---|
0 | 0.154678 | 63.902798 |