Skip to content

Commit 1536018

Browse files
committed
added solution docstrings
1 parent c3ed3a3 commit 1536018

File tree

7 files changed

+1134
-3
lines changed

7 files changed

+1134
-3
lines changed

burnman/data/input_raw_endmember_datasets/hpx_eos_to_burnman.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ def replace_numbers(match):
179179
n_data = len(data)
180180

181181
noods = []
182+
names = []
182183
for ind in start_indices:
183184
i = ind
184185
name = data[i][0]
186+
names.append(name)
185187
n_mbrs = int(data[i][1])
186188
logging.debug(f"Solution: {name}")
187189
logging.debug(f"Number of endmembers: {n_mbrs}")
@@ -380,8 +382,24 @@ def replace_numbers(match):
380382

381383
mbr_initializations.append(f'[{mbr}, "{site_formula}"]')
382384

385+
# Create docstring
386+
doc = ' """\n'
387+
doc += f" Initialisation for a {name} solution object.\n"
388+
389+
doc += " Contains the following endmembers with associated site occupancies :\n"
390+
391+
for mbr_initialization in mbr_initializations:
392+
doc += f" * {mbr_initialization}\n"
393+
394+
if formulation == "asf":
395+
doc += f"\n This is implemented as an asymmetric solution.\n"
396+
else:
397+
doc += f"\n This is implemented as a symmetric solution.\n"
398+
doc += ' """\n'
399+
383400
out_ss += f"class {name}(Solution):\n"
384401
out_ss += " def __init__(self, molar_fractions=None):\n"
402+
out_ss += doc
385403
out_ss += f' self.name = "{name}"\n'
386404
if formulation == "asf":
387405
out_ss += " self.solution_model = AsymmetricRegularSolution(\n"
@@ -427,9 +445,15 @@ def replace_numbers(match):
427445
f"{underline}\n"
428446
"\n"
429447
"HPx-eos solutions using endmembers from\n"
430-
f"dataset {mbr_dataset}.\n"
431-
"The values in this document are all in S.I. units,\n"
432-
"unlike those in the original THERMOCALC file.\n"
448+
f"dataset {mbr_dataset}.\n\n"
449+
"Contains the following solutions:\n"
450+
)
451+
for name in names:
452+
preamble += f"* {name}\n"
453+
454+
preamble += (
455+
"\nThe values in this document are all in S.I. units,\n"
456+
"unlike those in the original THERMOCALC file.\n\n"
433457
"This file is autogenerated using hpx_eos_to_burnman.py\n"
434458
'"""\n\n'
435459
f"import numpy as np\n"

burnman/minerals/ig50NCKFMASHTOCr.py

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,28 @@
99
1010
HPx-eos solutions using endmembers from
1111
dataset HGP_2018_ds633.
12+
13+
Contains the following solutions:
14+
* pl4tr
15+
* k4tr
16+
* pli
17+
* plc
18+
* ol
19+
* ksp
20+
* mu
21+
* bi
22+
* g
23+
* ep
24+
* cd
25+
* opx
26+
* cpx
27+
* spn
28+
* hb
29+
* ilm
30+
1231
The values in this document are all in S.I. units,
1332
unlike those in the original THERMOCALC file.
33+
1434
This file is autogenerated using hpx_eos_to_burnman.py
1535
"""
1636

@@ -432,6 +452,15 @@
432452

433453
class pl4tr(Solution):
434454
def __init__(self, molar_fractions=None):
455+
"""
456+
Initialisation for a pl4tr solution object.
457+
Contains the following endmembers with associated site occupancies :
458+
* [HGP_2018_ds633.ab(), "[Naa][Altb1/4Sitb3/4]"]
459+
* [HGP_2018_ds633.an(), "[Caa][Altb1/2Sitb1/2]"]
460+
* [HGP_2018_ds633.san(), "[Ka][Altb1/4Sitb3/4]"]
461+
462+
This is implemented as an asymmetric solution.
463+
"""
435464
self.name = "pl4tr"
436465
self.solution_model = AsymmetricRegularSolution(
437466
endmembers=[
@@ -452,6 +481,15 @@ def __init__(self, molar_fractions=None):
452481

453482
class k4tr(Solution):
454483
def __init__(self, molar_fractions=None):
484+
"""
485+
Initialisation for a k4tr solution object.
486+
Contains the following endmembers with associated site occupancies :
487+
* [HGP_2018_ds633.ab(), "[Naa][Altb1/4Sitb3/4]"]
488+
* [HGP_2018_ds633.an(), "[Caa][Altb1/2Sitb1/2]"]
489+
* [HGP_2018_ds633.san(), "[Ka][Altb1/4Sitb3/4]"]
490+
491+
This is implemented as an asymmetric solution.
492+
"""
455493
self.name = "k4tr"
456494
self.solution_model = AsymmetricRegularSolution(
457495
endmembers=[
@@ -472,6 +510,15 @@ def __init__(self, molar_fractions=None):
472510

473511
class pli(Solution):
474512
def __init__(self, molar_fractions=None):
513+
"""
514+
Initialisation for a pli solution object.
515+
Contains the following endmembers with associated site occupancies :
516+
* [abhI, "[Na]"]
517+
* [HGP_2018_ds633.an(), "[Ca]"]
518+
* [HGP_2018_ds633.san(), "[K]"]
519+
520+
This is implemented as an asymmetric solution.
521+
"""
475522
self.name = "pli"
476523
self.solution_model = AsymmetricRegularSolution(
477524
endmembers=[
@@ -489,6 +536,15 @@ def __init__(self, molar_fractions=None):
489536

490537
class plc(Solution):
491538
def __init__(self, molar_fractions=None):
539+
"""
540+
Initialisation for a plc solution object.
541+
Contains the following endmembers with associated site occupancies :
542+
* [HGP_2018_ds633.abh(), "[Na]"]
543+
* [anC, "[Ca]"]
544+
* [HGP_2018_ds633.san(), "[K]"]
545+
546+
This is implemented as an asymmetric solution.
547+
"""
492548
self.name = "plc"
493549
self.solution_model = AsymmetricRegularSolution(
494550
endmembers=[
@@ -506,6 +562,16 @@ def __init__(self, molar_fractions=None):
506562

507563
class ol(Solution):
508564
def __init__(self, molar_fractions=None):
565+
"""
566+
Initialisation for a ol solution object.
567+
Contains the following endmembers with associated site occupancies :
568+
* [HGP_2018_ds633.mont(), "[Mgmone][Camtwo]"]
569+
* [HGP_2018_ds633.fa(), "[Femone][Femtwo]"]
570+
* [HGP_2018_ds633.fo(), "[Mgmone][Mgmtwo]"]
571+
* [cfm, "[Mgmone][Femtwo]"]
572+
573+
This is implemented as a symmetric solution.
574+
"""
509575
self.name = "ol"
510576
self.solution_model = SymmetricRegularSolution(
511577
endmembers=[
@@ -525,6 +591,15 @@ def __init__(self, molar_fractions=None):
525591

526592
class ksp(Solution):
527593
def __init__(self, molar_fractions=None):
594+
"""
595+
Initialisation for a ksp solution object.
596+
Contains the following endmembers with associated site occupancies :
597+
* [HGP_2018_ds633.san(), "[K]"]
598+
* [HGP_2018_ds633.abh(), "[Na]"]
599+
* [anC, "[Ca]"]
600+
601+
This is implemented as an asymmetric solution.
602+
"""
528603
self.name = "ksp"
529604
self.solution_model = AsymmetricRegularSolution(
530605
endmembers=[
@@ -542,6 +617,18 @@ def __init__(self, molar_fractions=None):
542617

543618
class mu(Solution):
544619
def __init__(self, molar_fractions=None):
620+
"""
621+
Initialisation for a mu solution object.
622+
Contains the following endmembers with associated site occupancies :
623+
* [HGP_2018_ds633.mu(), "[Ka][Almtwoa][Almtwob][Sitone1/2Altone1/2]2"]
624+
* [HGP_2018_ds633.cel(), "[Ka][Mgmtwoa][Almtwob][Sitone]2"]
625+
* [HGP_2018_ds633.fcel(), "[Ka][Femtwoa][Almtwob][Sitone]2"]
626+
* [HGP_2018_ds633.pa(), "[Naa][Almtwoa][Almtwob][Sitone1/2Altone1/2]2"]
627+
* [mam, "[Caa][Almtwoa][Almtwob][Altone]2"]
628+
* [fmu, "[Ka][Almtwoa][Fethreemtwob][Sitone1/2Altone1/2]2"]
629+
630+
This is implemented as an asymmetric solution.
631+
"""
545632
self.name = "mu"
546633
self.solution_model = AsymmetricRegularSolution(
547634
endmembers=[
@@ -580,6 +667,18 @@ def __init__(self, molar_fractions=None):
580667

581668
class bi(Solution):
582669
def __init__(self, molar_fractions=None):
670+
"""
671+
Initialisation for a bi solution object.
672+
Contains the following endmembers with associated site occupancies :
673+
* [HGP_2018_ds633.phl(), "[Mgmthree][Mgmonetwo]2[Sit1/2Alt1/2]2[Ohv]2"]
674+
* [annm, "[Femthree][Femonetwo]2[Sit1/2Alt1/2]2[Ohv]2"]
675+
* [obi, "[Femthree][Mgmonetwo]2[Sit1/2Alt1/2]2[Ohv]2"]
676+
* [HGP_2018_ds633.east(), "[Almthree][Mgmonetwo]2[Alt]2[Ohv]2"]
677+
* [tbi, "[Timthree][Mgmonetwo]2[Sit1/2Alt1/2]2[Ov]2"]
678+
* [fbi, "[Fethreemthree][Mgmonetwo]2[Alt]2[Ohv]2"]
679+
680+
This is implemented as a symmetric solution.
681+
"""
583682
self.name = "bi"
584683
self.solution_model = SymmetricRegularSolution(
585684
endmembers=[
@@ -603,6 +702,18 @@ def __init__(self, molar_fractions=None):
603702

604703
class g(Solution):
605704
def __init__(self, molar_fractions=None):
705+
"""
706+
Initialisation for a g solution object.
707+
Contains the following endmembers with associated site occupancies :
708+
* [HGP_2018_ds633.py(), "[Mgmone]3[Almtwo]2"]
709+
* [HGP_2018_ds633.alm(), "[Femone]3[Almtwo]2"]
710+
* [HGP_2018_ds633.gr(), "[Camone]3[Almtwo]2"]
711+
* [HGP_2018_ds633.andr(), "[Camone]3[Fethreemtwo]2"]
712+
* [knom, "[Mgmone]3[Crmtwo]2"]
713+
* [tig, "[Mgmone]3[Almtwo1/2Mgmtwo1/4Timtwo1/4]2"]
714+
715+
This is implemented as an asymmetric solution.
716+
"""
606717
self.name = "g"
607718
self.solution_model = AsymmetricRegularSolution(
608719
endmembers=[
@@ -641,6 +752,15 @@ def __init__(self, molar_fractions=None):
641752

642753
class ep(Solution):
643754
def __init__(self, molar_fractions=None):
755+
"""
756+
Initialisation for a ep solution object.
757+
Contains the following endmembers with associated site occupancies :
758+
* [HGP_2018_ds633.cz(), "[Almone][Almthree]"]
759+
* [HGP_2018_ds633.ep(), "[Almone][Femthree]"]
760+
* [HGP_2018_ds633.fep(), "[Femone][Femthree]"]
761+
762+
This is implemented as a symmetric solution.
763+
"""
644764
self.name = "ep"
645765
self.solution_model = SymmetricRegularSolution(
646766
endmembers=[
@@ -655,6 +775,15 @@ def __init__(self, molar_fractions=None):
655775

656776
class cd(Solution):
657777
def __init__(self, molar_fractions=None):
778+
"""
779+
Initialisation for a cd solution object.
780+
Contains the following endmembers with associated site occupancies :
781+
* [HGP_2018_ds633.crd(), "[Mgx]2[Vh]"]
782+
* [HGP_2018_ds633.fcrd(), "[Fex]2[Vh]"]
783+
* [HGP_2018_ds633.hcrd(), "[Mgx]2[Htwooh]"]
784+
785+
This is implemented as a symmetric solution.
786+
"""
658787
self.name = "cd"
659788
self.solution_model = SymmetricRegularSolution(
660789
endmembers=[
@@ -669,6 +798,21 @@ def __init__(self, molar_fractions=None):
669798

670799
class opx(Solution):
671800
def __init__(self, molar_fractions=None):
801+
"""
802+
Initialisation for a opx solution object.
803+
Contains the following endmembers with associated site occupancies :
804+
* [HGP_2018_ds633.en(), "[Mgmone][Mgmtwo][Sit]1/2"]
805+
* [HGP_2018_ds633.fs(), "[Femone][Femtwo][Sit]1/2"]
806+
* [fm, "[Mgmone][Femtwo][Sit]1/2"]
807+
* [odi, "[Mgmone][Camtwo][Sit]1/2"]
808+
* [HGP_2018_ds633.mgts(), "[Almone][Mgmtwo][Sit1/2Alt1/2]1/2"]
809+
* [cren, "[Crmone][Mgmtwo][Sit1/2Alt1/2]1/2"]
810+
* [obuf, "[Mgmone1/2Timone1/2][Mgmtwo][Sit1/2Alt1/2]1/2"]
811+
* [mess, "[Fethreemone][Mgmtwo][Sit1/2Alt1/2]1/2"]
812+
* [ojd, "[Almone][Namtwo][Sit]1/2"]
813+
814+
This is implemented as an asymmetric solution.
815+
"""
672816
self.name = "opx"
673817
self.solution_model = AsymmetricRegularSolution(
674818
endmembers=[
@@ -709,6 +853,22 @@ def __init__(self, molar_fractions=None):
709853

710854
class cpx(Solution):
711855
def __init__(self, molar_fractions=None):
856+
"""
857+
Initialisation for a cpx solution object.
858+
Contains the following endmembers with associated site occupancies :
859+
* [HGP_2018_ds633.di(), "[Mgmone][Camtwo][Sit]1/2"]
860+
* [cfs, "[Femone][Femtwo][Sit]1/2"]
861+
* [HGP_2018_ds633.cats(), "[Almone][Camtwo][Sit1/2Alt1/2]1/2"]
862+
* [crdi, "[Crmone][Camtwo][Sit1/2Alt1/2]1/2"]
863+
* [cess, "[Fethreemone][Camtwo][Sit1/2Alt1/2]1/2"]
864+
* [cbuf, "[Mgmone1/2Timone1/2][Camtwo][Sit1/2Alt1/2]1/2"]
865+
* [HGP_2018_ds633.jd(), "[Almone][Namtwo][Sit]1/2"]
866+
* [cen, "[Mgmone][Mgmtwo][Sit]1/2"]
867+
* [cfm, "[Mgmone][Femtwo][Sit]1/2"]
868+
* [kjd, "[Almone][Kmtwo][Sit]1/2"]
869+
870+
This is implemented as an asymmetric solution.
871+
"""
712872
self.name = "cpx"
713873
self.solution_model = AsymmetricRegularSolution(
714874
endmembers=[
@@ -762,6 +922,20 @@ def __init__(self, molar_fractions=None):
762922

763923
class spn(Solution):
764924
def __init__(self, molar_fractions=None):
925+
"""
926+
Initialisation for a spn solution object.
927+
Contains the following endmembers with associated site occupancies :
928+
* [nsp, "[Mgt][Alm]"]
929+
* [isp, "[Alt][Mgm1/2Alm1/2]"]
930+
* [nhc, "[Fet][Alm]"]
931+
* [ihc, "[Alt][Fem1/2Alm1/2]"]
932+
* [nmt, "[Fet][Fethreem]"]
933+
* [imt, "[Fethreet][Fem1/2Fethreem1/2]"]
934+
* [pcr, "[Mgt][Crm]"]
935+
* [qndm, "[Mgt][Mgm1/2Tim1/2]"]
936+
937+
This is implemented as a symmetric solution.
938+
"""
765939
self.name = "spn"
766940
self.solution_model = SymmetricRegularSolution(
767941
endmembers=[
@@ -789,6 +963,23 @@ def __init__(self, molar_fractions=None):
789963

790964
class hb(Solution):
791965
def __init__(self, molar_fractions=None):
966+
"""
967+
Initialisation for a hb solution object.
968+
Contains the following endmembers with associated site occupancies :
969+
* [HGP_2018_ds633.tr(), "[Va][Mgmonethree]3[Mgmtwo]2[Camfour]2[Sitone][Ohv]2"]
970+
* [tsm, "[Va][Mgmonethree]3[Almtwo]2[Camfour]2[Sitone1/2Altone1/2][Ohv]2"]
971+
* [prgm, "[Naa][Mgmonethree]3[Mgmtwo1/2Almtwo1/2]2[Camfour]2[Sitone1/2Altone1/2][Ohv]2"]
972+
* [glm, "[Va][Mgmonethree]3[Almtwo]2[Namfour]2[Sitone][Ohv]2"]
973+
* [HGP_2018_ds633.cumm(), "[Va][Mgmonethree]3[Mgmtwo]2[Mgmfour]2[Sitone][Ohv]2"]
974+
* [grnm, "[Va][Femonethree]3[Femtwo]2[Femfour]2[Sitone][Ohv]2"]
975+
* [a, "[Va][Mgmonethree]3[Femtwo]2[Femfour]2[Sitone][Ohv]2"]
976+
* [b, "[Va][Femonethree]3[Mgmtwo]2[Femfour]2[Sitone][Ohv]2"]
977+
* [mrb, "[Va][Mgmonethree]3[Fethreemtwo]2[Namfour]2[Sitone][Ohv]2"]
978+
* [kprg, "[Ka][Mgmonethree]3[Mgmtwo1/2Almtwo1/2]2[Camfour]2[Sitone1/2Altone1/2][Ohv]2"]
979+
* [tts, "[Va][Mgmonethree]3[Timtwo]2[Camfour]2[Sitone1/2Altone1/2][Ov]2"]
980+
981+
This is implemented as an asymmetric solution.
982+
"""
792983
self.name = "hb"
793984
self.solution_model = AsymmetricRegularSolution(
794985
endmembers=[
@@ -868,6 +1059,15 @@ def __init__(self, molar_fractions=None):
8681059

8691060
class ilm(Solution):
8701061
def __init__(self, molar_fractions=None):
1062+
"""
1063+
Initialisation for a ilm solution object.
1064+
Contains the following endmembers with associated site occupancies :
1065+
* [oilm, "[Fetwoa][Tib]"]
1066+
* [dilm, "[Fetwoa1/2Tia1/2][Fetwob1/2Tib1/2]"]
1067+
* [dhem, "[Fethreea][Fethreeb]"]
1068+
1069+
This is implemented as a symmetric solution.
1070+
"""
8711071
self.name = "ilm"
8721072
self.solution_model = SymmetricRegularSolution(
8731073
endmembers=[

0 commit comments

Comments
 (0)