PetThermoTools 0.2.37__tar.gz → 0.2.38__tar.gz

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.
Files changed (25) hide show
  1. {PetThermoTools-0.2.37/src/PetThermoTools.egg-info → PetThermoTools-0.2.38}/PKG-INFO +1 -1
  2. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/GenFuncs.py +25 -0
  3. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Path.py +8 -112
  4. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/_version.py +1 -1
  5. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38/src/PetThermoTools.egg-info}/PKG-INFO +1 -1
  6. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/LICENSE.txt +0 -0
  7. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/README.md +0 -0
  8. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/setup.cfg +0 -0
  9. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/setup.py +0 -0
  10. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Barom.py +0 -0
  11. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Compositions.py +0 -0
  12. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Holland.py +0 -0
  13. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Installation.py +0 -0
  14. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Liq.py +0 -0
  15. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/MELTS.py +0 -0
  16. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Melting.py +0 -0
  17. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Path_wrappers.py +0 -0
  18. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/PhaseDiagrams.py +0 -0
  19. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Plotting.py +0 -0
  20. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/Saturation.py +0 -0
  21. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools/__init__.py +0 -0
  22. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools.egg-info/SOURCES.txt +0 -0
  23. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools.egg-info/dependency_links.txt +0 -0
  24. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools.egg-info/requires.txt +0 -0
  25. {PetThermoTools-0.2.37 → PetThermoTools-0.2.38}/src/PetThermoTools.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.37
3
+ Version: 0.2.38
4
4
  Summary: PetThermoTools
5
5
  Home-page: https://github.com/gleesonm1/PetThermoTools
6
6
  Author: Matthew Gleeson
@@ -46,6 +46,31 @@ Names_MM = {'liq1': '_Liq',
46
46
  'spn1': '_Sp',
47
47
  'spn2': '_Sp2'}
48
48
 
49
+ def label_results(Result,label):
50
+ Results = Result.copy()
51
+ new_out = {}
52
+ if label == "CO2":
53
+ for r in Results:
54
+ new_out['CO2 = ' + str(Results[r]['Input']['comp']['CO2_Liq']) + ' wt%'] = Results[r].copy()
55
+ new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
56
+ elif label == "pressure" or label == "P" or label == "P_bar":
57
+ for r in Results:
58
+ new_out['P = ' + str(Results[r]['Input']['P_bar']) + ' bars'] = Results[r].copy()
59
+ new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
60
+ elif label == "fO2":
61
+ for r in Results:
62
+ new_out['fO2 = ' + Results[r]['Input']['fO2_buffer'] + ' ' + str(round(Results[r]['Input']['fO2_offset'],2))] = Results[r].copy()
63
+ new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[2])))
64
+ elif label == 'H2O':
65
+ for r in Results:
66
+ new_out['H2O = ' + str(Results[r]['Input']['comp']['H2O_Liq']) + ' wt%'] = Results[r].copy()
67
+ new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
68
+
69
+ if len(new_out) == 0:
70
+ new_out = Results.copy()
71
+
72
+ return new_out
73
+
49
74
  def supCalc(Model = "MELTSv1.0.2", bulk = None, phase = None, T_C = None, P_bar = None,
50
75
  Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, fO2_buffer = None, fO2_offset = None,
51
76
  melts = None):
@@ -117,10 +117,8 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
117
117
  Dictionary where each entry represents the results of a single calculation. Within the dictionary each single calculation is reported as a series of pandas DataFrames, displaying the composition and thermodynamic properties of each phase.
118
118
 
