From 31aae3f92141246bfdec3a8fc47804ca763ff34f Mon Sep 17 00:00:00 2001 From: David Hart Date: Wed, 11 Sep 2024 10:44:18 -0600 Subject: [PATCH] Fix outting CSV files without extra linespacing --- src/python/sansmic/io.py | 44 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/src/python/sansmic/io.py b/src/python/sansmic/io.py index 9ae6955..089658d 100644 --- a/src/python/sansmic/io.py +++ b/src/python/sansmic/io.py @@ -760,16 +760,46 @@ def write_csv_results(results: Results, prefix: str): Write results files in CSV formats. """ with open(prefix + "-summary.csv", "w") as f: - results.df_t_1D.to_csv(f) + results.df_t_1D.to_csv(f, lineterminator="\n", index=False) with open(prefix + "-radius.csv", "w") as f: - results.radius.to_csv(f) + df = results.radius + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n") with open(prefix + "-density.csv", "w") as f: - results.cell_sg.to_csv(f) + df = results.cell_sg + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n") with open(prefix + "-wall-angle.csv", "w") as f: - results.wall_angle.to_csv(f) + df = results.wall_angle + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n") with open(prefix + "-dr_dt.csv", "w") as f: - results.rate_of_change_in_radius.to_csv(f) + df = results.rate_of_change_in_radius + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n") with open(prefix + "-dC_dt.csv", "w") as f: - results.rate_of_change_in_sg.to_csv(f) + df = results.rate_of_change_in_sg + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n") with open(prefix + "-dC_dz.csv", "w") as f: - results.vertical_diffusion_rate.to_csv(f) + df = results.vertical_diffusion_rate + df.index = results.depths + df = df.T + df.index = results.time + df = df.T + df.to_csv(f, lineterminator="\n")