PetThermoTools 0.2.40__py3-none-any.whl → 0.2.41__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
PetThermoTools/Barom.py CHANGED
@@ -186,7 +186,18 @@ def mineral_cosaturation(Model="MELTSv1.0.2", cores=int(np.floor(multiprocessing
186
186
  Results : dict
187
187
  Raw simulation outputs for each pressure step.
188
188
  """
189
-
189
+ ## make sure everything is a float
190
+ T_initial_C = to_float(T_initial_C)
191
+ T_maxdrop_C = to_float(T_maxdrop_C)
192
+ T_cut_C = to_float(T_cut_C)
193
+
194
+ P_bar = to_float(P_bar)
195
+
196
+ Fe3Fet_init= to_float(Fe3Fet_init)
197
+ H2O_init = to_float(H2O_init)
198
+ CO2_init = to_float(CO2_init)
199
+ fO2_offset = to_float(fO2_offset)
200
+
190
201
  comp = bulk.copy()
191
202
  if H2O_Sat:
192
203
  comp['H2O_Liq'] = 20
@@ -51,6 +51,17 @@ Names_MM = {'liq1': '_Liq',
51
51
  'spl1': '_Sp',
52
52
  'spl2': '_Sp2'}
53
53
 
54
+ def to_float(x):
55
+ if x is None:
56
+ return None
57
+ if isinstance(x, (int, float)):
58
+ return float(x)
59
+ if isinstance(x, (list, tuple)):
60
+ return [float(v) for v in x]
61
+ if isinstance(x, np.ndarray):
62
+ return x.astype(float)
63
+ return x # leave unchanged if unexpected type
64
+
54
65
  def label_results(Result,label):
55
66
  Results = Result.copy()
56
67
  new_out = {}
PetThermoTools/Melting.py CHANGED
@@ -49,6 +49,17 @@ def AdiabaticDecompressionMelting(cores = multiprocessing.cpu_count(),
49
49
  P_path_bar = None, Frac = False, prop = None,
50
50
  fO2_buffer = None, fO2_offset = None, Fe3Fet = None, MELTS_filter = True):
51
51
 
52
+ Tp_C = to_float(Tp_C)
53
+
54
+ P_path_bar = to_float(P_path_bar)
55
+ P_start_bar= to_float(P_start_bar)
56
+ P_end_bar = to_float(P_end_bar)
57
+ dp_bar = to_float(dp_bar)
58
+
59
+ Fe3Fet = to_float(Fe3Fet)
60
+ fO2_offset = to_float(fO2_offset)
61
+
62
+
52
63
  if Tp_Method == "pyMelt":
53
64
  try:
54
65
  import pyMelt as m
@@ -265,7 +276,7 @@ def AdiabaticMelt(q, index, *, Model = None, comp_1 = None, comp_2 = None, comp_
265
276
  if type(comp_1) == dict:
266
277
  comp_julia = jl.seval("Dict")(comp_1)
267
278
  else:
268
- comp_new = comp_1.loc[i].to_dict()
279
+ comp_new = comp_1.loc[0].to_dict()
269
280
  comp_julia = jl.seval("Dict")(comp_new)
270
281
 
271
282
  Output_jl = jl.MAGEMinCalc.AdiabaticDecompressionMelting(comp = comp_julia, P_start_kbar = P_start_bar/1000.0,
PetThermoTools/Path.py CHANGED
@@ -98,6 +98,26 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
98
98
  Dictionary with each run's label as key. Values are sub-dictionaries of phase/property DataFrames.
99
99
  Includes `Input` key summarizing model configuration per run.
100
100
  """
101
+ ## make sure everything is a float
102
+ T_C = to_float(T_C)
103
+ T_path_C = to_float(T_path_C)
104
+ T_start_C = to_float(T_start_C)
105
+ T_end_C = to_float(T_end_C)
106
+ dt_C = to_float(dt_C)
107
+
108
+ P_bar = to_float(P_bar)
109
+ P_path_bar = to_float(P_path_bar)
110
+ P_start_bar= to_float(P_start_bar)
111
+ P_end_bar = to_float(P_end_bar)
112
+ dp_bar = to_float(dp_bar)
113
+
114
+ Fe3Fet_init= to_float(Fe3Fet_init)
115
+ Fe3Fet_Liq = to_float(Fe3Fet_Liq)
116
+ H2O_init = to_float(H2O_init)
117
+ H2O_Liq = to_float(H2O_Liq)
118
+ CO2_init = to_float(CO2_init)
119
+ CO2_Liq = to_float(CO2_Liq)
120
+ fO2_offset = to_float(fO2_offset)
101
121
 
102
122
  if timeout is None:
103
123
  timeout = 180
@@ -153,7 +173,7 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
153
173
 
154
174
  # ensure the bulk composition has the correct headers etc.
155
175
  comp = comp_fix(Model = Model, comp = comp, Fe3Fet_Liq = Fe3Fet_init, H2O_Liq = H2O_init, CO2_Liq = CO2_init)
156
-
176
+
157
177
  if type(comp) == dict:
158
178
  if comp['H2O_Liq'] == 0.0 and "MELTS" in Model:
159
179
  raise Warning("Adding small amounts of H$_{2}$O may improve the ability of MELTS to accurately reproduce the saturation of oxide minerals. Additionally, sufficient H$_{2}$O is required in the model for MELTS to predict the crystallisation of apatite, rather than whitlockite.")
@@ -473,28 +493,48 @@ def path_multi(q, index, *, Model = None, comp = None, Frac_solid = None, Frac_f
473
493
 
474
494
  jl.seval("using MAGEMinCalc")
475
495
 
476
-
477
496
  for i in index:
478
497
  try:
479
498
  if "MELTS" in Model:
480
499
  if type(comp) == dict:
481
- Results, tr = path_MELTS(Model = Model, comp = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
482
- T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
483
- T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
484
- P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
485
- isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
486
- find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
487
- fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
488
- Suppress_except=Suppress_except, trail = trail, melts = melts)
500
+ if trail is not None:
501
+ Results, tr = path_MELTS(Model = Model, comp = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
502
+ T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
503
+ T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
504
+ P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
505
+ isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
506
+ find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
507
+ fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
508
+ Suppress_except=Suppress_except, trail = trail, melts = melts)
509
+ else:
510
+ Results = path_MELTS(Model = Model, comp = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
511
+ T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
512
+ T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
513
+ P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
514
+ isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
515
+ find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
516
+ fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
517
+ Suppress_except=Suppress_except, trail = trail, melts = melts)
518
+
489
519
  else:
490
- Results, tr = path_MELTS(Model = Model, comp = comp.loc[i].to_dict(), Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
491
- T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
492
- T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
493
- P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
494
- isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
495
- find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
496
- fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
497
- Suppress_except=Suppress_except, trail = trail, melts = melts)
520
+ if trail is not None:
521
+ Results, tr = path_MELTS(Model = Model, comp = comp.loc[i].to_dict(), Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
522
+ T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
523
+ T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
524
+ P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
525
+ isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
526
+ find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
527
+ fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
528
+ Suppress_except=Suppress_except, trail = trail, melts = melts)
529
+ else:
530
+ Results = path_MELTS(Model = Model, comp = comp.loc[i].to_dict(), Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
531
+ T_initial_C = 1400, T_C = T_C[i], T_path_C = T_path_C[i], T_start_C = T_start_C[i],
532
+ T_end_C = T_end_C[i], dt_C = dt_C[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i],
533
+ P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i], dp_bar = dp_bar[i],
534
+ isenthalpic = isenthalpic, isentropic = isentropic, isochoric = isochoric,
535
+ find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset[i],
536
+ fluid_sat = fluid_sat, Crystallinity_limit = Crystallinity_limit, Suppress = Suppress,
537
+ Suppress_except=Suppress_except, trail = trail, melts = melts)
498
538
  else:
499
539
  if fO2_offset[i] is None:
500
540
  fO2_offset[i] = 0.0
@@ -66,6 +66,26 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
66
66
  pandas.DataFrame
67
67
  A dataframe containing the phase diagram results.
68
68
  """
69
+
70
+ ## make sure everything is a float
71
+ T_C = to_float(T_C)
72
+ T_min_C = to_float(T_min_C)
73
+ T_max_C = to_float(T_max_C)
74
+ T_num = to_float(T_num)
75
+
76
+ P_bar = to_float(P_bar)
77
+ P_min_bar = to_float(P_min_bar)
78
+ P_max_bar= to_float(P_max_bar)
79
+ P_num = to_float(P_num)
80
+
81
+ Fe3Fet_init= to_float(Fe3Fet_init)
82
+ Fe3Fet_Liq = to_float(Fe3Fet_Liq)
83
+ H2O_init = to_float(H2O_init)
84
+ H2O_Liq = to_float(H2O_Liq)
85
+ CO2_init = to_float(CO2_init)
86
+ CO2_Liq = to_float(CO2_Liq)
87
+ fO2_offset = to_float(fO2_offset)
88
+
69
89
  if H2O_Liq is not None:
70
90
  print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
71
91
  if H2O_init is None:
@@ -299,7 +319,7 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
299
319
  return Combined
300
320
 
301
321
  def phaseDiagram_refine(Data = None, Model = None, bulk = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None,
302
- fO2_buffer = None, fO2_offset = None, i_max = 25):
322
+ fO2_buffer = None, fO2_offset = None, i_max = 150):
303
323
  Combined = Data.copy()
304
324
  # find existing T,P data
305
325
  T_C = Combined['T_C'].unique()
@@ -5,4 +5,4 @@
5
5
  # 1) we don't load dependencies by storing it in __init__.py
6
6
  # 2) we can import it in setup.py for the same reason
7
7
  # 3) we can import it into your module
8
- __version__ = '0.2.40'
8
+ __version__ = '0.2.41'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.40
3
+ Version: 0.2.41
4
4
  Summary: PetThermoTools
5
5
  Home-page: https://github.com/gleesonm1/PetThermoTools
6
6
  Author: Matthew Gleeson
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  Requires-Dist: pandas
15
- Requires-Dist: numpy<2
15
+ Requires-Dist: numpy
16
16
  Requires-Dist: matplotlib
17
17
  Requires-Dist: scikit-learn
18
18
  Requires-Dist: scipy
@@ -1,20 +1,20 @@
1
- PetThermoTools/Barom.py,sha256=2NLhuidKKG8ljaXdWtQfGUE7QgIVMjHyJZq0GUtsayI,45818
1
+ PetThermoTools/Barom.py,sha256=6uObJ8ZsHQD6r46ZAyBQGiuVKbmdIVMe4SFp5v-Vigg,46149
2
2
  PetThermoTools/Compositions.py,sha256=65NzfduzWdfHJ8VmHBN1Cv7fMz7kF3QbDVLei-e4v00,1483
3
- PetThermoTools/GenFuncs.py,sha256=KS2zgccvUWDU_A4e6tK7NQrBrHYHTysHiFGC8WdilW8,17824
3
+ PetThermoTools/GenFuncs.py,sha256=qiDB0Tdxu4sErSZGCl_Hm6ZUginDI2LG0s9YGiiRqBw,18130
4
4
  PetThermoTools/Holland.py,sha256=udBFeVUyTBpSfLIhx7Hy6o0I8ApNCDvwU_gZa0diY5w,7251
5
5
  PetThermoTools/Installation.py,sha256=UfVOW1NZFdzMWPyID5u7t0KwvpJA0AqYohzidXIAwYs,6098
6
6
  PetThermoTools/Liq.py,sha256=BxAiHTeVQSLgpJT1Ac71apOQYmY3LGTPrxXclwE4F6w,35145
7
7
  PetThermoTools/MELTS.py,sha256=MIW1QUF-W76xjS4nD4tmFXKzYdh7ghY4W05kXU3hoBc,76412
8
- PetThermoTools/Melting.py,sha256=6EXjDJi5ZEZkQdoZbClRvnm3la_9c1tqurwyagcp5ts,12808
9
- PetThermoTools/Path.py,sha256=gF8C_bGV_BkVyCvBYEVWN2A6TcfHAppiV4jAOmJilA8,35207
8
+ PetThermoTools/Melting.py,sha256=O6BX_NEWsjLrdkpaZSwPYqQOzIvSHxfyOMKtg7HSmZc,13061
9
+ PetThermoTools/Path.py,sha256=9ijpgp91QNRUftnR80F7wWgenWr8bsZkaZ20OIdOD0M,38116
10
10
  PetThermoTools/Path_wrappers.py,sha256=gUxs_4Qbk4MLlLl4iySxfbfKU34588bIJAYyhHmhFdc,30177
11
- PetThermoTools/PhaseDiagrams.py,sha256=7tagrboKpln3fTXOZVX1ouxhzhV2-cmWGo9Qtmtsfn4,29285
11
+ PetThermoTools/PhaseDiagrams.py,sha256=CqiZbP3R2DHTHXI6EYam91Lqz_CqrRjyxG01FlOUVHU,29847
12
12
  PetThermoTools/Plotting.py,sha256=uvL_j2emMveGumLQ-IeJqyMXGUQT_PyInOpGnsWziAI,28992
13
13
  PetThermoTools/Saturation.py,sha256=m014Wtcd6pT8qmQhUoQQczZEB6dX3iIdxsCGtxmuOh0,29806
14
14
  PetThermoTools/__init__.py,sha256=PbiwQj_mNNEwuIZOLETmtMMshiXa50wjCA6mfvpOpOs,2393
15
- PetThermoTools/_version.py,sha256=_VYZ5bFE97hEGZ_S_lc6cSL5MwEE0cohtbh7q3t2VcM,296
16
- PetThermoTools-0.2.40.dist-info/LICENSE.txt,sha256=-mkx4iEw8Pk1RZUvncBhGLW87Uur5JB7FBQtOmX-VP0,1752
17
- PetThermoTools-0.2.40.dist-info/METADATA,sha256=LEddDdRVihjM4jtAPOkPKt6Qm5jYAWtjKOM8u0ZdFm4,796
18
- PetThermoTools-0.2.40.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
- PetThermoTools-0.2.40.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
20
- PetThermoTools-0.2.40.dist-info/RECORD,,
15
+ PetThermoTools/_version.py,sha256=WvrDLHqvUFROTO0ipm6xZxsmiXhJ3Pibqtgbf_NAJkM,296
16
+ PetThermoTools-0.2.41.dist-info/LICENSE.txt,sha256=-mkx4iEw8Pk1RZUvncBhGLW87Uur5JB7FBQtOmX-VP0,1752
17
+ PetThermoTools-0.2.41.dist-info/METADATA,sha256=DQ0lx7W5xgUFICbzLIyjAzANmDoHfdU1bPe4Op9Jh2U,794
18
+ PetThermoTools-0.2.41.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
+ PetThermoTools-0.2.41.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
20
+ PetThermoTools-0.2.41.dist-info/RECORD,,