119
119
  '''
120
- try:
121
- from meltsdynamic import MELTSdynamic
122
- except:
123
- Warning('alphaMELTS for Python files are not on the python path. \n Please add these files to the path running \n import sys \n sys.path.append(r"insert_your_path_to_melts_here") \n You are looking for the location of the meltsdynamic.py file')
120
+ if timeout is None:
121
+ timeout = 180
124
122
 
125
123
  timeout_main = timeout
126
124
 
@@ -137,6 +135,12 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
137
135
  if Model is None:
138
136
  Model == "MELTSv1.0.2"
139
137
 
138
+ if "MELTS" in Model:
139
+ try:
140
+ from meltsdynamic import MELTSdynamic
141
+ except:
142
+ Warning('alphaMELTS for Python files are not on the python path. \n Please add these files to the path running \n import sys \n sys.path.append(r"insert_your_path_to_melts_here") \n You are looking for the location of the meltsdynamic.py file')
143
+
140
144
  # if comp is entered as a pandas series, it must first be converted to a dict
141
145
  if type(comp) == pd.core.series.Series:
142
146
  comp = comp.to_dict()
@@ -357,89 +361,6 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
357
361
  results = combined_results
358
362
 
359
363
  Results = stich(Res=results, multi=True, Model=Model, Frac_fluid = Frac_fluid, Frac_solid = Frac_solid)
360
-
361
- # for j in tqdm(range(len(Group))):
362
- # ps = []
363
-
364
- # if Print_suppress is None:
365
- # print("Running " + Model + " calculations " + str(int(cores*j)) + " to " + str(int(cores*j) + Group[j] - 1) + " ...", end = "", flush = True)
366
- # s = time.time()
367
-
368
- # for i in range(int(cores*j), int(cores*j + Group[j])):
369
- # if type(comp) == dict:
370
- # p = Process(target = path, args = (q, i),
371
- # kwargs = {'Model': Model, 'comp': comp, 'Frac_solid': Frac_solid, 'Frac_fluid': Frac_fluid,
372
- # 'T_C': T_C[i], 'T_path_C': T_path_C[i], 'T_start_C': T_start_C[i], 'T_end_C': T_end_C[i], 'dt_C': dt_C[i],
373
- # 'P_bar': P_bar[i], 'P_path_bar': P_path_bar[i], 'P_start_bar': P_start_bar[i], 'P_end_bar': P_end_bar[i], 'dp_bar': dp_bar[i],
374
- # 'isenthalpic': isenthalpic, 'isentropic': isentropic, 'isochoric': isochoric, 'find_liquidus': find_liquidus,
375
- # 'fO2_buffer': fO2_buffer, 'fO2_offset': fO2_offset[i], 'fluid_sat': fluid_sat, 'Crystallinity_limit': Crystallinity_limit,
376
- # 'Suppress': Suppress, 'Suppress_except': Suppress_except})
377
- # else:
378
- # p = Process(target = path, args = (q, i),
379
- # kwargs = {'Model': Model, 'comp': comp.loc[i].to_dict(), 'Frac_solid': Frac_solid, 'Frac_fluid': Frac_fluid,
380
- # 'T_C': T_C[i], 'T_path_C': T_path_C[i], 'T_start_C': T_start_C[i], 'T_end_C': T_end_C[i], 'dt_C': dt_C[i],
381
- # 'P_bar': P_bar[i], 'P_path_bar': P_path_bar[i], 'P_start_bar': P_start_bar[i], 'P_end_bar': P_end_bar[i], 'dp_bar': dp_bar[i],
382
- # 'isenthalpic': isenthalpic, 'isentropic': isentropic, 'isochoric': isochoric, 'find_liquidus': find_liquidus,
383
- # 'fO2_buffer': fO2_buffer, 'fO2_offset': fO2_offset[i], 'fluid_sat': fluid_sat, 'Crystallinity_limit': Crystallinity_limit,
384
- # 'Suppress': Suppress, 'Suppress_except': Suppress_except})
385
-
386
- # ps.append(p)
387
- # p.start()
388
-
389
- # if timeout is None:
390
- # TIMEOUT = 240
391
- # else:
392
- # TIMEOUT = timeout
393
-
394
- # start = time.time()
395
- # first = True
396
- # for p in ps:
397
- # if time.time() - start < TIMEOUT - 10:
398
- # try:
399
- # ret = q.get(timeout = TIMEOUT - (time.time()-start) + 10)
400
- # except:
401
- # ret = []
402
- # else:
403
- # if first == True:
404
- # print('Timeout Reached - this likely indicates the calculation failed. \n You can try increasing the timeout limit using the "timeout" kwarg.')
405
- # first = False
406
- # try:
407
- # ret = q.get(timeout = 10)
408
- # except:
409
- # ret = []
410
-
411
- # qs.append(ret)
412
-
413
- # TIMEOUT = 5
414
- # start = time.time()
415
- # for p in ps:
416
- # if p.is_alive():
417
- # while time.time() - start <= TIMEOUT:
418
- # if not p.is_alive():
419
- # p.join()
420
- # p.terminate()
421
- # break
422
- # time.sleep(.1)
423
- # else:
424
- # p.terminate()
425
- # p.join(5)
426
- # else:
427
- # p.join()
428
- # p.terminate()
429
-
430
- # if Print_suppress is None:
431
- # print(" Complete (time taken = " + str(round(time.time() - s,2)) + " seconds)", end = "\n", flush = True)
432
-
433
-
434
- # Results = {}
435
- # Out = {}
436
- # for i in range(len(qs)):
437
- # if len(qs[i]) > 0:
438
- # Res, index = qs[i]
439
- # Results['index = ' + str(index)] = Res
440
-
441
- #if "MELTS" in Model:
442
- # Results = stich(Results, multi = True, Model = Model, Frac_fluid = Frac_fluid, Frac_solid = Frac_solid)
443
364
 
444
365
  for r in Results:
445
366
  i = int(r.split('=')[1].strip())
@@ -464,31 +385,6 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
464
385
  else:
465
386
  return Results
466
387
 
467
- def label_results(Result,label):
468
- Results = Result.copy()
469
- new_out = {}
470
- if label == "CO2":
471
- for r in Results:
472
- new_out['CO2 = ' + str(Results[r]['Input']['comp']['CO2_Liq']) + ' wt%'] = Results[r].copy()
473
- new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
474
- elif label == "pressure" or label == "P" or label == "P_bar":
475
- for r in Results:
476
- new_out['P = ' + str(Results[r]['Input']['P_bar']) + ' bars'] = Results[r].copy()
477
- new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
478
- elif label == "fO2":
479
- for r in Results:
480
- new_out['fO2 = ' + Results[r]['Input']['fO2_buffer'] + ' ' + str(round(Results[r]['Input']['fO2_offset'],2))] = Results[r].copy()
481
- new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[2])))
482
- elif label == 'H2O':
483
- for r in Results:
484
- new_out['H2O = ' + str(Results[r]['Input']['comp']['H2O_Liq']) + ' wt%'] = Results[r].copy()
485
- new_out = dict(sorted(new_out.items(), key=lambda x: float(x[0].split('=')[1].split(' ')[1])))
486
-
487
- if len(new_out) == 0:
488
- new_out = Results.copy()
489
-
490
- return new_out
491
-
492
388
  def path_multi(q, index, *, Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
493
389
  T_C = None, T_path_C = None, T_start_C = None, T_end_C = None, dt_C = None,
494
390
  P_bar = None, P_path_bar = None, P_start_bar = None, P_end_bar = None, dp_bar = None,
@@ -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.37'
8
+ __version__ = '0.2.38'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.37
3
+ Version: 0.2.38
4
4
  Summary: PetThermoTools
5
5
  Home-page: https://github.com/gleesonm1/PetThermoTools
6
6
  Author: Matthew Gleeson