Skip to content

Commit a8adbc5

Browse files
committed
refactor: use pathlib.Path with_suffix method to save libE output to pickle and np + Correctly parse Path to str when saving history every kth sim step
1 parent a5b2d30 commit a8adbc5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

libensemble/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def _save_every_k(self, fname: str, count: int, k: int, complete: bool) -> None:
339339
def _save_every_k_sims(self, complete: bool) -> None:
340340
"""Saves history every kth sim step"""
341341
self._save_every_k(
342-
Path(self.libE_specs["workflow_dir_path"]) / "{}_{}after_sim_{}.npy",
342+
str(Path(self.libE_specs["workflow_dir_path"]) / "{}_{}after_sim_{}.npy"),
343343
self.hist.sim_ended_count,
344344
self.libE_specs["save_every_k_sims"],
345345
complete,

libensemble/tools/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ def save_libE_output(
161161
logger.info(f"{status_mess}\nSaving results to file: {h_filename}")
162162
np.save(h_filename, H)
163163

164-
with open(p_filename + ".pickle", "wb") as f:
164+
with open(p_filename.with_suffix(".pickle"), "wb") as f:
165165
pickle.dump(persis_info, f)
166166

167-
return h_filename + ".npy"
167+
return str(h_filename.with_suffix(".npy"))
168168

169169

170170
# ===================== per-process numpy random-streams =======================

0 commit comments

Comments
 (0)