Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docstrings for SLB2022 #592

Merged
merged 2 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions burnman/data/input_raw_endmember_datasets/HeFESTo_to_burnman.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def rfloat(x, m=1.0):
# Do not process liquid!!
if os.stat(f).st_size > 0 and str(f).split("/")[-1] != "liq":
name = str(f).split("/")[-1]
d = pd.read_csv(f, delim_whitespace=True)
d = pd.read_csv(f, sep="\\s+")

endmembers = list(d.columns)

Expand Down Expand Up @@ -295,7 +295,7 @@ def rfloat(x, m=1.0):

assert idict["debye"] == "1.00000"

if idict["beta"] != "0.00000":
if idict["bel_0"] != "0.00000":
# Fe endmember equations of state not yet implemented
process = False

Expand Down Expand Up @@ -384,9 +384,19 @@ def rfloat(x, m=1.0):


for key, prm in sorted(sol_params.items()):
docstring = '"""'
docstring += f'{prm["solution_type"]} model for {solution_aliases[key]} ({key}).\n'
docstring += "Endmembers (and site species distributions) are given in the order:\n"
for i in range(prm["n_mbrs"]):
docstring += f'- {prm["mbr_names"][i]} ({prm["mbr_site_formulae"][i]})\n'
if key == "mw":
docstring += "The entropy from the first site in magnetite is not counted.\n"
docstring += '"""'

