Configuration

See the current settings by printing the configuration class:

import MagmaPandas as mp

print(mp.configuration)
################## MagmaPandas ###################
##################################################
General settings__________________________________
fO2 buffer.....................................QFM
ΔfO2.............................................1
Melt Fe3+/Fe2+.............................sun2024
Kd Fe-Mg ol-melt........................toplis2005
Melt thermometer....................putirka2008_15
Volatile solubility model.......iaconomarziano2012
Volatile species.............................mixed
##################################################

Print the configuration options to see all optional settings and models currently implemented in MagmaPandas

mp.configuration.available_models()
############################ MagmaPandas #############################
######################################################################
Configuration options_________________________________________________
fO2 buffers....................................................QFM, IW
Melt Fe3+/Fe2+ models.............armstrong2019, borisov2018, deng2020
                                 fixed, hirschmann2022, jayasuriya2004
                                      kress_carmichael1991, oneill2006
                                            oneill2018, putirka2016_6b
                                    putirka2016_6c, sun2024, zhang2017

Ol-melt Fe-Mg Kd models..............blundy2020, fixed, putirka2016_8a
                                        putirka2016_8b, putirka2016_8c
                                    putirka2016_8d, saper2022, sun2020
                                                            toplis2005

Melt thermometers.......................putirka2008_13, putirka2008_14
                                        putirka2008_15, putirka2008_16
                                              putirka2008_22, shea2022
                                       sugawara2000_3, sugawara2000_6a
                                                               sun2020

Volatile solubility models.............allison2022, iaconomarziano2012
                                                          shiskina2014

Volatile species.......................................co2, h2o, mixed
######################################################################

Change settings by setting attribute values:

mp.configuration.dfO2 = 0
mp.configuration.Fe3Fe2_model = 'kress_carmichael1991'
mp.configuration.Kd_model = 'blundy2020'

print(mp.configuration)
################ MagmaPandas ################
#############################################
General settings_____________________________
fO2 buffer................................QFM
ΔfO2........................................0
Melt Fe3+/Fe2+................kressCarmichael
Kd Fe-Mg ol-melt.......................blundy
Melt thermometer...............putirka2008_15
Volatile solubility model......IaconoMarziano
Volatile species........................mixed
#############################################

MagmaPandas raises an error when invalid values are used and shows the valid options:

mp.configuration.melt_thermometer = "some thermometer"
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[4], line 1
----> 1 mp.configuration.melt_thermometer = "some thermometer"

File ~/Dropbox/research/python/packages/MagmaPandas/src/MagmaPandas/parse_io/validate.py:60, in _check_setter.<locals>.decorator.<locals>.wrapper(*args)
     58 elif isinstance(var, str):
     59     if var not in allowed_values:
---> 60         raise ValueError(
     61             f"'{var}' is not recognised, please choose from: {*allowed_values,}"
     62         )
     63 return func(*args)

ValueError: 'some thermometer' is not recognised, please choose from: ('putirka2008_13', 'putirka2008_14', 'putirka2008_15', 'putirka2008_16', 'shea2022', 'sugawara2000_3', 'sugawara2000_6a', 'sun2020')

For ol-melt Fe-mg Kd and melt Fe3+/Fe2+, fixed values can also be used instead of models . For setting these, you need to provide a list, or tuple, with the value and its associated error. Note that if you don’t intend to use the error, you can set it to 0. The input list (or tuple) should look like ['fixed', value, error] with positive integers or floats for value and error, e.g. ['fixed', 0.33, 0.02] for a fixed Kd of 0.33 with a 0.02 error. When done correctly, the printed configuration shows the inputted values.

mp.configuration.Kd_model = ["fixed", 0.33, 0.02]
mp.configuration.Fe3Fe2_model = ("fixed", 0.25, 0.05)
print(mp.configuration)
################## MagmaPandas ###################
##################################################
General settings__________________________________
fO2 buffer.....................................QFM
ΔfO2.............................................1
Melt Fe3+/Fe2+.....................fixed 0.25±0.05
Kd Fe-Mg ol-melt...................fixed 0.33±0.02
Melt thermometer....................putirka2008_15
Volatile solubility model.......iaconomarziano2012
Volatile species.............................mixed
##################################################

Reset to default values:

mp.configuration.reset()
print(mp.configuration)
################## MagmaPandas ###################
##################################################
General settings__________________________________
fO2 buffer.....................................QFM
ΔfO2.............................................1
Melt Fe3+/Fe2+.............................sun2024
Kd Fe-Mg ol-melt........................toplis2005
Melt thermometer....................putirka2008_15
Volatile solubility model.......iaconomarziano2012
Volatile species.............................mixed
##################################################