PetThermoTools 0.2.28__py3-none-any.whl → 0.2.30__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.
@@ -220,7 +220,11 @@ def stich(Res, multi = None, Model = None, Frac_fluid = None, Frac_solid = None)
220
220
  Result = stich_work(Results = Result, Order = Order, Model = "MELTS", Frac_fluid = Frac_fluid, Frac_solid = Frac_solid)
221
221
  Results[Ind] = Result.copy()
222
222
  else:
223
- Order = ['SiO2', 'TiO2', 'Al2O3', 'Cr2O3', 'FeOt', 'MgO', 'CaO', 'Na2O', 'K2O', 'H2O', 'Fe3Fet']
223
+ if Model == "Weller2024":
224
+ Order = ['SiO2', 'TiO2', 'Al2O3', 'Cr2O3', 'FeOt', 'MgO', 'CaO', 'Na2O', 'K2O', 'Fe3Fet']
225
+ else:
226
+ Order = ['SiO2', 'TiO2', 'Al2O3', 'Cr2O3', 'FeOt', 'MgO', 'CaO', 'Na2O', 'K2O', 'H2O', 'Fe3Fet']
227
+
224
228
  if multi is None:
225
229
  Results = stich_work(Results = Results, Order = Order, Model = "Holland", Frac_fluid = Frac_fluid, Frac_solid = Frac_solid)
226
230
  else:
PetThermoTools/Liq.py CHANGED
@@ -15,20 +15,21 @@ from tqdm.notebook import tqdm, trange
15
15
  def equilibrate_multi(cores = None, Model = None, bulk = None, T_C = None, P_bar = None,
16
16
  Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, fO2_buffer = None, fO2_offset = None,
17
17
  timeout = None, copy_columns = None, Suppress = None):
18
-
19
- try:
20
- from meltsdynamic import MELTSdynamic
21
- except:
22
- 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')
18
+
19
+ if "MELTS" in Model:
20
+ try:
21
+ from meltsdynamic import MELTSdynamic
22
+ except:
23
+ 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')
23
24
 
24
25
  comp = bulk.copy()
25
26
 
26
27
  if Model is None:
27
28
  Model = "MELTSv1.0.2"
28
29
 
29
- if Model == "Holland":
30
- import pyMAGEMINcalc as MM
31
- print('pyMAGEMinCalc version: ' + str(MM.__version__))
30
+ # if Model == "Holland":
31
+ # import pyMAGEMINcalc as MM
32
+ # print('pyMAGEMinCalc version: ' + str(MM.__version__))
32
33
 
33
34
  if cores is None:
34
35
  cores = multiprocessing.cpu_count()