print(
f"\nclass {solution_aliases[key]}(Solution):\n"
" def __init__(self, molar_fractions=None):\n"
f" {docstring}\n"
f' self.name = "{solution_aliases[key]}"\n'
f" self.solution_model = {prm['solution_type']}(\n"
" endmembers=["
Expand Down
90 changes: 90 additions & 0 deletions burnman/minerals/SLB_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,11 @@ def __init__(self):

class c2c_pyroxene(Solution):
def __init__(self, molar_fractions=None):
"""IdealSolution model for c2c_pyroxene (c2c).
Endmembers (and site species distributions) are given in the order:
- mgc2 ([Mg]2)
- fec2 ([Fe]2)
"""
self.name = "c2c_pyroxene"
self.solution_model = IdealSolution(
endmembers=[
Expand All @@ -1635,6 +1640,12 @@ def __init__(self, molar_fractions=None):

class calcium_ferrite_structured_phase(Solution):
def __init__(self, molar_fractions=None):
"""AsymmetricRegularSolution model for calcium_ferrite_structured_phase (cf).
Endmembers (and site species distributions) are given in the order:
- mgcf ([Mg][Al])
- fecf ([Fe][Al])
- nacf ([Na][Si])
"""
self.name = "calcium_ferrite_structured_phase"
self.solution_model = AsymmetricRegularSolution(
endmembers=[
Expand All @@ -1651,6 +1662,14 @@ def __init__(self, molar_fractions=None):

class clinopyroxene(Solution):
def __init__(self, molar_fractions=None):
"""AsymmetricRegularSolution model for clinopyroxene (cpx).
Endmembers (and site species distributions) are given in the order:
- di ([Ca][Mg][Si]2)
- he ([Ca][Fe][Si]2)
- cen ([Mg][Mg][Si]2)
- cats ([Ca][Al][Si1/2Al1/2]2)
- jd ([Na][Al][Si]2)
"""
self.name = "clinopyroxene"
self.solution_model = AsymmetricRegularSolution(
endmembers=[
Expand All @@ -1674,6 +1693,14 @@ def __init__(self, molar_fractions=None):

class garnet(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for garnet (gt).
Endmembers (and site species distributions) are given in the order:
- py ([Mg]3[Al][Al])
- al ([Fe]3[Al][Al])
- gr ([Ca]3[Al][Al])
- mgmj ([Mg]3[Mg][Si])
- namj ([Na2/3Mg1/3]3[Si][Si])
"""
self.name = "garnet"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand Down Expand Up @@ -1702,6 +1729,12 @@ def __init__(self, molar_fractions=None):

class ilmenite(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for ilmenite (il).
Endmembers (and site species distributions) are given in the order:
- mgil ([Mg][Si])
- feil ([Fe][Si])
- co ([Al][Al])
"""
self.name = "ilmenite"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1717,6 +1750,13 @@ def __init__(self, molar_fractions=None):

class ferropericlase(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for ferropericlase (mw).
Endmembers (and site species distributions) are given in the order:
- pe ([Mg]2[Mg]2)
- wu ([Fe]2[Fe]2)
- anao ([Na]2[Al]2)
The entropy from the first site in magnetite is not counted.
"""
self.name = "ferropericlase"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1733,6 +1773,12 @@ def __init__(self, molar_fractions=None):

class new_aluminous_phase(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for new_aluminous_phase (nal).
Endmembers (and site species distributions) are given in the order:
- mnal ([Mg]2[Al5/6Si1/6]6)
- fnal ([Fe]2[Al5/6Si1/6]6)
- nnal ([Na]2[Al3/6Si3/6]6)
"""
self.name = "new_aluminous_phase"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1748,6 +1794,11 @@ def __init__(self, molar_fractions=None):

class olivine(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for olivine (ol).
Endmembers (and site species distributions) are given in the order:
- fo ([Mg]2)
- fa ([Fe]2)
"""
self.name = "olivine"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1762,6 +1813,13 @@ def __init__(self, molar_fractions=None):

class orthopyroxene(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for orthopyroxene (opx).
Endmembers (and site species distributions) are given in the order:
- en ([Mg][Mg])
- fs ([Fe][Fe])
- mgts ([Mg][Al])
- odi ([Ca][Mg])
"""
self.name = "orthopyroxene"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1778,6 +1836,11 @@ def __init__(self, molar_fractions=None):

class plagioclase(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for plagioclase (plg).
Endmembers (and site species distributions) are given in the order:
- an ([Ca])
- ab ([Na])
"""
self.name = "plagioclase"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1792,6 +1855,12 @@ def __init__(self, molar_fractions=None):

class post_perovskite(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for post_perovskite (ppv).
Endmembers (and site species distributions) are given in the order:
- mppv ([Mg][Si])
- fppv ([Fe][Si])
- appv ([Al][Al])
"""
self.name = "post_perovskite"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1807,6 +1876,12 @@ def __init__(self, molar_fractions=None):

class bridgmanite(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for bridgmanite (pv).
Endmembers (and site species distributions) are given in the order:
- mgpv ([Mg][Si])
- fepv ([Fe][Si])
- alpv ([Al][Al])
"""
self.name = "bridgmanite"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1822,6 +1897,11 @@ def __init__(self, molar_fractions=None):

class ringwoodite(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for ringwoodite (ri).
Endmembers (and site species distributions) are given in the order:
- mgri ([Mg]2)
- feri ([Fe]2)
"""
self.name = "ringwoodite"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1836,6 +1916,11 @@ def __init__(self, molar_fractions=None):

class mg_fe_aluminous_spinel(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for mg_fe_aluminous_spinel (sp).
Endmembers (and site species distributions) are given in the order:
- sp ([Mg3/4Al1/4]4[Al7/8Mg1/8]8)
- hc ([Fe3/4Al1/4]4[Al7/8Fe1/8]8)
"""
self.name = "mg_fe_aluminous_spinel"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand All @@ -1850,6 +1935,11 @@ def __init__(self, molar_fractions=None):

class wadsleyite(Solution):
def __init__(self, molar_fractions=None):
"""SymmetricRegularSolution model for wadsleyite (wa).
Endmembers (and site species distributions) are given in the order:
- mgwa ([Mg]2)
- fewa ([Fe]2)
"""
self.name = "wadsleyite"
self.solution_model = SymmetricRegularSolution(
endmembers=[
Expand Down
Loading