Skip to content

Commit

Permalink
python: Extended statistical tests with a CSV output file that lists …
Browse files Browse the repository at this point in the history
…all differing statistics.
  • Loading branch information
levy committed Mar 26, 2024
1 parent 0bc51aa commit 6c3f438
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/inet/test/statistical.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def check_simulation_task_result(self, simulation_task_result, result_name_filte
df["relative_error"] = df.apply(lambda row: row["absolute_error"] / abs(row["value_stored"]) if row["value_stored"] != 0 else (float("inf") if row["value_current"] != 0 else 0), axis=1)
df = df[df.apply(lambda row: matches_filter(row["name"], result_name_filter, exclude_result_name_filter, full_match) and \
matches_filter(row["module"], result_module_filter, exclude_result_module_filter, full_match), axis=1)]
sorted_df = df.sort_values(by="relative_error", ascending=False)
scalar_result_csv_file_name = re.sub(".sca$", ".csv", stored_scalar_result_file_name)
sorted_df.to_csv(scalar_result_csv_file_name, float_format="%.15g")
id = df["relative_error"].idxmax()
if math.isnan(id):
id = next(iter(df.index), None)
Expand Down

0 comments on commit 6c3f438

Please sign in to comment.