Skip to content

Commit c2f2304

Browse files
committed
pickle phase diagram
1 parent 7207aed commit c2f2304

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

contrib/perplex/create_phase_diagram.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from perplex_utils import pretty_plot_phase_diagram
99

1010
import matplotlib.pyplot as plt
11+
import pickle
1112

1213

1314
def run_perplex(
@@ -266,13 +267,20 @@ def run_perplex(
266267
mask_polygon=mask_polygon,
267268
)
268269

269-
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:
270272
for i, small_field in enumerate(small_fields):
271273
line = f"{i+1}: {small_field}"
272274
print(line)
273275
f.write(f"{line}\n")
274276

275-
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+
276284
plt.show()
277285

278286
print("Processing complete.")

0 commit comments

Comments
 (0)