From 6334aae2232ff2e421fa4dd0fbae77ae4467a117 Mon Sep 17 00:00:00 2001 From: Deepak Mallubhotla Date: Sun, 21 Apr 2024 15:54:45 -0500 Subject: [PATCH] fix: properly write output file and headers --- tantri/cli/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tantri/cli/__init__.py b/tantri/cli/__init__.py index 210f7c6..d35c743 100755 --- a/tantri/cli/__init__.py +++ b/tantri/cli/__init__.py @@ -124,7 +124,7 @@ def write_time_series(dipoles_file, dots_file, measurement_type, delta_t, num_it labels = [dot.label for dot in dots] if header_row: value_labels = ", ".join([f"{value_name}_{label}" for label in labels]) - click.echo(f"t (s), {value_labels}") + output_file.write(f"t (s), {value_labels}\n") _logger.debug(f"Going to simulate {num_iterations} iterations with a delta t of {delta_t}") @@ -138,7 +138,7 @@ def write_time_series(dipoles_file, dots_file, measurement_type, delta_t, num_it for i in tqdm.trange(num_iterations): transition = time_series.transition() transition_values = ", ".join(str(transition[label]) for label in labels) - output_file.write(f"{i * delta_t}, {transition_values}") + output_file.write(f"{i * delta_t}, {transition_values}\n") @cli.command()