@@ -336,13 +337,18 @@ def equilibrate_multi(cores = None, Model = None, bulk = None, T_C = None, P_bar
336
337
  except:
337
338
  continue
338
339
  else:
339
- if len(qs[0]) > 0:
340
- Output, index = qs[0]
341
- Output = Results[0]
342
- Affinity = Results[1]
343
-
344
- if "MELTS" in Model:
345
- Output = stich(Output, Model = Model)
340
+ # try:
341
+ Results, index = qs[0]
342
+ Output = Results[0]
343
+ Affinity = pd.DataFrame([Results[1]])
344
+ Af_Combined = Affinity.copy()
345
+
346
+ if "MELTS" in Model:
347
+ Output = stich(Output, Model = Model)
348
+
349
+ Combined = Output['All'].copy()
350
+ # except:
351
+ # return Output
346
352
 
347
353
  if copy_columns is not None:
348
354
  if type(copy_columns) == str:
@@ -360,7 +366,22 @@ def equilibrate_multi(cores = None, Model = None, bulk = None, T_C = None, P_bar
360
366
  # Affinity = Af_Combined.copy()
361
367
  return Combined
362
368
  else:
363
- Output = MM.equilibrate_multi(P_bar = P_bar, T_C = T_C, comp = comp)
369
+ import julia
370
+ from julia.api import Julia
371
+ jl = Julia(compiled_modules=False)
372
+ from julia import MAGEMinCalc
373
+ # Output = MM.equilibrate_multi(P_bar = P_bar, T_C = T_C, comp = comp)
374
+
375
+ comp['O'] = comp['Fe3Fet_Liq']*(((159.59/2)/71.844)*comp['FeOt_Liq'] - comp['FeOt_Liq'])
376
+
377
+ if Model == "Weller2024":
378
+ bulk = comp[['SiO2_Liq', 'Al2O3_Liq', 'CaO_Liq', 'MgO_Liq', 'FeOt_Liq', 'K2O_Liq', 'Na2O_Liq', 'TiO2_Liq', 'O', 'Cr2O3_Liq']].astype(float).values
379
+ else:
380
+ bulk = comp[['SiO2_Liq', 'Al2O3_Liq', 'CaO_Liq', 'MgO_Liq', 'FeOt_Liq', 'K2O_Liq', 'Na2O_Liq', 'TiO2_Liq', 'O', 'Cr2O3_Liq', 'H2O_Liq']].astype(float).values
381
+
382
+ print(np.shape(bulk))
383
+
384
+ Output = MAGEMinCalc.equilibrate(bulk = bulk, P_kbar = P_bar/1000.0, T_C = T_C, fo2_buffer = fO2_buffer, fo2_offset = fO2_offset, Model = Model)
364
385
  Combined = stich(Output, Model = Model)
365
386
 
366
387
  if copy_columns is not None:
@@ -796,7 +817,7 @@ def findLiq(q, index,*, Model = None, P_bar = None, T_initial_C = None, comp = N
796
817
 
797
818
  Model: string
798
819
  "MELTS" or "Holland". Dictates whether MELTS or MAGEMin calculations are performed. Default "MELTS".
799
- Version of melts can be specified by additing "v1.0.1", "v1.1.0", "v1.2.0", or "p" to "MELTS". Default "v.1.0.1".
820
+ Version of melts can be specified by additing "v1.0.2", "v1.1.0", "v1.2.0", or "p" to "MELTS". Default "v.1.0.2".
800
821
 
801
822
  P_bar: float
802
823
  Specifies the pressure of the calculation (bar).
PetThermoTools/MELTS.py CHANGED
@@ -88,11 +88,11 @@ def equilibrate_MELTS(Model = None, P_bar = None, T_C = None, comp = None,
88
88
 
89
89
  for R in Results['Conditions']:
90
90
  if R == 'temperature':
91
- Results['Conditions'][R].loc[0] = melts.engine.temperature
91
+ Results['Conditions'].loc[0,R] = melts.engine.temperature
92
92
  elif R == 'pressure':
93
- Results['Conditions'][R].loc[0] = melts.engine.pressure
93
+ Results['Conditions'].loc[0,R] = melts.engine.pressure
94
94
  else:
95
- Results['Conditions'][R].loc[0] = melts.engine.getProperty(R, 'bulk')
95
+ Results['Conditions'].loc[0,R] = melts.engine.getProperty(R, 'bulk')
96
96
 
97
97
  for phase in PhaseList:
98
98
  if phase not in list(Results.keys()):
@@ -100,7 +100,7 @@ def equilibrate_MELTS(Model = None, P_bar = None, T_C = None, comp = None,
100
100
  Results[phase + '_prop'] = pd.DataFrame(data = np.zeros((length, 5)), columns = ['g','h', 'mass', 'v', 'rho'])
101
101
 
102
102
  for el in Results[phase]:
103
- Results[phase][el].loc[0] = melts.engine.getProperty('dispComposition', phase, el)
103
+ Results[phase].loc[0,el] = melts.engine.getProperty('dispComposition', phase, el)
104
104
 
105
105
  for pr in Results[phase + '_prop']:
106
106
  Results[phase + '_prop'][pr].loc[0] = melts.engine.getProperty(pr, phase)
PetThermoTools/Path.py CHANGED
@@ -145,6 +145,10 @@ def multi_path(cores = None, Model = None, bulk = None, comp = None, Frac_solid
145
145
  if fO2_buffer != "FMQ":
146
146
  raise Warning("fO2 buffer specified is not an allowed input. This argument can only be 'FMQ' or 'NNO' \n if you want to offset from these buffers use the 'fO2_offset' argument.")
147
147
 
148
+ if "MELTS" not in Model:
149
+ if fO2_buffer == "FMQ":
150
+ fO2_buffer = "qfm"
151
+
148
152
  # ensure the bulk composition has the correct headers etc.
149
153
  comp = comp_fix(Model = Model, comp = comp, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq)
150
154
 
@@ -620,12 +624,23 @@ def path(q, index, *, Model = None, comp = None, Frac_solid = None, Frac_fluid =
620
624
 
621
625
  return
622
626
 
623
- if Model == "Holland":
624
- import pyMAGEMINcalc as MM
625
- try:
626
- Results = MM.path(comp = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_C = T_C, T_path_C = T_path_C, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C, P_bar = P_bar, P_path_bar = P_path_bar, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset)
627
- q.put([Results, index])
628
- except:
629
- q.put([])
630
- return
627
+ if "MELTS" not in Model:
628
+ import julia
629
+ from julia.api import Julia
630
+ jl = Julia(compiled_modules=False)
631
+ from julia import MAGEMinCalc
632
+ # import pyMAGEMINcalc as MM
633
+ # try:
634
+ # Results = MM.path(Model = Model, comp = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_C = T_C, T_path_C = T_path_C, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C, P_bar = P_bar, P_path_bar = P_path_bar, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset)
635
+ if Frac_solid is None:
636
+ Frac_solid = False
637
+
638
+ Results = MAGEMinCalc.path(comp = comp, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C,
639
+ T_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar,
640
+ P_bar = P_bar, T_path_C = T_path_C, P_path_bar = P_path_bar, frac_xtal = Frac_solid,
641
+ Model = Model, fo2_buffer = fO2_buffer, fo2_offset = fO2_offset, find_liquidus = find_liquidus)
642
+ q.put([Results, index])
643
+ # except:
644
+ # q.put([])
645
+ # return
631
646
 
@@ -148,12 +148,22 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
148
148
  j = j + 1
149
149
 
150
150
  for i in range(cores):
151
+ # if "MELTS" in Model:
151
152
  T_path_C = np.array(subarrays_T[i])#T_flat[i*A:(i+1)*A]
152
153
  P_path_bar = np.array(subarrays_P[i])#P_flat[i*A:(i+1)*A]
154
+ # else:
155
+ # T_path_C = subarrays_T[i]
156
+ # P_path_bar = subarrays_P[i]
157
+
153
158
 
154
- if len(T_path_C) > 150:
155
- T_path_C = T_path_C[:99]
156
- P_path_bar = P_path_bar[:99]
159
+ if "MELTS" in Model:
160
+ if len(T_path_C) > 150:
161
+ T_path_C = T_path_C[:99]
162
+ P_path_bar = P_path_bar[:99]
163
+ else:
164
+ if len(T_path_C) > 300:
165
+ T_path_C = T_path_C[:249]
166
+ P_path_bar = P_path_bar[:249]
157
167
 
158
168
  if "MELTS" in Model:
159
169
  if j % 3 == 0:
@@ -165,6 +175,10 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
165
175
  T_path_C = np.flip(T_path_C)
166
176
  P_path_bar = np.flip(P_path_bar)
167
177
 
178
+ # if "MELTS" not in Model:
179
+ # T_path_C = T_path_C.tolist()
180
+ # P_path_bar = P_path_bar.tolist()
181
+
168
182
  # if j > 5:
169
183
  # com = list(zip(T, P))
170
184
 
@@ -182,7 +196,11 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
182
196
  ps.append(p)
183
197
  p.start()
184
198
 
185
- TIMEOUT = 120
199
+ if "MELTS" in Model:
200
+ TIMEOUT = 240
201
+ else:
202
+ TIMEOUT = 900
203
+
186
204
  start = time.time()
187
205
  first = True
188
206
  for p in ps:
@@ -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.28'
8
+ __version__ = '0.2.30'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.28
3
+ Version: 0.2.30
4
4
  Summary: PetThermoTools
5
5
  Home-page: https://github.com/gleesonm1/PetThermoTools
6
6
  Author: Matthew Gleeson
@@ -1,19 +1,19 @@
1
1
  PetThermoTools/Barom.py,sha256=RmFT7HQ2htKrrnzLNBU1HiVN88LU82Am3cEKByxo_6o,44439
2
2
  PetThermoTools/Compositions.py,sha256=65NzfduzWdfHJ8VmHBN1Cv7fMz7kF3QbDVLei-e4v00,1483
3
- PetThermoTools/GenFuncs.py,sha256=3S0uWXgfFuyL8SvJOEXbLCynpBa9jngjuekFsR-PoCU,16257
3
+ PetThermoTools/GenFuncs.py,sha256=u2GWqH--Wmqd0WXHxfulEAatQb6uswjl1s9SyyoHSa8,16412
4
4
  PetThermoTools/Holland.py,sha256=udBFeVUyTBpSfLIhx7Hy6o0I8ApNCDvwU_gZa0diY5w,7251
5
5
  PetThermoTools/Installation.py,sha256=UfVOW1NZFdzMWPyID5u7t0KwvpJA0AqYohzidXIAwYs,6098
6
- PetThermoTools/Liq.py,sha256=ze5H0wWFkhek6TDIripWaEZMk9dkWZi1PFQ07onoNyM,34053
7
- PetThermoTools/MELTS.py,sha256=MX9LqW9GpO-P7qI7wxYx7LRIZEi3WGi1CUS5qLt5_6c,72265
6
+ PetThermoTools/Liq.py,sha256=I-vYp2i7CpQjzoo-nZ8gQNTP5jrao6pZtmkmwLtjodY,35043
7
+ PetThermoTools/MELTS.py,sha256=wx_j2a63sJcm8dRePVrLzc0XcpngAr7mLHewPe4ODUs,72261
8
8
  PetThermoTools/Melting.py,sha256=iQpSXXDhwfEUTlHa80-XFK1lahb_VNrLW8ISbVCE8lY,10773
9
- PetThermoTools/Path.py,sha256=8Fwm8bQlI9yZqzRd8az0QS8j-_yzd4jMzMg-o3b_5KU,31841
9
+ PetThermoTools/Path.py,sha256=RChQYqDayqc0hVugmX3j3uE1x2BvWIfcINFqcqwrRxw,32642
10
10
  PetThermoTools/Path_wrappers.py,sha256=_0pBs_cK2hICxAHkYxKXICUnUEBSiUg07-qhgBeuTdc,26555
11
- PetThermoTools/PhaseDiagrams.py,sha256=TIArnYLvQSQEP5PN9PYoPt1ZJFMLIqygUcPQnHoEkXQ,30001
11
+ PetThermoTools/PhaseDiagrams.py,sha256=J3-h5N2K2uByahgWuBxkvajpx7j_2MJ7QuxEswp3f6Y,30558
12
12
  PetThermoTools/Plotting.py,sha256=biM4QJFCH6xVDpK-nG2oAIGIFFJCzBt5Uez6XzTFiGY,28107
13
13
  PetThermoTools/Saturation.py,sha256=XXY6fKVouQM3RLgQgXur4xSq7_uGp7bCw_k7NNlWYi8,14095
14
14
  PetThermoTools/__init__.py,sha256=PbiwQj_mNNEwuIZOLETmtMMshiXa50wjCA6mfvpOpOs,2393
15
- PetThermoTools/_version.py,sha256=a-zOM1hoieIeENa8fbKnOrGVzjc3buA32iKNp_vKvjs,296
16
- PetThermoTools-0.2.28.dist-info/METADATA,sha256=3bnTAx5hdRLz5A0LJZtypGr6VMMNVRwZeAe6kdYumqs,796
17
- PetThermoTools-0.2.28.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
- PetThermoTools-0.2.28.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
19
- PetThermoTools-0.2.28.dist-info/RECORD,,
15
+ PetThermoTools/_version.py,sha256=7vyciDXWjHOhht0C35bFPf-Y7bGUJN5nWlLPX5LfaZE,296
16
+ PetThermoTools-0.2.30.dist-info/METADATA,sha256=20BfknXMVWrNDBAHX9ypKqU_y1B70KHD7ve3xrpbiw4,796
17
+ PetThermoTools-0.2.30.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
+ PetThermoTools-0.2.30.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
19
+ PetThermoTools-0.2.30.dist-info/RECORD,,