Mineral Equilibrium Functions

Thermobar.mineral_equilibrium.add_Leake_Amp_Fields_Fig3bot(plot_axes, fontsize=8, color=[0.3, 0.3, 0.3], linewidth=0.5, lower_text=0.3, upper_text=0.7, text_labels=True)[source]

Code adapted from TAS plot (see https://bitbucket.org/jsteven5/tasplot/src/90ed07ec34fa13405e7d2d5c563341b3e5eef95f/tasplot.py?at=master) Following Putirka, all Fe is assumed to be Fet

Thermobar.mineral_equilibrium.calculate_An_Namur2011(liq_comps, T=None)[source]

calculates equilibrium An contents using the T and H2O-independent model of Namur et al. (2011). Returns An calculated using all 3 models, and selects the most suitable model based on the melt composition.

Parameters:
  • liq_comps (pandas.DataFrame) – Liquid compositions with column headings SiO2_Ol, MgO_Ol etc.

  • T (pandas.Series, int, float) – Temperature in Kelvin, needed for thermodynamic model.

Returns:

  • DataFrame with An contents for all three equations, and an indication of the most

  • suitable model using the major element filters of Namur et al. (2011) based on Si-Na-K.

Thermobar.mineral_equilibrium.calculate_cpx_rhodes_diagram_lines(Min_Mgno, Max_Mgno, T=None, KdMin=None, KdMax=None)[source]

Input minimum and maximum liquid Mg#, calculates lines for equilibrium Cpx Mg# contents based on user-specified Kd Fe-Mg options.

Parameters
Min_Mgno: float or int.

Min liquid Mg# you want equilibrium lines for

Max_Mgno: float or int.

Max liquid Mg# you want equilibrium lines for

By default, returns lines calculated using 0.28+-0.08 (Putirka, 2008). Can get other outputs as well using:

T: float or int (optional)

Temperature in Kelvin. returns lines calculated using Kd from T-sensitive eq 35 of Putirka (2008) (as well as +-0.08 error bounds)

KdMin: float (optional)

calculates equilibrium line for a user-specified Minimum Kd.

KdMax: float (optional)

calculates equilibrium line for a user-specified Minimum Kd

Mg#_Liq (100 points between Min_Mgno and Max_Mgno), and a variety of equilibrium Cpx Mg#s

Thermobar.mineral_equilibrium.calculate_eq_cpx_Mg_number(liq_comps, Fe3Fet_Liq=None, Kd_model=None, T=None)[source]

calculates equilibrium Cpx Mg#s based on inputtted liquid compositions.

Parameters:

liq_comps (pandas.DataFrame) – Liquid compositions with column headings SiO2_Ol, MgO_Ol etc.

Kd_model: str, int or float

Specify which Kd model you wish to use. “Putirka2008”: uses eq 35 of Putirka (2008), function of T. “Masotta2013”: Uses Masotta (2013), function of T, an Na and K in the melt. if int or float, uses that Kd.

Return type:

DataFrame with equilibrium Mg#s, with column headings corresponding to model choosen.

Thermobar.mineral_equilibrium.calculate_eq_ol_content(liq_comps, Kd_model, ol_comps=None, T=None, P=None, Fe3Fet_Liq=None, ol_fo=None, H2O_Liq=None, logfo2=None)[source]

calculates equilibrium forsterite contents based on inputtted liquid compositions.

Parameters
liq_comps: pandas.DataFrame

Liquid compositions with column headings SiO2_Ol, MgO_Ol etc.

Kd_model: str, int or float

Specify which Kd model you wish to use.

int or float: e.g. Kd=0.35, will return that number.

“Shea2022”: Uses 0.335+-0.1 (not sensitive to P, T, or ol Fo content. For hawaiian tholeiites)

“Roeder1970”: uses Kd=0.3+0.03 (Not sensitive to P, T, or Ol Fo content)

“Matzen2011”: uses Kd=0.34+0.012 (Not sensitive to P, T, or Ol Fo content)

“Toplis2005”: calculates Kd based on melt SiO2, Na2O, K2O, P, T, H2O, Ol Fo content. Users can specify a ol_fo content, or the function iterates Kd and Fo and returns both.

“Putirka2016”: Uses equation 8a, 8b and 8c of Putirka (2016) These are recomended when the proportion of Fe2O3 is known. 8a=0.33+-0.04 (constant) 8b= function of P, Si, Na and K 8c= function of Si, Na and K

Also uses equation 9a and 9b of Putirka, which are designed for FeOt. 9a is 0.29+-0.051, 9b is a function of Si, P, Na and K, and fo2.

“All”: Returns outputs for all models

Fe3FeT: optional, float or int.

overwrites Fe3Fet_Liq in liq_comps DataFrame

Additional required inputs for Toplis, 2005:

P: Pressure in kbar T: Temperature in Kelvin H2O: melt H2O content Optional:

ol_fo: If specify Fo content (decimal, 0-1), calculates Kd Else, will iterate to find equilibrium Ol content and Kd.

pandas DataFrame

returns equilibrium olivine contents (+- sigma for Roeder and Matzen). For Toplis, returns Kd-Ol Fo pair if an olivine-forsterite content wasn’t specified

Thermobar.mineral_equilibrium.calculate_eq_olivine(Kd, *, Liq_Mgno)[source]

calculates equilibrium forsterite contents based on inputtted liquid Mg# and Kd Fe-Mg

Thermobar.mineral_equilibrium.calculate_eq_plag_An_number(liq_comps, T=None, P=None, An_model=None)[source]

calculates equilibrium Plag An#s based on inputtted liquid compositions.

Parameters:
  • liq_comps (pandas.DataFrame) – Liquid compositions with column headings SiO2_Ol, MgO_Ol etc.

  • T (pandas.Series, float, int) – T in Kelvin, optional for 3 of the 4 outputs from Namur

  • P (pandas.Series, float, int) – P in kbar. Optional for Namur

An_model: str, int or float

Specify which An model you wish to use. “Putirka2005”: uses equilibrium An-Ab-Or from the Putirka (2005), as implemented in the spreadsheets of K. Putirka “Namur2011”: Uses equilibrium An from Namur (2011) “All”: returns values from Putirka2005 and Namur

Return type:

DataFrame with equilibrium An values, with column headings corresponding to model choosen.

Thermobar.mineral_equilibrium.calculate_ol_rhodes_diagram_lines(Min_Mgno, Max_Mgno, KdMin=None, KdMax=None)[source]

Input minimum and maximum liquid Mg#, calculates lines for equilibrium Fo content using Roeder and Emslie (1970) and Matzen (2011) Kd values.

Parameters
Min_Mgno: float or int

Min liquid Mg# you want equilibrium lines for

Max_Mgno: float or int

Max liquid Mg# you want equilibrium lines for

KdMin: float

Optional. Also returns line for a user-specified Minimum Kd.

KdMax: float

Optional. Also returns line for a user-specified Maximum Kd.

Returns

Mg#_Liq (100 points between Min) Eq_OlRoeder (Kd=0.3): Line calculated for Kd=0.3 (Roeder and Emslie, 1970 preferred value) Eq_OlRoeder (Kd=0.33): Line calculated for Kd=0.33 (Roeder and Emslie, 1970 +1 sigma) Eq_OlRoeder (Kd=0.27): Line calculated for Kd=0.27 (Roeder and Emslie, 1970 -1 sigma) Eq_OlMatzen (Kd=0.34): Line calculated for Kd=0.34 (Matzen et al. 2011 preferred value) Eq_OlMatzen (Kd=0.328): Line calculated for Kd=0.328 (Matzen et al. 2011 - 1 sigma) Eq_OlMatzen (Kd=0.352): Line calculated for Kd=0.352 (Matzen et al. 2011 + 1 sigma)

If user specifies KdMin and KdMax also returns:

Eq_Ol_KdMax=KdMax, Eq_Ol_KdMin=KdMin

Thermobar.mineral_equilibrium.calculate_opx_rhodes_diagram_lines(Min_Mgno, Max_Mgno, T=None, KdMin=None, KdMax=None, liq_comps=None)[source]

Input minimum and maximum liquid Mg#, calculates lines for equilibrium Opx Mg# content using a variety of choices for Kd Fe-Mg.

Parameters
Min_Mgno: float or int.

Min liquid Mg# you want equilibrium lines for

Max_Mgno: float or int.

Max liquid Mg# you want equilibrium lines for

By default, returns Mg#s for 0.29+-0.06 (Putirka). Can get other outputs as well using:

KdMin: float. Optional.

Also returns line for a user-specified Minimum Kd.

KdMax: float. Optional.

Also returns line for a user-specified Maximum Kd.

liq_comps: pandas.DataFrame. Optional

Uses average cation fraction of XSi in the liquid to calculate Kd Fe-Mg using the expression = 0.4805 - 0.3733 XSi (Putirka, 2008)

Returns

Mg#_Liq (100 points between Min) and equilibrium Opx compositions depending on inputs. Returns headings corresponding to options selected above.

Thermobar.mineral_equilibrium.calculate_toplis2005_kd(X_fo, *, SiO2_mol, Na2O_mol, K2O_mol, P, H2O, T)[source]

calculates olivine-liq Kd Fe-Mg using the expression of Toplis, 2005.

Thermobar.mineral_equilibrium.plot_fspar_classification(figsize=(6, 6), major_grid=False, minor_grid=False, labels=False, ticks=True, major_grid_kwargs={'c': 'k', 'ls': ':', 'lw': 0.5}, minor_grid_kwargs={'c': 'lightgrey', 'ls': '-', 'lw': 0.25}, fontsize_component_labels=10, fontsize_axes_labels=14, Anorthite_label='An', Anorthoclase_label='AnC', Albite_label='Ab', Oligoclase_label='Ol', Andesine_label='Ad', Labradorite_label='La', Bytownite_label='By', Sanidine_label='San')[source]

Plotting a feldspar ternary classification diagram according to Deer, Howie, and Zussman 1992 3rd edition. This function relies heavily on the python package python-ternary by Marc Harper et al. (2015). [chebee7i; Nick Swanson-Hysell; The Gitter Badger; Maximiliano Greco; Guido Zuidhof, 2015]

Inputs: figsize: tuple for figure size same as matplotlib

major_grid: boolean, whether or not to show major grid lines shows lines every .2. Default = False

minor_grid: boolean, whether or not to show minor grid lines…shows lines every .05. Default = False

labels: boolean, whether or not to show abbreviated field labels for feldspar classification

ticks: boolean.

If True, adds ticks onto side of axes

major_grid_kwargs: dict, inherited matplotlib kwargs for styling major grid

minor_grid_kwargs: dict, inherited matplotlib kwargs for styling minor grid

…labels: str Can overwrite defauls for what the different regions are named. Defaults below. Anorthite_label=’An’, Anorthoclase_label=’AnC’, Albite_label=’Ab’, Oligoclase_label=’Ol’, Andesine_label=’Ad’, Labradorite_label=’La’, Bytownite_label=’By’, Sanidine_label=’San’,

Returns:

fig: matplotlib figure

tax: ternary axis subplot from ternary package. To use matplotlib ax level styling and functions:

# Example ax = tax.get_axes() ax.set_title(‘my title’)

Thermobar.mineral_equilibrium.plot_px_classification(figsize=(7, 5), cut_in_half=True, major_grid=False, minor_grid=False, labels=False, major_grid_kwargs={'c': 'k', 'ls': ':', 'lw': 0.5}, minor_grid_kwargs={'c': 'lightgrey', 'ls': '-', 'lw': 0.25}, fontsize_component_labels=10, fontsize_axes_labels=14, Enstatite_label='Enstatite', Ferrosilite_label='Ferrosilite', Pigeonite_label='Pigeonite', Augite_label='Augite', Diopside_label='Diopside', Hedenbergite_label='Hedenbergite')[source]

Plotting a pyroxene ternary classification diagram according to Deer, Howie, and Zussman 1992 3rd edition. This function relies heavily on the python package python-ternary by Marc Harper et al. (2015). [chebee7i; Nick Swanson-Hysell; The Gitter Badger; Maximiliano Greco; Guido Zuidhof, 2015]

Inputs: figsize: tuple

for figure size same as matplotlib. Default is 7-5, assuming you’ll cut the top off.

cut_in_half: boolean

If True, cuts the top off to give the pyroxene quadrilateral.

major_grid: boolean

whether or not to show major grid lines shows lines every .2. Default = False

minor_grid: boolean,

whether or not to show minor grid lines…shows lines every .05. Default = False

labels: boolean,

whether or not to show abbreviated field labels for pyroxene classification

major_grid_kwargs: dict,

inherited matplotlib kwargs for styling major grid

minor_grid_kwargs: dict,

inherited matplotlib kwargs for styling minor grid

…labels: str Can overwrite defauls for what the different regions are named. Defaults below. Enstatite_label=’Enstatite’ Ferrosilite_label=’Ferrosilite’ Pigeonite_label=’Pigeonite’ Augite_label=’Augite’ Diopside_label=’Diopside’ Hedenbergite_label=’Hedenbergite’

Returns:

fig: matplotlib figure

tax: ternary axis subplot from ternary package. To use matplotlib ax level styling and functions:

# Example ax = tax.get_axes() ax.set_title(‘my title’)

Thermobar.mineral_equilibrium.tern_points(right, top, left)[source]

Tern_points takes 3 equal size 1D arrays or pandas series and organizes them into points to be plotted on a ternary with the following arrangement:(lower right,top,lower left). This is a generic function to allow flexibiliy, see also tern_points_px to calculate the components for pyroxene, and tern_points_fspar to calculate components and coordinates for feldspar

Inputs: x = 1D array like (lower right vertex) y = 1D array like (top vertex) z = 1D array like (lower left vertex)

Thermobar.mineral_equilibrium.tern_points_fspar(fspar_comps=None)[source]

Tern_points takes feldspar compositions, and calculates An, Ab, Or, and returns co-ordinates to plot on a ternary diagram as a np.array You can input plag or kspar compositions as fspar_comps

Thermobar.mineral_equilibrium.tern_points_px(px_comps=None)[source]

Tern_points takes pyroxene compositions, and calculates Fs, En and Wo, and returns co-ordinates to plot on a ternary diagram as a np.array