Skip to content

Commit

Permalink
fix: fix bugs with using pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Oct 30, 2024
1 parent 7c8ef09 commit fd73cbe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions examples/boxmodelcollisions/breakup.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def get_executable(path2build, kernel):

def get_params(path2build, kernel):
params = {
"setup_filename": str(path2build / "bin" / kernel + "_setup.txt"),
"stats_filename": str(path2build / "bin" / kernel + "_stats.txt"),
"zarrbasedir": str(path2build / "bin" / kernel + "_sol.zarr"),
"setup_filename": str(path2build / "bin" / Path(kernel + "_setup.txt")),
"stats_filename": str(path2build / "bin" / Path(kernel + "_stats.txt")),
"zarrbasedir": str(path2build / "bin" / Path(kernel + "_sol.zarr")),
}

return params
Expand Down Expand Up @@ -341,7 +341,7 @@ def blank_axis(ax, xlims, ylims):
for kernel in kernels:
t2plts = [0, 600, 1200, 1800, 2400]
xlims = [10, 5000]
savename = savefigpath / kernel + "_validation.png"
savename = savefigpath / Path(kernel + "_validation.png")
plot_onekernel_results(
gridfile,
path2build,
Expand Down
2 changes: 1 addition & 1 deletion examples/exampleplotting/plotssrc/animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def animate_me(
if saveani:
print(f"saving animation as {savename}.gif")
ani.save(
savename + ".gif",
f"{savename}.gif",
writer=animation.PillowWriter(fps=fps, bitrate=5000, codec="h264"),
dpi=100,
savefig_kwargs={"transparent": True},
Expand Down
3 changes: 2 additions & 1 deletion examples/fromfile/src/plot_output_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib import colors
from pathlib import Path


def plot_domain_thermodynamics_timeseries(time, gbxs, thermo, winds, savedir):
Expand Down Expand Up @@ -99,7 +100,7 @@ def plot_timeseries_domain_slices(
fig.tight_layout()

if savedir != "":
savename = savedir + "/timeseries_" + key + ".png"
savename = savedir / Path(f"timeseries_{key}.png")
fig.savefig(savename, dpi=400, bbox_inches="tight", facecolor="w", format="png")
print("Figure .png saved as: " + str(savename))
plt.show()
Expand Down
3 changes: 2 additions & 1 deletion examples/fromfile_irreg/src/plot_output_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib import colors
from pathlib import Path


def plot_domain_thermodynamics_timeseries(time, gbxs, thermo, winds, savedir):
Expand Down Expand Up @@ -97,7 +98,7 @@ def plot_timeseries_domain_slices(
plt.colorbar(pcm, cax=cax, orientation="horizontal")

if savedir != "":
savename = savedir + "/timeseries_" + key + ".png"
savename = savedir / Path(f"timeseries_{key}.png")
fig.savefig(savename, dpi=400, bbox_inches="tight", facecolor="w", format="png")
print("Figure .png saved as: " + str(savename))
plt.show()
Expand Down

0 comments on commit fd73cbe

Please sign in to comment.