Skip to content

Commit

Permalink
added install tweak to rtd, fixed MELTS bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PennyWieser committed Oct 23, 2024
1 parent 02f0ae8 commit fbb7f3b
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
10 changes: 10 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,13 @@
'current_version': release, # Use release variable defined earlier
}


# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- method: pip
path: .
- requirements: docs/requirements.txt


5 changes: 2 additions & 3 deletions src/Thermobar/clinopyroxene_thermobarometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2208,9 +2208,8 @@ def calculate_cpx_liq_temp(*, equationT, cpx_comps=None, liq_comps=None, meltmat
if np.max(Combo_liq_cpxs['SiO2_Liq']) < 70:
w.warn("Some inputted Liq compositions have SiO2<70 wt%;",
stacklevel=2)
if np.max(Combo_liq_cpxs['Mgno_Cpx']) > 0.65 or Combo_liq_cpxs['Al2O3_Cpx'] or p.max(
Combo_liq_cpxs['SiO2_Liq']) < 70:
w.warn("which is outside the recomended calibration range of Brugman and Till (2019)")
if np.max(Combo_liq_cpxs['Mgno_Cpx']) > 0.65 or Combo_liq_cpxs['Al2O3_Cpx'].any() or np.max(Combo_liq_cpxs['SiO2_Liq']) < 70:
w.warn("Some of your compositions are outside the recomended calibration range of Brugman and Till (2019)")

# Easiest to treat Machine Learning ones differently
if ('Petrelli' in equationT or "Jorgenson" in equationT) and "onnx" not in equationT:
Expand Down
69 changes: 68 additions & 1 deletion src/Thermobar/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4012,6 +4012,73 @@ def calculate_eq_plag_components(liq_comps, H2O_Liq, T,P):


## Tool to get Fe3Fet from logfo2 or buffer value.

def calculate_logfo2_from_buffer_pos(*, buffer='QFM', T_K, P_kbar, fo2_offset):
""" Calculates fo2 value for a specified buffer position
Parameters
------------
buffer: 'QFM' or 'FMQ', 'NNO', 'C-CO-CO2' or 'CCO', IW', 'WM' or 'MW'
fo2_offset:
"""
if buffer=='QFM' or buffer=='FMQ':
logfo2=(-24930/T_K) + 9.36 + 0.046 * ((P_kbar*1000)-1)/T_K

if buffer=='NNO':
# Buffer position from frost (1991)
logfo2=(-24930/T_K) + 9.36 + 0.046 * ((P_kbar*1000)-1)/T_K

# Buffer position from frost (1991)
logfo2_QFM_highT=(-25096.3/T_K) + 8.735 + 0.11 * ((P_kbar*1000)-1)/T_K
T_Choice='HighT Beta Qtz'

logfo2_QFM_lowT=(-26455.3/T_K) +10.344 + 0.092 * ((P_kbar*1000)-1)/T_K
T_Choice='Low T alpha Qtz'

Cut_off_T=573+273.15+0.025*(P_kbar*1000)

if isinstance(logfo2_QFM_lowT, float) or isinstance(logfo2_QFM_lowT, int):
if T_K<Cut_off_T:
logfo2_QFM=logfo2_QFM_lowT
if T_K>=Cut_off_T:
logfo2_QFM=logfo2_QFM_highT

else:
logfo2_QFM=pd.Series(logfo2_QFM_highT)
T_K=pd.Series(T_K).fillna(0)
lowT = pd.Series(T_K)<Cut_off_T



if sum(lowT)>0:

logfo2_QFM.loc[lowT]=logfo2_QFM_lowT




if buffer=='C-CO-CO2' or buffer=='CCO':
# French and Eugster (1965)
logfo2=(-20586/T_K) - 0.044 + np.log10(P_kbar*1000) - 0.028 * (P_kbar*1000-1)/T_K


if buffer=='IW':
# Frost 1991
logfo2=(-27489/T_K) + 6.702 + 0.055 * ((P_kbar*1000)-1)/T_K

if buffer=='WM'or buffer=='MW':
# Front 1991
logfo2=(-32807/T_K) + 13.012 + 0.083 * ((P_kbar*1000)-1)/T_K

logfo2_off=logfo2+fo2_offset

# MW, IW,


return logfo2_off

def convert_fo2_to_fe_partition(*, liq_comps, T_K, P_kbar, model="Kress1991", fo2, renorm=False, fo2_offset=0):
'''
Calculates Fe3Fet_Liq, FeO and Fe2O3 based on user-specified buffer or fo2 value (in bars)
Expand Down Expand Up @@ -4102,7 +4169,7 @@ def convert_fo2_to_fe_partition(*, liq_comps, T_K, P_kbar, model="Kress1991", f



logfo2=logfo2_QFM
logfo2=logfo2_QFM+logfo2_offset


fo2=10**logfo2
Expand Down

0 comments on commit fbb7f3b

Please sign in to comment.