From fdf010458da0bda9d314b4a99ecf67c7359a9092 Mon Sep 17 00:00:00 2001 From: Luca Colagrande Date: Thu, 29 Aug 2024 13:17:21 +0200 Subject: [PATCH] verif_utils: Log per-element pass status in results --- util/sim/verif_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/sim/verif_utils.py b/util/sim/verif_utils.py index 90f4c61291..ef0caf8c75 100644 --- a/util/sim/verif_utils.py +++ b/util/sim/verif_utils.py @@ -24,6 +24,8 @@ def dump_results_to_csv(expected_results, actual_results, error, max_error, path size), flattens them, and dumps them to a CSV file. Each array is mapped to a different column of the CSV, in the same order as they appear as arguments in the function signature. + Also dumps an additional column, indicating pass (or failure) status, + calculated as `error <= max_error`. Args: expected_results: Array of expected results. @@ -38,11 +40,12 @@ def dump_results_to_csv(expected_results, actual_results, error, max_error, path # Flatten and zip arrays arrays = (expected_results, actual_results, error, max_error) flattened = [flatten(arr) for arr in arrays] + flattened.append((flattened[2] <= flattened[3]).astype(bool).astype(str)) zipped = np.column_stack(flattened) # Write row-by-row to CSV file with open(path, 'w') as csv_file: csv_writer = csv.writer(csv_file) - csv_writer.writerow(['expected', 'actual', 'error', 'max_error']) + csv_writer.writerow(['expected', 'actual', 'error', 'max_error', 'pass']) for row in zipped: csv_writer.writerow(row) # Print path where results were written