Loading scripts/basop_check_for_regressions.py 0 → 100644 +52 −0 Original line number Diff line number Diff line #! /usr/bin/env python3 import pandas as pd import argparse import sys # set positive threshold for "lower is better" metrics, negative for "higher is better" COLS_2_THRESHOLDS = { "MLD": 0.1, "MAXIMUM ABS DIFF": 5, "MIN_SSNR": -1, "MIN_ODG": -0.05, } def main(args): df_curr = pd.read_csv(args.csv_current, sep=";").sort_values(by="testcase") df_prev = pd.read_csv(args.csv_previous, sep=";").sort_values(by="testcase") pd.options.display.max_colwidth = 200 regressions_found = False for col, thresh in COLS_2_THRESHOLDS.items(): diff = df_curr[col] - df_prev[col] # invert sign of difference for "higher is better" metrics if thresh < 0: diff *= -1 thresh = abs(thresh) mask_worse = diff > thresh mask_better = diff < -thresh if sum(mask_worse) > 0: regressions_found = True print(f"Testcases that got worse wrt to {col}:") print(df_curr[mask_worse]["testcase"]) if sum(mask_better) > 0: print(f"Testcases that got better wrt to {col}:") print(df_curr[mask_better]["testcase"]) return int(regressions_found) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("csv_current") parser.add_argument("csv_previous") args = parser.parse_args() sys.exit(main(args)) Loading
scripts/basop_check_for_regressions.py 0 → 100644 +52 −0 Original line number Diff line number Diff line #! /usr/bin/env python3 import pandas as pd import argparse import sys # set positive threshold for "lower is better" metrics, negative for "higher is better" COLS_2_THRESHOLDS = { "MLD": 0.1, "MAXIMUM ABS DIFF": 5, "MIN_SSNR": -1, "MIN_ODG": -0.05, } def main(args): df_curr = pd.read_csv(args.csv_current, sep=";").sort_values(by="testcase") df_prev = pd.read_csv(args.csv_previous, sep=";").sort_values(by="testcase") pd.options.display.max_colwidth = 200 regressions_found = False for col, thresh in COLS_2_THRESHOLDS.items(): diff = df_curr[col] - df_prev[col] # invert sign of difference for "higher is better" metrics if thresh < 0: diff *= -1 thresh = abs(thresh) mask_worse = diff > thresh mask_better = diff < -thresh if sum(mask_worse) > 0: regressions_found = True print(f"Testcases that got worse wrt to {col}:") print(df_curr[mask_worse]["testcase"]) if sum(mask_better) > 0: print(f"Testcases that got better wrt to {col}:") print(df_curr[mask_better]["testcase"]) return int(regressions_found) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("csv_current") parser.add_argument("csv_previous") args = parser.parse_args() sys.exit(main(args))