Skip to content

Commit

Permalink
Fix output dir creation
Browse files Browse the repository at this point in the history
  • Loading branch information
william-galvin committed Dec 27, 2023
1 parent 228a9e0 commit f7942a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pennylane/vqe_pennylane/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import argparse
import os

from pennylane import numpy as np
import numpy
Expand Down Expand Up @@ -108,6 +109,9 @@ def cost_fn(param):
plt.xticks(fontsize=12)
plt.yticks(fontsize=12)

if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)

plt.savefig(f"{args.output_dir}/plot.png")
print(f"\nPlot saved at {args.output_dir}/plot.png")

Expand Down

0 comments on commit f7942a8

Please sign in to comment.