From 107ef344b7bc822a3e54b5418017f591c264069f Mon Sep 17 00:00:00 2001 From: jedbakerMO Date: Sat, 17 May 2025 11:54:09 +0100 Subject: [PATCH 1/3] Adding options for changing decimal place precision --- post-processing/post-process.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/post-processing/post-process.py b/post-processing/post-process.py index f7861690..6ef4a208 100755 --- a/post-processing/post-process.py +++ b/post-processing/post-process.py @@ -32,6 +32,7 @@ def parse_cli_arguments(input_arguments: list[str] = None, parser.add_argument("-p", "--path", type=Path, default=(os.getcwd()), help="Path to Vernier output files") parser.add_argument("-o", "--outputname", type=str, default=str("vernier-merged-output"), help="Name of file to write to") parser.add_argument("-i", "--inputname", type=str, default=str("vernier-output-"), help="Vernier files to read from") + parser.add_argument("-d", "--decimals", type=int, default=3, help="Number of decimal places calculated results will be reported to") return parser.parse_args(args=input_arguments) @@ -145,8 +146,13 @@ def main(): file_path = args.path merged_file_name = args.outputname input_name = args.inputname + decimals = args.decimals mpiranks = read_mpi_ranks(file_path, input_name) + if decimals >= 4: + + print("WARNING: Calculated values may not be accurate or representative at higher precisions and may not display correctly") + if mpiranks == 0: print("Error, no vernier-outputs detected") @@ -161,7 +167,7 @@ def main(): thread_string = "@0" merged_frame["Routine"] = merged_frame["Routine"].str.replace(thread_string, '') - + merged_frame = merged_frame.round(decimals) print("\nWriting...") with open(f"{merged_file_name}", 'w') as f: f.write(merged_frame.to_string(index=False, col_space=10)) From 54b2c3a844ed096b98d321b2561bc8ac23ac3510 Mon Sep 17 00:00:00 2001 From: jedbakerMO Date: Wed, 21 May 2025 15:04:05 +0100 Subject: [PATCH 2/3] Adding documentation --- documentation/Sphinx/user_guide/output/post-processing.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/documentation/Sphinx/user_guide/output/post-processing.rst b/documentation/Sphinx/user_guide/output/post-processing.rst index fb81a6f6..1ef548eb 100644 --- a/documentation/Sphinx/user_guide/output/post-processing.rst +++ b/documentation/Sphinx/user_guide/output/post-processing.rst @@ -49,6 +49,9 @@ script, these are given in the table below. * - ``-i/ --inputname`` - vernier-output- - Vernier files to read from + * - ``-d/ --decimals`` + - 3 + - Number of decimal places to report calculated values to Below is an example of the current script output. From f3568a1e8d675e62f39a44c90e83257882b99ce1 Mon Sep 17 00:00:00 2001 From: jedbakerMO Date: Thu, 12 Jun 2025 13:10:02 +0100 Subject: [PATCH 3/3] Updating warning statement --- post-processing/post-process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/post-processing/post-process.py b/post-processing/post-process.py index 529796b6..902b795f 100755 --- a/post-processing/post-process.py +++ b/post-processing/post-process.py @@ -30,11 +30,11 @@ def parse_cli_arguments(input_arguments: list[str] = None, parser = argparse.ArgumentParser(description="This script is for merging the outputs from a test that uses Vernier callipers into one file. For full documentation please see the post-processing section of the user guide.") - parser.add_argument("-p", "--path", type=Path, default=(os.getcwd()), help="Path to Vernier output files") + parser.add_argument("-p", "--path", type=Path, default=(os.getcwd()), help="Path to Vernier output files") parser.add_argument("-o", "--output_name", type=str, default=str("vernier-merged-output"), help="Name of file to write to") parser.add_argument("-i", "--input_name", type=str, default=str("vernier-output-"), help="Vernier files to read from") - parser.add_argument("-d", "--decimals", type=int, default=3, help="Number of decimal places calculated results will be reported to") - parser.add_argument("-b", "--basic_output", action="store_true", default=False, help="Outputs only mean values across MPI ranks") + parser.add_argument("-d", "--decimals", type=int, default=3, help="Number of decimal places calculated results will be reported to") + parser.add_argument("-b", "--basic_output", action="store_true", default=False, help="Outputs only mean values across MPI ranks") return parser.parse_args(args=input_arguments) @@ -176,7 +176,7 @@ def main(): if decimals >= 4: - print("WARNING: Calculated values may not be accurate or representative at higher precisions and may not display correctly") + print("WARNING: Vernier typically reports values to 3 d.p, so calculated values may not be accurate or representative at higher precisions and may not display correctly") if mpiranks == 0: