From 2854878c1420dc50a469aceb2e68fe7bafc63fae Mon Sep 17 00:00:00 2001 From: Zihao Xu Date: Wed, 4 Sep 2024 14:31:36 -0400 Subject: [PATCH] Fix backend filename if the user changes the h5 filename (#185) * fix backend filename * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dacheng Xu --- appletree/context.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appletree/context.py b/appletree/context.py index c4bb209..6a52bec 100644 --- a/appletree/context.py +++ b/appletree/context.py @@ -64,6 +64,9 @@ def from_backend(cls, backend_h5_file_name): nwalkers = file["mcmc"].attrs["nwalkers"] batch_size = file["mcmc"].attrs["batch_size"] tree = cls(instruct) + # Overwrite the backend_h5 file name. If the user renames the + # backend file then it could be different from the one in intruct + tree.backend_h5 = backend_h5_file_name tree.pre_fitting(nwalkers, batch_size=batch_size) return tree