Data Structures#

peridoxia.data_structures.normalize(array: ndarray, norm_array: ndarray | None = None, norm_val: float = 100) ndarray#

Normalizes an array to a specific value. If norm_array is given, normalizes based on the sum of that array.

Parameters:
arraynp.ndarray

The array to normalize.

norm_arraynp.ndarray | None, optional

The array whose sum should equal the normalizing value (usually the array itself), by default None.

norm_valfloat, optional

The value to normalize to, by default 100.

Returns:
np.ndarray

A normalized array.

peridoxia.data_structures.get_oxide_moles(oxides: ndarray, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns moles of oxides.

Parameters:
oxidesnp.ndarray

The array of oxides to translate to moles.

oxide_setnp.ndarray, optional

The oxide order, by default setup_comp.oxide_info

Returns:
np.ndarray

Moles of oxides

peridoxia.data_structures.get_element_moles(oxides: ndarray, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns moles of elements (cations).

Parameters:
oxidesnp.ndarray

The array of oxides to translate to moles of elements

oxide_setnp.ndarray, optional

The oxide order, by default setup_comp.oxide_info

Returns:
np.ndarray

Moles of elements (cations)

class peridoxia.data_structures.PhaseDictionaries(oxides: dict = <factory>, modes: dict[str, float] = <factory>)#

Dataclass for oxide and mode dictionaries. Use this for input compositions, then convert to assemblages (extensive endmembers).

Attributes:
oxidesdict[str,dict]

A dictionary of dictionaries for oxide wt% in each phase, e.g. {‘olv’:{‘SiO2’:40.0, ‘Al2O3’:0.0, … }, …}.

modesdict[str,float]

Modes for each phase, e.g. {‘olv’: 60.0, ‘opx’: 28.0, …}

Methods

adjust_bulk_Fe2O3([Fe2O3_value, ferric_phases])

Adjusts bulk Fe₂O₃ in place by redistributing FeO and Fe₂O₃.

create_assemblage([TC, PGPa])

Creates an Assemblage object, for use with model.

create_extensive_endmember_array()

Creates an extensive endmember array for all phases, with oxides and modes converted to stoichiometric phases.

display_output()

Displays modes and oxides for the PhaseDictionary object.

get_element_mole_array_from_oxides(phase[, ...])

Returns an array with the composition of the indicated phase, in moles of elements (cations).

get_elements_normalized_to_oxygen(phase, O_num)

Returns an array with the composition (in elements/cations) normalized to a certain number of moles of Oxygen.

get_garnet_endmember_fractions([phase])

Returns an array of garnet endmember fractions, normalized to one mole of (Ca²⁺,Mg²⁺,Fe²⁺)3(Al³⁺,Cr³⁺,Fe³⁺)₂Si₃O1₂.

get_liquid_endmember_fractions([phase])

Returns an array of liquid endmember fractions, normalized to 1 mole of oxides.

get_normalized_modes()

Returns modes normalized to 100;

get_normalized_oxides()

Returns normalized oxides for all phases.

get_olivine_endmember_fractions([phase])

Returns an array of olivine endmember fractions, normalized to one mole of (Mg²⁺,Fe²⁺)₂SiO₄.

get_oxide_comp_array(phase[, oxide_set])

Returns an array with the oxide composition of the indicated phase, in wt%.

get_oxide_mole_array_from_oxides(phase[, ...])

Returns an array with the oxide composition of the indicated phase, in moles of oxides.

get_phase_dictionaries_from_phase_masses_and_oxides(...)

Returns a PhaseDictionaries object from a 2D-array of phases (rows) and mass/oxides (columns).

get_pyroxene_endmember_fractions([phase])

Returns an array of pyroxene endmember fractions, normalized to one mole of (Ca²⁺,Mg²⁺,Fe²⁺)₂₋ₓ(Al³⁺,Cr³⁺,Fe³⁺)₂ₓSi₂₋ₓO₆.

get_spinel_endmember_fractions([phase])

Returns an array of spinel endmember fractions, normalized to one mole of (Mg²⁺,Fe²⁺)(Al³⁺,Cr³⁺,Fe³⁺)₂O₄.

classmethod get_phase_dictionaries_from_phase_masses_and_oxides(phase_masses_and_oxides: ndarray)#

Returns a PhaseDictionaries object from a 2D-array of phases (rows) and mass/oxides (columns).

Parameters:
phase_masses_and_oxidesnp.ndarray

Phase order (rows) is [‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’]. Mass/oxide order (columns) for each phase is [‘mass’, ‘SiO2’, ‘Al2O3’, ‘Fe2O3’, ‘Cr2O3’, ‘FeO’, ‘MgO’, ‘CaO’].

Returns:
PhaseDictionary

A PhaseDictionary object with the indicated phase masses and compositions.

get_oxide_comp_array(phase: str, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns an array with the oxide composition of the indicated phase, in wt%.

Parameters:
phasestr

The phase abbreviation string for the phase of interest (e.g., ‘olv’)

oxide_setnp.ndarray, optional

The oxide set and order in which to report the data, by default setup_comp.oxide_info

Returns:
np.ndarray

An ordered array of oxide wt%, normalized to 100 wt%.

get_oxide_mole_array_from_oxides(phase: str, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns an array with the oxide composition of the indicated phase, in moles of oxides.

Parameters:
phasestr

The phase abbreviation string for the phase of interest (e.g., ‘olv’)

oxide_setnp.ndarray, optional

The oxide set and order in which to report the data, by default setup_comp.oxide_info

Returns:
np.ndarray

An ordered array of oxide moles, normalized to 100 wt%.

get_element_mole_array_from_oxides(phase: str, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns an array with the composition of the indicated phase, in moles of elements (cations).

Parameters:
phasestr

The phase abbreviation string for the phase of interest (e.g., ‘olv’)

oxide_setnp.ndarray, optional

The oxide (cation) set and order in which to report the data, by default setup_comp.oxide_info

Returns:
np.ndarray

An ordered array of element (cation) moles, normalized to 100 wt%.

get_elements_normalized_to_oxygen(phase: str, O_num: float, oxide_set=array([('SiO2', 60.08, b'Si', 1, 2, 4), ('Al2O3', 101.96, b'Al', 2, 3, 3), ('Fe2O3', 159.69, b'Fe', 2, 3, 3), ('Cr2O3', 151.99, b'Cr', 2, 3, 3), ('FeO', 71.844, b'Fe', 1, 1, 2), ('MgO', 40.3044, b'Mg', 1, 1, 2), ('CaO', 56.0774, b'Ca', 1, 1, 2)], dtype=[('oxide_names', '<U6'), ('mol_wts', '<f8'), ('elem_names', 'S2'), ('elems_per_oxide', '<i4'), ('oxygen_per_oxide', '<i4'), ('elem_charges', '<i4')])) ndarray#

Returns an array with the composition (in elements/cations) normalized to a certain number of moles of Oxygen.

Parameters:
phasestr

The phase abbreviation string for the phase of interest (e.g., ‘olv’)

O_numfloat

The number of moles of O (not O2) to normalize to

oxide_setnp.ndarray, optional

The oxide (cation) set and order in which to report the data, by default setup_comp.oxide_info

Returns:
np.ndarray

An ordered array of element (cation) moles, normalized to the given number of moles of Oxygen.

get_normalized_modes() dict[str, float]#

Returns modes normalized to 100;

Returns:
dict[str,float]

A dictionary of normalized modes.

get_normalized_oxides() dict[str, dict]#

Returns normalized oxides for all phases.

Returns:
dict[str,dict]

A dictionary of oxide dictionaries for each phase.

adjust_bulk_Fe2O3(Fe2O3_value: float = 0.3, ferric_phases: dict[str, float] = {'cpx': 1, 'opx': 1, 'spl': 2})#

Adjusts bulk Fe₂O₃ in place by redistributing FeO and Fe₂O₃. Keeps mineral modes the same, and gives ferric-bearing phases an approximate Fe³⁺/ΣFe ratio. Does not worry about stoichiometry. These approximate values will be readjusted if/when an assemblage object is created and equilibrated.

Parameters:
Fe2O3_valuefloat, optional

The desired bulk Fe₂O₃ value, by default 0.3.

ferric_phasesdict[str,float], optional

The ratio of Fe³⁺/ΣFe desired across ferric-bearing phases, by default {‘opx’:1, ‘cpx’:1, ‘spl’:2}. These approximate values will be readjusted if/when an assemblage object is created and equilibrated.

create_extensive_endmember_array() ndarray#

Creates an extensive endmember array for all phases, with oxides and modes converted to stoichiometric phases.

Extensive endmembers are reported in total moles (total moles of phase * endmember mole fractions).

Returns:
np.ndarray

A 1D array of total moles of endmembers: olv (2), opx (6), cpx (6), spl (4), gt (5), liq (7), agg_liq (7) = 37 endmembers

create_assemblage(TC: float = 0, PGPa: float = 0)#

Creates an Assemblage object, for use with model. Converts phase oxide/mole dictionaries into extensive array of endmembers by running functions for creating stoichiometric phases.

Parameters:
TCfloat, optional

Temperature, in Celsius, by default 0

PGPafloat, optional

Pressure, in Gigapascals, by default 0

Returns:
Assemblage

An Assemblage object consisting of stoichiometric phases.

display_output()#

Displays modes and oxides for the PhaseDictionary object.

get_olivine_endmember_fractions(phase='olv') ndarray#

Returns an array of olivine endmember fractions, normalized to one mole of (Mg²⁺,Fe²⁺)₂SiO₄. Endmember order is [Mg₂SiO₄, Fe₂SiO₄]. Algorithm maintains Mg²⁺:Fe²⁺ ratio and excludes any additional components.

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest (e.g., ‘olv’), by default ‘olv’.

Returns:
np.ndarray

An array of olivine endmember fractions: [X_Mg₂SiO₄, X_Fe₂SiO₄].

get_pyroxene_endmember_fractions(phase='opx')#

Returns an array of pyroxene endmember fractions, normalized to one mole of (Ca²⁺,Mg²⁺,Fe²⁺)₂₋ₓ(Al³⁺,Cr³⁺,Fe³⁺)₂ₓSi₂₋ₓO₆. Endmember order is [Mg₂Si₂O₆, Fe₂Si₂O₆, CaMgSi₂O₆, CaAlAlSiO₆, CaCrAlSiO₆, CaFe³⁺AlSiO₆].

Algorithm works as follows:

  • Maintains Ca²⁺:Mg²⁺:Fe²⁺ ratio

  • Maintains Cr³⁺:Al³⁺:Fe³⁺ ratio

  • Maintains (Cr³⁺+Al³⁺+Fe³⁺):Si ratio; i.e., fraction of Tschermak component

  • Fe³⁺:Fe²⁺ ratio may change slightly if phase is not initially stoichiometric

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘opx’.

Returns:
np.ndarray

An array of orthopyroxene endmember fractions: [X_Mg₂Si₂O₆, X_Fe₂Si₂O₆, X_CaMgSi₂O₆, X_CaAlAlSiO₆, X_CaCrAlSiO₆, X_CaFe³⁺AlSiO₆].

get_spinel_endmember_fractions(phase='spl')#

Returns an array of spinel endmember fractions, normalized to one mole of (Mg²⁺,Fe²⁺)(Al³⁺,Cr³⁺,Fe³⁺)₂O₄. Endmember order is [MgAl₂O₄, FeAl₂O₄, FeCr₂O₄, FeFe₂O₄].

Algorithm works as follows:

  • Maintains Ca²⁺:Mg²⁺:Fe²⁺ ratio

  • Maintains Cr³⁺:Al³⁺:Fe³⁺ ratio

  • Fe³⁺:Fe²⁺ ratio may change slightly if phase is not initially stoichiometric

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘spl’.

Returns:
np.ndarray

An array of spinel endmember fractions: [X_MgAl₂O₄, X_FeAl₂O₄, X_FeCr₂O₄, X_FeFe₂O₄].

get_garnet_endmember_fractions(phase='gt')#

Returns an array of garnet endmember fractions, normalized to one mole of (Ca²⁺,Mg²⁺,Fe²⁺)3(Al³⁺,Cr³⁺,Fe³⁺)₂Si₃O1₂. Endmember order is [Mg₃Al₂Si₃O₁₂, Fe₃Al₂Si₃O₁₂, Ca₃Fe₂Si₃O₁₂, Ca₃Al₂Si₃O₁₂, Ca₃Cr₂Si₃O₁₂].

Algorithm works as follows:

  • Maintains Ca²⁺:Mg²⁺:Fe²⁺ ratio

  • Maintains Cr³⁺:Al³⁺:Fe³⁺ ratio

  • Fe³⁺:Fe²⁺ ratio may change slightly if phase is not initially stoichiometric

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘gt’.

Returns:
np.ndarray

An array of garnet endmember fractions: [X_Mg₃Al₂Si₃O₁₂, X_Fe₃Al₂Si₃O₁₂, X_Ca₃Fe₂Si₃O₁₂, X_Ca₃Al₂Si₃O₁₂, X_Ca₃Cr₂Si₃O₁₂].

get_liquid_endmember_fractions(phase='agg_liq')#

Returns an array of liquid endmember fractions, normalized to 1 mole of oxides. Endmember order is [SiO₂, Al₂O₃, Fe₂O₃, Cr₂O₃, FeO, MgO, CaO].

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘agg_liq’.

Returns:
np.ndarray

An array of liquid endmember fractions: [X_SiO₂, X_Al₂O₃, X_Fe₂O₃, X_Cr₂O₃, X_FeO, X_MgO, X_CaO].

class peridoxia.data_structures.Assemblage(extensive_endmember_array: ~numpy.ndarray = <factory>, TC: float = 0, PGPa: float = 0)#

Dataclass for Assemblage objects, which consist of an extensive endmember array, a temperature, and a pressure. The endmember array ensures that Assemblage phases are stoichiometric. They do not necessarily need to be equilibrated.

The user will generally want to start with a PhaseDictionary object and then convert to an Assemblage using either the PhaseDictionary.create_assemblage() method or the Assemblage.get_assemblage_from_phase_masses_and_oxides() class method.

Endmember list:

idx

formula

phase

endmember name

00

Mg2SiO4

olivine

forsterite

01

Fe2SiO4

olivine

fayalite

02

Mg2Si2O6

orthopyroxene

enstatite

03

Fe2Si2O6

orthopyroxene

ferrosilite

04

CaMgSi2O6

orthopyroxene

diopside

05

CaAlAlSiO6

orthopyroxene

kushiroite (CaTs)]

06

CaCrAlSiO6

orthopyroxene

Cr-CaTs

07

CaFeAlSiO6

orthopyroxene

essenite (Fe3+-CaTs)

08

Mg2Si2O6

clinopyroxene

enstatite

09

Fe2Si2O6

clinopyroxene

ferrosilite

10

CaMgSi2O6

clinopyroxene

diopside

11

CaAlAlSiO6

clinopyroxene

kushiroite (CaTs)

12

CaCrAlSiO6

clinopyroxene

Cr-CaTs

13

CaFeAlSiO6

clinopyroxene

essenite (Fe3+-CaTs)

14

MgAl2O4

spinel

spinel

15

FeAl2O4

spinel

hercynite

16

FeCr2O4

spinel

chromite

17

FeFe2O4

spinel

magnetite

18

Mg3Al2Si3O12

garnet

pyrope

19

Fe3Al2Si3O12

garnet

almandine

20

Ca3Fe2Si3O12

garnet

andradite

21

Ca3Al2Si3O12

garnet

grossular

22

Ca3Cr2Si3O12

garnet

uvarovite

23

SiO2

liquid

24

Al2O3

liquid

25

Fe2O3

liquid

26

Cr2O3

liquid

27

FeO

liquid

28

MgO

liquid

29

CaO

liquid

30

SiO2

agg. liquid

31

Al2O3

agg. liquid

32

Fe2O3

agg. liquid

33

Cr2O3

agg. liquid

34

FeO

agg. liquid

35

MgO

agg. liquid

36

CaO

agg. liquid

Attributes:
extensive_endmember_array: np.ndarray

A 37-element array of moles of all endmembers (see table above). Endmember moles are extensive, meaning that mode information is incorporated (extensive endmember moles = total moles of phase * endmember mole fractions).

TCfloat

The temperature, in Celsius. By default 0.

PGPafloat

The pressure, in GPa. By default 0.

Methods

display_output([method])

Displays modes and oxides for each phase.

get_all_phase_objects()

Creates phase objects for all assemblage phases: ['olv', 'opx', 'cpx', 'spl', 'gt', 'liq', 'agg_liq']

get_assemblage_dictionaries()

Converts an Assemblage back into mode and oxide dictionaries.

get_assemblage_from_phase_masses_and_oxides(...)

Returns an Assemblage object from a 2D-array of phases (rows) and mass/oxides (columns).

get_endmember_mass_from_endmember_mol([phase])

Returns the extensive mass of each endmember.

get_endmember_mol_from_endmember_mass(mass_array)

Returns an array of extensive endmember moles from an array of endmember masses

get_oxide_wt_dict_from_endmember_mol(phase)

Returns a dictionary of oxide wt% values for a given phase.

get_oxide_wt_from_endmember_mol(phase[, norm])

Takes in one phase at a time, returns an array of oxides.

get_phase_endmember_mol([phase])

Returns the extensive endmember moles for a single phase.

get_phase_idx([phase])

Returns the beginning and end indices of a phase within the endmember array.

get_phase_mass(phase)

Returns mass as grams of phase.

get_phase_object(phase)

Creates phase objects for calculating properties

replace_phase_endmember_mol(phase, new_array)

Updates the extensive endmember array in-place.

classmethod get_assemblage_from_phase_masses_and_oxides(phase_masses_and_oxides: ndarray, TC: float = 0, PGPa: float = 0)#

Returns an Assemblage object from a 2D-array of phases (rows) and mass/oxides (columns).

Parameters:
phase_masses_and_oxidesnp.ndarray

A 2D array, with phases as rows and mass/oxides as columns.

  • Phase order (rows) is [‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’]

  • Mass/oxide order (columns) for each phase is [‘mass’, ‘SiO2’, ‘Al2O3’, ‘Fe2O3’, ‘Cr2O3’, ‘FeO’, ‘MgO’, ‘CaO’]

TCfloat, optional

Temperature, in Celsius, by default 0

PGPafloat, optional

Pressure, in Gigapascals, by default 0

Returns:
Assemblage

An Assemblage object consisting of stoichiometric phase information, pressure, and temperature.

classmethod get_endmember_mol_from_endmember_mass(mass_array: ndarray, phase='all') ndarray#

Returns an array of extensive endmember moles from an array of endmember masses

Parameters:
mass_arraynp.ndarray

An array of endmember masses. Must be in the same order as the Assemblage.extensive_endmember_array attribute.

phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘all’

Returns:
np.ndarray

An array of extensive endmember moles, which can then be assigned to an extensive_endmember_array using Assemblage.replace_phase_endmember_mol().

get_phase_idx(phase='all') slice#

Returns the beginning and end indices of a phase within the endmember array.

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘all’.

Returns:
slice

A slice with the beginning and ending indices.

get_phase_endmember_mol(phase='all') ndarray#

Returns the extensive endmember moles for a single phase.

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘all’. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’

Returns:
np.ndarray

A 1D array of extensive moles of endmembers

replace_phase_endmember_mol(phase: str, new_array: ndarray)#

Updates the extensive endmember array in-place.

Parameters:
phasestr

The phase abbreviation string for the phase of interest. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’.

new_arraynp.ndarray

The array of extensive endmember moles with which to replace the current slice of endmember moles.

get_oxide_wt_from_endmember_mol(phase: str, norm=True) ndarray#
Takes in one phase at a time, returns an array of oxides.

By default, normalizes to 100%.

Parameters:
phasestr

The phase abbreviation string for the phase of interest. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’.

normbool, optional

Whether to normalize oxide wts to 100 wt% (True) or leave extensive (False), by default True.

Returns:
np.ndarray

A 1D array of oxide weights. Oxide order can be found using Assemblage.oxide_order.

get_endmember_mass_from_endmember_mol(phase='all') ndarray#

Returns the extensive mass of each endmember.

Parameters:
phasestr, optional

The phase abbreviation string for the phase of interest, by default ‘all’. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’.

Returns:
np.ndarray

A 1D array of extensive masses of each endmember.

get_phase_mass(phase: str) float#

Returns mass as grams of phase.

Parameters:
phasestr

The phase abbreviation string for the phase of interest. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’.

Returns:
float

The extensive mass of the phase of interest.

get_oxide_wt_dict_from_endmember_mol(phase: str) dict[str, float]#

Returns a dictionary of oxide wt% values for a given phase.

Parameters:
phasestr

The phase abbreviation string for the phase of interest. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’, ‘all’.

Returns
——-
dict[str,float]

A dictionary of oxide wt%s. Keys are ‘SiO2’, ‘Al2O3’, ‘Fe2O3’, ‘Cr2O3’, ‘FeO’, ‘MgO’, ‘CaO’.

get_assemblage_dictionaries() tuple[dict, dict]#

Converts an Assemblage back into mode and oxide dictionaries.

Returns:
dict[str,dict[str,float]]

A dictionary of dictionaries for oxide wt% in each phase, e.g. {‘olv’:{‘SiO2’:40.0, ‘Al2O3’:0.0, … }, …}.

dict[str,float]

A dictionary of modes for each phase, e.g. {‘olv’: 60.0, ‘opx’: 28.0, …}.

get_phase_object(phase: str)#

Creates phase objects for calculating properties

Parameters:
phasestr

The phase abbreviation string for the phase of interest. Phase options: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’, ‘sys’.

Returns:
Phase

A Phase object of the correct Phase subclass type.

get_all_phase_objects() list#

Creates phase objects for all assemblage phases: [‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’]

Returns:
list

A list of phase objects.

display_output(method: str = 'short')#

Displays modes and oxides for each phase.

Parameters:
methodstr, optional

Number of decimal places to display. ‘short’ gives 2 decimal places, ‘long’ gives 6 decimal places, by default ‘short’.

Raises:
ValueError

If a method other than ‘short’ or ‘long’ is provided.

property endmember_names: list#

Returns an ordered list of endmembers for all phases.

Returns:
list

A list of all endmember names (as formulas)

property phase_names: list[str]#

Returns an ordered list of phases in the model.

Returns:
list[str]

A list of the phases in the model (as phase abbreviation strings)

property oxide_order: list[str]#

Returns an ordered list of strings representing the model oxides.

Returns:
list[str]

A list of the oxides in the model.

property TK_olv_spl: float#

Returns T (in K) from olivine and spinel compositions using the Li et al., 1995 thermometer.

Returns:
float

The temperature, in K.

property G_cont_to_fO2: float#

Returns the Gibbs Free Energy contribution to \(logfO_{2}\) for the spl-olv-opx oxybarometer:

\(6Fe_2SiO_4 (olv) + O_2 \rightarrow 3Fe_2Si_2O_6 (opx) + 2Fe_3O_4 (spl)\)

Uses the formulation of Davis et al. (2017):

\(\frac{-\Delta G°_{rxn}}{RT*ln(10)} = log_{10}(K_{eq}) = -\frac{24222}{T_{K}} + 8.64 + \frac{0.0567*(P_{bar}-1)}{T_{K}}\)

Returns:
float

The Gibbs Free Energy contribution to \(log_{10}fO_{2}\).

property logfO2_abs: float#

Returns the absolute \(logfO_{2}\) value of the assemblage, not normalized to any buffer, for the spinel oxybarometer:

\(6Fe_2SiO_4 (olv) + O_2 \rightarrow 3Fe_2Si_2O_6 (opx) + 2Fe_3O_4 (spl)\).

Uses the formulation of Davis et al. (2017):

\(log_{10}fO_{2} = \frac{-\Delta G°_{rxn}}{RT*ln(10)} + 2log_{10}a^{spl}_{Fe3O4} + 3log_{10}a^{opx}_{Fe2Si2O6} - 2log_{10}a^{olv}_{Fe2SiO4}\)

Returns:
float

The absolute \(logfO_{2}\).

property FFM: float#

Returns the value of the FFM buffer at the P and T of the Assemblage object. Notice that the FFM buffer is equivalent to the Gibbs Free Energy contribution for the pure phase reaction:

\(6Fe_2SiO_4 (olv) + O_2 \rightarrow 3Fe_2Si_2O_6 (opx) + 2Fe_3O_4 (spl)\)

Uses the formulation of Davis et al. (2017):

\(log_{10}fO_{2}(FFM) = \frac{-\Delta G°_{rxn}}{RT*ln(10)} = -\frac{24222}{T_{K}} + 8.64 + \frac{0.0567*(P_{bar}-1)}{T_{K}}\)

Returns:
float

The value of the FFM buffer.

property QFM: float#

Returns the value of the QFM buffer at the P and T of the Assemblage object.

Uses the formulation of Frost (1991):

\(log_{10}fO_{2}(QFM) = -\frac{25096.3}{T_{K}} + 8.735 + \frac{0.11*(P_{bar}-1)}{T_{K}}\)

Returns:
float

The value of the QFM buffer.

property logfO2_dFFM: float#

Returns \(log_{10}fO_{2}\) relative to FFM buffer.

\(log_{10}fO_{2}(\Delta FFM) = log_{10}fO_{2} - log_{10}fO_{2}(FFM)\)

Note that because FFM buffer is equivalent to the Gibbs Free Energy contribution (\(\frac{-\Delta G°_{rxn}}{RT*ln(10)}\)) for the pure phase spl-olv-opx reaction, \(log_{10}fO_{2}(\Delta FFM)\) can be calculated from just the mineral activities:

\(log_{10}fO_{2}(\Delta FFM) = 2log_{10}a^{spl}_{Fe3O4} + 3log_{10}a^{opx}_{Fe2Si2O6} - 2log_{10}a^{olv}_{Fe2SiO4}\)

Returns:
float

The value of \(log_{10}fO_{2}\) relative to the FFM buffer.

property logfO2_dQFM: float#

Returns \(log_{10}fO_{2}\) relative to QFM buffer.

\(log_{10}fO_{2}(\Delta QFM) = log_{10}fO_{2} - log_{10}fO_{2}(QFM)\)

Returns:
float

The value of \(log_{10}fO_{2}\) relative to the QFM buffer.

class peridoxia.data_structures.Phase(extensive_endmember_array: ndarray, phs_str: str, TC: float | None = None, PGPa: float | None = None, label: str = 'phs', color='k')#

Class for handling individual phases as part of an assemblage. This is a parent class for the specific phase classes: Olivine, Orthopyroxene, Clinopyroxene, Spinel, Garnet, Liquid. Generally, phases should be created through the specific phase classes (e.g., phase=Olivine(…)) rather than through this class.

Parameters:
extensive_endmember_arraynp.ndarray

The endmember array for the phase, in the order indicated by the Assemblage class

phs_strstr, optional

The phase type: ‘olv’, ‘opx’, ‘cpx’, ‘spl’, ‘gt’, ‘liq’, ‘agg_liq’

TCfloat | None, optional

Temperature, in Celsius, by default None

PGPafloat | None, optional

Pressure, in GPa, by default None

labelstr, optional

Label for the phase, by default ‘phs’

colorstr, optional

Color with which to plot the phase, by default ‘k’

Attributes:
Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

color
extensive_endmember_array

_summary_

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property extensive_endmember_array: ndarray#

_summary_

Returns:
np.ndarray

The endmember array for the phase, in the order indicated by the Assemblage class

property TC: float | None#
Returns:
float

The temperature, in Celsius.

property PGPa: float | None#

_summary_

Returns:
float|None

_description_

property label: str#
Returns:
str

Label

property mass#

Total mass of phase

property oxides#

Returns an array of oxides normalized to 100%

property mol_cat#

Returns an array of moles of cations (per 100 g oxides)

property ox_dict#

Returns a dictionary of oxides

property Fe3_Al#

Returns the Fe3+/Al3+ ratio.

property Fe3_tFe#

Returns the Fe3+/(Fe3 + Fe2) ratio.

property Cr_num#

Returns the Cr/(Cr+Al) ratio.

property Mg_num#

Returns the Mg/(Mg+Fe2) ratio.

class peridoxia.data_structures.Olivine(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='olvine', color='springgreen')#
Attributes:
Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Fo_num

Returns the Forsterite number (100*Mg/(Mg+Fe2))

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

color
extensive_endmember_array

_summary_

fO2_cont

Returns the olivine contribution to logfO2 (using the Davis et al.

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property Fo_num#

Returns the Forsterite number (100*Mg/(Mg+Fe2))

property fO2_cont#

Returns the olivine contribution to logfO2 (using the Davis et al. formulation of the spl oxybarometer)

class peridoxia.data_structures.Orthopyroxene(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='orthopyroxene', color='darkolivegreen')#
Attributes:
Al_per_6_O

Returns total Al per 6 Oxygen

Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

Ts_per_6_O

Returns Al_VI+Cr_VI per 6 Oxygen as a proxy for Ts per 6 Oxygen

XM1XM2

Returns XM1XM2 for a set of endmembers.

color
extensive_endmember_array

_summary_

fO2_cont

Returns the orthopyroxene contribution to logfO2 (using the Davis et al.

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property Ts_per_6_O#

Returns Al_VI+Cr_VI per 6 Oxygen as a proxy for Ts per 6 Oxygen

property Al_per_6_O#

Returns total Al per 6 Oxygen

property XM1XM2#

Returns XM1XM2 for a set of endmembers. Gives slightly different result than original XM1XM2 calculator because it takes Fe3+ vs Fe2+ into account. Differences are on the order of 0.01 log units contribution to fO2.

property fO2_cont#

Returns the orthopyroxene contribution to logfO2 (using the Davis et al. formulation of the spl oxybarometer)

class peridoxia.data_structures.Clinopyroxene(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='clinopyroxene', color='green')#
Attributes:
Al_per_6_O

Returns total Al per 6 Oxygen

Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

Ts_per_6_O

Returns Al_VI+Cr_VI per 6 Oxygen as a proxy for Ts per 6 Oxygen

color
extensive_endmember_array

_summary_

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property Ts_per_6_O#

Returns Al_VI+Cr_VI per 6 Oxygen as a proxy for Ts per 6 Oxygen

property Al_per_6_O#

Returns total Al per 6 Oxygen

class peridoxia.data_structures.Spinel(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='spinel', color='black')#
Attributes:
Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

aFe3O4

Returns spinel activity.

color
extensive_endmember_array

_summary_

fO2_cont

Returns the orthopyroxene contribution to logfO2 (using the Davis et al.

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property aFe3O4#

Returns spinel activity. Uses Sack and Ghiorso (1991ab) spinel models and is implemented using the ThermoEngine package (enki-portal.org).

property fO2_cont#

Returns the orthopyroxene contribution to logfO2 (using the Davis et al. formulation of the spl oxybarometer)

class peridoxia.data_structures.Garnet(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='garnet', color='purple')#
Attributes:
Ca_mass_ratio

Return ratio of Ca-garnet to Fe-Mg garnet

Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

color
extensive_endmember_array

_summary_

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str
property Ca_mass_ratio#

Return ratio of Ca-garnet to Fe-Mg garnet

class peridoxia.data_structures.Liquid(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='liquid', color='red')#
Attributes:
Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

color
extensive_endmember_array

_summary_

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str

Methods

fO2_Borisov_2018([pressure_term])

Calculates fO2 of a liquid using the Borisov 2018 formulation (Table 2) Pressure term options are: 'None', 'KC1991', 'Zhang2017'

fO2_Hirschmann_2022([pressure_term])

Calculates fO2 of a liquid using the Hirschmann 2022 formulation (Eq 21).

fO2_Kress_and_Carmichael_1991()

Calculates fO2 of a liquid using the Kress and Carmichael (1991) formulation.

fO2_Kress_and_Carmichael_1991()#

Calculates fO2 of a liquid using the Kress and Carmichael (1991) formulation.

fO2_Borisov_2018(pressure_term: str = 'None')#

Calculates fO2 of a liquid using the Borisov 2018 formulation (Table 2) Pressure term options are: ‘None’, ‘KC1991’, ‘Zhang2017’

fO2_Hirschmann_2022(pressure_term='Zhang2017')#

Calculates fO2 of a liquid using the Hirschmann 2022 formulation (Eq 21). Starts with Borisov 2018 and builds from there. Pressure term is built in.

class peridoxia.data_structures.System(extensive_endmember_moles: ndarray, TC: float | None = None, PGPa: float | None = None, label='sys', color='grey')#
Attributes:
Cr_num

Returns the Cr/(Cr+Al) ratio.

Fe3_Al

Returns the Fe3+/Al3+ ratio.

Fe3_tFe

Returns the Fe3+/(Fe3 + Fe2) ratio.

Mg_num

Returns the Mg/(Mg+Fe2) ratio.

PGPa

_summary_

TC

Returns ——- float The temperature, in Celsius.

color
extensive_endmember_array

_summary_

label

Returns

mass

Total mass of phase

mol_cat

Returns an array of moles of cations (per 100 g oxides)

ox_dict

Returns a dictionary of oxides

oxide_order
oxides

Returns an array of oxides normalized to 100%

phs_str