PetThermoTools 0.2.43__py3-none-any.whl → 0.2.45__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
@@ -223,6 +223,7 @@ def mineral_cosaturation(Model="MELTSv1.0.2", cores=int(np.floor(multiprocessing
223
223
  index_out = np.array([], dtype=int)
224
224
 
225
225
  while len(index_out) < len(index_in):
226
+ Start = time.time()
226
227
  index = np.setdiff1d(index_in, index_out)
227
228
  groups = np.array_split(index, cores)
228
229
  non_empty_groups = [g for g in groups if g.size > 0]
@@ -242,10 +243,19 @@ def mineral_cosaturation(Model="MELTSv1.0.2", cores=int(np.floor(multiprocessing
242
243
 
243
244
  for p, q, group in processes:
244
245
  try:
245
- res = q.get(timeout=timeout)
246
+ if time.time() - Start > timeout + 10:
247
+ res = q.get(timeout = 10)
248
+ else:
249
+ res = q.get(timeout=timeout)
246
250
  except:
251
+ if "MELTS" not in Model:
252
+ print(f"Timeout warning reached. Calculation P_bar = {P_bar[group[0]]} will not be returned. Try increasing the timeout.")
247
253
  res = []
248
254
  idx_chunks = np.array([group[0]], dtype = int)
255
+ mask = np.ones(len(P_bar), dtype=bool)
256
+ mask[idx_chunks] = False
257
+ P_bar = P_bar[mask]
258
+
249
259
  p.join(timeout = 2)
250
260
  p.terminate()
251
261
 
@@ -290,7 +300,7 @@ def mineral_cosaturation(Model="MELTSv1.0.2", cores=int(np.floor(multiprocessing
290
300
  phases=phases,
291
301
  melts = melts
292
302
  )
293
- results[f"index = {i}"] = Results
303
+ results[f"Run {i}"] = Results
294
304
  combined_results.update(results)
295
305
  else:
296
306
  if fO2_offset is None:
@@ -307,7 +317,7 @@ def mineral_cosaturation(Model="MELTSv1.0.2", cores=int(np.floor(multiprocessing
307
317
  )
308
318
 
309
319
  Results = dict(Results_df)
310
- results[f"index = {i}"] = Results
320
+ results[f"Run {i}"] = Results
311
321
  combined_results.update(results)
312
322
 
313
323
  results = combined_results
PetThermoTools/MELTS.py CHANGED
@@ -953,7 +953,6 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
953
953
  else:
954
954
  return Results
955
955
 
956
- print(Liq_Results)
957
956
  T_start_C = Liq_Results['T_Liq'] + 0.1
958
957
  if T_end_C is None and T_maxdrop_C is not None:
959
958
  T_end_C = T_start_C - T_maxdrop_C
@@ -965,6 +964,9 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
965
964
  else:
966
965
  melts.engine.setSystemProperties(["Log fO2 Path: " + fO2_buffer, "Log fO2 Offset: " + str(fO2_offset)])
967
966
 
967
+ T = None
968
+ P = None
969
+
968
970
  if T_path_C is None:
969
971
  if T_end_C is None and dt_C is None:
970
972
  T = T_start_C
@@ -973,6 +975,8 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
973
975
  elif T_path_C is not None:
974
976
  T = T_path_C
975
977
 
978
+
979
+
976
980
  if P_path_bar is None:
977
981
  if P_end_bar is None and dp_bar is None:
978
982
  P = P_start_bar
@@ -981,12 +985,21 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
981
985
  elif P_path_bar is not None:
982
986
  P = P_path_bar
983
987
 
988
+ print(P_path_bar)
989
+ print(P_end_bar)
990
+ print(P_start_bar)
991
+ print(dp_bar)
992
+
993
+ if type(P) == np.ndarray and T_end_C is not None and dt_C is None:
994
+ T = np.linspace(T_start_C, T_end_C, len(P))
995
+
984
996
  if type(T) == np.ndarray and P_end_bar is None and dp_bar is not None:
985
997
  P = np.linspace(P_start_bar, P_start_bar - dp_bar*(len(T)-1), len(T))
986
998
  if type(T) == np.ndarray and P_end_bar is not None and dp_bar is None:
987
999
  P = np.linspace(P_start_bar, P_end_bar, len(T))
988
1000
  elif type(P) == np.ndarray and T_end_C is None and dt_C is not None:
989
1001
  T = np.linspace(T_start_C, T_start_C - dt_C*(len(P)-1), len(P))
1002
+
990
1003
 
991
1004
  if type(T) == np.ndarray and type(P) == np.ndarray:
992
1005
  if len(T) != len(P):
PetThermoTools/Melting.py CHANGED
@@ -13,7 +13,7 @@ from tqdm.notebook import tqdm, trange
13
13
 
14
14
  def AdiabaticDecompressionMelting(cores = multiprocessing.cpu_count(),
15
15
  Model = "pMELTS", bulk = "KLB-1", comp_lith_1 = None,
16
- comp_lith_2 = None, comp_lith_3 = None, Tp_C = 1350, Tp_Method = "pyMelt",
16
+ comp_lith_2 = None, comp_lith_3 = None, Tp_C = 1350, Tp_Method = None,
17
17
  P_start_bar = 30000, P_end_bar = 2000, dp_bar = 200,
18
18
  P_path_bar = None, Frac = False, prop = None,
19
19
  fO2_buffer = None, fO2_offset = None, Fe3Fet = None, MELTS_filter = True):
@@ -311,6 +311,17 @@ def AdiabaticMelt(q, index, *, Model = None, comp_1 = None, comp_2 = None, comp_
311
311
 
312
312
  from juliacall import Main as jl, convert as jlconvert
313
313
 
314
+ # import os, pathlib
315
+
316
+ # # 1. Where to install Julia + MAGEMin environment (user home dir, persistent)
317
+ # home = str(pathlib.Path.home())
318
+ # env_path = os.path.join(home, ".MAGEMinEnv")
319
+
320
+ # jl.seval(f"""
321
+ # import Pkg
322
+ # Pkg.activate("{env_path}")
323
+ # """)
324
+
314
325
  jl.seval("using MAGEMinCalc")
315
326
 
316
327
  comp_1['O'] = comp_1['Fe3Fet_Liq']*(((159.59/2)/71.844)*comp_1['FeOt_Liq'] - comp_1['FeOt_Liq'])
@@ -323,7 +334,8 @@ def AdiabaticMelt(q, index, *, Model = None, comp_1 = None, comp_2 = None, comp_
323
334
 
324
335
  Output_jl = jl.MAGEMinCalc.AdiabaticDecompressionMelting(comp = comp_julia, P_start_kbar = P_start_bar/1000.0,
325
336
  P_end_kbar = P_end_bar/1000.0, dp_kbar = dp_bar/1000.0,
326
- T_start_C = T_start_C, fo2_buffer = fO2_buffer, fo2_offset = fO2_offset, Model = Model)
337
+ T_start_C = T_start_C, fo2_buffer = fO2_buffer,
338
+ fo2_offset = fO2_offset, Model = Model, Tp_C = Tp_C)
327
339
  Results = dict(Output_jl)
328
340
  # Results = stich(Results, Model = Model)
329
341
 
PetThermoTools/Path.py CHANGED
@@ -567,9 +567,11 @@ def path_multi(q, index, *, Model = None, comp = None, Frac_solid = None, Frac_f
567
567
  # T_C = T_C[i], T_path_C = T_path_C[i], P_start_bar = P_start_bar[i], P_end_bar = P_end_bar[i],
568
568
  # dp_bar = dp_bar[i], P_bar = P_bar[i], P_path_bar = P_path_bar[i], frac_xtal = Frac_solid,
569
569
  # fo2_buffer = fO2_buffer, fo2_offset = fO2_offset[i], find_liquidus = find_liquidus)
570
-
570
+
571
+ julia_Suppress = None
571
572
  if Suppress == ['rutile', 'tridymite']:
572
573
  Suppress = None
574
+ julia_Suppress = None
573
575
 
574
576
  if Suppress is not None:
575
577
  jl.Suppress = Suppress
@@ -772,8 +774,10 @@ def path(q, index, *, Model = None, comp = None, Frac_solid = None, Frac_fluid =
772
774
  else:
773
775
  P_path_bar_julia = P_path_bar
774
776
 
777
+ julia_Suppress = None
775
778
  if Suppress == ['rutile', 'tridymite']:
776
779
  Suppress = None
780
+ julia_Suppress = None
777
781
 
778
782
  if Suppress is not None:
779
783
  jl.Suppress = Suppress
@@ -185,7 +185,7 @@ def polybaric_crystallisation_path(Model = None, bulk = None, Frac_solid = None,
185
185
  Fe3Fet_init = None, Fe3Fet_Liq = None, H2O_init = None, H2O_Liq = None,
186
186
  CO2_init = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None,
187
187
  fO2_offset = None, label = None, timeout = None, multi_processing=True,
188
- Suppress = ['rutile', 'tridymite'], Suppress_except=False):
188
+ Suppress = ['rutile', 'tridymite'], Suppress_except=False, multiprocessing = True):
189
189
  """
190
190
  Simulates polybaric crystallization along a user-specified P-T path using the `multi_path` function.
191
191
 
@@ -275,7 +275,8 @@ def polybaric_crystallisation_onestep(Model = None, bulk = None, Frac_solid = No
275
275
  P_start_bar = None, P_end_bar = None, Fe3Fet_Liq = None, Fe3Fet_init = None,
276
276
  H2O_Liq = None, H2O_init = None, CO2_Liq = None, CO2_init = None,
277
277
  find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None,
278
- timeout = None, multi_processing = True, Suppress = ['rutile', 'tridymite'], Suppress_except=False,):
278
+ timeout = None, multi_processing = True, Suppress = ['rutile', 'tridymite'],
279
+ Suppress_except=False,multiprocessing=True):
279
280
  """
280
281
  Simulates polybaric crystallization along a user-specified P-T path using the `multi_path` function.
281
282
 
@@ -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.43'
8
+ __version__ = '0.2.45'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.43
3
+ Version: 0.2.45
4
4
  Summary: PetThermoTools
5
5
  Home-page: https://github.com/gleesonm1/PetThermoTools
6
6
  Author: Matthew Gleeson
@@ -1,20 +1,20 @@
1
- PetThermoTools/Barom.py,sha256=HKd1TTHHl0FnM_SGb0qC7KqH7rybyVixVMH7Wph-nk8,46613
1
+ PetThermoTools/Barom.py,sha256=6LObqDzICfgBTH3ki9mt8yd-2EgTZIAO55p5BwfiBBk,47113
2
2
  PetThermoTools/Compositions.py,sha256=65NzfduzWdfHJ8VmHBN1Cv7fMz7kF3QbDVLei-e4v00,1483
3
3
  PetThermoTools/GenFuncs.py,sha256=oMV3FYIpfHNpGZloN5a6Vr8Sv_5IRsKt4hHIUNbDu24,19996
4
4
  PetThermoTools/Holland.py,sha256=udBFeVUyTBpSfLIhx7Hy6o0I8ApNCDvwU_gZa0diY5w,7251
5
5
  PetThermoTools/Installation.py,sha256=UfVOW1NZFdzMWPyID5u7t0KwvpJA0AqYohzidXIAwYs,6098
6
6
  PetThermoTools/Liq.py,sha256=4tOnVROXr7V6cfvZceKidFT9J20TZE3Om2oem92QC4s,36842
7
- PetThermoTools/MELTS.py,sha256=2WB4Y11i7yfTM5dRjEr-KrJY2_7f1kLaW4V0di6Qnew,76511
8
- PetThermoTools/Melting.py,sha256=D4mXTrKkoUPK8dAuHPQRAnK79owI23W7JBmUMvm1DVU,15332
9
- PetThermoTools/Path.py,sha256=l_2ttEa1qP7vL1vVmbOoztpFIIjJLk4jUJTudI6nI00,39436
10
- PetThermoTools/Path_wrappers.py,sha256=gUxs_4Qbk4MLlLl4iySxfbfKU34588bIJAYyhHmhFdc,30177
7
+ PetThermoTools/MELTS.py,sha256=sH2sadG2vhr1be0kkMGB_rFJbjF0XDiJ4EZItGRjlD0,76730
8
+ PetThermoTools/Melting.py,sha256=19rFcTegaB04Dx3bsclbLdjzlegJHGlMRn2QnccLqQw,15718
9
+ PetThermoTools/Path.py,sha256=MOQMN9jIBbSsqXD1BCHsWoMPOWphqCYCKQvmm88mltA,39580
10
+ PetThermoTools/Path_wrappers.py,sha256=Ht-hAxrJvHq6jc8M5LEL319n47zinOu_rCvvaM5G4Lg,30260
11
11
  PetThermoTools/PhaseDiagrams.py,sha256=sjjX84LK34m_OjsKCV78zpzRDAXG7oaLu_Z5BxwB_3I,30298
12
12
  PetThermoTools/Plotting.py,sha256=KxBNT2nqqrVn9dsAIjGk1hMUVRq7r-WrG_b9quNcRMo,37295
13
13
  PetThermoTools/Saturation.py,sha256=3liK4WDVtl5DWpMpE_tQ_fONBCZTctkiNeCXCuNmXoM,29961
14
14
  PetThermoTools/__init__.py,sha256=PbiwQj_mNNEwuIZOLETmtMMshiXa50wjCA6mfvpOpOs,2393
15
- PetThermoTools/_version.py,sha256=68l4yYMIdTzlrR6yCoKXpHFZ6zlV-3fLMMyjvwsFwQ4,296
16
- PetThermoTools-0.2.43.dist-info/LICENSE.txt,sha256=-mkx4iEw8Pk1RZUvncBhGLW87Uur5JB7FBQtOmX-VP0,1752
17
- PetThermoTools-0.2.43.dist-info/METADATA,sha256=z0BojW2W4owvI6xRKBBidPHO-o7w83BXy-5AtFQVE1c,773
18
- PetThermoTools-0.2.43.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
- PetThermoTools-0.2.43.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
20
- PetThermoTools-0.2.43.dist-info/RECORD,,
15
+ PetThermoTools/_version.py,sha256=aO6nD2-_TYFrY_TLmEbkDg2SutbHKOk3GYXyyizX_b4,296
16
+ PetThermoTools-0.2.45.dist-info/LICENSE.txt,sha256=-mkx4iEw8Pk1RZUvncBhGLW87Uur5JB7FBQtOmX-VP0,1752
17
+ PetThermoTools-0.2.45.dist-info/METADATA,sha256=GDY65Q6Z12Ur8VgA8YxG_ZMsS8Zl_EBE0dA72cXbfDU,773
18
+ PetThermoTools-0.2.45.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
+ PetThermoTools-0.2.45.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
20
+ PetThermoTools-0.2.45.dist-info/RECORD,,