PetThermoTools 0.2.29__py3-none-any.whl → 0.2.31__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()
@@ -365,7 +366,22 @@ def equilibrate_multi(cores = None, Model = None, bulk = None, T_C = None, P_bar
365
366
  # Affinity = Af_Combined.copy()
366
367
  return Combined
367
368
  else:
368
- 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)
369
385
  Combined = stich(Output, Model = Model)
370
386
 
371
387
  if copy_columns is not None:
@@ -801,7 +817,7 @@ def findLiq(q, index,*, Model = None, P_bar = None, T_initial_C = None, comp = N
801
817
 
802
818
  Model: string
803
819
  "MELTS" or "Holland". Dictates whether MELTS or MAGEMin calculations are performed. Default "MELTS".
804
- 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".
805
821
 
806
822
  P_bar: float
807
823
  Specifies the pressure of the calculation (bar).
PetThermoTools/MELTS.py CHANGED
@@ -911,21 +911,22 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
911
911
  bulk = list(100*np.array(bulk)/np.sum(bulk))
912
912
 
913
913
  if Suppress_except is False:
914
- if Suppress == "All":
915
- melts.engine.pressure = np.random.normal(500, 500/10)
916
- melts.engine.temperature = 1200 + 200
917
- melts.engine.setBulkComposition(bulk)
918
- PL = melts.engine.calcSaturationState()
919
- for p in PL:
920
- if p != "fluid":
921
- if p != "water":
922
- melts.engine.setSystemProperties("Suppress", p)
923
- else:
924
- if type(Suppress) == list:
925
- for p in Suppress:
926
- melts.engine.setSystemProperties("Suppress", p)
914
+ if Suppress is not None:
915
+ if Suppress == "All":
916
+ melts.engine.pressure = np.random.normal(500, 500/10)
917
+ melts.engine.temperature = 1200 + 200
918
+ melts.engine.setBulkComposition(bulk)
919
+ PL = melts.engine.calcSaturationState()
920
+ for p in PL:
921
+ if p != "fluid":
922
+ if p != "water":
923
+ melts.engine.setSystemProperties("Suppress", p)
927
924
  else:
928
- melts.engine.setSystemProperties("Suppress", Suppress)
925
+ if type(Suppress) == list:
926
+ for p in Suppress:
927
+ melts.engine.setSystemProperties("Suppress", p)
928
+ else:
929
+ melts.engine.setSystemProperties("Suppress", Suppress)
929
930
  else:
930
931
  melts.engine.pressure = np.random.normal(500, 500/10)
931
932
  melts.engine.temperature = 1200 + 200
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
- T_path_C = np.array(subarrays_T[i])#T_flat[i*A:(i+1)*A]
152
- P_path_bar = np.array(subarrays_P[i])#P_flat[i*A:(i+1)*A]
151
+ if "MELTS" in Model:
152
+ T_path_C = T_flat[i*A:(i+1)*A]
153
+ P_path_bar = P_flat[i*A:(i+1)*A]
154
+ else:
155
+ T_path_C = np.array(subarrays_T[i])
156
+ P_path_bar = np.array(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
 
@@ -177,12 +191,21 @@ def phaseDiagram_calc(cores = None, Model = None, bulk = None, T_C = None, P_bar
177
191
  # T_path_C = np.array(T_randomized)
178
192
  # P_path_bar = np.array(P_randomized)
179
193
 
180
- p = Process(target = path, args = (q,i), kwargs = {'Model': Model, 'comp': comp, 'T_path_C': T_path_C, 'P_path_bar': P_path_bar, 'fO2_buffer': fO2_buffer, 'fO2_offset': fO2_offset})
194
+ p = Process(target = path, args = (q,i), kwargs = {'Model': Model, 'comp': comp,
195
+ 'T_path_C': T_path_C,
196
+ 'P_path_bar': P_path_bar,
197
+ 'fO2_buffer': fO2_buffer,
198
+ 'fO2_offset': fO2_offset,
199
+ 'Suppress': ['rutile', 'tridymite']})
181
200
 
182
201
  ps.append(p)
183
202
  p.start()
184
203
 
185
- TIMEOUT = 120
204
+ if "MELTS" in Model:
205
+ TIMEOUT = 240
206
+ else:
207
+ TIMEOUT = 900
208
+
186
209
  start = time.time()
187
210
  first = True
188
211
  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.29'
8
+ __version__ = '0.2.31'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PetThermoTools
3
- Version: 0.2.29
3
+ Version: 0.2.31
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=ea7d02vEikkyzpbLvvmdhEf_iuPaOFWoHnXa3d_asZU,34191
7
- PetThermoTools/MELTS.py,sha256=wx_j2a63sJcm8dRePVrLzc0XcpngAr7mLHewPe4ODUs,72261
6
+ PetThermoTools/Liq.py,sha256=I-vYp2i7CpQjzoo-nZ8gQNTP5jrao6pZtmkmwLtjodY,35043
7
+ PetThermoTools/MELTS.py,sha256=-nkyo3yx7dZXVnRwZhlMRGCc5SkYSm1nP3qDbLDNNyY,72354
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=8S_BcqggBzfUbiCPcsJRWFBenGL4tcCevte3-ATQjQI,30884
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=dK2FGJmCrGM9Av6-fgBmVHvL4zeJu8qYhtvBvy-Q37I,296
16
- PetThermoTools-0.2.29.dist-info/METADATA,sha256=Y-ZngnaprlzGNRuhNavgtxolHOs2yts6docnquxtU5M,796
17
- PetThermoTools-0.2.29.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
- PetThermoTools-0.2.29.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
19
- PetThermoTools-0.2.29.dist-info/RECORD,,
15
+ PetThermoTools/_version.py,sha256=x3oJ2coFvekDMGQwrW7LzNxduPT9SxWIZWCKamBahjQ,296
16
+ PetThermoTools-0.2.31.dist-info/METADATA,sha256=TDZlBVXnbinSw2bKIR_YvA9KJqR4w2XxlqSGVEe4klg,796
17
+ PetThermoTools-0.2.31.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
+ PetThermoTools-0.2.31.dist-info/top_level.txt,sha256=IqK8iYBR3YJozzMOTRZ8x8mU2k6x8ycoMBxZTm-I06U,15
19
+ PetThermoTools-0.2.31.dist-info/RECORD,,