Skip to content

Commit

Permalink
Swap matplotlib backend to fix plt.close freezes
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Lichtinger committed Jan 27, 2023
1 parent 56c60b7 commit 735d9ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions PyMEMENTO/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

import warnings

# Using the pdf backend for matplotlib to avoid plot close freezing when doing memory intensive runs
# Not sure at this stage whether this is a temporary bug in matplotlib, but it seems to fixthe problem and has no downside
import matplotlib
matplotlib.use('pdf')


# Check whether Modeller is installed, if not, throw error and abort
try:
import modeller
Expand Down
2 changes: 1 addition & 1 deletion PyMEMENTO/mc_path_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def run_monte_carlo(
plt.ylabel("Energy proxy for path RMSD of RMSDs")
plt.xlabel("MC step")
plt.savefig(local_path + "trajectory.pdf")
plt.clf()
plt.close()

# Write full trajectory and energies to file
np.savetxt(local_path + "mc_energies.dat", energy_progression)
Expand Down

0 comments on commit 735d9ea

Please sign in to comment.