Skip to content

Commit

Permalink
Fix writing tuples in CLI summary
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Mar 3, 2025
1 parent 26d651b commit cec488e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 0 additions & 4 deletions janus_core/cli/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ def phonons(
from janus_core.cli.utils import (
carbon_summary,
check_config,
dict_tuples_to_lists,
end_summary,
parse_typer_dicts,
save_struct_calc,
Expand Down Expand Up @@ -356,9 +355,6 @@ def phonons(
log=log,
)

# Convert all tuples to list in inputs nested dictionary
dict_tuples_to_lists(inputs)

output_files = phonon.output_files

# Save summary information before calculations begin
Expand Down
12 changes: 10 additions & 2 deletions janus_core/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ def dict_tuples_to_lists(dictionary: dict) -> None:
"""
for key, value in dictionary.items():
if isinstance(value, dict):
dict_paths_to_strs(value)
dict_tuples_to_lists(value)
elif isinstance(value, tuple):
dictionary[key] = list(value)
elif isinstance(value, list):
dictionary[key] = [list(x) if isinstance(x, tuple) else x for x in value]


def dict_remove_hyphens(dictionary: dict) -> dict:
Expand Down Expand Up @@ -172,13 +174,19 @@ def start_summary(
output_files
Output files with labels to be generated by CLI command.
"""
# Prevent modification of calculation inputs
inputs_copy = inputs.copy()

output_files["summary"] = summary.absolute()
dict_paths_to_strs(output_files)

# Convert all tuples to list in inputs nested dictionary
dict_tuples_to_lists(inputs_copy)

save_info = {
"command": f"janus {command}",
"start_time": datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"),
"inputs": inputs,
"inputs": inputs_copy,
"output_files": output_files,
}

Expand Down

0 comments on commit cec488e

Please sign in to comment.