11import os
22import shutil
3-
3+ import numpy as np
44import burnman
55from perplex_utils import databases , make_build_file
66from perplex_utils import run_vertex , run_pssect
77from perplex_utils import create_mode_table
88from perplex_utils import pretty_plot_phase_diagram
99
1010import matplotlib .pyplot as plt
11+ import pickle
1112
1213
1314def run_perplex (
@@ -71,25 +72,11 @@ def run_perplex(
7172 "molar" ,
7273 ),
7374 "harzburgite" : burnman .Composition (
74- {
75- "SiO2" : 36.07 ,
76- "MgO" : 56.51 ,
77- "FeO" : 6.07 ,
78- "CaO" : 0.81 ,
79- "Al2O3" : 0.53 ,
80- "Na2O" : 0.001 ,
81- },
75+ {"SiO2" : 36.07 , "MgO" : 56.51 , "FeO" : 6.07 , "CaO" : 0.81 , "Al2O3" : 0.53 },
8276 "molar" ,
8377 ),
8478 "modified_harzburgite" : burnman .Composition (
85- {
86- "SiO2" : 36.04 ,
87- "MgO" : 56.54 ,
88- "FeO" : 5.97 ,
89- "CaO" : 0.79 ,
90- "Al2O3" : 0.65 ,
91- "Na2O" : 0.001 ,
92- },
79+ {"SiO2" : 36.04 , "MgO" : 56.54 , "FeO" : 5.97 , "CaO" : 0.79 , "Al2O3" : 0.65 },
9380 "molar" ,
9481 ),
9582}
@@ -100,15 +87,15 @@ def run_perplex(
10087 project_name = "basalt"
10188 database = databases ["stx21" ]
10289 composition = compositions [project_name ]
103- pressure_range_total = [1.0e5 , 140.0e9 ]
104- temperature_range_total = [200.0 , 3000 .0 ]
90+ pressure_range_total = [1.0 , 140.0e9 ]
91+ temperature_range_total = [200.0 , 4000 .0 ]
10592
10693 # Split pressure and temperature so that PerpleX
10794 # no temperature splits seems to make diagram with
10895 # less prominent discontinuities
109- n_pressures_per_split = 121
110- n_temperatures_per_split = 601
111- n_splits_pressure = 14
96+ n_pressures_per_split = 101
97+ n_temperatures_per_split = 761
98+ n_splits_pressure = 28
11299 n_splits_temperature = 1
113100
114101 # If this script has already been run, and you just want to
@@ -258,6 +245,10 @@ def run_perplex(
258245
259246 modes_filenames .append (split_project_name + "_modes.dat" )
260247
248+ mask_polygon = np .array (
249+ [[0.0 , 2150.0 ], [12.0e9 , 4000.0001 ], [0.0 , 4000.001 ], [0.0 , 2150.0 ]]
250+ )
251+
261252 fig = plt .figure (figsize = (12 , 8 ))
262253 ax = fig .add_subplot (1 , 1 , 1 )
263254
@@ -273,15 +264,23 @@ def run_perplex(
273264 label_scaling = 3.0 ,
274265 label_clearance = 0.01 ,
275266 number_small_fields = True ,
267+ mask_polygon = mask_polygon ,
276268 )
277269
278- with open (f"{ project_name } _field_ids.txt" , "w" ) as f :
270+ # Save the assemblage data for all the small fields
271+ with open (f"{ project_name } _phase_diagram_field_ids.txt" , "w" ) as f :
279272 for i , small_field in enumerate (small_fields ):
280273 line = f"{ i + 1 } : { small_field } "
281274 print (line )
282275 f .write (f"{ line } \n " )
283276
284- fig .savefig (f"{ project_name } .pdf" )
277+ # Save figure as a pdf
278+ fig .savefig (f"{ project_name } _phase_diagram.pdf" )
279+
280+ # Save figure as a pickle file to reload later
281+ with open (f"{ project_name } _phase_diagram.pkl" , "wb" ) as f :
282+ pickle .dump (fig , f )
283+
285284 plt .show ()
286285
287286 print ("Processing complete." )
0 commit comments