Skip to content

Commit

Permalink
set plotting dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mlincett committed Oct 17, 2023
1 parent 53eab6a commit 2e44617
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions skyreader/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ def check_result(self):
for k in self.result:
if "nside-" not in k:
raise RuntimeError("\"nside\" not in result file..")

PLOT_DIR = Path("./output/plots")
PLOT_DIR.mkdir(exist_ok=True)

@staticmethod
# Calculates are using Gauss-Green theorem / shoelace formula
Expand Down Expand Up @@ -821,7 +824,7 @@ def create_plot(self, dozoom = False):

print(f"saving: {plot_filename}...")

fig.savefig(plot_filename, dpi=dpi, transparent=True)
fig.savefig(self.PLOT_DIR / plot_filename, dpi=dpi, transparent=True)

print("done.")

Expand Down Expand Up @@ -1150,7 +1153,7 @@ def bounding_box(ra, dec, theta, phi):
savename = unique_id + ".contour_" + val + ".txt"
try:
print("Dumping to", savename)
ascii.write(tab, savename, overwrite=True)
ascii.write(tab, self.PLOT_DIR / savename, overwrite=True)
except OSError as err:
print("OS Error prevented contours from being written, maybe a memory issue.")
print(err)
Expand Down Expand Up @@ -1215,7 +1218,7 @@ def bounding_box(ra, dec, theta, phi):
# Save the figure
print("saving: {0}...".format(plot_filename))
#ax.invert_xaxis()
fig.savefig(plot_filename, dpi=dpi, transparent=True)
fig.savefig(self.PLOT_DIR / plot_filename, dpi=dpi, transparent=True)

print("done.")

Expand Down

0 comments on commit 2e44617

Please sign in to comment.