Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building path using os library instead of f-strings for real time analysis #616

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openmmtools/multistate/multistatereporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ def write_current_statistics(self, data):
reporter_dir, reporter_filename = os.path.split(self._storage_analysis_file_path)
# remove extension from filename
yaml_prefix = os.path.splitext(reporter_filename)[0]
output_filepath = f"{reporter_dir}/{yaml_prefix}_real_time_analysis.yaml"
output_filepath = os.path.join(reporter_dir, f"{yaml_prefix}_real_time_analysis.yaml")
# Remove if it is a fresh reporter session
if self._overwrite_statistics:
try:
Expand Down
4 changes: 2 additions & 2 deletions openmmtools/tests/test_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,8 @@ def test_real_time_analysis_yaml(self):
storage_dir, reporter_filename = os.path.split(sampler._reporter._storage_analysis_file_path)
# remove extension from filename
yaml_prefix = os.path.splitext(reporter_filename)[0]
output_filepath = f"{storage_dir}/{yaml_prefix}_real_time_analysis.yaml"
with open(f"{storage_dir}/{yaml_prefix}_real_time_analysis.yaml") as yaml_file:
output_filepath = os.path.join(storage_dir, f"{yaml_prefix}_real_time_analysis.yaml")
with open(output_filepath) as yaml_file:
yaml_contents = yaml.safe_load(yaml_file)
# Make sure we get the correct number of entries
assert len(yaml_contents) == expected_yaml_entries, \
Expand Down